2011-07-04 181 views
2

我在网上浏览一些关于CryptUnprotectData和WZC的信息。我发现这个小脚本用于在Vista上解密存储的无线密码。我用Python3尝试过(它可能是为Python 2.X编写的),但它给了我:TypeError期望带有缓冲区接口的对象。我不太清楚如何解决它。 这是简单的脚本:Python3 CryptUnprotectData()类型错误期望一个缓冲区接口的对象

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]) 

脚本是从here

回答

-1

你给它时,它预计二进制/字节的数据字符串/ Unicode数据。

如果它是为Python 2编写的,那么不经过一些修改就可以在Python 3上工作。使用Python 2(或修复它)。

+0

好,现在,当我知道它是什么意思时,我认为字节(pwdHash,'UTF-8')应该为Python3修复它。 – J91321

+0

@ J91321:值得一试。但如果它不起作用,请切换到Python 2。 –

相关问题