Advertisement
simbha

Python [MD5 Hash Decrypt]

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