Mercurial > eagle-eye
annotate pyikriam/createAccount.py @ 287:d194ff3edb2f
reduced default number of army for plunderCity
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 05 Dec 2008 20:20:03 +0800 |
parents | c0b9604b0be9 |
children |
rev | line source |
---|---|
220 | 1 import urllib2,urllib |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
2 import libgmail,email,string,time |
220 | 3 from ikariam import fake_moz |
4 from lazy.www import c | |
5 | |
6 class CreateAccount: | |
7 """ | |
8 For create sheep to cheat. take care of the ip address & email check by yourself. | |
9 """ | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
10 def __init__(self,account,password,server): |
220 | 11 self.account=account |
12 self.password=password | |
231
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
13 if len(self.password)<8: |
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
14 print 'Password size mast bigger then 8 chars' |
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
15 pass |
220 | 16 self.server=server |
17 headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')] | |
18 self.browser = fake_moz(headers) | |
19 urllib2.install_opener(self.browser) | |
20 pass | |
21 | |
22 def ca(self): | |
23 self.baseurl='http://'+self.server | |
24 params = { | |
25 "function":"createAvatar",\ | |
26 "name":self.account,\ | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
27 "email":self.account+"@ossug.org",\ |
220 | 28 "password":self.password,\ |
29 "agb":"on"} | |
30 self.ret=c(self.baseurl+'/index.php?action=newPlayer').get(params).get_content() | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
31 print "Waiting for 30 seconds to get confirme..." |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
32 time.sleep(30) |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
33 confirme(self.account).run() |
220 | 34 pass |
35 | |
36 class confirme: | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
37 def __init__(self,account): |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
38 self.account=account |
220 | 39 self.browser = fake_moz() |
40 urllib2.install_opener(self.browser) | |
41 pass | |
42 | |
43 def run(self): | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
44 print "Start get confirme url..." |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
45 ga = libgmail.GmailAccount("gmp3fs@gmail.com", "ossug.org") |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
46 ga.login() |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
47 folder = ga.getMessagesByFolder('inbox') |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
48 |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
49 for thread in folder: |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
50 #thread.id, len(thread), thread.subject |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
51 account=string.split(thread.subject)[0] |
231
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
52 acsize=len(self.account) |
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
53 if account[-acsize:]==self.account: |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
54 print "find "+account |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
55 for msg in thread: |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
56 mmsg=email.message_from_string(msg.source) |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
57 confcontext=mmsg.get_payload(decode = True) |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
58 for x in string.split(confcontext): |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
59 if x[0:7]=='http://': |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
60 confurl=x |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
61 break |
231
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
62 print "send confirme." |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
63 self.ret=c(confurl).get().get_content() |
220 | 64 pass |
65 | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
66 def rename(self): |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
67 """ |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
68 http://s4.ikariam.tw/index.php?view=renameCity&id=6079&position=0 |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
69 <input class="textfield" id="newCityName" name="name" size="30" maxlength="15" type="text"> |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
70 <input class="button" value="" type="submit"> |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
71 """ |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
72 |
231
c0b9604b0be9
the currect version of last bug fix
kevin@tombear.tombears.com
parents:
228
diff
changeset
|
73 ikariamca=CreateAccount('jdanny','taaaa123','s4.ikariam.tw') |
220 | 74 a=ikariamca.ca() |
75 |