zoukankan      html  css  js  c++  java
  • [python脚本]MD5破解工具iCrack

    iCrack是一个在线/离线 md5破解工具,使用python编写,目前覆盖大约14个在线破解数据库。

    刚刚试了下,还不错 

      1 #!/usr/bin/env python
      2 #
      3 # File_name: md5 hash cracker
      4 # Writin by: lnxg33k <ahmed[at]isecur1ty.org>
      5 # Currently contains about 13 site for cracking
      6 #
      7 # This program is free software: you can redistribute it and/or modify
      8 # it under the terms of the GNU General Public License as published by
      9 # the Free Software Foundation, either version 3 of the License, or
     10 # (at your option) any later version.
     11 #
     12 # This program is distributed in the hope that it will be useful,
     13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 # GNU General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     19 #
     20 
     21 import sys
     22 import time
     23 import urllib2
     24 import urllib 
     25 import re
     26 import hashlib
     27 
     28 if len(sys.argv) < 2:
     29   print '\nUsage:'
     30   print '\t%s --online [hash..] ' % sys.argv[0]
     31   print '\t%s --offline [hash..] [dictionary..]'  % sys.argv[0]
     32   sys.exit(1)
     33 
     34 def banner():
     35   print '''
     36                   ___           ___           ___           ___           ___     
     37     ___          /  /\         /  /\         /  /\         /  /\         /__/|    
     38    /  /\        /  /:/        /  /::\       /  /::\       /  /:/        |  |:|    
     39   /  /:/       /  /:/        /  /:/\:\     /  /:/\:\     /  /:/         |  |:|    
     40  /__/::\      /  /:/  ___   /  /:/~/:/    /  /:/~/::\   /  /:/  ___   __|  |:|    
     41  \__\/\:\__  /__/:/  /  /\ /__/:/ /:/___ /__/:/ /:/\:\ /__/:/  /  /\ /__/\_|:|____
     42     \  \:\/\ \  \:\ /  /:/ \  \:\/:::::/ \  \:\/:/__\/ \  \:\ /  /:/ \  \:\/:::::/
     43      \__\::/  \  \:\  /:/   \  \::/~~~~   \  \::/       \  \:\  /:/   \  \::/~~~~ 
     44      /__/:/    \  \:\/:/     \  \:\        \  \:\        \  \:\/:/     \  \:\     
     45      \__\/      \  \::/       \  \:\        \  \:\        \  \::/       \  \:\    
     46                  \__\/         \__\/         \__\/         \__\/         \__\/
     47   
     48         |-----------------------------------------------|
     49         | [+] MD5 Hash Cracker (online | offline)       |
     50         | [+] Home: http://www.isecur1ty.org            |
     51         | [+] Written by: isecur1ty team members        |
     52         | [+] Credits: Obzy, Relik and Sas-TerrOrisT    |
     53         |-----------------------------------------------|
     54 '''
     55 
     56 option   = sys.argv[1]
     57 passwd   = sys.argv[2]
     58 
     59 if option == '--online':
     60   if len(passwd) != 32: 
     61     print '\n[*] Error: "%s" doesn\'t seem to be a valid MD5 hash "32 bit hexadecimal"' % passwd
     62   else:
     63     try:
     64       banner()
     65       def myaddr():
     66         site = 'http://md5.my-addr.com/'
     67         rest = 'md5_decrypt-md5_cracker_online/md5_decoder_tool.php'
     68         para = urllib.urlencode({'md5':passwd})
     69         req  = urllib2.Request(site+rest)
     70         try:
     71           fd   = urllib2.urlopen(req, para)
     72           data = fd.read()
     73           match= re.search('(Hashed string</span>: )(\w+.\w+)', data)
     74           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
     75           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
     76         except urllib2.URLError:  print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
     77       myaddr()
     78 
     79       def victorov():
     80         try:
     81           site = 'http://www.victorov.su/'
     82           para = 'md5/?md5e=&md5d=%s' % passwd
     83           req  = urllib2.Request(site+para)
     84           req.add_header
     85           opener = urllib2.urlopen(req)
     86           data = opener.read()
     87           match = re.search('(<b>)(.+[^>])(</b>)', data)
     88           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
     89           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
     90         except urllib2.URLError:  print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
     91       victorov()
     92       
     93       def md5crack():
     94         site = 'http://www.md5crack.com/'
     95         rest = 'crackmd5.php'
     96         para = urllib.urlencode({'term':passwd})
     97         req = urllib2.Request(site+rest)
     98         try
     99           fd = urllib2.urlopen(req, para)
    100           data = fd.read()
    101           match = re.search('(Found: md5)(..)(\w+.\w+)', data)
    102           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(3))
    103           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    104         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error seems to be down' % site
    105       md5crack()
    106       
    107       def passcracking():
    108         site = 'http://passcracking.com/'
    109         rest = 'index.php'
    110         para = urllib.urlencode({'datafromuser':passwd})
    111         req = urllib2.Request(site+rest)
    112         try:
    113           fd = urllib2.urlopen(req, para)
    114           data = fd.read()
    115           match = re.search(r"(<td bgcolor=#FF0000>)(.+[^<])(</td><td>)", data)
    116           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
    117           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    118         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    119       passcracking()
    120 
    121       def rednoize():
    122         site = 'http://md5.rednoize.com/'
    123         para = 'p&s=md5&q=%s&_=' % passwd
    124         try:
    125           req = urllib2.urlopen(site+'?'+para)
    126           data = req.read()
    127           if not len(data): print '[-] site: %s\t\t\tPassword: Not found' %site
    128           elseprint '[-] site: %s\t\t\tPassword: %s' % (site, data)
    129         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    130       rednoize()
    131 
    132       def md5pass():
    133         site = 'http://www.md5pass.info/'
    134         para = urllib.urlencode({'hash':passwd, 'get_pass':'Get+Pass'})
    135         req = urllib2.Request(site)
    136         try:
    137           fd = urllib2.urlopen(req, para)
    138           data = fd.read()
    139           match = re.search('(Password - <b>)(\w+)', data)
    140           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
    141           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    142         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    143       md5pass()
    144 
    145       def md5decryption():
    146         site = 'http://md5decryption.com/'
    147         para = urllib.urlencode({'hash':passwd,'submit':'Decrypt+It!'})
    148         req = urllib2.Request(site)
    149         try:
    150           fd = urllib2.urlopen(req, para)
    151           data = fd.read()
    152           match = re.search(r'(Decrypted Text: </b>)(.+[^>])(</font><br/><center>)', data)
    153           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
    154           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    155         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    156       md5decryption()
    157 
    158       def hashkiller():
    159         site = 'http://opencrack.hashkiller.com/'
    160         para = urllib.urlencode({'oc_check_md5':passwd,'oc_submit':'Search+MD5'})
    161         req = urllib2.Request(site)
    162         try:
    163           fd = urllib2.urlopen(req, para)
    164           data = fd.read()
    165           match = re.search('(<div class="result">)(\w+)(:)(\w+.\w+)', data)
    166           if match:
    167             print '[-] site: %s\t\t\tPassword: %s' % (site.replace('http://'''), match.group(4).replace('<br',''))
    168           elseprint '[-] site: %s\t\t\tPassword: Not found' % site.replace('http://''')
    169         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    170       hashkiller()
    171 
    172       def bigtrapeze():
    173         site = 'http://www.bigtrapeze.com/'
    174         rest = 'md5/index.php?query=%s' % passwd
    175         req = urllib2.Request(site+rest)
    176         req.add_header('User-Agent''Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.2)\
    177         Gecko/20100316 AskTbSPC2/3.9.1.14019 Firefox/3.6.2')
    178         try:
    179           opener = urllib2.build_opener()
    180           data = opener.open(req).read()
    181           match = re.search('(=> <strong>)(\w+.\w+)', data)
    182           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
    183           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    184         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    185       bigtrapeze()
    186 
    187       def cloudcracker():
    188         site = 'http://www.netmd5crack.com/'
    189         para = 'cgi-bin/Crack.py?InputHash=%s' % passwd
    190         try:
    191           req = urllib.urlopen(site+para)
    192           data = req.read()
    193           match = re.search(r'<tr><td class="border">[^<]+</td><td class="border">\
    194           (?P<hash>[^>]+)</td></tr></tbody></table>', data)
    195           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(hash))
    196           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    197         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    198       cloudcracker()
    199 
    200       def hashchecker():
    201         site = 'http://www.hashchecker.com/'
    202         para = urllib.urlencode({'search_field':passwd, 'Submit':'search'})
    203         req = urllib2.Request(site)
    204         try:
    205           fd = urllib2.urlopen(req, para)
    206           data = fd.read()
    207           match = re.search('(is <b>)(\w+)', data)
    208           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(2))
    209           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    210         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    211       hashchecker()  
    212 
    213       def hashcracking():
    214         site = 'http://md5.hashcracking.com/'
    215         rest = 'search.php'
    216         para = 'md5=%s' % passwd
    217         try:
    218           req = urllib2.urlopen(site+rest+'?'+para)
    219           data = req.read()
    220           match = re.search('(is)(.)(\w+.\w+)', data)
    221           if match: print '[-] site: %s\t\t\tPassword: %s' % (site, match.group(3))
    222           elseprint '[-] site: %s\t\t\tPassword: Not found' % site
    223         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    224       hashcracking()
    225 
    226       def cloudcracker():
    227         site = 'http://www.cloudcracker.net/'
    228         para = urllib.urlencode({'inputbox':passwd, 'submit':'Crack+MD5+Hash!'})
    229         req = urllib2.Request(site)
    230         try:
    231           fd = urllib2.urlopen(req, para)
    232           data = fd.read()
    233           match = re.search('(this.select)(....)(\w+=")(\w+.\w+)', data)
    234           if match: print '[-] site: %s\t\t\tPassword: %s\n' % (site, match.group(4))
    235           elseprint '[-] site: %s\t\t\tPassword: Not found\n' % site
    236         except urllib2.URLError: print '[+] site: %s \t\t\t[+] Error: seems to be down' % site
    237       cloudcracker()
    238     except KeyboardInterrupt: print '\nTerminated by user ...'
    239     
    240 elif option == '--offline':
    241   banner()
    242   try:
    243     def offline():
    244       print '[+] This opertaion will take some time, be patient ...' 
    245       dictionary = sys.argv[3]
    246       dic = {}
    247       shooter = 0
    248       try:
    249         f = open(dictionary, 'rb')
    250         start = time.time()
    251         for line in f:
    252           line = line.rstrip()
    253           dic[line] = hashlib.md5(line).hexdigest()
    254         for k in dic.keys(): 
    255           if passwd in dic[k]:
    256             stop = time.time()
    257             global spent
    258             spent = stop - start
    259             print '\n[-] Hash: %s\t\tData: %s\t\tTime: %.f seconds' % (dic[k], k, spent)
    260             shooter += 1
    261         if shooter == 0:  print "\n[*]Password not found in [%s] try the online cracker\n" % dictionary
    262         f.close()
    263       except IOError: print '\n[*] Erorr: %s doesn\'t exsit \n' % dictionary
    264     offline()
    265   except KeyboardInterrupt: print '\nTerminated by user ...'
    266  

    267 elsepass

     

    转载请注明出自: FreebuF.COM - http://www.freebuf.com/tools/3942.html 

  • 相关阅读:
    [ZZ]风险驱动的测试
    移动测试书籍推荐
    4月收藏
    Appium路线图及1.0正式版发布
    匿名吐槽和测试小道消息
    文章收藏
    [ZZ]最小化不可重现的bug
    华人世界——客家足迹行
    移动测试会第七期
    2月收藏
  • 原文地址:https://www.cnblogs.com/scrat/p/2559467.html
Copyright © 2011-2022 走看看