milo2012

findmyhash

Jan 26th, 2012
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 78.26 KB | None | 0 0
  1. # -*- coding: iso-8859-1 -*-
  2.  
  3. ########################################################################################################
  4. ### LICENSE
  5. ########################################################################################################
  6. #
  7. # findmyhash.py - v 1.1.2a
  8. #
  9. # This script is under GPL v3 License (http://www.gnu.org/licenses/gpl-3.0.html).
  10. #
  11. # Only this source code is under GPL v3 License. Web services used in this script are under
  12. # different licenses.
  13. #
  14. # If you know some clause in one of these web services which forbids to use it inside this script,
  15. # please contact me to remove the web service as soon as possible.
  16. #
  17. # Developed by JulGor ( http://laxmarcaellugar.blogspot.com/ )
  18. # Mail: bloglaxmarcaellugar AT gmail DOT com
  19. # twitter: @laXmarcaellugar
  20. #
  21.  
  22. ########################################################################################################
  23. ### IMPORTS
  24. ########################################################################################################
  25.  
  26. try:
  27.     import sys
  28.     import hashlib
  29.     import urllib2
  30.     import getopt
  31.     from os import path
  32.     from urllib import urlencode
  33.     from re import search, findall
  34.     from random import seed, randint
  35.     from base64 import decodestring, encodestring
  36.     from cookielib import LWPCookieJar
  37. except:
  38.     print """
  39. Execution error:
  40.  
  41.  You required some basic Python libraries.
  42.  
  43.  This application use: sys, hashlib, urllib, urllib2, os, re, random, getopt, base64 and cookielib.
  44.  
  45.  Please, check if you have all of them installed in your system.
  46.  
  47. """
  48.     sys.exit(1)
  49.  
  50. try:
  51.     from httplib2 import Http
  52. except:
  53.     print """
  54. Execution error:
  55.  
  56.  The Python library httplib2 is not installed in your system.
  57.  
  58.  Please, install it before use this application.
  59.  
  60. """
  61.     sys.exit(1)
  62.    
  63. try:
  64.     from libxml2 import parseDoc
  65. except:
  66.     print """
  67. Execution error:
  68.  
  69.  The Python library libxml2 is not installed in your system.
  70.  
  71.  Because of that, some plugins aren't going to work correctly.
  72.  
  73.  Please, install it before use this application.
  74.  
  75. """
  76.  
  77.  
  78.  
  79. ########################################################################################################
  80. ### CONSTANTS
  81. ########################################################################################################
  82.  
  83. MD4 = "md4"
  84. MD5     = "md5"
  85. SHA1    = "sha1"
  86. SHA224  = "sha224"
  87. SHA256  = "sha256"
  88. SHA384  = "sha384"
  89. SHA512  = "sha512"
  90. RIPEMD  = "rmd160"
  91. LM  = "lm"
  92. NTLM    = "ntlm"
  93. MYSQL   = "mysql"
  94. CISCO7  = "cisco7"
  95. JUNIPER = "juniper"
  96. GOST    = "gost"
  97. WHIRLPOOL = "whirlpool"
  98. LDAP_MD5 = "ldap_md5"
  99. LDAP_SHA1 = "ldap_sha1"
  100.  
  101.  
  102. USER_AGENTS = [
  103.     "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Crazy Browser 1.0.5)",
  104.     "curl/7.7.2 (powerpc-apple-darwin6.0) libcurl 7.7.2 (OpenSSL 0.9.6b)",
  105.     "Mozilla/5.0 (X11; U; Linux amd64; en-US; rv:5.0) Gecko/20110619 Firefox/5.0",
  106.     "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b8pre) Gecko/20101213 Firefox/4.0b8pre",
  107.     "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
  108.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)",
  109.     "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) chromeframe/10.0.648.205",
  110.     "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)",
  111.     "Opera/9.80 (Windows NT 6.1; U; sv) Presto/2.7.62 Version/11.01",
  112.     "Opera/9.80 (Windows NT 6.1; U; pl) Presto/2.7.62 Version/11.00",
  113.     "Opera/9.80 (X11; Linux i686; U; pl) Presto/2.6.30 Version/10.61",
  114.     "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.861.0 Safari/535.2",
  115.     "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2",
  116.     "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.812.0 Safari/535.1",
  117.     "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
  118.     ]
  119.    
  120.  
  121.  
  122. ########################################################################################################
  123. ### CRACKERS DEFINITION
  124. ########################################################################################################
  125.  
  126.  
  127. class SCHWETT:
  128.    
  129.     name =      "schwett"
  130.     url =       "http://schwett.com"
  131.     supported_algorithm = [MD5]
  132.    
  133.     def isSupported (self, alg):
  134.         """Return True if HASHCRACK can crack this type of algorithm and
  135.         False if it cannot."""
  136.        
  137.         if alg in self.supported_algorithm:
  138.             return True
  139.         else:
  140.             return False
  141.  
  142.  
  143.     def crack (self, hashvalue, alg):
  144.         """Try to crack the hash.
  145.         @param hashvalue Hash to crack.
  146.         @param alg Algorithm to crack."""
  147.        
  148.         # Check if the cracker can crack this kind of algorithm
  149.         if not self.isSupported (alg):
  150.             return None
  151.        
  152.         # Build the URL
  153.         url = "http://schwett.com/md5/index.php?md5value=%s&md5c=Hash+Match" % (hashvalue)
  154.        
  155.         # Make the request
  156.         response = do_HTTP_request ( url )
  157.        
  158.         # Analyze the response
  159.         html = None
  160.         if response:
  161.             html = response.read()
  162.         else:
  163.             return None
  164.        
  165.         match = search (r"<h3><font color='red'>No Match Found</font></h3><br />", html)
  166.         if match:
  167.             return None
  168.         else:
  169.             return "The hash is broken, please contact with La X marca el lugar and send it the hash value to add the correct regexp."
  170.  
  171.  
  172.  
  173. class NETMD5CRACK:
  174.  
  175.     name =      "netmd5crack"
  176.     url =       "http://www.netmd5crack.com"
  177.     supported_algorithm = [MD5]
  178.    
  179.     def isSupported (self, alg):
  180.         """Return True if HASHCRACK can crack this type of algorithm and
  181.         False if it cannot."""
  182.        
  183.         if alg in self.supported_algorithm:
  184.             return True
  185.         else:
  186.             return False
  187.  
  188.  
  189.     def crack (self, hashvalue, alg):
  190.         """Try to crack the hash.
  191.         @param hashvalue Hash to crack.
  192.         @param alg Algorithm to crack."""
  193.        
  194.         # Check if the cracker can crack this kind of algorithm
  195.         if not self.isSupported (alg):
  196.             return None
  197.        
  198.         # Build the URL
  199.         url = "http://www.netmd5crack.com/cgi-bin/Crack.py?InputHash=%s" % (hashvalue)
  200.        
  201.         # Make the request
  202.         response = do_HTTP_request ( url )
  203.        
  204.         # Analyze the response
  205.         html = None
  206.         if response:
  207.             html = response.read()
  208.         else:
  209.             return None
  210.        
  211.         regexp = r'<tr><td class="border">%s</td><td class="border">[^<]*</td></tr></table>' % (hashvalue)
  212.         match = search (regexp, html)
  213.        
  214.         if match:
  215.             match2 = search ( "Sorry, we don't have that hash in our database", match.group() )
  216.             if match2:
  217.                 return None
  218.             else:
  219.                 return match.group().split('border')[2].split('<')[0][2:]
  220.  
  221.  
  222.  
  223. class MD5_CRACKER:
  224.    
  225.     name =      "md5-cracker"
  226.     url =       "http://www.md5-cracker.tk"
  227.     supported_algorithm = [MD5]
  228.    
  229.     def isSupported (self, alg):
  230.         """Return True if HASHCRACK can crack this type of algorithm and
  231.         False if it cannot."""
  232.        
  233.         if alg in self.supported_algorithm:
  234.             return True
  235.         else:
  236.             return False
  237.  
  238.  
  239.     def crack (self, hashvalue, alg):
  240.         """Try to crack the hash.
  241.         @param hashvalue Hash to crack.
  242.         @param alg Algorithm to crack."""
  243.        
  244.         # Check if the cracker can crack this kind of algorithm
  245.         if not self.isSupported (alg):
  246.             return None
  247.        
  248.         # Build the URL
  249.         url = "http://www.md5-cracker.tk/xml.php?md5=%s" % (hashvalue)
  250.        
  251.         # Make the request
  252.         response = do_HTTP_request ( url )
  253.        
  254.         # Analyze the response
  255.         if response:
  256.             try:
  257.                 doc = parseDoc ( response.read() )
  258.             except:
  259.                 print "INFO: You need libxml2 to use this plugin."
  260.                 return None
  261.         else:
  262.             return None
  263.        
  264.         result = doc.xpathEval("//data")
  265.         if len(result):
  266.             return result[0].content
  267.         else:
  268.             return None
  269.  
  270.  
  271. class BENRAMSEY:
  272.    
  273.     name =      "benramsey"
  274.     url =       "http://tools.benramsey.com"
  275.     supported_algorithm = [MD5]
  276.    
  277.     def isSupported (self, alg):
  278.         """Return True if HASHCRACK can crack this type of algorithm and
  279.         False if it cannot."""
  280.        
  281.         if alg in self.supported_algorithm:
  282.             return True
  283.         else:
  284.             return False
  285.  
  286.  
  287.     def crack (self, hashvalue, alg):
  288.         """Try to crack the hash.
  289.         @param hashvalue Hash to crack.
  290.         @param alg Algorithm to crack."""
  291.        
  292.         # Check if the cracker can crack this kind of algorithm
  293.         if not self.isSupported (alg):
  294.             return None
  295.        
  296.         # Build the URL
  297.         url = "http://tools.benramsey.com/md5/md5.php?hash=%s" % (hashvalue)
  298.        
  299.         # Make the request
  300.         response = do_HTTP_request ( url )
  301.        
  302.         # Analyze the response
  303.         html = None
  304.         if response:
  305.             html = response.read()
  306.         else:
  307.             return None
  308.            
  309.         match = search (r'<string><!\[CDATA\[[^\]]*\]\]></string>', html)
  310.        
  311.         if match:
  312.             return match.group().split(']')[0][17:]
  313.         else:
  314.             return None
  315.  
  316.  
  317.  
  318. class GROMWEB:
  319.    
  320.     name =      "gromweb"
  321.     url =       "http://md5.gromweb.com"
  322.     supported_algorithm = [MD5]
  323.    
  324.     def isSupported (self, alg):
  325.         """Return True if HASHCRACK can crack this type of algorithm and
  326.         False if it cannot."""
  327.        
  328.         if alg in self.supported_algorithm:
  329.             return True
  330.         else:
  331.             return False
  332.  
  333.  
  334.     def crack (self, hashvalue, alg):
  335.         """Try to crack the hash.
  336.         @param hashvalue Hash to crack.
  337.         @param alg Algorithm to crack."""
  338.        
  339.         # Check if the cracker can crack this kind of algorithm
  340.         if not self.isSupported (alg):
  341.             return None
  342.        
  343.         # Build the URL
  344.         url = "http://md5.gromweb.com/query/%s" % (hashvalue)
  345.        
  346.         # Make the request
  347.         response = do_HTTP_request ( url )
  348.        
  349.         # Analyze the response
  350.         if response:
  351.             return response.read()
  352.            
  353.         return response
  354.        
  355.        
  356.  
  357.  
  358. class HASHCRACKING:
  359.    
  360.     name =      "hashcracking"
  361.     url =       "http://md5.hashcracking.com"
  362.     supported_algorithm = [MD5]
  363.    
  364.     def isSupported (self, alg):
  365.         """Return True if HASHCRACK can crack this type of algorithm and
  366.         False if it cannot."""
  367.        
  368.         if alg in self.supported_algorithm:
  369.             return True
  370.         else:
  371.             return False
  372.  
  373.  
  374.     def crack (self, hashvalue, alg):
  375.         """Try to crack the hash.
  376.         @param hashvalue Hash to crack.
  377.         @param alg Algorithm to crack."""
  378.        
  379.         # Check if the cracker can crack this kind of algorithm
  380.         if not self.isSupported (alg):
  381.             return None
  382.        
  383.         # Build the URL
  384.         url = "http://md5.hashcracking.com/search.php?md5=%s" % (hashvalue)
  385.        
  386.         # Make the request
  387.         response = do_HTTP_request ( url )
  388.        
  389.         # Analyze the response
  390.         html = None
  391.         if response:
  392.             html = response.read()
  393.         else:
  394.             return None
  395.        
  396.         match = search (r'\sis.*', html)
  397.        
  398.         if match:
  399.             return match.group()[4:]
  400.            
  401.         return None
  402.  
  403.  
  404.  
  405. class VICTOROV:
  406.    
  407.     name =      "hashcracking"
  408.     url =       "http://victorov.su"
  409.     supported_algorithm = [MD5]
  410.    
  411.     def isSupported (self, alg):
  412.         """Return True if HASHCRACK can crack this type of algorithm and
  413.         False if it cannot."""
  414.        
  415.         if alg in self.supported_algorithm:
  416.             return True
  417.         else:
  418.             return False
  419.  
  420.  
  421.     def crack (self, hashvalue, alg):
  422.         """Try to crack the hash.
  423.         @param hashvalue Hash to crack.
  424.         @param alg Algorithm to crack."""
  425.        
  426.         # Check if the cracker can crack this kind of algorithm
  427.         if not self.isSupported (alg):
  428.             return None
  429.        
  430.         # Build the URL
  431.         url = "http://victorov.su/md5/?md5e=&md5d=%s" % (hashvalue)
  432.        
  433.         # Make the request
  434.         response = do_HTTP_request ( url )
  435.        
  436.         # Analyze the response
  437.         html = None
  438.         if response:
  439.             html = response.read()
  440.         else:
  441.             return None
  442.        
  443.         match = search (r': <b>[^<]*</b><br><form action="">', html)
  444.        
  445.         if match:
  446.             return match.group().split('b>')[1][:-2]
  447.            
  448.         return None
  449.  
  450.  
  451. class THEKAINE:
  452.    
  453.     name =      "thekaine"
  454.     url =       "http://md5.thekaine.de"
  455.     supported_algorithm = [MD5]
  456.    
  457.     def isSupported (self, alg):
  458.         """Return True if HASHCRACK can crack this type of algorithm and
  459.         False if it cannot."""
  460.        
  461.         if alg in self.supported_algorithm:
  462.             return True
  463.         else:
  464.             return False
  465.  
  466.  
  467.     def crack (self, hashvalue, alg):
  468.         """Try to crack the hash.
  469.         @param hashvalue Hash to crack.
  470.         @param alg Algorithm to crack."""
  471.        
  472.         # Check if the cracker can crack this kind of algorithm
  473.         if not self.isSupported (alg):
  474.             return None
  475.        
  476.         # Build the URL
  477.         url = "http://md5.thekaine.de/?hash=%s" % (hashvalue)
  478.        
  479.         # Make the request
  480.         response = do_HTTP_request ( url )
  481.        
  482.         # Analyze the response
  483.         html = None
  484.         if response:
  485.             html = response.read()
  486.         else:
  487.             return None
  488.        
  489.         match = search (r'<td colspan="2"><br><br><b>[^<]*</b></td><td></td>', html)
  490.        
  491.         if match:
  492.            
  493.             match2 = search (r'not found', match.group() )
  494.            
  495.             if match2:
  496.                 return None
  497.             else:
  498.                 return match.group().split('b>')[1][:-2]
  499.            
  500.  
  501.  
  502. class TMTO:
  503.    
  504.     name =      "tmto"
  505.     url =       "http://www.tmto.org"
  506.     supported_algorithm = [MD5]
  507.    
  508.     def isSupported (self, alg):
  509.         """Return True if HASHCRACK can crack this type of algorithm and
  510.         False if it cannot."""
  511.        
  512.         if alg in self.supported_algorithm:
  513.             return True
  514.         else:
  515.             return False
  516.  
  517.  
  518.     def crack (self, hashvalue, alg):
  519.         """Try to crack the hash.
  520.         @param hashvalue Hash to crack.
  521.         @param alg Algorithm to crack."""
  522.        
  523.         # Check if the cracker can crack this kind of algorithm
  524.         if not self.isSupported (alg):
  525.             return None
  526.        
  527.         # Build the URL
  528.         url = "http://www.tmto.org/api/latest/?hash=%s&auth=true" % (hashvalue)
  529.        
  530.         # Make the request
  531.         response = do_HTTP_request ( url )
  532.        
  533.         # Analyze the response
  534.         html = None
  535.         if response:
  536.             html = response.read()
  537.         else:
  538.             return None
  539.        
  540.         match = search (r'text="[^"]+"', html)
  541.        
  542.         if match:
  543.             return decodestring(match.group().split('"')[1])
  544.         else:
  545.             return None
  546.  
  547.  
  548. class MD5_DB:
  549.    
  550.     name =      "md5-db"
  551.     url =       "http://md5-db.de"
  552.     supported_algorithm = [MD5]
  553.    
  554.     def isSupported (self, alg):
  555.         """Return True if HASHCRACK can crack this type of algorithm and
  556.         False if it cannot."""
  557.        
  558.         if alg in self.supported_algorithm:
  559.             return True
  560.         else:
  561.             return False
  562.  
  563.  
  564.     def crack (self, hashvalue, alg):
  565.         """Try to crack the hash.
  566.         @param hashvalue Hash to crack.
  567.         @param alg Algorithm to crack."""
  568.        
  569.         # Check if the cracker can crack this kind of algorithm
  570.         if not self.isSupported (alg):
  571.             return None
  572.        
  573.         # Build the URL
  574.         url = "http://md5-db.de/%s.html" % (hashvalue)
  575.        
  576.         # Make the request
  577.         response = do_HTTP_request ( url )
  578.        
  579.         # Analyze the response
  580.         if not response:
  581.             return None
  582.            
  583.         html = None
  584.         if response:
  585.             html = response.read()
  586.         else:
  587.             return None
  588.        
  589.         match = search (r'<strong>Es wurden 1 m.gliche Begriffe gefunden, die den Hash \w* verwenden:</strong><ul><li>[^<]*</li>', html)
  590.        
  591.         if match:
  592.             return match.group().split('li>')[1][:-2]
  593.         else:
  594.             return None
  595.  
  596.  
  597.  
  598.  
  599. class MY_ADDR:
  600.    
  601.     name =      "my-addr"
  602.     url =       "http://md5.my-addr.com"
  603.     supported_algorithm = [MD5]
  604.    
  605.     def isSupported (self, alg):
  606.         """Return True if HASHCRACK can crack this type of algorithm and
  607.         False if it cannot."""
  608.        
  609.         if alg in self.supported_algorithm:
  610.             return True
  611.         else:
  612.             return False
  613.  
  614.  
  615.     def crack (self, hashvalue, alg):
  616.         """Try to crack the hash.
  617.         @param hashvalue Hash to crack.
  618.         @param alg Algorithm to crack."""
  619.        
  620.         # Check if the cracker can crack this kind of algorithm
  621.         if not self.isSupported (alg):
  622.             return None
  623.        
  624.         # Build the URL
  625.         url = "http://md5.my-addr.com/md5_decrypt-md5_cracker_online/md5_decoder_tool.php"
  626.        
  627.         # Build the parameters
  628.         params = { "md5" : hashvalue,
  629.                "x" : 21,
  630.                "y" : 8 }
  631.        
  632.         # Make the request
  633.         response = do_HTTP_request ( url, params )
  634.        
  635.         # Analyze the response
  636.         html = None
  637.         if response:
  638.             html = response.read()
  639.         else:
  640.             return None
  641.        
  642.         match = search (r"<span class='middle_title'>Hashed string</span>: [^<]*</div>", html)
  643.        
  644.         if match:
  645.             return match.group().split('span')[2][3:-6]
  646.         else:
  647.             return None
  648.  
  649.  
  650.  
  651.  
  652. class MD5PASS:
  653.    
  654.     name =      "md5pass"
  655.     url =       "http://md5pass.info"
  656.     supported_algorithm = [MD5]
  657.    
  658.     def isSupported (self, alg):
  659.         """Return True if HASHCRACK can crack this type of algorithm and
  660.         False if it cannot."""
  661.        
  662.         if alg in self.supported_algorithm:
  663.             return True
  664.         else:
  665.             return False
  666.  
  667.  
  668.     def crack (self, hashvalue, alg):
  669.         """Try to crack the hash.
  670.         @param hashvalue Hash to crack.
  671.         @param alg Algorithm to crack."""
  672.        
  673.         # Check if the cracker can crack this kind of algorithm
  674.         if not self.isSupported (alg):
  675.             return None
  676.        
  677.         # Build the URL
  678.         url = self.url
  679.        
  680.         # Build the parameters
  681.         params = { "hash" : hashvalue,
  682.                "get_pass" : "Get Pass" }
  683.        
  684.         # Make the request
  685.         response = do_HTTP_request ( url, params )
  686.        
  687.         # Analyze the response
  688.         html = None
  689.         if response:
  690.             html = response.read()
  691.         else:
  692.             return None
  693.        
  694.         match = search (r"Password - <b>[^<]*</b>", html)
  695.        
  696.         if match:
  697.             return match.group().split('b>')[1][:-2]
  698.         else:
  699.             return None
  700.  
  701.  
  702.  
  703. class MD5DECRYPTION:
  704.    
  705.     name =      "md5decryption"
  706.     url =       "http://md5decryption.com"
  707.     supported_algorithm = [MD5]
  708.    
  709.     def isSupported (self, alg):
  710.         """Return True if HASHCRACK can crack this type of algorithm and
  711.         False if it cannot."""
  712.        
  713.         if alg in self.supported_algorithm:
  714.             return True
  715.         else:
  716.             return False
  717.  
  718.  
  719.     def crack (self, hashvalue, alg):
  720.         """Try to crack the hash.
  721.         @param hashvalue Hash to crack.
  722.         @param alg Algorithm to crack."""
  723.        
  724.         # Check if the cracker can crack this kind of algorithm
  725.         if not self.isSupported (alg):
  726.             return None
  727.        
  728.         # Build the URL
  729.         url = self.url
  730.        
  731.         # Build the parameters
  732.         params = { "hash" : hashvalue,
  733.                "submit" : "Decrypt It!" }
  734.        
  735.         # Make the request
  736.         response = do_HTTP_request ( url, params )
  737.        
  738.         # Analyze the response
  739.         html = None
  740.         if response:
  741.             html = response.read()
  742.         else:
  743.             return None
  744.        
  745.         match = search (r"Decrypted Text: </b>[^<]*</font>", html)
  746.        
  747.         if match:
  748.             return match.group().split('b>')[1][:-7]
  749.         else:
  750.             return None
  751.  
  752.  
  753.  
  754. class MD5CRACK:
  755.    
  756.     name =      "md5crack"
  757.     url =       "http://md5crack.com"
  758.     supported_algorithm = [MD5]
  759.    
  760.     def isSupported (self, alg):
  761.         """Return True if HASHCRACK can crack this type of algorithm and
  762.         False if it cannot."""
  763.        
  764.         if alg in self.supported_algorithm:
  765.             return True
  766.         else:
  767.             return False
  768.  
  769.  
  770.     def crack (self, hashvalue, alg):
  771.         """Try to crack the hash.
  772.         @param hashvalue Hash to crack.
  773.         @param alg Algorithm to crack."""
  774.        
  775.         # Check if the cracker can crack this kind of algorithm
  776.         if not self.isSupported (alg):
  777.             return None
  778.        
  779.         # Build the URL
  780.         url = "http://md5crack.com/crackmd5.php"
  781.        
  782.         # Build the parameters
  783.         params = { "term" : hashvalue,
  784.                "crackbtn" : "Crack that hash baby!" }
  785.        
  786.         # Make the request
  787.         response = do_HTTP_request ( url, params )
  788.        
  789.         # Analyze the response
  790.         html = None
  791.         if response:
  792.             html = response.read()
  793.         else:
  794.             return None
  795.        
  796.         match = search (r'Found: md5\("[^"]+"\)', html)
  797.        
  798.         if match:
  799.             return match.group().split('"')[1]
  800.         else:
  801.             return None
  802.  
  803.  
  804. class MD5ONLINE:
  805.    
  806.     name =      "md5online"
  807.     url =       "http://md5online.net"
  808.     supported_algorithm = [MD5]
  809.    
  810.     def isSupported (self, alg):
  811.         """Return True if HASHCRACK can crack this type of algorithm and
  812.         False if it cannot."""
  813.        
  814.         if alg in self.supported_algorithm:
  815.             return True
  816.         else:
  817.             return False
  818.  
  819.  
  820.     def crack (self, hashvalue, alg):
  821.         """Try to crack the hash.
  822.         @param hashvalue Hash to crack.
  823.         @param alg Algorithm to crack."""
  824.        
  825.         # Check if the cracker can crack this kind of algorithm
  826.         if not self.isSupported (alg):
  827.             return None
  828.        
  829.         # Build the URL
  830.         url = self.url
  831.        
  832.         # Build the parameters
  833.         params = { "pass" : hashvalue,
  834.                "option" : "hash2text",
  835.                "send" : "Submit" }
  836.        
  837.         # Make the request
  838.         response = do_HTTP_request ( url, params )
  839.        
  840.         # Analyze the response
  841.         html = None
  842.         if response:
  843.             html = response.read()
  844.         else:
  845.             return None
  846.        
  847.         match = search (r'<center><p>md5 :<b>\w*</b> <br>pass : <b>[^<]*</b></p></table>', html)
  848.        
  849.         if match:
  850.             return match.group().split('b>')[3][:-2]
  851.         else:
  852.             return None
  853.  
  854.  
  855.  
  856.  
  857. class MD5_DECRYPTER:
  858.    
  859.     name =      "md5-decrypter"
  860.     url =       "http://md5-decrypter.com"
  861.     supported_algorithm = [MD5]
  862.    
  863.     def isSupported (self, alg):
  864.         """Return True if HASHCRACK can crack this type of algorithm and
  865.         False if it cannot."""
  866.        
  867.         if alg in self.supported_algorithm:
  868.             return True
  869.         else:
  870.             return False
  871.  
  872.  
  873.     def crack (self, hashvalue, alg):
  874.         """Try to crack the hash.
  875.         @param hashvalue Hash to crack.
  876.         @param alg Algorithm to crack."""
  877.        
  878.         # Check if the cracker can crack this kind of algorithm
  879.         if not self.isSupported (alg):
  880.             return None
  881.        
  882.         # Build the URL
  883.         url = self.url
  884.        
  885.         # Build the parameters
  886.         params = { "data[Row][cripted]" : hashvalue }
  887.        
  888.         # Make the request
  889.         response = do_HTTP_request ( url, params )
  890.        
  891.         # Analyze the response
  892.         html = None
  893.         if response:
  894.             html = response.read()
  895.         else:
  896.             return None
  897.        
  898.         match = findall (r'<b class="res">[^<]*</b>', html)
  899.        
  900.         if match:
  901.             return match[1].split('>')[1][:-3]
  902.         else:
  903.             return None
  904.  
  905.  
  906.  
  907. class AUTHSECUMD5:
  908.    
  909.     name =      "authsecu"
  910.     url =       "http://www.authsecu.com"
  911.     supported_algorithm = [MD5]
  912.    
  913.     def isSupported (self, alg):
  914.         """Return True if HASHCRACK can crack this type of algorithm and
  915.         False if it cannot."""
  916.        
  917.         if alg in self.supported_algorithm:
  918.             return True
  919.         else:
  920.             return False
  921.  
  922.  
  923.     def crack (self, hashvalue, alg):
  924.         """Try to crack the hash.
  925.         @param hashvalue Hash to crack.
  926.         @param alg Algorithm to crack."""
  927.        
  928.         # Check if the cracker can crack this kind of algorithm
  929.         if not self.isSupported (alg):
  930.             return None
  931.        
  932.         # Build the URL
  933.         url = "http://www.authsecu.com/decrypter-dechiffrer-cracker-hash-md5/script-hash-md5.php"
  934.        
  935.         # Build the parameters
  936.         params = { "valeur_bouton" : "dechiffrage",
  937.                "champ1" : "",
  938.                "champ2" : hashvalue,
  939.                "dechiffrer.x" : "78",
  940.                "dechiffrer.y" : "7" }
  941.        
  942.         # Make the request
  943.         response = do_HTTP_request ( url, params )
  944.        
  945.         # Analyze the response
  946.         html = None
  947.         if response:
  948.             html = response.read()
  949.         else:
  950.             return None
  951.        
  952.         match = findall (r'<td><p class="chapitre---texte-du-tableau-de-niveau-1">[^<]*</p></td>', html)
  953.        
  954.         if len(match) > 2:
  955.             return match[1].split('>')[2][:-3]
  956.         else:
  957.             return None
  958.  
  959.  
  960.  
  961. class HASHCRACK:
  962.    
  963.     name =      "hashcrack"
  964.     url =       "http://hashcrack.com"
  965.     supported_algorithm = [MD5, SHA1, MYSQL, LM, NTLM]
  966.    
  967.     def isSupported (self, alg):
  968.         """Return True if HASHCRACK can crack this type of algorithm and
  969.         False if it cannot."""
  970.        
  971.         if alg in self.supported_algorithm:
  972.             return True
  973.         else:
  974.             return False
  975.  
  976.  
  977.  
  978.     def crack (self, hashvalue, alg):
  979.         """Try to crack the hash.
  980.         @param hashvalue Hash to crack.
  981.         @param alg Algorithm to crack."""
  982.        
  983.         # Check if the cracker can crack this kind of algorithm
  984.         if not self.isSupported (alg):
  985.             return None
  986.        
  987.         # Build the URL
  988.         url = "http://hashcrack.com/indx.php"
  989.        
  990.         hash2 = None
  991.         if alg in [LM, NTLM] and ':' in hashvalue:
  992.             if alg == LM:
  993.                 hash2 = hashvalue.split(':')[0]
  994.             else:
  995.                 hash2 = hashvalue.split(':')[1]
  996.         else:
  997.             hash2 = hashvalue
  998.        
  999.         # Delete the possible starting '*'
  1000.         if alg == MYSQL and hash2[0] == '*':
  1001.             hash2 = hash2[1:]
  1002.        
  1003.         # Build the parameters
  1004.         params = { "auth" : "8272hgt",
  1005.                "hash" : hash2,
  1006.                "string" : "",
  1007.                "Submit" : "Submit" }
  1008.        
  1009.         # Make the request
  1010.         response = do_HTTP_request ( url, params )
  1011.        
  1012.         # Analyze the response
  1013.         html = None
  1014.         if response:
  1015.             html = response.read()
  1016.         else:
  1017.             return None
  1018.        
  1019.         match = search (r'<div align=center>"[^"]*" resolves to</div><br><div align=center> <span class=hervorheb2>[^<]*</span></div></TD>', html)
  1020.        
  1021.         if match:
  1022.             return match.group().split('hervorheb2>')[1][:-18]
  1023.         else:
  1024.             return None
  1025.  
  1026.  
  1027.  
  1028. class OPHCRACK:
  1029.    
  1030.     name =      "ophcrack"
  1031.     url =       "http://www.objectif-securite.ch"
  1032.     supported_algorithm = [LM, NTLM]
  1033.    
  1034.     def isSupported (self, alg):
  1035.         """Return True if HASHCRACK can crack this type of algorithm and
  1036.         False if it cannot."""
  1037.        
  1038.         if alg in self.supported_algorithm:
  1039.             return True
  1040.         else:
  1041.             return False
  1042.  
  1043.  
  1044.  
  1045.     def crack (self, hashvalue, alg):
  1046.         """Try to crack the hash.
  1047.         @param hashvalue Hash to crack.
  1048.         @param alg Algorithm to crack."""
  1049.        
  1050.         # Check if the cracker can crack this kind of algorithm
  1051.         if not self.isSupported (alg):
  1052.             return None
  1053.        
  1054.         # Check if hashvalue has the character ':'
  1055.         if ':' not in hashvalue:
  1056.             return None
  1057.            
  1058.         # Ophcrack doesn't crack NTLM hashes. It needs a valid LM hash and this one is an empty hash.
  1059.         if hashvalue.split(':')[0] == "aad3b435b51404eeaad3b435b51404ee":
  1060.             return None
  1061.        
  1062.         # Build the URL and the headers
  1063.         url = "http://www.objectif-securite.ch/en/products.php?hash=%s" % (hashvalue.replace(':', '%3A'))
  1064.        
  1065.         # Make the request
  1066.         response = do_HTTP_request ( url )
  1067.        
  1068.         # Analyze the response
  1069.         html = None
  1070.         if response:
  1071.             html = response.read()
  1072.         else:
  1073.             return None
  1074.        
  1075.         match = search (r'<table><tr><td>Hash:</td><td>[^<]*</td></tr><tr><td><b>Password:</b></td><td><b>[^<]*</b></td>', html)
  1076.        
  1077.         if match:
  1078.             return match.group().split('b>')[3][:-2]
  1079.         else:
  1080.             return None
  1081.    
  1082.  
  1083.  
  1084. class C0LLISION:
  1085.    
  1086.     name =      "c0llision"
  1087.     url =       "http://www.c0llision.net"
  1088.     supported_algorithm = [MD5, LM, NTLM]
  1089.    
  1090.     def isSupported (self, alg):
  1091.         """Return True if HASHCRACK can crack this type of algorithm and
  1092.         False if it cannot."""
  1093.        
  1094.         if alg in self.supported_algorithm:
  1095.             return True
  1096.         else:
  1097.             return False
  1098.  
  1099.  
  1100.  
  1101.     def crack (self, hashvalue, alg):
  1102.         """Try to crack the hash.
  1103.         @param hashvalue Hash to crack.
  1104.         @param alg Algorithm to crack."""
  1105.        
  1106.         # Check if the cracker can crack this kind of algorithm
  1107.         if not self.isSupported (alg):
  1108.             return None
  1109.        
  1110.         # Check if hashvalue has the character ':'
  1111.         if alg in [LM, NTLM] and ':' not in hashvalue:
  1112.             return None
  1113.            
  1114.         # Look for "hash[_csrf_token]" parameter
  1115.         response = do_HTTP_request ( "http://www.c0llision.net/webcrack.php" )
  1116.         html = None
  1117.         if response:
  1118.             html = response.read()
  1119.         else:
  1120.             return None
  1121.         match = search (r'<input type="hidden" name="hash._csrf_token." value="[^"]*" id="hash__csrf_token" />', html)
  1122.         token = None
  1123.         if match:
  1124.             token = match.group().split('"')[5]
  1125.        
  1126.         # Build the URL
  1127.         url = "http://www.c0llision.net/webcrack/request"
  1128.        
  1129.         # Build the parameters
  1130.         params = { "hash[_input_]" : hashvalue,
  1131.                "hash[_csrf_token]" : token }
  1132.        
  1133.         # Make the request
  1134.         response = do_HTTP_request ( url, params )
  1135.        
  1136.         # Analyze the response
  1137.         html = None
  1138.         if response:
  1139.             html = response.read()
  1140.         else:
  1141.             return None
  1142.        
  1143.         match = None
  1144.         if alg in [LM, NTLM]:
  1145.             html = html.replace('\n', '')
  1146.             result = ""
  1147.            
  1148.             match = search (r'<table class="pre">.*?</table>', html)
  1149.             if match:
  1150.                 try:
  1151.                     doc = parseDoc ( match.group() )
  1152.                 except:
  1153.                     print "INFO: You need libxml2 to use this plugin."
  1154.                     return None
  1155.                 lines = doc.xpathEval("//tr")
  1156.                 for l in lines:
  1157.                     doc = parseDoc ( str(l) )
  1158.                     cols = doc.xpathEval("//td")
  1159.                    
  1160.                     if len(cols) < 4:
  1161.                         return None
  1162.                    
  1163.                     if cols[2].content:
  1164.                         result = " > %s (%s) = %s\n" % ( cols[1].content, cols[2].content, cols[3].content )
  1165.                
  1166.                 #return ( result and "\n" + result or None )
  1167.                 return ( result and result.split()[-1] or None )
  1168.            
  1169.         else:
  1170.             match = search (r'<td class="plaintext">[^<]*</td>', html)
  1171.        
  1172.             if match:
  1173.                 return match.group().split('>')[1][:-4]
  1174.        
  1175.         return None
  1176.  
  1177.  
  1178.  
  1179. class REDNOIZE:
  1180.    
  1181.     name =      "rednoize"
  1182.     url =       "http://md5.rednoize.com"
  1183.     supported_algorithm = [MD5, SHA1]
  1184.    
  1185.     def isSupported (self, alg):
  1186.         """Return True if HASHCRACK can crack this type of algorithm and
  1187.         False if it cannot."""
  1188.        
  1189.         if alg in self.supported_algorithm:
  1190.             return True
  1191.         else:
  1192.             return False
  1193.  
  1194.  
  1195.     def crack (self, hashvalue, alg):
  1196.         """Try to crack the hash.
  1197.         @param hashvalue Hash to crack.
  1198.         @param alg Algorithm to crack."""
  1199.        
  1200.         # Check if the cracker can crack this kind of algorithm
  1201.         if not self.isSupported (alg):
  1202.             return None
  1203.        
  1204.         # Build the URL
  1205.         url = ""
  1206.         if alg == MD5:
  1207.             url = "http://md5.rednoize.com/?p&s=md5&q=%s&_=" % (hashvalue)
  1208.         else:
  1209.             url = "http://md5.rednoize.com/?p&s=sha1&q=%s&_=" % (hashvalue)
  1210.        
  1211.         # Make the request
  1212.         response = do_HTTP_request ( url )
  1213.        
  1214.         # Analyze the response
  1215.         html = None
  1216.         if response:
  1217.             html = response.read()
  1218.         else:
  1219.             return None
  1220.        
  1221.         return html
  1222.            
  1223.            
  1224.  
  1225.  
  1226. class CMD5:
  1227.    
  1228.     name =      "cmd5"
  1229.     url =       "http://www.cmd5.org"
  1230.     supported_algorithm = [MD5, NTLM]
  1231.    
  1232.     def isSupported (self, alg):
  1233.         """Return True if HASHCRACK can crack this type of algorithm and
  1234.         False if it cannot."""
  1235.        
  1236.         if alg in self.supported_algorithm:
  1237.             return True
  1238.         else:
  1239.             return False
  1240.  
  1241.  
  1242.     def crack (self, hashvalue, alg):
  1243.         """Try to crack the hash.
  1244.         @param hashvalue Hash to crack.
  1245.         @param alg Algorithm to crack."""
  1246.        
  1247.         # Check if the cracker can crack this kind of algorithm
  1248.         if not self.isSupported (alg):
  1249.             return None
  1250.        
  1251.         # Look for hidden parameters
  1252.         response = do_HTTP_request ( "http://www.cmd5.org/" )
  1253.         html = None
  1254.         if response:
  1255.             html = response.read()
  1256.         else:
  1257.             return None
  1258.        
  1259.         match = search (r'<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="[^"]*" />', html)
  1260.         viewstate = None
  1261.         if match:
  1262.             viewstate = match.group().split('"')[7]
  1263.        
  1264.         match = search (r'<input type="hidden" name="ctl00.ContentPlaceHolder1.HiddenField1" id="ctl00_ContentPlaceHolder1_HiddenField1" value="[^"]*" />', html)
  1265.         ContentPlaceHolder1 = ""
  1266.         if match:
  1267.             ContentPlaceHolder1 = match.group().split('"')[7]
  1268.        
  1269.         match = search (r'<input type="hidden" name="ctl00.ContentPlaceHolder1.HiddenField2" id="ctl00_ContentPlaceHolder1_HiddenField2" value="[^"]*" />', html)
  1270.         ContentPlaceHolder2 = ""
  1271.         if match:
  1272.             ContentPlaceHolder2 = match.group().split('"')[7]
  1273.        
  1274.         # Build the URL
  1275.         url = "http://www.cmd5.org/"
  1276.        
  1277.         hash2 = ""
  1278.         if alg == MD5:
  1279.             hash2 = hashvalue
  1280.         else:
  1281.             if ':' in hashvalue:
  1282.                 hash2 = hashvalue.split(':')[1]
  1283.        
  1284.         # Build the parameters
  1285.         params = { "__EVENTTARGET" : "",
  1286.                "__EVENTARGUMENT" : "",
  1287.                "__VIEWSTATE" : viewstate,
  1288.                "ctl00$ContentPlaceHolder1$TextBoxq" : hash2,
  1289.                "ctl00$ContentPlaceHolder1$InputHashType" : alg,
  1290.                "ctl00$ContentPlaceHolder1$Button1" : "decrypt",
  1291.                "ctl00$ContentPlaceHolder1$HiddenField1" : ContentPlaceHolder1,
  1292.                "ctl00$ContentPlaceHolder1$HiddenField2" : ContentPlaceHolder2 }
  1293.                
  1294.         header = { "Referer" : "http://www.cmd5.org/" }
  1295.        
  1296.         # Make the request
  1297.         response = do_HTTP_request ( url, params, header )
  1298.        
  1299.         # Analyze the response
  1300.         html = None
  1301.         if response:
  1302.             html = response.read()
  1303.         else:
  1304.             return None
  1305.        
  1306.         match = search (r'<span id="ctl00_ContentPlaceHolder1_LabelResult">[^<]*</span>', html)
  1307.        
  1308.         if match:
  1309.             return match.group().split('>')[1][:-6]
  1310.         else:
  1311.             return None
  1312.  
  1313.  
  1314.  
  1315. class AUTHSECUCISCO7:
  1316.    
  1317.     name =      "authsecu"
  1318.     url =       "http://www.authsecu.com"
  1319.     supported_algorithm = [CISCO7]
  1320.    
  1321.     def isSupported (self, alg):
  1322.         """Return True if HASHCRACK can crack this type of algorithm and
  1323.         False if it cannot."""
  1324.        
  1325.         if alg in self.supported_algorithm:
  1326.             return True
  1327.         else:
  1328.             return False
  1329.  
  1330.  
  1331.  
  1332.     def crack (self, hashvalue, alg):
  1333.         """Try to crack the hash.
  1334.         @param hashvalue Hash to crack.
  1335.         @param alg Algorithm to crack."""
  1336.        
  1337.         # Check if the cracker can crack this kind of algorithm
  1338.         if not self.isSupported (alg):
  1339.             return None
  1340.        
  1341.         # Build the URL and the headers
  1342.         url = "http://www.authsecu.com/decrypter-dechiffrer-cracker-password-cisco-7/script-password-cisco-7-launcher.php"
  1343.        
  1344.         # Build the parameters
  1345.         params = { "valeur_bouton" : "dechiffrage",
  1346.                "champ1" : hashvalue,
  1347.                "dechiffrer.x" : 43,
  1348.                "dechiffrer.y" : 16 }
  1349.                
  1350.         # Make the request
  1351.         response = do_HTTP_request ( url, params )
  1352.        
  1353.         # Analyze the response
  1354.         html = None
  1355.         if response:
  1356.             html = response.read()
  1357.         else:
  1358.             return None
  1359.        
  1360.         match = findall (r'<td><p class="chapitre---texte-du-tableau-de-niveau-1">[^<]*</p></td>', html)
  1361.        
  1362.         if match:
  1363.             return match[1].split('>')[2][:-3]
  1364.         else:
  1365.             return None
  1366.  
  1367.  
  1368.  
  1369.  
  1370. class CACIN:
  1371.    
  1372.     name =      "cacin"
  1373.     url =       "http://cacin.net"
  1374.     supported_algorithm = [CISCO7]
  1375.    
  1376.     def isSupported (self, alg):
  1377.         """Return True if HASHCRACK can crack this type of algorithm and
  1378.         False if it cannot."""
  1379.        
  1380.         if alg in self.supported_algorithm:
  1381.             return True
  1382.         else:
  1383.             return False
  1384.  
  1385.  
  1386.  
  1387.     def crack (self, hashvalue, alg):
  1388.         """Try to crack the hash.
  1389.         @param hashvalue Hash to crack.
  1390.         @param alg Algorithm to crack."""
  1391.        
  1392.         # Check if the cracker can crack this kind of algorithm
  1393.         if not self.isSupported (alg):
  1394.             return None
  1395.        
  1396.         # Build the URL and the headers
  1397.         url = "http://cacin.net/cgi-bin/decrypt-cisco.pl?cisco_hash=%s" % (hashvalue)
  1398.        
  1399.         # Make the request
  1400.         response = do_HTTP_request ( url )
  1401.        
  1402.         # Analyze the response
  1403.         html = None
  1404.         if response:
  1405.             html = response.read()
  1406.         else:
  1407.             return None
  1408.        
  1409.         match = search (r'<tr>Cisco password 7: [^<]*</tr><br><tr><th><br>Decrypted password: .*', html)
  1410.        
  1411.         if match:
  1412.             return match.group().split(':')[2][1:]
  1413.         else:
  1414.             return None
  1415.  
  1416.  
  1417. class IBEAST:
  1418.    
  1419.     name =      "ibeast"
  1420.     url =       "http://www.ibeast.com"
  1421.     supported_algorithm = [CISCO7]
  1422.    
  1423.     def isSupported (self, alg):
  1424.         """Return True if HASHCRACK can crack this type of algorithm and
  1425.         False if it cannot."""
  1426.        
  1427.         if alg in self.supported_algorithm:
  1428.             return True
  1429.         else:
  1430.             return False
  1431.  
  1432.  
  1433.  
  1434.     def crack (self, hashvalue, alg):
  1435.         """Try to crack the hash.
  1436.         @param hashvalue Hash to crack.
  1437.         @param alg Algorithm to crack."""
  1438.        
  1439.         # Check if the cracker can crack this kind of algorithm
  1440.         if not self.isSupported (alg):
  1441.             return None
  1442.        
  1443.         # Build the URL and the headers
  1444.         url = "http://www.ibeast.com/content/tools/CiscoPassword/decrypt.php?txtPassword=%s&submit1=Enviar+consulta" % (hashvalue)
  1445.        
  1446.         # Make the request
  1447.         response = do_HTTP_request ( url )
  1448.        
  1449.         # Analyze the response
  1450.         html = None
  1451.         if response:
  1452.             html = response.read()
  1453.         else:
  1454.             return None
  1455.        
  1456.         match = search (r'<font size="\+2">Your Password is [^<]*<br>', html)
  1457.        
  1458.         if match:
  1459.             return match.group().split('is ')[1][:-4]
  1460.         else:
  1461.             return None
  1462.  
  1463.  
  1464.  
  1465. class PASSWORD_DECRYPT:
  1466.    
  1467.     name =      "password-decrypt"
  1468.     url =       "http://password-decrypt.com"
  1469.     supported_algorithm = [CISCO7, JUNIPER]
  1470.    
  1471.     def isSupported (self, alg):
  1472.         """Return True if HASHCRACK can crack this type of algorithm and
  1473.         False if it cannot."""
  1474.        
  1475.         if alg in self.supported_algorithm:
  1476.             return True
  1477.         else:
  1478.             return False
  1479.  
  1480.  
  1481.  
  1482.     def crack (self, hashvalue, alg):
  1483.         """Try to crack the hash.
  1484.         @param hashvalue Hash to crack.
  1485.         @param alg Algorithm to crack."""
  1486.        
  1487.         # Check if the cracker can crack this kind of algorithm
  1488.         if not self.isSupported (alg):
  1489.             return None
  1490.        
  1491.         # Build the URL and the parameters
  1492.         url = ""
  1493.         params = None
  1494.         if alg == CISCO7:
  1495.             url = "http://password-decrypt.com/cisco.cgi"
  1496.             params = { "submit" : "Submit",
  1497.                 "cisco_password" : hashvalue,
  1498.                 "submit" : "Submit" }
  1499.         else:
  1500.             url = "http://password-decrypt.com/juniper.cgi"
  1501.             params = { "submit" : "Submit",
  1502.                 "juniper_password" : hashvalue,
  1503.                 "submit" : "Submit" }
  1504.        
  1505.        
  1506.         # Make the request
  1507.         response = do_HTTP_request ( url, params )
  1508.        
  1509.         # Analyze the response
  1510.         html = None
  1511.         if response:
  1512.             html = response.read()
  1513.         else:
  1514.             return None
  1515.        
  1516.         match = search (r'Decrypted Password:&nbsp;<B>[^<]*</B> </p>', html)
  1517.        
  1518.         if match:
  1519.             return match.group().split('B>')[1][:-2]
  1520.         else:
  1521.             return None
  1522.  
  1523.  
  1524.  
  1525.  
  1526. class BIGTRAPEZE:
  1527.    
  1528.     name =      "bigtrapeze"
  1529.     url =       "http://www.bigtrapeze.com"
  1530.     supported_algorithm = [MD5]
  1531.    
  1532.     def isSupported (self, alg):
  1533.         """Return True if HASHCRACK can crack this type of algorithm and
  1534.         False if it cannot."""
  1535.        
  1536.         if alg in self.supported_algorithm:
  1537.             return True
  1538.         else:
  1539.             return False
  1540.  
  1541.  
  1542.  
  1543.     def crack (self, hashvalue, alg):
  1544.         """Try to crack the hash.
  1545.         @param hashvalue Hash to crack.
  1546.         @param alg Algorithm to crack."""
  1547.        
  1548.         # Check if the cracker can crack this kind of algorithm
  1549.         if not self.isSupported (alg):
  1550.             return None
  1551.        
  1552.         # Build the URL and the headers
  1553.         url = "http://www.bigtrapeze.com/md5/index.php"
  1554.        
  1555.         # Build the parameters
  1556.         params = { "query" : hashvalue,
  1557.                " Crack " : "Enviar consulta" }
  1558.                
  1559.         # Build the Headers with a random User-Agent
  1560.         headers = { "User-Agent" : USER_AGENTS[randint(0, len(USER_AGENTS))-1] }
  1561.  
  1562.         # Make the request
  1563.         response = do_HTTP_request ( url, params, headers )
  1564.        
  1565.         # Analyze the response
  1566.         html = None
  1567.         if response:
  1568.             html = response.read()
  1569.         else:
  1570.             return None
  1571.            
  1572.         match = search (r'Congratulations!<li>The hash <strong>[^<]*</strong> has been deciphered to: <strong>[^<]*</strong></li>', html)
  1573.        
  1574.         if match:
  1575.             return match.group().split('strong>')[3][:-2]
  1576.         else:
  1577.             return None
  1578.  
  1579.  
  1580. class HASHCHECKER:
  1581.    
  1582.     name =      "hashchecker"
  1583.     url =       "http://www.hashchecker.com"
  1584.     supported_algorithm = [MD5]
  1585.    
  1586.     def isSupported (self, alg):
  1587.         """Return True if HASHCRACK can crack this type of algorithm and
  1588.         False if it cannot."""
  1589.        
  1590.         if alg in self.supported_algorithm:
  1591.             return True
  1592.         else:
  1593.             return False
  1594.  
  1595.  
  1596.  
  1597.     def crack (self, hashvalue, alg):
  1598.         """Try to crack the hash.
  1599.         @param hashvalue Hash to crack.
  1600.         @param alg Algorithm to crack."""
  1601.        
  1602.         # Check if the cracker can crack this kind of algorithm
  1603.         if not self.isSupported (alg):
  1604.             return None
  1605.        
  1606.         # Build the URL and the headers
  1607.         url = "http://www.hashchecker.com/index.php"
  1608.        
  1609.         # Build the parameters
  1610.         params = { "search_field" : hashvalue,
  1611.                "Submit" : "search" }
  1612.                
  1613.         # Make the request
  1614.         response = do_HTTP_request ( url, params )
  1615.        
  1616.         # Analyze the response
  1617.         html = None
  1618.         if response:
  1619.             html = response.read()
  1620.         else:
  1621.             return None
  1622.            
  1623.         match = search (r'<td><li>Your md5 hash is :<br><li>[^\s]* is <b>[^<]*</b> used charlist :2</td>', html)
  1624.        
  1625.         if match:
  1626.             return match.group().split('b>')[1][:-2]
  1627.         else:
  1628.             return None
  1629.  
  1630.  
  1631.  
  1632. class MD5HASHCRACKER:
  1633.    
  1634.     name =      "md5hashcracker"
  1635.     url =       "http://md5hashcracker.appspot.com"
  1636.     supported_algorithm = [MD5]
  1637.    
  1638.     def isSupported (self, alg):
  1639.         """Return True if HASHCRACK can crack this type of algorithm and
  1640.         False if it cannot."""
  1641.        
  1642.         if alg in self.supported_algorithm:
  1643.             return True
  1644.         else:
  1645.             return False
  1646.  
  1647.  
  1648.  
  1649.     def crack (self, hashvalue, alg):
  1650.         """Try to crack the hash.
  1651.         @param hashvalue Hash to crack.
  1652.         @param alg Algorithm to crack."""
  1653.        
  1654.         # Check if the cracker can crack this kind of algorithm
  1655.         if not self.isSupported (alg):
  1656.             return None
  1657.        
  1658.         # Build the URL
  1659.         url = "http://md5hashcracker.appspot.com/crack"
  1660.        
  1661.         # Build the parameters
  1662.         params = { "query" : hashvalue,
  1663.                "submit" : "Crack" }
  1664.        
  1665.         # Make the firt request
  1666.         response = do_HTTP_request ( url, params )
  1667.        
  1668.         # Build the second URL
  1669.         url = "http://md5hashcracker.appspot.com/status"
  1670.        
  1671.         # Make the second request
  1672.         response = do_HTTP_request ( url )
  1673.        
  1674.         # Analyze the response
  1675.         if response:
  1676.             html = response.read()
  1677.         else:
  1678.             return None
  1679.         match = search (r'<td id="cra[^"]*">not cracked</td>', html)
  1680.        
  1681.         if not match:
  1682.             match = search (r'<td id="cra[^"]*">cracked</td>', html)
  1683.             regexp = r'<td id="pla_' + match.group().split('"')[1][4:] + '">[^<]*</td>'
  1684.             match2 = search (regexp, html)
  1685.             if match2:
  1686.                 return match2.group().split('>')[1][:-4]
  1687.            
  1688.         else:
  1689.             return None
  1690.  
  1691.  
  1692.  
  1693. class PASSCRACKING:
  1694.    
  1695.     name =      "passcracking"
  1696.     url =       "http://passcracking.com"
  1697.     supported_algorithm = [MD5]
  1698.    
  1699.     def isSupported (self, alg):
  1700.         """Return True if HASHCRACK can crack this type of algorithm and
  1701.         False if it cannot."""
  1702.        
  1703.         if alg in self.supported_algorithm:
  1704.             return True
  1705.         else:
  1706.             return False
  1707.  
  1708.  
  1709.  
  1710.     def crack (self, hashvalue, alg):
  1711.         """Try to crack the hash.
  1712.         @param hashvalue Hash to crack.
  1713.         @param alg Algorithm to crack."""
  1714.        
  1715.         # Check if the cracker can crack this kind of algorithm
  1716.         if not self.isSupported (alg):
  1717.             return None
  1718.        
  1719.         # Build the URL
  1720.         url = "http://passcracking.com/index.php"
  1721.        
  1722.         # Build the parameters
  1723.         boundary = "-----------------------------" + str(randint(1000000000000000000000000000,9999999999999999999999999999))
  1724.         params = [ '--' + boundary,
  1725.                'Content-Disposition: form-data; name="admin"',
  1726.                '',
  1727.                'false',
  1728.                
  1729.                '--' + boundary,
  1730.                'Content-Disposition: form-data; name="admin2"',
  1731.                '',
  1732.                '77.php',
  1733.                
  1734.                '--' + boundary,
  1735.                'Content-Disposition: form-data; name="datafromuser"',
  1736.                '',
  1737.                '%s' % (hashvalue) ,
  1738.                
  1739.                '--' + boundary + '--', '' ]
  1740.         body = '\r\n'.join(params)
  1741.  
  1742.         # Build the headers
  1743.         headers = { "Content-Type" : "multipart/form-data; boundary=%s" % (boundary),
  1744.                     "Content-length" : len(body) }
  1745.        
  1746.                
  1747.         # Make the request
  1748.         request = urllib2.Request ( url )
  1749.         request.add_header ( "Content-Type", "multipart/form-data; boundary=%s" % (boundary) )
  1750.         request.add_header ( "Content-length", len(body) )
  1751.         request.add_data(body)
  1752.         try:
  1753.             response = urllib2.urlopen(request)
  1754.         except:
  1755.             return None
  1756.        
  1757.         # Analyze the response
  1758.         html = None
  1759.         if response:
  1760.             html = response.read()
  1761.         else:
  1762.             return None
  1763.            
  1764.         match = search (r'<td>md5 Database</td><td>[^<]*</td><td bgcolor=.FF0000>[^<]*</td>', html)
  1765.        
  1766.         if match:
  1767.             return match.group().split('>')[5][:-4]
  1768.         else:
  1769.             return None
  1770.  
  1771.  
  1772. class ASKCHECK:
  1773.    
  1774.     name =      "askcheck"
  1775.     url =       "http://askcheck.com"
  1776.     supported_algorithm = [MD4, MD5, SHA1, SHA256]
  1777.    
  1778.     def isSupported (self, alg):
  1779.         """Return True if HASHCRACK can crack this type of algorithm and
  1780.         False if it cannot."""
  1781.        
  1782.         if alg in self.supported_algorithm:
  1783.             return True
  1784.         else:
  1785.             return False
  1786.  
  1787.  
  1788.  
  1789.     def crack (self, hashvalue, alg):
  1790.         """Try to crack the hash.
  1791.         @param hashvalue Hash to crack.
  1792.         @param alg Algorithm to crack."""
  1793.        
  1794.         # Check if the cracker can crack this kind of algorithm
  1795.         if not self.isSupported (alg):
  1796.             return None
  1797.        
  1798.         # Build the URL
  1799.         url = "http://askcheck.com/reverse?reverse=%s" % (hashvalue)
  1800.        
  1801.         # Make the request
  1802.         response = do_HTTP_request ( url )
  1803.        
  1804.         # Analyze the response
  1805.         html = None
  1806.         if response:
  1807.             html = response.read()
  1808.         else:
  1809.             return None
  1810.            
  1811.         match = search (r'Reverse value of [^\s]* hash <a[^<]*</a> is <a[^>]*>[^<]*</a>', html)
  1812.        
  1813.         if match:
  1814.             return match.group().split('>')[3][:-3]
  1815.         else:
  1816.             return None
  1817.  
  1818.  
  1819.  
  1820. class FOX21:
  1821.    
  1822.     name =      "fox21"
  1823.     url =       "http://cracker.fox21.at"
  1824.     supported_algorithm = [MD5, LM, NTLM]
  1825.    
  1826.     def isSupported (self, alg):
  1827.         """Return True if HASHCRACK can crack this type of algorithm and
  1828.         False if it cannot."""
  1829.        
  1830.         if alg in self.supported_algorithm:
  1831.             return True
  1832.         else:
  1833.             return False
  1834.  
  1835.  
  1836.  
  1837.     def crack (self, hashvalue, alg):
  1838.         """Try to crack the hash.
  1839.         @param hashvalue Hash to crack.
  1840.         @param alg Algorithm to crack."""
  1841.        
  1842.         # Check if the cracker can crack this kind of algorithm
  1843.         if not self.isSupported (alg):
  1844.             return None
  1845.        
  1846.         hash2 = None
  1847.         if alg in [LM, NTLM] and ':' in hashvalue:
  1848.             if alg == LM:
  1849.                 hash2 = hashvalue.split(':')[0]
  1850.             else:
  1851.                 hash2 = hashvalue.split(':')[1]
  1852.         else:
  1853.             hash2 = hashvalue
  1854.        
  1855.        
  1856.         # Build the URL
  1857.         url = "http://cracker.fox21.at/api.php?a=check&h=%s" % (hashvalue)
  1858.        
  1859.         # Make the request
  1860.         response = do_HTTP_request ( url )
  1861.        
  1862.         # Analyze the response
  1863.         xml = None
  1864.         if response:
  1865.             try:
  1866.                 doc = parseDoc ( response.read() )
  1867.             except:
  1868.                 print "INFO: You need libxml2 to use this plugin."
  1869.                 return None
  1870.         else:
  1871.             return None
  1872.        
  1873.         result = doc.xpathEval("//hash/@plaintext")
  1874.        
  1875.         if result:
  1876.             return result[0].content
  1877.         else:
  1878.             return None
  1879.  
  1880.  
  1881. class NICENAMECREW:
  1882.    
  1883.     name =      "nicenamecrew"
  1884.     url =       "http://crackfoo.nicenamecrew.com"
  1885.     supported_algorithm = [MD5, SHA1, LM]
  1886.    
  1887.     def isSupported (self, alg):
  1888.         """Return True if HASHCRACK can crack this type of algorithm and
  1889.         False if it cannot."""
  1890.        
  1891.         if alg in self.supported_algorithm:
  1892.             return True
  1893.         else:
  1894.             return False
  1895.  
  1896.  
  1897.  
  1898.     def crack (self, hashvalue, alg):
  1899.         """Try to crack the hash.
  1900.         @param hashvalue Hash to crack.
  1901.         @param alg Algorithm to crack."""
  1902.        
  1903.         # Check if the cracker can crack this kind of algorithm
  1904.         if not self.isSupported (alg):
  1905.             return None
  1906.        
  1907.         hash2 = None
  1908.         if alg in [LM] and ':' in hashvalue:
  1909.             hash2 = hashvalue.split(':')[0]
  1910.         else:
  1911.             hash2 = hashvalue
  1912.            
  1913.         # Build the URL
  1914.         url = "http://crackfoo.nicenamecrew.com/?t=%s" % (alg)
  1915.        
  1916.         # Build the parameters
  1917.         params = { "q" : hash2,
  1918.                "sa" : "Crack" }
  1919.                
  1920.         # Make the request
  1921.         response = do_HTTP_request ( url, params )
  1922.        
  1923.         # Analyze the response
  1924.         html = None
  1925.         if response:
  1926.             html = response.read()
  1927.         else:
  1928.             return None
  1929.        
  1930.         match = search (r'The decrypted version of [^\s]* is:<br><strong>[^<]*</strong>', html)
  1931.        
  1932.         if match:
  1933.             return match.group().split('strong>')[1][:-2].strip()
  1934.         else:
  1935.             return None
  1936.  
  1937.  
  1938.  
  1939. class JOOMLAAA:
  1940.    
  1941.     name =      "joomlaaa"
  1942.     url =       "http://joomlaaa.com"
  1943.     supported_algorithm = [MD5]
  1944.    
  1945.     def isSupported (self, alg):
  1946.         """Return True if HASHCRACK can crack this type of algorithm and
  1947.         False if it cannot."""
  1948.        
  1949.         if alg in self.supported_algorithm:
  1950.             return True
  1951.         else:
  1952.             return False
  1953.  
  1954.  
  1955.  
  1956.     def crack (self, hashvalue, alg):
  1957.         """Try to crack the hash.
  1958.         @param hashvalue Hash to crack.
  1959.         @param alg Algorithm to crack."""
  1960.        
  1961.         # Check if the cracker can crack this kind of algorithm
  1962.         if not self.isSupported (alg):
  1963.             return None
  1964.        
  1965.         # Build the URL
  1966.         url = "http://joomlaaa.com/component/option,com_md5/Itemid,31/"
  1967.        
  1968.         # Build the parameters
  1969.         params = { "md5" : hashvalue,
  1970.                "decode" : "Submit" }
  1971.                
  1972.         # Make the request
  1973.         response = do_HTTP_request ( url, params )
  1974.        
  1975.         # Analyze the response
  1976.         html = None
  1977.         if response:
  1978.             html = response.read()
  1979.         else:
  1980.             return None
  1981.        
  1982.         match = search (r"<td class='title1'>not available</td>", html)
  1983.        
  1984.         if not match:
  1985.             match2 = findall (r"<td class='title1'>[^<]*</td>", html)
  1986.             return match2[1].split('>')[1][:-4]
  1987.         else:
  1988.             return None
  1989.  
  1990.  
  1991.  
  1992. class MD5_LOOKUP:
  1993.    
  1994.     name =      "md5-lookup"
  1995.     url =       "http://md5-lookup.com"
  1996.     supported_algorithm = [MD5]
  1997.    
  1998.     def isSupported (self, alg):
  1999.         """Return True if HASHCRACK can crack this type of algorithm and
  2000.         False if it cannot."""
  2001.        
  2002.         if alg in self.supported_algorithm:
  2003.             return True
  2004.         else:
  2005.             return False
  2006.  
  2007.  
  2008.  
  2009.     def crack (self, hashvalue, alg):
  2010.         """Try to crack the hash.
  2011.         @param hashvalue Hash to crack.
  2012.         @param alg Algorithm to crack."""
  2013.        
  2014.         # Check if the cracker can crack this kind of algorithm
  2015.         if not self.isSupported (alg):
  2016.             return None
  2017.        
  2018.         # Build the URL
  2019.         url = "http://md5-lookup.com/livesearch.php?q=%s" % (hashvalue)
  2020.        
  2021.         # Make the request
  2022.         response = do_HTTP_request ( url )
  2023.        
  2024.         # Analyze the response
  2025.         html = None
  2026.         if response:
  2027.             html = response.read()
  2028.         else:
  2029.             return None
  2030.        
  2031.         match = search (r'<td width="250">[^<]*</td>', html)
  2032.        
  2033.         if match:
  2034.             return match.group().split('>')[1][:-4]
  2035.         else:
  2036.             return None
  2037.  
  2038.  
  2039. class SHA1_LOOKUP:
  2040.    
  2041.     name =      "sha1-lookup"
  2042.     url =       "http://sha1-lookup.com"
  2043.     supported_algorithm = [SHA1]
  2044.    
  2045.     def isSupported (self, alg):
  2046.         """Return True if HASHCRACK can crack this type of algorithm and
  2047.         False if it cannot."""
  2048.        
  2049.         if alg in self.supported_algorithm:
  2050.             return True
  2051.         else:
  2052.             return False
  2053.  
  2054.  
  2055.  
  2056.     def crack (self, hashvalue, alg):
  2057.         """Try to crack the hash.
  2058.         @param hashvalue Hash to crack.
  2059.         @param alg Algorithm to crack."""
  2060.        
  2061.         # Check if the cracker can crack this kind of algorithm
  2062.         if not self.isSupported (alg):
  2063.             return None
  2064.        
  2065.         # Build the URL
  2066.         url = "http://sha1-lookup.com/livesearch.php?q=%s" % (hashvalue)
  2067.        
  2068.         # Make the request
  2069.         response = do_HTTP_request ( url )
  2070.        
  2071.         # Analyze the response
  2072.         html = None
  2073.         if response:
  2074.             html = response.read()
  2075.         else:
  2076.             return None
  2077.        
  2078.         match = search (r'<td width="250">[^<]*</td>', html)
  2079.        
  2080.         if match:
  2081.             return match.group().split('>')[1][:-4]
  2082.         else:
  2083.             return None
  2084.  
  2085.  
  2086. class SHA256_LOOKUP:
  2087.    
  2088.     name =      "sha256-lookup"
  2089.     url =       "http://sha-256.sha1-lookup.com"
  2090.     supported_algorithm = [SHA256]
  2091.    
  2092.     def isSupported (self, alg):
  2093.         """Return True if HASHCRACK can crack this type of algorithm and
  2094.         False if it cannot."""
  2095.        
  2096.         if alg in self.supported_algorithm:
  2097.             return True
  2098.         else:
  2099.             return False
  2100.  
  2101.  
  2102.  
  2103.     def crack (self, hashvalue, alg):
  2104.         """Try to crack the hash.
  2105.         @param hashvalue Hash to crack.
  2106.         @param alg Algorithm to crack."""
  2107.        
  2108.         # Check if the cracker can crack this kind of algorithm
  2109.         if not self.isSupported (alg):
  2110.             return None
  2111.        
  2112.         # Build the URL
  2113.         url = "http://sha-256.sha1-lookup.com/livesearch.php?q=%s" % (hashvalue)
  2114.        
  2115.         # Make the request
  2116.         response = do_HTTP_request ( url )
  2117.        
  2118.         # Analyze the response
  2119.         html = None
  2120.         if response:
  2121.             html = response.read()
  2122.         else:
  2123.             return None
  2124.        
  2125.         match = search (r'<td width="250">[^<]*</td>', html)
  2126.        
  2127.         if match:
  2128.             return match.group().split('>')[1][:-4]
  2129.         else:
  2130.             return None
  2131.  
  2132.  
  2133.  
  2134. class RIPEMD160_LOOKUP:
  2135.    
  2136.     name =      "ripemd-lookup"
  2137.     url =       "http://www.ripemd-lookup.com"
  2138.     supported_algorithm = [RIPEMD]
  2139.    
  2140.     def isSupported (self, alg):
  2141.         """Return True if HASHCRACK can crack this type of algorithm and
  2142.         False if it cannot."""
  2143.        
  2144.         if alg in self.supported_algorithm:
  2145.             return True
  2146.         else:
  2147.             return False
  2148.  
  2149.  
  2150.  
  2151.     def crack (self, hashvalue, alg):
  2152.         """Try to crack the hash.
  2153.         @param hashvalue Hash to crack.
  2154.         @param alg Algorithm to crack."""
  2155.        
  2156.         # Check if the cracker can crack this kind of algorithm
  2157.         if not self.isSupported (alg):
  2158.             return None
  2159.        
  2160.         # Build the URL
  2161.         url = "http://www.ripemd-lookup.com/livesearch.php?q=%s" % (hashvalue)
  2162.        
  2163.         # Make the request
  2164.         response = do_HTTP_request ( url )
  2165.        
  2166.         # Analyze the response
  2167.         html = None
  2168.         if response:
  2169.             html = response.read()
  2170.         else:
  2171.             return None
  2172.        
  2173.         match = search (r'<td width="250">[^<]*</td>', html)
  2174.        
  2175.         if match:
  2176.             return match.group().split('>')[1][:-4]
  2177.         else:
  2178.             return None
  2179.  
  2180.  
  2181.  
  2182. class MD5_COM_CN:
  2183.    
  2184.     name =      "md5.com.cn"
  2185.     url =       "http://md5.com.cn"
  2186.     supported_algorithm = [MD5]
  2187.    
  2188.     def isSupported (self, alg):
  2189.         """Return True if HASHCRACK can crack this type of algorithm and
  2190.         False if it cannot."""
  2191.        
  2192.         if alg in self.supported_algorithm:
  2193.             return True
  2194.         else:
  2195.             return False
  2196.  
  2197.  
  2198.  
  2199.     def crack (self, hashvalue, alg):
  2200.         """Try to crack the hash.
  2201.         @param hashvalue Hash to crack.
  2202.         @param alg Algorithm to crack."""
  2203.        
  2204.         # Check if the cracker can crack this kind of algorithm
  2205.         if not self.isSupported (alg):
  2206.             return None
  2207.        
  2208.         # Build the URL
  2209.         url = "http://md5.com.cn/md5reverse"
  2210.        
  2211.         # Build the parameters
  2212.         params = { "md" : hashvalue,
  2213.                "submit" : "MD5 Crack" }
  2214.        
  2215.         # Make the request
  2216.         response = do_HTTP_request ( url, params )
  2217.        
  2218.         # Analyze the response
  2219.         html = None
  2220.         if response:
  2221.             html = response.read()
  2222.         else:
  2223.             return None
  2224.        
  2225.         match = search (r'<b style="color:red;">[^<]*</b><br/><span', html)
  2226.        
  2227.         if match:
  2228.             return match.group().split('>')[1][:-3]
  2229.         else:
  2230.             return None
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236. class DIGITALSUN:
  2237.    
  2238.     name =      "digitalsun.pl"
  2239.     url =       "http://md5.digitalsun.pl"
  2240.     supported_algorithm = [MD5]
  2241.    
  2242.     def isSupported (self, alg):
  2243.         """Return True if HASHCRACK can crack this type of algorithm and
  2244.         False if it cannot."""
  2245.        
  2246.         if alg in self.supported_algorithm:
  2247.             return True
  2248.         else:
  2249.             return False
  2250.  
  2251.  
  2252.  
  2253.     def crack (self, hashvalue, alg):
  2254.         """Try to crack the hash.
  2255.         @param hashvalue Hash to crack.
  2256.         @param alg Algorithm to crack."""
  2257.        
  2258.         # Check if the cracker can crack this kind of algorithm
  2259.         if not self.isSupported (alg):
  2260.             return None
  2261.        
  2262.         # Build the URL
  2263.         url = "http://md5.digitalsun.pl/"
  2264.        
  2265.         # Build the parameters
  2266.         params = { "hash" : hashvalue }
  2267.        
  2268.         # Make the request
  2269.         response = do_HTTP_request ( url, params )
  2270.        
  2271.         # Analyze the response
  2272.         html = None
  2273.         if response:
  2274.             html = response.read()
  2275.         else:
  2276.             return None
  2277.        
  2278.         match = search (r'<b>[^<]*</b> == [^<]*<br>\s*<br>', html)
  2279.        
  2280.         if match:
  2281.             return match.group().split('b>')[1][:-2]
  2282.         else:
  2283.             return None
  2284.  
  2285.  
  2286.  
  2287. class DRASEN:
  2288.    
  2289.     name =      "drasen.net"
  2290.     url =       "http://md5.drasen.net"
  2291.     supported_algorithm = [MD5]
  2292.    
  2293.     def isSupported (self, alg):
  2294.         """Return True if HASHCRACK can crack this type of algorithm and
  2295.         False if it cannot."""
  2296.        
  2297.         if alg in self.supported_algorithm:
  2298.             return True
  2299.         else:
  2300.             return False
  2301.  
  2302.  
  2303.  
  2304.     def crack (self, hashvalue, alg):
  2305.         """Try to crack the hash.
  2306.         @param hashvalue Hash to crack.
  2307.         @param alg Algorithm to crack."""
  2308.        
  2309.         # Check if the cracker can crack this kind of algorithm
  2310.         if not self.isSupported (alg):
  2311.             return None
  2312.        
  2313.         # Build the URL
  2314.         url = "http://md5.drasen.net/search.php?query=%s" % (hashvalue)
  2315.        
  2316.         # Make the request
  2317.         response = do_HTTP_request ( url )
  2318.        
  2319.         # Analyze the response
  2320.         html = None
  2321.         if response:
  2322.             html = response.read()
  2323.         else:
  2324.             return None
  2325.        
  2326.         match = search (r'Hash: [^<]*<br />Plain: [^<]*<br />', html)
  2327.        
  2328.         if match:
  2329.             return match.group().split('<br />')[1][7:]
  2330.         else:
  2331.             return None
  2332.  
  2333.  
  2334.  
  2335.  
  2336. class MYINFOSEC:
  2337.    
  2338.     name =      "myinfosec"
  2339.     url =       "http://md5.myinfosec.net"
  2340.     supported_algorithm = [MD5]
  2341.    
  2342.     def isSupported (self, alg):
  2343.         """Return True if HASHCRACK can crack this type of algorithm and
  2344.         False if it cannot."""
  2345.        
  2346.         if alg in self.supported_algorithm:
  2347.             return True
  2348.         else:
  2349.             return False
  2350.  
  2351.  
  2352.  
  2353.     def crack (self, hashvalue, alg):
  2354.         """Try to crack the hash.
  2355.         @param hashvalue Hash to crack.
  2356.         @param alg Algorithm to crack."""
  2357.        
  2358.         # Check if the cracker can crack this kind of algorithm
  2359.         if not self.isSupported (alg):
  2360.             return None
  2361.        
  2362.         # Build the URL
  2363.         url = "http://md5.myinfosec.net/md5.php"
  2364.        
  2365.         # Build the parameters
  2366.         params = { "md5hash" : hashvalue }
  2367.        
  2368.         # Make the request
  2369.         response = do_HTTP_request ( url, params )
  2370.        
  2371.         # Analyze the response
  2372.         html = None
  2373.         if response:
  2374.             html = response.read()
  2375.         else:
  2376.             return None
  2377.        
  2378.         match = search (r'<center></center>[^<]*<font color=green>[^<]*</font><br></center>', html)
  2379.        
  2380.         if match:
  2381.             return match.group().split('>')[3][:-6]
  2382.         else:
  2383.             return None
  2384.  
  2385.  
  2386.  
  2387. class MD5_NET:
  2388.    
  2389.     name =      "md5.net"
  2390.     url =       "http://md5.net"
  2391.     supported_algorithm = [MD5]
  2392.    
  2393.     def isSupported (self, alg):
  2394.         """Return True if HASHCRACK can crack this type of algorithm and
  2395.         False if it cannot."""
  2396.        
  2397.         if alg in self.supported_algorithm:
  2398.             return True
  2399.         else:
  2400.             return False
  2401.  
  2402.  
  2403.  
  2404.     def crack (self, hashvalue, alg):
  2405.         """Try to crack the hash.
  2406.         @param hashvalue Hash to crack.
  2407.         @param alg Algorithm to crack."""
  2408.        
  2409.         # Check if the cracker can crack this kind of algorithm
  2410.         if not self.isSupported (alg):
  2411.             return None
  2412.        
  2413.         # Build the URL
  2414.         url = "http://www.md5.net/cracker.php"
  2415.        
  2416.         # Build the parameters
  2417.         params = { "hash" : hashvalue }
  2418.        
  2419.         # Make the request
  2420.         response = do_HTTP_request ( url, params )
  2421.        
  2422.         # Analyze the response
  2423.         html = None
  2424.         if response:
  2425.             html = response.read()
  2426.         else:
  2427.             return None
  2428.        
  2429.         match = search (r'<input type="text" id="hash" size="32" value="[^"]*"/>', html)
  2430.        
  2431.         if match:
  2432.             return match.group().split('"')[7]
  2433.         else:
  2434.             return None
  2435.  
  2436.  
  2437.  
  2438.  
  2439. class NOISETTE:
  2440.    
  2441.     name =      "noisette.ch"
  2442.     url =       "http://md5.noisette.ch"
  2443.     supported_algorithm = [MD5]
  2444.    
  2445.     def isSupported (self, alg):
  2446.         """Return True if HASHCRACK can crack this type of algorithm and
  2447.         False if it cannot."""
  2448.        
  2449.         if alg in self.supported_algorithm:
  2450.             return True
  2451.         else:
  2452.             return False
  2453.  
  2454.  
  2455.  
  2456.     def crack (self, hashvalue, alg):
  2457.         """Try to crack the hash.
  2458.         @param hashvalue Hash to crack.
  2459.         @param alg Algorithm to crack."""
  2460.        
  2461.         # Check if the cracker can crack this kind of algorithm
  2462.         if not self.isSupported (alg):
  2463.             return None
  2464.        
  2465.         # Build the URL
  2466.         url = "http://md5.noisette.ch/index.php"
  2467.        
  2468.         # Build the parameters
  2469.         params = { "hash" : hashvalue }
  2470.        
  2471.         # Make the request
  2472.         response = do_HTTP_request ( url, params )
  2473.        
  2474.         # Analyze the response
  2475.         html = None
  2476.         if response:
  2477.             html = response.read()
  2478.         else:
  2479.             return None
  2480.        
  2481.         match = search (r'<p>String to hash : <input name="text" value="[^"]+"/>', html)
  2482.        
  2483.         if match:
  2484.             return match.group().split('"')[3]
  2485.         else:
  2486.             return None
  2487.  
  2488.  
  2489.  
  2490.  
  2491. class MD5HOOD:
  2492.    
  2493.     name =      "md5hood"
  2494.     url =       "http://md5hood.com"
  2495.     supported_algorithm = [MD5]
  2496.    
  2497.     def isSupported (self, alg):
  2498.         """Return True if HASHCRACK can crack this type of algorithm and
  2499.         False if it cannot."""
  2500.        
  2501.         if alg in self.supported_algorithm:
  2502.             return True
  2503.         else:
  2504.             return False
  2505.  
  2506.  
  2507.  
  2508.     def crack (self, hashvalue, alg):
  2509.         """Try to crack the hash.
  2510.         @param hashvalue Hash to crack.
  2511.         @param alg Algorithm to crack."""
  2512.        
  2513.         # Check if the cracker can crack this kind of algorithm
  2514.         if not self.isSupported (alg):
  2515.             return None
  2516.        
  2517.         # Build the URL
  2518.         url = "http://md5hood.com/index.php/cracker/crack"
  2519.        
  2520.         # Build the parameters
  2521.         params = { "md5" : hashvalue,
  2522.                "submit" : "Go" }
  2523.        
  2524.         # Make the request
  2525.         response = do_HTTP_request ( url, params )
  2526.        
  2527.         # Analyze the response
  2528.         html = None
  2529.         if response:
  2530.             html = response.read()
  2531.         else:
  2532.             return None
  2533.        
  2534.         match = search (r'<div class="result_true">[^<]*</div>', html)
  2535.        
  2536.         if match:
  2537.             return match.group().split('>')[1][:-5]
  2538.         else:
  2539.             return None
  2540.  
  2541.  
  2542.  
  2543. class STRINGFUNCTION:
  2544.    
  2545.     name =      "stringfunction"
  2546.     url =       "http://www.stringfunction.com"
  2547.     supported_algorithm = [MD5, SHA1]
  2548.    
  2549.     def isSupported (self, alg):
  2550.         """Return True if HASHCRACK can crack this type of algorithm and
  2551.         False if it cannot."""
  2552.        
  2553.         if alg in self.supported_algorithm:
  2554.             return True
  2555.         else:
  2556.             return False
  2557.  
  2558.  
  2559.  
  2560.     def crack (self, hashvalue, alg):
  2561.         """Try to crack the hash.
  2562.         @param hashvalue Hash to crack.
  2563.         @param alg Algorithm to crack."""
  2564.        
  2565.         # Check if the cracker can crack this kind of algorithm
  2566.         if not self.isSupported (alg):
  2567.             return None
  2568.        
  2569.         # Build the URL
  2570.         url = ""
  2571.         if alg == MD5:
  2572.             url = "http://www.stringfunction.com/md5-decrypter.html"
  2573.         else:
  2574.             url = "http://www.stringfunction.com/sha1-decrypter.html"
  2575.        
  2576.         # Build the parameters
  2577.         params = { "string" : hashvalue,
  2578.                "submit" : "Decrypt",
  2579.                "result" : "" }
  2580.        
  2581.         # Make the request
  2582.         response = do_HTTP_request ( url, params )
  2583.        
  2584.         # Analyze the response
  2585.         html = None
  2586.         if response:
  2587.             html = response.read()
  2588.         else:
  2589.             return None
  2590.        
  2591.         match = search (r'<textarea class="textarea-input-tool-b" rows="10" cols="50" name="result"[^>]*>[^<]+</textarea>', html)
  2592.        
  2593.         if match:
  2594.             return match.group().split('>')[1][:-10]
  2595.         else:
  2596.             return None
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602. class XANADREL:
  2603.    
  2604.     name =      "99k.org"
  2605.     url =       "http://xanadrel.99k.org"
  2606.     supported_algorithm = [MD4, MD5]
  2607.    
  2608.     def isSupported (self, alg):
  2609.         """Return True if HASHCRACK can crack this type of algorithm and
  2610.         False if it cannot."""
  2611.        
  2612.         if alg in self.supported_algorithm:
  2613.             return True
  2614.         else:
  2615.             return False
  2616.  
  2617.  
  2618.  
  2619.     def crack (self, hashvalue, alg):
  2620.         """Try to crack the hash.
  2621.         @param hashvalue Hash to crack.
  2622.         @param alg Algorithm to crack."""
  2623.        
  2624.         # Check if the cracker can crack this kind of algorithm
  2625.         if not self.isSupported (alg):
  2626.             return None
  2627.        
  2628.         # Build the URL
  2629.         url = "http://xanadrel.99k.org/hashes/index.php?k=search"
  2630.        
  2631.         # Build the parameters
  2632.         params = { "hash" : hashvalue,
  2633.                "search" : "ok" }
  2634.        
  2635.         # Make the request
  2636.         response = do_HTTP_request ( url, params )
  2637.        
  2638.         # Analyze the response
  2639.         html = None
  2640.         if response:
  2641.             html = response.read()
  2642.         else:
  2643.             return None
  2644.        
  2645.         match = search (r'<p>Hash : [^<]*<br />Type : [^<]*<br />Plain : "[^"]*"<br />', html)
  2646.        
  2647.         if match:
  2648.             return match.group().split('"')[1]
  2649.         else:
  2650.             return None
  2651.  
  2652.  
  2653.  
  2654.  
  2655. class SANS:
  2656.    
  2657.     name =      "sans"
  2658.     url =       "http://isc.sans.edu"
  2659.     supported_algorithm = [MD5, SHA1]
  2660.    
  2661.     def isSupported (self, alg):
  2662.         """Return True if HASHCRACK can crack this type of algorithm and
  2663.         False if it cannot."""
  2664.        
  2665.         if alg in self.supported_algorithm:
  2666.             return True
  2667.         else:
  2668.             return False
  2669.  
  2670.  
  2671.  
  2672.     def crack (self, hashvalue, alg):
  2673.         """Try to crack the hash.
  2674.         @param hashvalue Hash to crack.
  2675.         @param alg Algorithm to crack."""
  2676.        
  2677.         # Check if the cracker can crack this kind of algorithm
  2678.         if not self.isSupported (alg):
  2679.             return None
  2680.        
  2681.         # Build the URL
  2682.         url = "http://isc.sans.edu/tools/reversehash.html"
  2683.        
  2684.         # Build the Headers with a random User-Agent
  2685.         headers = { "User-Agent" : USER_AGENTS[randint(0, len(USER_AGENTS))-1] }
  2686.        
  2687.         # Build the parameters
  2688.         response = do_HTTP_request ( url, httpheaders=headers )
  2689.         html = None
  2690.         if response:
  2691.             html = response.read()
  2692.         else:
  2693.             return None
  2694.         match = search (r'<input type="hidden" name="token" value="[^"]*" />', html)
  2695.         token = ""
  2696.         if match:
  2697.             token = match.group().split('"')[5]
  2698.         else:
  2699.             return None
  2700.        
  2701.         params = { "token" : token,
  2702.                "text" : hashvalue,
  2703.                "word" : "",
  2704.                "submit" : "Submit" }
  2705.        
  2706.         # Build the Headers with the Referer header
  2707.         headers["Referer"] = "http://isc.sans.edu/tools/reversehash.html"
  2708.        
  2709.         # Make the request
  2710.         response = do_HTTP_request ( url, params, headers )
  2711.        
  2712.         # Analyze the response
  2713.         html = None
  2714.         if response:
  2715.             html = response.read()
  2716.         else:
  2717.             return None
  2718.        
  2719.         match = search (r'... hash [^\s]* = [^\s]*\s*</p><br />', html)
  2720.        
  2721.         if match:
  2722.             print "hola mundo"
  2723.             return match.group().split('=')[1][:-10].strip()
  2724.         else:
  2725.             return None
  2726.  
  2727.  
  2728.  
  2729. class BOKEHMAN:
  2730.    
  2731.     name =      "bokehman"
  2732.     url =       "http://bokehman.com"
  2733.     supported_algorithm = [MD4, MD5]
  2734.    
  2735.     def isSupported (self, alg):
  2736.         """Return True if HASHCRACK can crack this type of algorithm and
  2737.         False if it cannot."""
  2738.        
  2739.         if alg in self.supported_algorithm:
  2740.             return True
  2741.         else:
  2742.             return False
  2743.  
  2744.  
  2745.  
  2746.     def crack (self, hashvalue, alg):
  2747.         """Try to crack the hash.
  2748.         @param hashvalue Hash to crack.
  2749.         @param alg Algorithm to crack."""
  2750.        
  2751.         # Check if the cracker can crack this kind of algorithm
  2752.         if not self.isSupported (alg):
  2753.             return None
  2754.        
  2755.         # Build the URL
  2756.         url = "http://bokehman.com/cracker/"
  2757.        
  2758.         # Build the parameters from the main page
  2759.         response = do_HTTP_request ( url )
  2760.         html = None
  2761.         if response:
  2762.             html = response.read()
  2763.         else:
  2764.             return None
  2765.         match = search (r'<input type="hidden" name="PHPSESSID" id="PHPSESSID" value="[^"]*" />', html)
  2766.         phpsessnid = ""
  2767.         if match:
  2768.             phpsessnid = match.group().split('"')[7]
  2769.         else:
  2770.             return None
  2771.         match = search (r'<input type="hidden" name="key" id="key" value="[^"]*" />', html)
  2772.         key = ""
  2773.         if match:
  2774.             key = match.group().split('"')[7]
  2775.         else:
  2776.             return None
  2777.        
  2778.         params = { "md5" : hashvalue,
  2779.                "PHPSESSID" : phpsessnid,
  2780.                "key" : key,
  2781.                "crack" : "Try to crack it" }
  2782.        
  2783.         # Make the request
  2784.         response = do_HTTP_request ( url, params )
  2785.        
  2786.         # Analyze the response
  2787.         html = None
  2788.         if response:
  2789.             html = response.read()
  2790.         else:
  2791.             return None
  2792.        
  2793.         match = search (r'<tr><td>[^<]*</td><td>[^<]*</td><td>[^s]*seconds</td></tr>', html)
  2794.        
  2795.         if match:
  2796.             return match.group().split('td>')[1][:-2]
  2797.         else:
  2798.             return None
  2799.  
  2800.  
  2801.  
  2802. class GOOG_LI:
  2803.  
  2804.     name =      "goog.li"
  2805.     url =       "http://goog.li"
  2806.     supported_algorithm = [MD5, MYSQL, SHA1, SHA224, SHA384, SHA256, SHA512, RIPEMD, NTLM, GOST, WHIRLPOOL, LDAP_MD5, LDAP_SHA1]
  2807.    
  2808.     def isSupported (self, alg):
  2809.         """Return True if HASHCRACK can crack this type of algorithm and
  2810.         False if it cannot."""
  2811.        
  2812.         if alg in self.supported_algorithm:
  2813.             return True
  2814.         else:
  2815.             return False
  2816.  
  2817.  
  2818.     def crack (self, hashvalue, alg):
  2819.         """Try to crack the hash.
  2820.         @param hashvalue Hash to crack.
  2821.         @param alg Algorithm to crack."""
  2822.        
  2823.         # Check if the cracker can crack this kind of algorithm
  2824.         if not self.isSupported (alg):
  2825.             return None
  2826.            
  2827.         hash2 = None
  2828.         if alg in [NTLM] and ':' in hashvalue:
  2829.             hash2 = hashvalue.split(':')[1]
  2830.         else:
  2831.             hash2 = hashvalue
  2832.        
  2833.         # Confirm the initial '*' character
  2834.         if alg == MYSQL and hash2[0] != '*':
  2835.             hash2 = '*' + hash2
  2836.        
  2837.         # Build the URL
  2838.         url = "http://goog.li/?q=%s" % (hash2)
  2839.        
  2840.         # Make the request
  2841.         response = do_HTTP_request ( url )
  2842.        
  2843.         # Analyze the response
  2844.         html = None
  2845.         if response:
  2846.             html = response.read()
  2847.         else:
  2848.             return None
  2849.        
  2850.         match = search (r'<br />cleartext[^:]*: [^<]*<br />', html)
  2851.        
  2852.         if match:
  2853.             return match.group().split(':')[1].strip()[:-6]
  2854.         else:
  2855.             return None
  2856.  
  2857.  
  2858.  
  2859. class WHREPORITORY:
  2860.  
  2861.     name =      "Windows Hashes Repository"
  2862.     url =       "http://nediam.com.mx"
  2863.     supported_algorithm = [LM, NTLM]
  2864.    
  2865.     def isSupported (self, alg):
  2866.         """Return True if HASHCRACK can crack this type of algorithm and
  2867.         False if it cannot."""
  2868.        
  2869.         if alg in self.supported_algorithm:
  2870.             return True
  2871.         else:
  2872.             return False
  2873.  
  2874.  
  2875.     def crack (self, hashvalue, alg):
  2876.         """Try to crack the hash.
  2877.         @param hashvalue Hash to crack.
  2878.         @param alg Algorithm to crack."""
  2879.        
  2880.         # Check if the cracker can crack this kind of algorithm
  2881.         if not self.isSupported (alg):
  2882.             return None
  2883.            
  2884.         hash2 = None
  2885.         if ':' in hashvalue:
  2886.             if alg == LM:
  2887.                 hash2 = hashvalue.split(':')[0]
  2888.             else:
  2889.                 hash2 = hashvalue.split(':')[1]
  2890.         else:
  2891.             hash2 = hashvalue
  2892.        
  2893.         # Build the URL, parameters and headers
  2894.         url = ""
  2895.         params = None
  2896.         headers = None
  2897.         if alg == LM:
  2898.             url = "http://nediam.com.mx/winhashes/search_lm_hash.php"
  2899.             params = { "lm" : hash2,
  2900.                 "btn_go" : "Search" }
  2901.             headers = { "Referer" : "http://nediam.com.mx/winhashes/search_lm_hash.php" }
  2902.         else:
  2903.             url = "http://nediam.com.mx/winhashes/search_nt_hash.php"
  2904.             params = { "nt" : hash2,
  2905.                 "btn_go" : "Search" }
  2906.             headers = { "Referer" : "http://nediam.com.mx/winhashes/search_nt_hash.php" }
  2907.        
  2908.         # Make the request
  2909.         response = do_HTTP_request ( url, params, headers )
  2910.        
  2911.         # Analyze the response
  2912.         html = None
  2913.         if response:
  2914.             html = response.read()
  2915.         else:
  2916.             return None
  2917.        
  2918.         match = search (r'<tr><td align="right">PASSWORD</td><td>[^<]*</td></tr>', html)
  2919.        
  2920.         if match:
  2921.             return match.group().split(':')[1]
  2922.         else:
  2923.             return None
  2924.  
  2925.  
  2926.  
  2927. CRAKERS = [     SCHWETT,
  2928.         NETMD5CRACK,
  2929.         MD5_CRACKER,
  2930.         BENRAMSEY,
  2931.         GROMWEB,
  2932.         HASHCRACKING,
  2933.         VICTOROV,
  2934.         THEKAINE,
  2935.         TMTO,
  2936.         REDNOIZE,
  2937.         MD5_DB,
  2938.         MY_ADDR,
  2939.         MD5PASS,
  2940.         MD5DECRYPTION,
  2941.         MD5CRACK,
  2942.         MD5ONLINE,
  2943.         MD5_DECRYPTER,
  2944.         AUTHSECUMD5,
  2945.         HASHCRACK,
  2946.         OPHCRACK,
  2947.         C0LLISION,
  2948.         CMD5,
  2949.         AUTHSECUCISCO7,
  2950.         CACIN,
  2951.         IBEAST,
  2952.         PASSWORD_DECRYPT,
  2953.         BIGTRAPEZE,
  2954.         HASHCHECKER,
  2955.         MD5HASHCRACKER,
  2956.         PASSCRACKING,
  2957.         ASKCHECK,
  2958.         FOX21,
  2959.         NICENAMECREW,
  2960.         JOOMLAAA,
  2961.         MD5_LOOKUP,
  2962.         SHA1_LOOKUP,
  2963.         SHA256_LOOKUP,
  2964.         RIPEMD160_LOOKUP,
  2965.         MD5_COM_CN,
  2966.         DIGITALSUN,
  2967.         DRASEN,
  2968.         MYINFOSEC,
  2969.         MD5_NET,
  2970.         NOISETTE,
  2971.         MD5HOOD,
  2972.         STRINGFUNCTION,
  2973.         XANADREL,
  2974.         SANS,
  2975.         BOKEHMAN,
  2976.         GOOG_LI,
  2977.         WHREPORITORY ]
  2978.  
  2979.  
  2980.  
  2981. ########################################################################################################
  2982. ### GENERAL METHODS
  2983. ########################################################################################################
  2984.  
  2985. def configureCookieProcessor (cookiefile='/tmp/searchmyhash.cookie'):
  2986.     '''Set a Cookie Handler to accept cookies from the different Web sites.
  2987.    
  2988.     @param cookiefile Path of the cookie store.'''
  2989.    
  2990.     cookieHandler = LWPCookieJar()
  2991.     if cookieHandler is not None:
  2992.         if path.isfile (cookiefile):
  2993.             cookieHandler.load (cookiefile)
  2994.            
  2995.         opener = urllib2.build_opener ( urllib2.HTTPCookieProcessor(cookieHandler) )
  2996.         urllib2.install_opener (opener)
  2997.  
  2998.  
  2999.  
  3000. def do_HTTP_request (url, params={}, httpheaders={}):
  3001.     '''
  3002.     Send a GET or POST HTTP Request.
  3003.     @return: HTTP Response
  3004.     '''
  3005.  
  3006.     data = {}
  3007.     request = None
  3008.    
  3009.     # If there is parameters, they are been encoded
  3010.     if params:
  3011.         data = urlencode(params)
  3012.  
  3013.         request = urllib2.Request ( url, data, headers=httpheaders )
  3014.     else:
  3015.         request = urllib2.Request ( url, headers=httpheaders )
  3016.        
  3017.     # Send the request
  3018.     try:
  3019.         response = urllib2.urlopen (request)
  3020.     except:
  3021.         return ""
  3022.    
  3023.     return response
  3024.  
  3025.  
  3026. def printSyntax ():
  3027.     """Print application syntax."""
  3028.    
  3029.     print """%s 1.1.2 ( http://code.google.com/p/findmyhash/ )
  3030.    
  3031.  
  3032. Usage:
  3033. ------
  3034.  
  3035.  python %s <algorithm> OPTIONS
  3036.  
  3037.  
  3038. Accepted algorithms are:
  3039. ------------------------
  3040.  
  3041.  MD4       - RFC 1320
  3042.  MD5       - RFC 1321
  3043.  SHA1      - RFC 3174 (FIPS 180-3)
  3044.  SHA224    - RFC 3874 (FIPS 180-3)
  3045.  SHA256    - FIPS 180-3
  3046.  SHA384    - FIPS 180-3
  3047.  SHA512    - FIPS 180-3
  3048.  RMD160    - RFC 2857
  3049.  GOST      - RFC 5831
  3050.  WHIRLPOOL - ISO/IEC 10118-3:2004
  3051.  LM        - Microsoft Windows hash
  3052.  NTLM      - Microsoft Windows hash
  3053.  MYSQL     - MySQL 3, 4, 5 hash
  3054.  CISCO7    - Cisco IOS type 7 encrypted passwords
  3055.  JUNIPER   - Juniper Networks $9$ encrypted passwords
  3056.  LDAP_MD5  - MD5 Base64 encoded
  3057.  LDAP_SHA1 - SHA1 Base64 encoded
  3058.  
  3059.  NOTE: for LM / NTLM it is recommended to introduce both values with this format:
  3060.         python %s LM   -h 9a5760252b7455deaad3b435b51404ee:0d7f1f2bdeac6e574d6e18ca85fb58a7
  3061.         python %s NTLM -h 9a5760252b7455deaad3b435b51404ee:0d7f1f2bdeac6e574d6e18ca85fb58a7
  3062.  
  3063.  
  3064. Valid OPTIONS are:
  3065. ------------------
  3066.  
  3067.  -h <hash_value>  If you only want to crack one hash, specify its value with this option.
  3068.  
  3069.  -f <file>        If you have several hashes, you can specify a file with one hash per line.
  3070.                   NOTE: All of them have to be the same type.
  3071.                  
  3072.  -g               If your hash cannot be cracked, search it in Google and show all the results.
  3073.                   NOTE: This option ONLY works with -h (one hash input)
  3074.  
  3075. Examples:
  3076. ---------
  3077.  
  3078.  -> Try to crack only one hash.
  3079.     python %s MD5 -h 098f6bcd4621d373cade4e832627b4f6
  3080.    
  3081.  -> Try to crack hashes on a webpage
  3082.     python %s MD5 -u http://pastebin.com/ddWYY634
  3083.     python %s SHA1 -u http://pastebin.com/1YbcH2k5
  3084.  
  3085.  -> Try to crack a JUNIPER encrypted password escaping special characters.
  3086.     python %s JUNIPER -h "\$9\$LbHX-wg4Z"
  3087.  
  3088.  -> If the hash cannot be cracked, it will be searched in Google.
  3089.     python %s LDAP_SHA1 -h "{SHA}cRDtpNCeBiql5KOQsKVyrA0sAiA=" -g
  3090.  
  3091.  -> Try to crack multiple hashes using a file (one hash per line).
  3092.     python %s MYSQL -f mysqlhashesfile.txt
  3093.    
  3094.    
  3095. Contact:
  3096. --------
  3097.  
  3098. [Web]           http://laxmarcaellugar.blogspot.com/
  3099. [Mail/Google+]  bloglaxmarcaellugar@gmail.com
  3100. [twitter]       @laXmarcaellugar
  3101. """ % ( (sys.argv[0],) * 10 )
  3102.  
  3103.  
  3104.  
  3105. def crackHash (algorithm, hashvalue=None, hashfile=None):
  3106.     """Crack a hash or all the hashes of a file.
  3107.    
  3108.     @param alg Algorithm of the hash (MD5, SHA1...).
  3109.     @param hashvalue Hash value to be cracked.
  3110.     @param hashfile Path of the hash file.
  3111.     @return If the hash has been cracked or not."""
  3112.    
  3113.     global CRAKERS
  3114.    
  3115.     # Cracked hashes will be stored here
  3116.     crackedhashes = []
  3117.    
  3118.     # Is the hash cracked?
  3119.     cracked = False
  3120.    
  3121.     # Only one of the two possible inputs can be setted.
  3122.     if (not hashvalue and not hashfile) or (hashvalue and hashfile):
  3123.         return False
  3124.    
  3125.     # hashestocrack depends on the input value
  3126.     hashestocrack = None
  3127.     if hashvalue:
  3128.         hashestocrack = [ hashvalue ]
  3129.     else:
  3130.         try:
  3131.             hashestocrack = open (hashfile, "r")
  3132.         except:
  3133.             print "\nIt is not possible to read input file (%s)\n" % (hashfile)
  3134.             return cracked
  3135.    
  3136.    
  3137.     # Try to crack all the hashes...
  3138.     for activehash in hashestocrack:
  3139.         hashresults = []
  3140.        
  3141.         # Standarize the hash
  3142.         activehash = activehash.strip()
  3143.         if algorithm not in [JUNIPER, LDAP_MD5, LDAP_SHA1]:
  3144.             activehash = activehash.lower()
  3145.        
  3146.         # Initial message
  3147.         print "\nCracking hash: %s\n" % (activehash)
  3148.  
  3149.         # Each loop starts for a different start point to try to avoid IP filtered
  3150.         begin = randint(0, len(CRAKERS)-1)
  3151.        
  3152.         for i in range(len(CRAKERS)):
  3153.            
  3154.             # Select the cracker
  3155.             cr = CRAKERS[ (i+begin)%len(CRAKERS) ]()
  3156.            
  3157.             # Check if the cracker support the algorithm
  3158.             if not cr.isSupported ( algorithm ):
  3159.                 continue
  3160.            
  3161.             # Analyze the hash
  3162.             print "Analyzing with %s (%s)..." % (cr.name, cr.url)
  3163.            
  3164.             # Crack the hash
  3165.             result = None
  3166.             try:
  3167.                 result = cr.crack ( activehash, algorithm )
  3168.             # If it was some trouble, exit
  3169.             except:
  3170.                 print "\nSomething was wrong. Please, contact with us to report the bug:\n\nbloglaxmarcaellugar@gmail.com\n"
  3171.                 if hashfile:
  3172.                     try:
  3173.                         hashestocrack.close()
  3174.                     except:
  3175.                         pass
  3176.                 return False
  3177.            
  3178.             # If there is any result...
  3179.             cracked = 0
  3180.             if result:
  3181.                
  3182.                 # If it is a hashlib supported algorithm...
  3183.                 if algorithm in [MD4, MD5, SHA1,  SHA224, SHA384, SHA256, SHA512, RIPEMD]:
  3184.                     # Hash value is calculated to compare with cracker result
  3185.                     h = hashlib.new (algorithm)
  3186.                     h.update (result)
  3187.                    
  3188.                     # If the calculated hash is the same to cracker result, the result is correct (finish!)
  3189.                     if h.hexdigest() == activehash:
  3190.                         hashresults.append (result)
  3191.                         cracked = 2
  3192.                
  3193.                 # If it is a half-supported hashlib algorithm
  3194.                 elif algorithm in [LDAP_MD5, LDAP_SHA1]:
  3195.                     alg = algorithm.split('_')[1]
  3196.                     ahash =  decodestring ( activehash.split('}')[1] )
  3197.                    
  3198.                     # Hash value is calculated to compare with cracker result
  3199.                     h = hashlib.new (alg)
  3200.                     h.update (result)
  3201.                    
  3202.                     # If the calculated hash is the same to cracker result, the result is correct (finish!)
  3203.                     if h.digest() == ahash:
  3204.                         hashresults.append (result)
  3205.                         cracked = 2
  3206.                
  3207.                 # If it is a NTLM hash
  3208.                 elif algorithm == NTLM or (algorithm == LM and ':' in activehash):
  3209.                     # NTLM Hash value is calculated to compare with cracker result
  3210.                     candidate = hashlib.new('md4', result.split()[-1].encode('utf-16le')).hexdigest()
  3211.                    
  3212.                     # It's a LM:NTLM combination or a single NTLM hash
  3213.                     if (':' in activehash and candidate == activehash.split(':')[1]) or (':' not in activehash and candidate == activehash):
  3214.                         hashresults.append (result)
  3215.                         cracked = 2
  3216.                
  3217.                 # If it is another algorithm, we search in all the crackers
  3218.                 else:
  3219.                     hashresults.append (result)
  3220.                     cracked = 1
  3221.            
  3222.             # Had the hash cracked?
  3223.             if cracked:
  3224.                 print "\n***** HASH CRACKED!! *****\nThe original string is: %s\n" % (result)
  3225.                 # If result was verified, break
  3226.                 if cracked == 2:
  3227.                     break
  3228.             else:
  3229.                 print "... hash not found in %s\n" % (cr.name)
  3230.        
  3231.        
  3232.         # Store the result/s for later...
  3233.         if hashresults:
  3234.            
  3235.             # With some hash types, it is possible to have more than one result,
  3236.             # Repited results are deleted and a single string is constructed.
  3237.             resultlist = []
  3238.             for r in hashresults:
  3239.                 #if r.split()[-1] not in resultlist:
  3240.                     #resultlist.append (r.split()[-1])
  3241.                 if r not in resultlist:
  3242.                     resultlist.append (r)
  3243.                    
  3244.             finalresult = ""
  3245.             if len(resultlist) > 1:
  3246.                 finalresult = ', '.join (resultlist)
  3247.             else:
  3248.                 finalresult = resultlist[0]
  3249.            
  3250.             # Valid results are stored
  3251.             crackedhashes.append ( (activehash, finalresult) )
  3252.    
  3253.    
  3254.     # Loop is finished. File can need to be closed
  3255.     if hashfile:
  3256.         try:
  3257.             hashestocrack.close ()
  3258.         except:
  3259.             pass
  3260.        
  3261.     # Show a resume of all the cracked hashes
  3262.     print "\nThe following hashes were cracked:\n----------------------------------\n"
  3263.     print crackedhashes and "\n".join ("%s -> %s" % (hashvalue, result.strip()) for hashvalue, result in crackedhashes) or "NO HASH WAS CRACKED."
  3264.     print
  3265.    
  3266.     return cracked
  3267.  
  3268.  
  3269.  
  3270.  
  3271. def searchHash (hashvalue):
  3272.     '''Google the hash value looking for any result which could give some clue...
  3273.    
  3274.     @param hashvalue The hash is been looking for.'''
  3275.    
  3276.     start = 0
  3277.     finished = False
  3278.     results = []
  3279.    
  3280.     sys.stdout.write("\nThe hash wasn't found in any database. Maybe Google has any idea...\nLooking for results...")
  3281.     sys.stdout.flush()
  3282.    
  3283.     while not finished:
  3284.        
  3285.         sys.stdout.write('.')
  3286.         sys.stdout.flush()
  3287.    
  3288.         # Build the URL
  3289.         url = "http://www.google.com/search?hl=en&q=%s&filter=0" % (hashvalue)
  3290.         if start:
  3291.             url += "&start=%d" % (start)
  3292.            
  3293.         # Build the Headers with a random User-Agent
  3294.         headers = { "User-Agent" : USER_AGENTS[randint(0, len(USER_AGENTS))-1] }
  3295.        
  3296.         # Send the request
  3297.         response = do_HTTP_request ( url, httpheaders=headers )
  3298.        
  3299.         # Extract the results ...
  3300.         html = None
  3301.         if response:
  3302.             html = response.read()
  3303.         else:
  3304.             continue
  3305.            
  3306.         resultlist = findall (r'<a href="[^"]*?" class=l', html)
  3307.        
  3308.         # ... saving only new ones
  3309.         new = False
  3310.         for r in resultlist:
  3311.             url_r = r.split('"')[1]
  3312.            
  3313.             if not url_r in results:
  3314.                 results.append (url_r)
  3315.                 new = True
  3316.        
  3317.         start += len(resultlist)
  3318.        
  3319.         # If there is no a new result, finish
  3320.         if not new:
  3321.             finished = True
  3322.        
  3323.    
  3324.     # Show the results
  3325.     if results:
  3326.         print "\n\nGoogle has some results. Maybe you would like to check them manually:\n"
  3327.        
  3328.         results.sort()
  3329.         for r in results:
  3330.             print "  *> %s" % (r)
  3331.         print
  3332.    
  3333.     else:
  3334.         print "\n\nGoogle doesn't have any result. Sorry!\n"
  3335.  
  3336.  
  3337. ########################################################################################################
  3338. ### MAIN CODE
  3339. ########################################################################################################
  3340.  
  3341. def main():
  3342.     """Main method."""
  3343.  
  3344.  
  3345.     ###################################################
  3346.     # Syntax check
  3347.     if len (sys.argv) < 4:
  3348.         printSyntax()
  3349.         sys.exit(1)
  3350.    
  3351.     else:
  3352.         try:
  3353.             opts, args = getopt.getopt (sys.argv[2:], "gh:f:u:")
  3354.         except:
  3355.             printSyntax()
  3356.             sys.exit(1)
  3357.    
  3358.    
  3359.     ###################################################
  3360.     # Load input parameters
  3361.     algorithm = sys.argv[1].lower()
  3362.     hashvalue = None
  3363.     hashfile  = None
  3364.     retrieveUrl = None
  3365.     googlesearch = False
  3366.    
  3367.     for opt, arg in opts:
  3368.         if opt == '-h':
  3369.             hashvalue = arg
  3370.         elif opt == '-f':
  3371.             hashfile = arg
  3372.         elif opt == '-u':
  3373.             retrieveUrl = arg
  3374.         else:
  3375.             googlesearch = True
  3376.    
  3377.    
  3378.     ###################################################
  3379.     # Configure the Cookie Handler
  3380.     configureCookieProcessor()
  3381.    
  3382.     # Initialize PRNG seed
  3383.     seed()
  3384.    
  3385.     cracked = 0
  3386.  
  3387.     md5list = []   
  3388.     if retrieveUrl:
  3389.         response = do_HTTP_request ( retrieveUrl )
  3390.         html = None
  3391.         if response:
  3392.             html = response.read()
  3393.         else:
  3394.             return None
  3395.         if(algorithm=="md5"):      
  3396.             match = findall (r'(?i)(?<![a-z0-9])[a-f0-9]{32}(?![a-z0-9])', html)
  3397.             print match
  3398.             for hashvalue in match:
  3399.                 cracked = crackHash (algorithm, hashvalue, hashfile)
  3400.                 if not cracked and googlesearch and not hashfile:
  3401.                     searchHash (hashvalue)
  3402.                 sys.exit(1)
  3403.         if(algorithm=="sha1"):             
  3404.             match = findall (r'(?i)(?<![a-z0-9])[a-f0-9]{40}(?![a-z0-9])', html)
  3405.             for hashvalue in match:
  3406.                 cracked = crackHash (algorithm, hashvalue, hashfile)
  3407.                 if not cracked and googlesearch and not hashfile:
  3408.                     searchHash (hashvalue)
  3409.                 sys.exit(1)
  3410.    
  3411.     ###################################################
  3412.     # Crack the hash/es
  3413.     cracked = crackHash (algorithm, hashvalue, hashfile)
  3414.    
  3415.    
  3416.     ###################################################
  3417.     # Look for the hash in Google if it was not cracked
  3418.     if not cracked and googlesearch and not hashfile:
  3419.         searchHash (hashvalue)
  3420.    
  3421.    
  3422.    
  3423.     # App is finished
  3424.     sys.exit()
  3425.  
  3426.  
  3427.  
  3428. if __name__ == "__main__":
  3429.     main()
Add Comment
Please, Sign In to add comment