能否将字节串连接到字符串中?
>>> b = b'this is bytes'
>>> s = 'this is string'
>>> b + s
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can't concat str to bytes
>>>
仅凭上面的简单代码是不可能实现的。
我之所以问这个问题,是因为我看到了一些将字节串连接到字符串的代码。以下是代码片段:
buf = ""
buf += "\xdb\xd1\xd9\x74\x24\xf4\x5a\x2b\xc9\xbd\x0e\x55\xbd"
buffer = "TRUN /.:/" + "A" * 2003 + "\xcd\x73\xa3\x77" + "\x90" * 16 + buf + "C" * (5060 - 2003 - 4 - 16 - len(buf))
你可以在这里查看全部代码。 http://sh3llc0d3r.com/vulnserver-trun-command-buffer-overflow-exploit/
type("\xdb\xd1\xd9\x74\x24\xf4\x5a\x2b\xc9\xbd\x0e\x55\xbd")
。 - juanpa.arrivillagabytes
只是str
的同义词。话虽如此,他发布的代码片段中并没有bytes
。 - blhsing