python写unix口令破解器

看了python绝技做出来的unix口令破解器

首先需要crypt。

python并不自带!!

windows下pip安装失败= =

后来直接去kali敲了

附件:jiami.txt #假设是unix的口令文件

附件1:passwds.txt#假设是字典

windows crypt模块下载:https://www.dlitz.net/software/pycrypto/

import crypt
def testpass(cryptpass):#加密的口令hash
  salt=cryptpass[0:2]#提取加密口令hash前面两个字符视为salt
  destfiles=open('passwd.txt','r')#读取密码字典
  for word in destfiles.readlines():#历遍字典
    word=word.strip('
')#提取每一个单词
    cryptword=crypt.crypt(word,salt)#用每个单词计和salt算一个新hash
    print'[*]Found password:'+word+'
'#找到密码
    return
print'[-]Fount Not password.
'#找不到密码

def mian():
  passfile=open('jiami.txt')#打开加密的文件
  for line in passfile.readlines():#历遍加密的文件
    if ':' in line:
      user=line.split(':')[0]
     cryptpass=line.split(':')[1].strip('')#每一行hash都是分开的
     print'[*]Cracking Password For:'+user
     testpass(cryptpass)

if__name__='__main__':
  main()

 结果图:

原文地址:https://www.cnblogs.com/haq5201314/p/7528200.html