view pyikriam/createAccount.py @ 220:5fa938cbe058

Class of account creater
author kevin@tombear.tombears.com
date Tue, 04 Nov 2008 18:28:28 +0800
parents
children f3502833be7c
line wrap: on
line source

import urllib2,urllib

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,email,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)
        pass

    def ca(self):
        self.baseurl='http://'+self.server
        params = {
        "function":"createAvatar",\
        "name":self.account,\
        "email":self.email,\
        "password":self.password,\
        "agb":"on"}
        self.ret=c(self.baseurl+'/index.php?action=newPlayer').get(params).get_content()
        pass

class confirme:
    def __init__(self,confirmeurl):
        self.confirmeurl=confirmeurl
        self.browser = fake_moz()
        urllib2.install_opener(self.browser)
        pass

    def run(self):
        self.ret=c(self.confirmeurl).get().get_content()
        pass

"""
ikariamca=CreateAccount('someac','kevin@butyshop.com','contest123','s2.ikariam.tw')
a=ikariamca.ca()
confirme("http://s2.ikariam.tw/index.php?action=newPlayer&function=validateEmail&hash=c239c92a94690066078ca95c993d348b&id=70997").run()
"""