import httplib import urllib import re from random import randrange def step1(): global hiddenkey params1 = urllib.urlencode({'s':'', 'securitytoken': 'guest', 'do': 'register', 'url':'http://vnhfamily.us/forum/', 'month':'', 'day':'', 'year':'', 'who':'adult', 'agree':'1'}) headers1 = ({"Host": "vnhfamily.us", "User-Agent": "Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0", "Referer": "http://vnhfamily.us/forum/register.php?do=signup", "Cookie": "PHPSESSID=a4fc2f131455eae8900afa8f3ea289bd; IDstack=%2C3053%2C%2C3054%2C%2C3052", "Authorization": "Basic Vk5IOlZOSA==", "Connection": "keep-alive", "Content-type": "application/x-www-form-urlencoded", "Content-Length": "111"}) conn1 = httplib.HTTPConnection("www.vnhfamily.us",80) conn1.request("POST", "/forum/register.php?do=register", params1, headers1) response1 = conn1.getresponse() print response1.status, response1.reason data = response1.read() hiddenkey = re.search('name="humanverify\[hash\]" value="(.*)" />',data) print "Get humanverify is Ok" print "Key: %s" % (hiddenkey.group(1)) conn1.close() def step2(): i = randrange(9999) user = 'parkdream%s' % (i) email = 'idesign199%s@gmail.com' % (i) c_email = 'idesign199%s@gmail.com' % (i) print user,"\n",email params = urllib.urlencode({'s':'', 'securitytoken': 'guest', 'do': 'addmember', 'url':'http://vnhfamily.us/forum/index.php', 'agree':'1', 'password_md5':'1f5d020ac0ce982f5846897871b6b5ec', 'passwordconfirm_md5':'1f5d020ac0ce982f5846897871b6b5ec', 'day':'0', 'month':'0', 'year':'0', 'username':'%s'%(user), 'password':'', 'passwordconfirm':'', 'email':'%s'%(email), 'emailconfirm':'%s'%(c_email), 'humanverify[input]':'2', 'humanverify[hash]':'%s'%(hiddenkey.group(1)), 'referrername':'', 'timezoneoffset':'7', 'dst':'2', 'options[adminemail]':'1'}) headers = ({ "Host": "vnhfamily.us", "User-Agent": "Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0", "Referer": "http://vnhfamily.us/forum/register.php?do=register", "Cookie": "PHPSESSID=a4fc2f131455eae8900afa8f3ea289bd; IDstack=%2C3053%2C%2C3054%2C%2C3052%2C%2C3055%2C; bblastvisit=1370460727; bblastactivity=0", "Authorization": "Basic Vk5IOlZOSA==", "Connection": "keep-alive", "Content-type": "application/x-www-form-urlencoded", "Content-Length": "470"}) conn = httplib.HTTPConnection("www.vnhfamily.us",80) conn.request("POST", "/forum/register.php?do=addmember", params, headers) response = conn.getresponse() print response.status, response.reason data = response.read() print "Ok Song" conn.close() if __name__ == "__main__": while True: step1() step2()