pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Python pastebin - collaborative debugging tool View Help


Posted by SiD on Sun 5 Oct 07:46
report abuse | download | new post

  1. """
  2. App Name: Milw0rm Hash-Exploits Searcher
  3. Author: SiD
  4. License: Gnu/Gpl
  5.  
  6. Search MD5 Hashes / Apps Vulnerabilities on milw0rm.com database.
  7. ------------------>
  8. Vuln example:
  9. PHP-Fusion
  10.  
  11. Hash example:
  12. 0800fc577294c34e0b28ad2839435945
  13. <------------------
  14. """
  15.  
  16. import urllib, httplib, re
  17.  
  18. """ Variables """
  19. host = 'milw0rm.com'
  20. page = '/search.php'
  21. page_hash = '/cracker/search.php'
  22.  
  23. reg0 = '</TD><TD align="middle" nowrap="nowrap" width=90>(.*?)</TD>'
  24. regex0 = re.compile(reg0)
  25. reg1 = '<a href="(.*?)" target="_blank" class="style14">'
  26. regex1 = re.compile(reg1)
  27. reg2 = 'target="_blank" class="style14">(.*?)</a></td>'
  28. regex2 = re.compile(reg2)
  29.  
  30.  
  31. """ Help, of course =P """
  32. def help():
  33.     print '\nmilw0rm.com ~ Hash-Exploits Searcher\nAuthor: SiD\nLicense: Gnu/Gpl'
  34.     print '\nIn the menu, type 1 to search MD5 Hashes in the database, 2 to search exploits, 3 to view this help or 4 to exit.\n'
  35.     menu()
  36.  
  37. """ Hash Mode """
  38. def hash():
  39.     string = raw_input('\nSearch Hash >> ')
  40.     print '\nChecking data. Please, wait.'
  41.     if not string:
  42.         print '\nInvalid input.\n'
  43.         hash()
  44.     else:
  45.         if (len(string) < 32) or (len(string) > 32):
  46.             print '\nInvalid hash.\n'
  47.             hash()
  48.    
  49.     data = urllib.urlencode({
  50.                 'hash': string,
  51.                 'Submit': 'submit'
  52.                             })
  53.     head = {
  54.         'Content-type': 'application/x-www-form-urlencoded',
  55.         'Accept': 'text/plain'
  56.         }
  57.    
  58.     try:
  59.         http = httplib.HTTPConnection(host) #Http connection
  60.     except:
  61.         print 'Cannot connect to', host,'\n'
  62.     else:
  63.         http.request('POST', page_hash, data, head) #Basic request
  64.         resp = http.getresponse()
  65.         read = resp.read()
  66.         http.close()
  67.         # Regex
  68.         hash_f = regex0.findall(read)
  69.         if hash_f:
  70.             print '\n[+] Hash Found >>', hash_f[0]
  71.         else:
  72.             print '\n[-] Sorry, hash not found!'
  73.  
  74. """ Exploits (Vulnerabilities) Mode """          
  75. def vulnerability():
  76.     string = raw_input('\nSearch Vulnerability (ex. PHP-Fusion) >> ')
  77.     print '\nChecking data. Please, wait.'
  78.     if not string:
  79.         print '\nInvalid input.\n'
  80.         vulnerability()
  81.    
  82.     data = urllib.urlencode({
  83.                 'dong': string,
  84.                 'Submit': 'submit'
  85.                             })
  86.     head = {
  87.         'Content-type': 'application/x-www-form-urlencoded',
  88.         'Accept': 'text/plain'
  89.         }
  90.    
  91.     try:
  92.         http = httplib.HTTPConnection(host) #Http connection
  93.     except:
  94.         print 'Cannot connect to', host,'\n'
  95.     else:
  96.         http.request('POST', page, data, head) #Basic request
  97.         resp = http.getresponse()
  98.         read = resp.read()
  99.         http.close()
  100.         # Regex
  101.         vuln_a = regex1.findall(read)
  102.         vuln_b = regex2.findall(read)
  103.         if vuln_a:
  104.             print '\n[+] Exploits Result\n---\n\n'
  105.             n = 0
  106.             report = open('milw0rm.searcher.txt', 'a')
  107.             report.write('\n[ Milw0rm Hash-Exploits Searcher ~ SiD ] Searched: "'+string+'"\n\n\n')
  108.             for x in vuln_b:
  109.                 report.write('http://'+host+vuln_a[n]+'\n'+vuln_b[n]+'\n-\n')
  110.                 print 'http://'+host+vuln_a[n],'\n',vuln_b[n],'\n\n'
  111.                 n = n+1
  112.             print '\n---\n'
  113.             report.close()
  114.         else:
  115.             print '\n[-] No Exploits named',string,'\n'
  116.  
  117. """  Script's menu  """
  118. def menu():
  119.     print '\n-\n## milw0rm.com ~ Hash-Exploits Searcher ##\n-\n'
  120.     print '\n1. Search MD5 Hash\n2. Search Exploits\n\n3. Help & About\n4. Exit'
  121.    
  122.     what = raw_input('>> ')
  123.    
  124.     if not what:
  125.         menu()
  126.     else:
  127.         if what == '1':
  128.             hash()
  129.         elif what == '2':
  130.             vulnerability()
  131.         elif what == '3':
  132.             help()
  133.         elif what == '4':
  134.             pass
  135.         else:
  136.             menu()
  137.  
  138. menu()

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post