我输入了错误的代码,找不到修复程序。
49 os.system('powershell -enc
'+base64.b64encode(addpermissions.encode('utf_16_le')))
.
.
.
137 HexRegHash, HexRegSysk, jd, skew1, gbg, data = getRegistryValues(HexRID)
我遇到此错误:
Traceback (most recent call last):
File "hash.py", line 137, in <module>
HexRegHash, HexRegSysk, jd, skew1, gbg, data =
getRegistryValues(HexRID)
File "hash.py", line 49, in getRegistryValues
os.system('powershell -enc
'+base64.b64encode(addpermissions.encode('utf_16_le')))
TypeError: can only concatenate str (not "bytes") to str
答案 0 :(得分:0)
base64.b64encode
产生字节流,而不是字符串。因此,要进行串联,必须先使用str(base64.b64encode(addpermissions.encode('utf_16_le')))
b64cmd = base64.b64encode(cmd.encode('utf_16_le')).decode('utf-8')
os.system('powershell -enc ' + b64cmd)
编辑:正常的字符串转换不适用于os.system,而是使用decode('utf-8')