Python文件读取错误

时间:2017-11-21 04:29:13

标签: python passwords md5

我正在尝试使用wordlist制作MD5密码破解程序。我正在比较的MD5哈希值是从我负责收集信息的网站的HTML中获得的。到目前为止,我已经成功地收集了MD5哈希,我已经获得了一个单词列表,我循环并成功创建了哈希。但是,当试图将它与我目前拥有的哈希值进行比较时,它只能找到一个结果(即使我知道它是四个)。我可能会做一些非常愚蠢的事情,但是想要一些建议。

def FindandCrackHash(content):
    # Find hashes
    attempt = 0
    contentHash = content
    hashList = []
    crackedHashes = []
    contentHash = re.findall(r'[A-Fa-f0-9]{32}', contentHash.decode())
    for h in contentHash:
        h = h.lower()
        hashList.append(h)
    print('')
    print(f'[+] {len(hashList)} MD5 Hashes Found:')
    for hashes in hashList:
        print(f'"{hashes}"')
    with open("C:\\Users\\Rory Gracey\\Desktop\\Napier CourseWork 2\\rockyou1.txt", 'r') as wordList:
        for line in wordList:
            md5Hash = hashlib.md5(line.encode('utf-8'))
            hashToCompare = md5Hash.hexdigest()
            compHash = str(hashToCompare)
            print(line) if compHash in hashList else None
[+] 4 MD5 Hashes Found:
"fea0f1f6fede90bd0a925b4194deac11"
"d1133275ee2118be63a577af759fc052"
"5badcaf789d3d1d09794d8f021f40f0e"
"5fcfd41e547a12215b173ff47fdd3739"
 trustno1

这就是我现在所拥有的。任何帮助将非常感激。干杯!

0 个答案:

没有答案