annotate usebot.sh @ 279:a9847bf80058

refined coding style
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 02 Dec 2008 17:13:36 +0800
parents 34ebf346f5b9
children
rev   line source
112
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
1 #!/bin/bash
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
2 #Auther: billy3321
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
3 #Version: 0.1
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
4 #Interface for Eagle-Eye ikariam bot project
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
5 #for more information please visit
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
6 # https://www.assembla.com/wiki/show/eagle-eye
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
7
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
8 function seteagleeye() {
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
9 read -p "Enter your server ( s1/s2/s3/s4 ): " SER_NAME
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
10 read -p "Enter your account: " ACC_NAME
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
11 read -p "Enter your password: " PW_NAME
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
12 echo -e "package main;\n\n\$::server = \"${SER_NAME}.ikariam.tw\";\n\$::user = \"${ACC_NAME}\";\n\$::pass = \"${PW_NAME}\";\n\n1;" > ${HOME}/.eagleeye.pm
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
13 }
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
14
113
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
15 function chihchunloop() {
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
16 read -p "Please enter the coordinate you want to fight(ex: 39:49)" SITE
115
34ebf346f5b9 changed usebot.sh
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 114
diff changeset
17 SITE_X=$(echo $SITE | cut -d : -f 1)
34ebf346f5b9 changed usebot.sh
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 114
diff changeset
18 SITE_Y=$(echo $SITE | cut -d : -f 2)
113
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
19 while : ; do
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
20 perl agent.pl
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
21
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
22 perl scan.pl
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
23
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
24 let RAN_X=$RANDOM%100
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
25 let RAN_Y=$RANDOM%100
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
26 perl scan.pl $RAN_X $RAN_Y
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
27
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
28 perl warfare.pl $SITE_X $SITE_Y
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
29 done
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
30 }
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
31
112
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
32 echo "Checking for Database..."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
33 if test -f ikariam.sqlite;then
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
34 echo "Find Database, continue..."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
35 else
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
36 echo "setting up database...."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
37 cat ikariam.sql | sqlite3 ikariam.sqlite
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
38 echo "Database Setting finished. Continue Program..."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
39 fi
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
40
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
41 echo "Checking for account information file..."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
42 if test -f ${HOME}/.eagleeye.pm ; then
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
43 echo "Find your account information file. Continue Program..."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
44 else
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
45 echo "Can't find your account information file. We will creat one"
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
46 seteagleeye
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
47
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
48 fi
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
49
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
50 while true
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
51 do
113
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
52 echo -e "Welcome to use eagle-eye ikariam bot. Please select the action you want to do.\n 1. Reset the account information file.\n 2. Reset the databse.\n 3. Scan around your island.\n 4. Run the bot.\n 5. List the sheeps(Please scan first).\n 6. Chihchun's loop, automatic scan and attack sheep.\n 0. Exit Program."
112
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
53
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
54 read -p "What do you want to do now? Please enter the number:" ACT
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
55 case $ACT in
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
56 "1")
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
57 seteagleeye
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
58 ;;
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
59 "2")
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
60 rm ikariam.sqlite
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
61 cat ikariam.sql | sqlite3 ikariam.sqlite
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
62 ;;
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
63 "3")
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
64 perl scan.pl
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
65 ;;
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
66 "4")
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
67 perl agent.pl
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
68 ;;
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
69 "5")
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
70 perl sheep.pl
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
71 ;;
113
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
72 "6")
82eff1aaf0ec billy3321 <billy3321 AT msn.com>
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 112
diff changeset
73 chihchunloop
114
900535236e34 user: billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
parents: 113
diff changeset
74 ;;
112
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
75 "0")
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
76 break
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
77 ;;
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
78 *)
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
79 echo "Please enter a number."
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
80 ;;
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
81 esac
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
82 done
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
83
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
84
ef5461db3951 Added usebot.sh,an interface for bot
macbook@59-116-8-229.dynamic.hinet.net
parents:
diff changeset
85 #END