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 Mon 6 Oct 15:11
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. Attention: in exploits mode, to search more than a word, separate the words with "_"
  16. """
  17.  
  18. import urllib, httplib, re, sys
  19. from string import *
  20.  
  21. """ Variables """
  22. host = 'milw0rm.com'
  23. page = '/search.php'
  24. page_hash = '/cracker/search.php'
  25.  
  26. reg0 = '</TD><TD align="middle" nowrap="nowrap" width=90>(.*?)</TD>'
  27. regex0 = re.compile(reg0)
  28. reg1 = '<a href="(.*?)" target="_blank" class="style14">'
  29. regex1 = re.compile(reg1)
  30. reg2 = 'target="_blank" class="style14">(.*?)</a></td>'
  31. regex2 = re.compile(reg2)
  32.  
  33.  
  34. """ Help, of course =P """
  35. def help():
  36.     print '\nmilw0rm.com ~ Hash-Exploits Searcher ~ Command line version\nAuthor: SiD\nLicense: Gnu/Gpl'
  37.     print '\nTo search hash: python milw0rm.py -h (md5 hash)\nEx. python milw0rm.py -h 0800fc577294c34e0b28ad2839435945'
  38.     print '\nTo search exploit: python milw0rm.py -e (app)\nEx. python milw0rm.py -e Linux_Kernel\nATTENTION: to search more than a word, separate the words with "_"\n'
  39.  
  40. """ Hash Mode """
  41. def hash():
  42.     print '\nChecking data. Please, wait.'
  43.     if (len(string) < 32) or (len(string) > 32):
  44.         print '\nInvalid hash.\n'
  45.    
  46.     data = urllib.urlencode({
  47.                 'hash': string,
  48.                 'Submit': 'submit'
  49.                             })
  50.     head = {
  51.         'Content-type': 'application/x-www-form-urlencoded',
  52.         'Accept': 'text/plain'
  53.         }
  54.    
  55.     try:
  56.         http = httplib.HTTPConnection(host) #Http connection
  57.     except:
  58.         print 'Cannot connect to', host,'\n'
  59.     else:
  60.         http.request('POST', page_hash, data, head) #Basic request
  61.         resp = http.getresponse()
  62.         read = resp.read()
  63.         http.close()
  64.         # Regex
  65.         hash_f = regex0.findall(read)
  66.         if hash_f:
  67.             print '\n[+] Hash Found >>', hash_f[0]
  68.         else:
  69.             print '\n[-] Sorry, hash not found!'
  70.  
  71. """ Exploits (Vulnerabilities) Mode """          
  72. def vulnerability():
  73.     print '\nChecking data. Please, wait.'
  74.    
  75.     data = urllib.urlencode({
  76.                 'dong': string,
  77.                 'Submit': 'submit'
  78.                             })
  79.     head = {
  80.         'Content-type': 'application/x-www-form-urlencoded',
  81.         'Accept': 'text/plain'
  82.         }
  83.    
  84.     try:
  85.         http = httplib.HTTPConnection(host) #Http connection
  86.     except:
  87.         print 'Cannot connect to', host,'\n'
  88.     else:
  89.         http.request('POST', page, data, head) #Basic request
  90.         resp = http.getresponse()
  91.         read = resp.read()
  92.         http.close()
  93.         # Regex
  94.         vuln_a = regex1.findall(read)
  95.         vuln_b = regex2.findall(read)
  96.         if vuln_a:
  97.             print '\n[+] Exploits Result\n---\n'
  98.             n = 0
  99.             report = open('milw0rm.searcher.txt', 'a')
  100.             report.write('\n[ Milw0rm Hash-Exploits Searcher ~ SiD ] Searched: "'+string+'"\n\n\n')
  101.             for x in vuln_b:
  102.                 report.write('http://'+host+vuln_a[n]+'\n'+vuln_b[n]+'\n-\n')
  103.                 print 'http://'+host+vuln_a[n],'\n',vuln_b[n],'\n'
  104.                 n = n+1
  105.             print '\n---\n'
  106.             report.close()
  107.         else:
  108.             print '\n[-] No Exploits named',string,'\n'
  109.  
  110.  
  111. """  Options   """
  112. if sys.argv[1] == '-h':
  113.     try:
  114.         string = sys.argv[2]
  115.         hash()
  116.     except:
  117.         help()
  118.        
  119. elif sys.argv[1] == '-e':
  120.     try:
  121.         string = sys.argv[2]
  122.         string = replace(string, '_', ' ')
  123.         vulnerability()
  124.     except:
  125.         help()
  126.  
  127. else:
  128.     help()

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