Difference between Python3 and Python2 - socket.send data

前端 未结 2 670
忘掉有多难
忘掉有多难 2020-12-20 23:18

I\'m practicing some buffer-overflow techniques and I came across an odd issue with sending socked data.

I have this two almost identical codes, except the fact that

2条回答
  •  粉色の甜心
    2020-12-20 23:29

    You can use six.b to make it compatible with both python2 and python3:

    import six
    
    ...
    sock.send(six.b(buffer))
    

    https://six.readthedocs.io/#six.b

提交回复
热议问题