在内存转储中使用XOR'ing字节来检查密钥是否存在

时间:2018-02-08 16:59:06

标签: python byte xor

读取二进制文件和XORing字节以查明是否存在AES 128密钥。

with open("FakeMemDump1.bin","rb") as memorydump:
    mem = memorydump.read(memorybytes)
    for i in mem:
        w = mem[i]^mem[i+15]
        x = mem[i+4]^mem[i+19]
        y = mem[i+8]^mem[i+23]
        z = mem[i+12]^mem[i+27]
        if w==mem[i+16] and x==mem[i+20] and y==mem[i+24] and z==mem[i+28]:
            keySched = mem[i-1:i+175]
            print ("Key Schedule : "%keySched)

Traceback (most recent call last):
File "AES128Keyfind.py", line 8, in <module>
w = mem[i]^mem[i+15]
TypeError: string indices must be integers, not str

上面是我收到的错误,即使文件被读取为二进制文件,被调用的字节是否作为字符串传入?

0 个答案:

没有答案