Mercurial > eagle-eye
view pyikriam/createAccount.py @ 230:2d65c786084e
happiness first, then wall
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 05 Nov 2008 01:10:48 +0800 |
parents | d54e2041e4aa |
children | c0b9604b0be9 |
line wrap: on
line source
import urllib2,urllib import libgmail,email,string,time from ikariam import fake_moz from lazy.www import c class CreateAccount: """ For create sheep to cheat. take care of the ip address & email check by yourself. """ def __init__(self,account,password,server): self.account=account self.password=password self.server=server headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')] self.browser = fake_moz(headers) urllib2.install_opener(self.browser) pass def ca(self): self.baseurl='http://'+self.server params = { "function":"createAvatar",\ "name":self.account,\ "email":self.account+"@ossug.org",\ "password":self.password,\ "agb":"on"} print 'debug 10' self.ret=c(self.baseurl+'/index.php?action=newPlayer').get(params).get_content() print "Waiting for 30 seconds to get confirme..." time.sleep(30) confirme(self.account).run() pass class confirme: def __init__(self,account): self.account=account self.browser = fake_moz() urllib2.install_opener(self.browser) pass def run(self): print "Start get confirme url..." ga = libgmail.GmailAccount("gmp3fs@gmail.com", "ossug.org") ga.login() folder = ga.getMessagesByFolder('inbox') for thread in folder: #thread.id, len(thread), thread.subject account=string.split(thread.subject)[0] print account, if account==self.account: print "find "+account for msg in thread: mmsg=email.message_from_string(msg.source) confcontext=mmsg.get_payload(decode = True) for x in string.split(confcontext): if x[0:7]=='http://': confurl=x print "got confirme url..." break self.ret=c(confurl).get().get_content() pass def rename(self): """ http://s4.ikariam.tw/index.php?view=renameCity&id=6079&position=0 <input class="textfield" id="newCityName" name="name" size="30" maxlength="15" type="text"> <input class="button" value="" type="submit"> """ ikariamca=CreateAccount('laswnny','wtaaa123','s4.ikariam.tw') a=ikariamca.ca()