简体   繁体   中英

Python3 CryptUnprotectData() TypeError expected an object with a buffer interface

I was browsing over the net for some information about CryptUnprotectData and WZC. I found this small script that is used for decrypting stored Wireless passwords on Vista. I tried with Python3 (it was written probably for Python 2.X) but it gives me: TypeError expected an object with a buffer interface. I'm not quite sure how to fix it. It is simple script:

    import win32crypt
    mykey = "Insert keyMaterial"
    binout = []
    for i in range(len(mykey)):
        if i % 2 == 0:
            binout.append(chr(int(mykey[i:i+2],16)))
    pwdHash=''.join(binout)

    output = win32crypt.CryptUnprotectData(pwdHash,None,None,None,0)

    print ("hex:", "".join(["%02X" % ord(char) for char in output[1]]))

    print ("ascii:", output[1])

Script is from here

You are giving it string/unicode data when it expected binary/bytes data.

If it is written for Python 2 it is unlikely to work on Python 3 without some modifications. Use Python 2 (or fix it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM