Mercurial > eagle-eye
comparison pyikriam/createAccount.py @ 225:f3502833be7c
add a gmail to get confirme url address.
author | kevin@tombear.tombears.com |
---|---|
date | Tue, 04 Nov 2008 23:32:06 +0800 |
parents | 5fa938cbe058 |
children | d54e2041e4aa |
comparison
equal
deleted
inserted
replaced
224:8e9f2848f8cd | 225:f3502833be7c |
---|---|
1 import urllib2,urllib | 1 import urllib2,urllib |
2 | 2 import libgmail,email,string,time |
3 from ikariam import fake_moz | 3 from ikariam import fake_moz |
4 from lazy.www import c | 4 from lazy.www import c |
5 | 5 |
6 class CreateAccount: | 6 class CreateAccount: |
7 """ | 7 """ |
8 For create sheep to cheat. take care of the ip address & email check by yourself. | 8 For create sheep to cheat. take care of the ip address & email check by yourself. |
9 """ | 9 """ |
10 def __init__(self,account,email,password,server): | 10 def __init__(self,account,password,server): |
11 self.account=account | 11 self.account=account |
12 self.password=password | 12 self.password=password |
13 self.server=server | 13 self.server=server |
14 self.email=email | |
15 headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')] | 14 headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')] |
16 self.browser = fake_moz(headers) | 15 self.browser = fake_moz(headers) |
17 urllib2.install_opener(self.browser) | 16 urllib2.install_opener(self.browser) |
18 pass | 17 pass |
19 | 18 |
20 def ca(self): | 19 def ca(self): |
21 self.baseurl='http://'+self.server | 20 self.baseurl='http://'+self.server |
22 params = { | 21 params = { |
23 "function":"createAvatar",\ | 22 "function":"createAvatar",\ |
24 "name":self.account,\ | 23 "name":self.account,\ |
25 "email":self.email,\ | 24 "email":self.account+"@ossug.org",\ |
26 "password":self.password,\ | 25 "password":self.password,\ |
27 "agb":"on"} | 26 "agb":"on"} |
27 print 'debug 10' | |
28 self.ret=c(self.baseurl+'/index.php?action=newPlayer').get(params).get_content() | 28 self.ret=c(self.baseurl+'/index.php?action=newPlayer').get(params).get_content() |
29 print "Waiting for 30 seconds to get confirme..." | |
30 time.sleep(30) | |
31 confirme(self.account).run() | |
29 pass | 32 pass |
30 | 33 |
31 class confirme: | 34 class confirme: |
32 def __init__(self,confirmeurl): | 35 def __init__(self,account): |
33 self.confirmeurl=confirmeurl | 36 self.account=account |
34 self.browser = fake_moz() | 37 self.browser = fake_moz() |
35 urllib2.install_opener(self.browser) | 38 urllib2.install_opener(self.browser) |
36 pass | 39 pass |
37 | 40 |
38 def run(self): | 41 def run(self): |
39 self.ret=c(self.confirmeurl).get().get_content() | 42 print "Start get confirme url..." |
43 ga = libgmail.GmailAccount("gmp3fs@gmail.com", "ossug.org") | |
44 ga.login() | |
45 folder = ga.getMessagesByFolder('inbox') | |
46 | |
47 for thread in folder: | |
48 #thread.id, len(thread), thread.subject | |
49 account=string.split(thread.subject)[0] | |
50 print account, | |
51 if account==self.account: | |
52 print "find "+account | |
53 for msg in thread: | |
54 mmsg=email.message_from_string(msg.source) | |
55 confcontext=mmsg.get_payload(decode = True) | |
56 for x in string.split(confcontext): | |
57 if x[0:7]=='http://': | |
58 confurl=x | |
59 print "got confirme url..." | |
60 break | |
61 self.ret=c(confurl).get().get_content() | |
40 pass | 62 pass |
41 | 63 |
42 """ | 64 def rename(self): |
43 ikariamca=CreateAccount('someac','kevin@butyshop.com','contest123','s2.ikariam.tw') | 65 """ |
66 http://s4.ikariam.tw/index.php?view=renameCity&id=6079&position=0 | |
67 <input class="textfield" id="newCityName" name="name" size="30" maxlength="15" type="text"> | |
68 <input class="button" value="" type="submit"> | |
69 """ | |
70 | |
71 ikariamca=CreateAccount('ijdanny','taaa123','s4.ikariam.tw') | |
44 a=ikariamca.ca() | 72 a=ikariamca.ca() |
45 confirme("http://s2.ikariam.tw/index.php?action=newPlayer&function=validateEmail&hash=c239c92a94690066078ca95c993d348b&id=70997").run() | |
46 """ | |
47 | 73 |