How to accept backslashes in raw input

190 Views Asked by At

I'm writing a little program with optparse. It should format shellcode. The problem is, that python doesn't accept e.g "\x31" as argument and interpret it as "x31". Of course it is possible to build a workarround.

But is there a way to work with an input like so?:

python prog.py -t \x31\xCA

print(args) => '\x31\xCA'

1

There are 1 best solutions below

0
snek_case On BEST ANSWER

Use quotation marks: python prog.py -t "\x31\xCA"