TypeError:object类型< class' str无法传递给C代码 - 值:不正确的AES密钥长度(64个字节)
首先,我想指出,我已经咨询了类似标题 /问题的帖子,但是经过数小时的研究,我仍然无法解决问题。
这是程序代码:
import sys
import base64
from Crypto.Cipher import AES
if len(sys.argv) != 2:
print("Incorrect amount of arguments.")
print("Example of use:")
print("$ python {} LjFWQMzS3GWDeav7+0Q0oSoOM43VwD30YZDVaItj8e0".format(sys.argv[0]))
sys.exit()
cpassword = sys.argv[1]
while len(cpassword) % 4 > 0:
cpassword += "="
decoded_password = base64.b64decode(cpassword)
# This is a Microsoft hardcoded key used to decrypt GPO hash.
key = '\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b'
decryption_suite = AES.new(key, AES.MODE_CBC, '\00'*16)
plain_text = decryption_suite.decrypt(decoded_password)
print("Password is: {}".format(plain_text.strip()))
这是我运行程序时的问题。
user@computer:~/gpocrack-master$ python3 gpocrack.py LjFWQMzS3GWDeav7+0Q0oSoOM43VwD30YZDVaItj8e0
...Traceback (most recent call last)...
raise TypeError("Object type %s cannot be passed to C code" % type(data))
TypeError: Object type <class 'str'> cannot be passed to C code
在咨询了许多应该解决问题的“解决方案”之后,例如更改密钥的类型:key = b“
”
...Traceback (most recent call last)...
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (64 bytes)
4e9906e8fcb66cc9faf49310620620ffee8f496e806cc057999990209b09b09a4333b666666c1b 找到有关此问题的任何 clear 解释...
希望您能帮助我清楚地了解出了什么问题或帮助我解决问题。
感谢社区!
First of all, I would like to point out that I have already consulted the posts with a similar title / problem but after hours of research I still can't solve my problem.
Here is the program code:
import sys
import base64
from Crypto.Cipher import AES
if len(sys.argv) != 2:
print("Incorrect amount of arguments.")
print("Example of use:")
print("$ python {} LjFWQMzS3GWDeav7+0Q0oSoOM43VwD30YZDVaItj8e0".format(sys.argv[0]))
sys.exit()
cpassword = sys.argv[1]
while len(cpassword) % 4 > 0:
cpassword += "="
decoded_password = base64.b64decode(cpassword)
# This is a Microsoft hardcoded key used to decrypt GPO hash.
key = '\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b'
decryption_suite = AES.new(key, AES.MODE_CBC, '\00'*16)
plain_text = decryption_suite.decrypt(decoded_password)
print("Password is: {}".format(plain_text.strip()))
Here is the problem when I run the program.
user@computer:~/gpocrack-master$ python3 gpocrack.py LjFWQMzS3GWDeav7+0Q0oSoOM43VwD30YZDVaItj8e0
...Traceback (most recent call last)...
raise TypeError("Object type %s cannot be passed to C code" % type(data))
TypeError: Object type <class 'str'> cannot be passed to C code
After consulting many "solutions", supposed to solve the problem, for example changing the type of key : key = b"4e9906e8fcb66cc9faf49310620ffee8f496e806cc057990209b09a433b66c1b"
This time the problem is that :
...Traceback (most recent call last)...
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (64 bytes)
Having been to see on Internet I did not find any clear explanations concerning this problem...
I hope you will be help me to understand clearly what was wrong or help me solve the problem.
Thanks to the community!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论