zoukankan      html  css  js  c++  java
  • 暴力破解unix/linux平台上采用crypt加密的口令

     1 # coding=utf-8
     2 
     3 '''
     4 暴力破解crypt模块加密的密码
     5 '''
     6 
     7 import crypt
     8 import optparse
     9 
    10 usage = 'Usage: %prog [optinos] -p password.txt -d dictionary.txt'
    11 parser = optparse.OptionParser(usage,version=1.0)
    12 parser.add_option('-p',dest='pFile',action='store',
    13                   help='加密后的口令存放文件')
    14 parser.add_option('-d',dest='dFile',action='store',
    15                   help='字典文件')
    16 (options,args) = parser.parse_args()
    17 
    18 def dection_passwords(password):
    19    salt = password[:2]
    20    dfile = open(options.dFile)
    21    for word in dfile:
    22         word = word.strip('
    ')
    23         cryptWord = crypt.crypt(word,salt)
    24         if cryptWord == password:
    25             print '找到密码,密码是:',word
    26             return
    27    print '未找到密码!'
    28    return
    29 
    30 def main():
    31    passfile = open(options.pFile)
    32    for password in passfile:
    33         password = password.strip('
    ')
    34         if password != '':
    35             dection_passwords(password)
    36 
    37 if __name__ == '__main__':
    38    main()

    运行后的结果是:

    1 python ForceCrackCrypt.py -p /root/Desktop/password.txt -d /root/Desktop/dictionary.txt
    2 找到密码,密码是: 123456
    3 找到密码,密码是: 11111111
    4 找到密码,密码是: abc123
  • 相关阅读:
    PHP技巧通过COM使用ADODB
    PHP开发环境安装配置全攻略
    散列表
    poj Antiprime Sequences
    HDU 2011 菜鸟杯
    UVA The ? 1 ? 2 ? ... ? n = k problem
    poj 3126 Prime Path
    uva 699 The Falling Leaves
    UVA Steps
    poj 1426 Find The Multiple
  • 原文地址:https://www.cnblogs.com/darkpig/p/5679348.html
Copyright © 2011-2022 走看看