其他分享
首页 > 其他分享> > unix破解机

unix破解机

作者:互联网

1.黑客会下载好数据库中已经被hash加密后的口令文件

2.黑客用字典+salt加密的形式加密后与口令文件进行对比,相同则说明找到正确口令

import crypt
#通过规律得到加密口令的前两位就是salt值,那么通过crypt加密,将加密后的值与文件中的值进行比较
#程序设计方法:运用testPass函数,实现比较的功能
#           在main函数中读取相应的加密口令传入testPass进行再加密和比较
def testPass(cryptPass):
    salt = crypt[0:2]
    dicFile = open('dictionary.txt','r')
    for word in dicFile.readline():
        word = word.strip('\n')
        cryptWord = crypt.crypt(word,salt)
        if (cryptWord == cryptPass):
            print("Found password:" + "word" + '\n')
            return

def main():
    passFile = open('password.txt')
    for password in passFile.readline():
        if ":" in password:
            user = password.strip(':')[0]
            password = password.strip(':')[1]
            testPass(password)

if __name__ == "__main" :
    main()

  

 

标签:main,加密,testPass,crypt,unix,word,password,破解
来源: https://www.cnblogs.com/lzwhehe/p/15193367.html