Advertisement
Gentoo7

md5hashcracker

Jul 18th, 2016
26,635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.94 KB | None | 0 0
  1. #!/usr/bin/python
  2. #
  3. #################################################################
  4. #  ______    ____    ____                                       #
  5. #  |   _  \   \   \  /   /                                      #
  6. #  |  |_)  |   \   \/   /                                       #
  7. #  |   _  <     \_    _/                                        #
  8. #  |  |_)  |      |  |                                          #
  9. #  |______/       |__|                                          #
  10. #                                                               #
  11. #   __  _    __      ___   __  __                                #
  12. # /\ \/'\ /'__`\  /' _ `\/\ \/\ \                               #
  13. # \/>  <//\ \L\.\_/\ \/\ \ \ \_\ \                              #
  14. # \_/\_\ \__/.\_\ \_\ \_\/`____ \                               #
  15. #  \//\/_/\/__/\/_/\/_/\/_/`/___/> \                            #
  16. #                            /\___/                             #
  17. #                           \/__/                               #
  18. #                                                               #
  19. #################################################################
  20.  
  21.  
  22. import sys
  23. import time
  24. import urllib2
  25. import urllib
  26. import re
  27. import hashlib
  28.  
  29. if len(sys.argv) < 2:
  30.   print '\nUsage:'
  31.   print '\t%s --online [hash..] ' % sys.argv[0]
  32.   print '\t%s --offline [hash..] [dictionary..]'  % sys.argv[0]
  33.   sys.exit(1)
  34.  
  35. def banner():
  36.   print '''
  37.  
  38.     __  _    __      ___   __  __    
  39.     /\ \/'\ /'__`\ /' _ `\/\ \/\ \  
  40.     \/>  <//\ \L\.\_/\ \/\ \ \ \_\ \
  41.      /\_/\_\ \__/.\_\ \_\ \_\/`____ \
  42.      \//\/_/\/__/\/_/\/_/\/_/`/___/> \
  43.                                 /\___/
  44.                                 \/__/
  45.  
  46.        
  47. '''
  48.  
  49. option   = sys.argv[1]
  50. passwd   = sys.argv[2]
  51.  
  52. if option == '--online':
  53.   if len(passwd) != 32:
  54.     print '\n[*] Error: "%s" doesn\'t seem to be a valid MD5 hash "32 bit hexadecimal"' % passwd
  55.   else:
  56.     try:
  57.       banner()
  58.       def myaddr():
  59.         site = 'http://md5.my-addr.com/'
  60.         rest = 'md5_decrypt-md5_cracker_online/md5_decoder_tool.php'
  61.         para = urllib.urlencode({'md5':passwd})
  62.         req  = urllib2.Request(site+rest)
  63.         try:
  64.           fd   = urllib2.urlopen(req, para)
  65.           data = fd.read()
  66.           match= re.search('(Hashed string</span>: )(\w+.\w+)', data)
  67.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
  68.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  69.         except urllib2.URLError:  print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  70.       myaddr()
  71.  
  72.       def victorov():
  73.         try:
  74.           site = 'http://www.victorov.su/'
  75.           para = 'md5/?md5e=&md5d=%s' % passwd
  76.           req  = urllib2.Request(site+para)
  77.           req.add_header
  78.           opener = urllib2.urlopen(req)
  79.           data = opener.read()
  80.           match = re.search('(<b>)(.+[^>])(</b>)', data)
  81.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
  82.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  83.         except urllib2.URLError:  print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  84.       victorov()
  85.      
  86.       def md5crack():
  87.         site = 'http://www.md5crack.com/'
  88.         rest = 'crackmd5.php'
  89.         para = urllib.urlencode({'term':passwd})
  90.         req = urllib2.Request(site+rest)
  91.         try:
  92.           fd = urllib2.urlopen(req, para)
  93.           data = fd.read()
  94.           match = re.search('(Found: md5)(..)(\w+.\w+)', data)
  95.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(3))
  96.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  97.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error seems to be down' % site
  98.       md5crack()
  99.  
  100.  
  101.       def rednoize():
  102.         site = 'http://md5.rednoize.com/'
  103.         para = 'p&s=md5&q=%s&_=' % passwd
  104.         try:
  105.           req = urllib2.urlopen(site+'?'+para)
  106.           data = req.read()
  107.           if not len(data): print '[-] site: %s\t\t\tPassword: Not found' %site
  108.           else: print '[-] site: %s\t\t\tPassword: %s' % (site, data)
  109.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  110.       rednoize()
  111.  
  112.       def md5pass():
  113.         site = 'http://www.md5pass.info/'
  114.         para = urllib.urlencode({'hash':passwd, 'get_pass':'Get+Pass'})
  115.         req = urllib2.Request(site)
  116.         try:
  117.           fd = urllib2.urlopen(req, para)
  118.           data = fd.read()
  119.           match = re.search('(Password - <b>)(\w+)', data)
  120.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
  121.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  122.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  123.       md5pass()
  124.  
  125.       def md5decryption():
  126.         site = 'http://md5decryption.com/'
  127.         para = urllib.urlencode({'hash':passwd,'submit':'Decrypt+It!'})
  128.         req = urllib2.Request(site)
  129.         try:
  130.           fd = urllib2.urlopen(req, para)
  131.           data = fd.read()
  132.           match = re.search(r'(Decrypted Text: </b>)(.+[^>])(</font><br/><center>)', data)
  133.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
  134.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  135.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  136.       md5decryption()
  137.  
  138.  
  139.       def bigtrapeze():
  140.         site = 'http://www.bigtrapeze.com/'
  141.         rest = 'md5/index.php?query=%s' % passwd
  142.         req = urllib2.Request(site+rest)
  143.         req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.2)\
  144.        Gecko/20100316 AskTbSPC2/3.9.1.14019 Firefox/3.6.2')
  145.         try:
  146.           opener = urllib2.build_opener()
  147.           data = opener.open(req).read()
  148.           match = re.search('(=> <strong>)(\w+.\w+)', data)
  149.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
  150.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  151.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  152.       bigtrapeze()
  153.  
  154.       def cloudcracker():
  155.         site = 'http://www.netmd5crack.com/'
  156.         para = 'cgi-bin/Crack.py?InputHash=%s' % passwd
  157.         try:
  158.           req = urllib.urlopen(site+para)
  159.           data = req.read()
  160.           match = re.search(r'<tr><td class="border">[^<]+</td><td class="border">\
  161.          (?P<hash>[^>]+)</td></tr></tbody></table>', data)
  162.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(hash))
  163.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  164.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  165.       cloudcracker()
  166.  
  167.  
  168.       def hashcracking():
  169.         site = 'http://md5.hashcracking.com/'
  170.         rest = 'search.php'
  171.         para = 'md5=%s' % passwd
  172.         try:
  173.           req = urllib2.urlopen(site+rest+'?'+para)
  174.           data = req.read()
  175.           match = re.search('(is)(.)(\w+.\w+)', data)
  176.           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(3))
  177.           else: print '[-] site: %s\t\t\tPassword: Not found' % site
  178.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  179.       hashcracking()
  180.  
  181.       def cloudcracker():
  182.         site = 'http://www.cloudcracker.net/'
  183.         para = urllib.urlencode({'inputbox':passwd, 'submit':'Crack+MD5+Hash!'})
  184.         req = urllib2.Request(site)
  185.         try:
  186.           fd = urllib2.urlopen(req, para)
  187.           data = fd.read()
  188.           match = re.search('(this.select)(....)(\w+=")(\w+.\w+)', data)
  189.           if match: print '[-] site: %s\t\t\tPassword: %s\n' % (site, match.group(4))
  190.           else: print '[-] site: %s\t\t\tPassword: Not found\n' % site
  191.         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
  192.       cloudcracker()
  193.     except KeyboardInterrupt: print '\nTerminated by user ...'
  194.    
  195. elif option == '--offline':
  196.   banner()
  197.   try:
  198.     def offline():
  199.       print '[+] This opertaion will take some time, be patient ...'
  200.       dictionary = sys.argv[3]
  201.       dic = {}
  202.       shooter = 0
  203.       try:
  204.         f = open(dictionary, 'rb')
  205.         start = time.time()
  206.         for line in f:
  207.           line = line.rstrip()
  208.           dic[line] = hashlib.md5(line).hexdigest()
  209.         for k in dic.keys():
  210.           if passwd in dic[k]:
  211.             stop = time.time()
  212.             global spent
  213.             spent = stop - start
  214.             print '\n[-] Hash: %s\t\tData: %s\t\tTime: %.f seconds' % (dic[k], k, spent)
  215.             shooter += 1
  216.         if shooter == 0:  print "\n[*]Password not found in [%s] try the online cracker\n" % dictionary
  217.         f.close()
  218.       except IOError: print '\n[*] Erorr: %s doesn\'t exsit \n' % dictionary
  219.     offline()
  220.   except KeyboardInterrupt: print '\nTerminated by user ...'
  221.  
  222. else: pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement