Skip to content

Instantly share code, notes, and snippets.

@0x6d61
Created September 11, 2017 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x6d61/4f0f6455bf344f1a353ccc79a17b5d21 to your computer and use it in GitHub Desktop.
Save 0x6d61/4f0f6455bf344f1a353ccc79a17b5d21 to your computer and use it in GitHub Desktop.
python obfuscator
import sys
code = """for i in range(1,100):
if i%3 == 0 or "3" in str(i):
print("3!!!")
else:
print(i)"""
test = list(code)
def char_obfuscator(char):
zero = "+(()<())"
one = "+(()==())"
two = "+-~(()==())"
ten = "+(-~(()==()))*(-~(()==()))*(-~(()==()))+(()==())+(()==())"
char_ord = ord(char)
c = char_ord%10
if c == 0:
result = ''.join([ten for i in range(int(char_ord/10))])
else:
d = int((char_ord - c)/10)
r = c % 2
if r== 0:
result = (ten*d)+(two*int(c/2))
return result
else:
result = (ten*d)+(two*int((c-r)/2))+(one*r)
return result
return result
rlist = list(map(char_obfuscator,test))
print("exec({0} %({1}))".format("'%c'*"+str(len(rlist)),','.join(rlist)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment