# coding=UTF-8
"""
暴力破解UNIX的密码,需要输入字典文件和UNIX的密码文件
遍历整个字典,试图用常用的盐值来匹配破解哈希密码
"""
import crypt
def testPass(cryptPass):
salt = cryptPass[0:2]
dictfile = open('dictionary.txt', 'r') # 打开字典文件
for word in dictfile.readlines():
word = word.strip('\n') # 保留原始字符,不去空格
cryptWord = crypt.crypt(word, salt)
if cryptPass == cryptWord:
print('Found passed:', word)
return
print('Password not found!')
return
def main():
passfile = open('passwor', 'r')
for line in passfile.readlines():
user = line.split(':')[0]
cryptPass = line.split(':')[1].strip(")
print("Cracking password For:", user)
testPass(cryptPass)
if __name__ == '__main__':
main()
Python-暴力破解UNIX密码脚本
最新推荐文章于 2022-06-23 13:30:41 发布