Outputting hex values in python3

前端 未结 1 415
礼貌的吻别
礼貌的吻别 2021-01-23 21:55

I am writing shellcode exploits with python3. However, when I try and output some hex bytes. e.g. using the line - python3 -c \'print(\"\\x8c\")\' | xxd

The

相关标签:
1条回答
  • 2021-01-23 22:59

    Your issue arises because Python 3 handles strings as Unicode, and print expects Unicode to encode some output for your terminal. Try the following to bypass this:

    python3 -c "import sys; sys.stdout.buffer.write(b'\x8c')" | xxd
    
    0 讨论(0)
提交回复
热议问题