# HG changeset patch
# User kevin@tombear.tombears.com
# Date 1225812726 -28800
# Node ID f3502833be7cd0eb5f588e38402b5f9f723e63ef
# Parent 8e9f2848f8cd0b5faed81a9b63825f2283dc6403
add a gmail to get confirme url address.
diff -r 8e9f2848f8cd -r f3502833be7c pyikriam/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pyikriam/README Tue Nov 04 23:32:06 2008 +0800
@@ -0,0 +1,2 @@
+apt-get install python-libgmail python-lxml
+
diff -r 8e9f2848f8cd -r f3502833be7c pyikriam/createAccount.py
--- a/pyikriam/createAccount.py Tue Nov 04 18:34:06 2008 +0800
+++ b/pyikriam/createAccount.py Tue Nov 04 23:32:06 2008 +0800
@@ -1,5 +1,5 @@
import urllib2,urllib
-
+import libgmail,email,string,time
from ikariam import fake_moz
from lazy.www import c
@@ -7,11 +7,10 @@
"""
For create sheep to cheat. take care of the ip address & email check by yourself.
"""
- def __init__(self,account,email,password,server):
+ def __init__(self,account,password,server):
self.account=account
self.password=password
self.server=server
- self.email=email
headers=[('Referer','http://'+self.server[self.server.find('.')+1:]+'/register.php')]
self.browser = fake_moz(headers)
urllib2.install_opener(self.browser)
@@ -22,26 +21,53 @@
params = {
"function":"createAvatar",\
"name":self.account,\
- "email":self.email,\
+ "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,confirmeurl):
- self.confirmeurl=confirmeurl
+ def __init__(self,account):
+ self.account=account
self.browser = fake_moz()
urllib2.install_opener(self.browser)
pass
def run(self):
- self.ret=c(self.confirmeurl).get().get_content()
+ 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
-"""
-ikariamca=CreateAccount('someac','kevin@butyshop.com','contest123','s2.ikariam.tw')
+ def rename(self):
+ """
+ http://s4.ikariam.tw/index.php?view=renameCity&id=6079&position=0
+
+
+ """
+
+ikariamca=CreateAccount('ijdanny','taaa123','s4.ikariam.tw')
a=ikariamca.ca()
-confirme("http://s2.ikariam.tw/index.php?action=newPlayer&function=validateEmail&hash=c239c92a94690066078ca95c993d348b&id=70997").run()
-"""
diff -r 8e9f2848f8cd -r f3502833be7c pyikriam/ikariam.py
--- a/pyikriam/ikariam.py Tue Nov 04 18:34:06 2008 +0800
+++ b/pyikriam/ikariam.py Tue Nov 04 23:32:06 2008 +0800
@@ -11,7 +11,7 @@
class fake_moz(object):
__metaclass__ = decorator
- def __init__(self,headers=0):
+ def __init__(self,headers=None):
fakeheaders=[('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.1.12pre) Gecko/20071220 BonEcho/2.0.0.12pre')]
if headers:
fakeheaders=fakeheaders+headers