Mercurial > eagle-eye
annotate pyikriam/createAccount.py @ 227:f41ee87f4f7a
merged
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Tue, 04 Nov 2008 23:44:48 +0800 |
parents | f3502833be7c |
children | d54e2041e4aa |
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 | |
13 self.server=server | |
14 headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')] | |
15 self.browser = fake_moz(headers) | |
16 urllib2.install_opener(self.browser) | |
17 pass | |
18 | |
19 def ca(self): | |
20 self.baseurl='http://'+self.server | |
21 params = { | |
22 "function":"createAvatar",\ | |
23 "name":self.account,\ | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
24 "email":self.account+"@ossug.org",\ |
220 | 25 "password":self.password,\ |
26 "agb":"on"} | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
27 print 'debug 10' |
220 | 28 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
|
29 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
|
30 time.sleep(30) |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
31 confirme(self.account).run() |
220 | 32 pass |
33 | |
34 class confirme: | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
35 def __init__(self,account): |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
36 self.account=account |
220 | 37 self.browser = fake_moz() |
38 urllib2.install_opener(self.browser) | |
39 pass | |
40 | |
41 def run(self): | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
42 print "Start get confirme url..." |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
43 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
|
44 ga.login() |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
45 folder = ga.getMessagesByFolder('inbox') |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
46 |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
47 for thread in folder: |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
48 #thread.id, len(thread), thread.subject |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
49 account=string.split(thread.subject)[0] |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
50 print account, |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
51 if account==self.account: |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
52 print "find "+account |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
53 for msg in thread: |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
54 mmsg=email.message_from_string(msg.source) |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
55 confcontext=mmsg.get_payload(decode = True) |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
56 for x in string.split(confcontext): |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
57 if x[0:7]=='http://': |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
58 confurl=x |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
59 print "got confirme url..." |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
60 break |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
61 self.ret=c(confurl).get().get_content() |
220 | 62 pass |
63 | |
225
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
64 def rename(self): |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
65 """ |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
66 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
|
67 <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
|
68 <input class="button" value="" type="submit"> |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
69 """ |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
70 |
f3502833be7c
add a gmail to get confirme url address.
kevin@tombear.tombears.com
parents:
220
diff
changeset
|
71 ikariamca=CreateAccount('ijdanny','taaa123','s4.ikariam.tw') |
220 | 72 a=ikariamca.ca() |
73 |