Created
September 11, 2017 06:19
-
-
Save 0x6d61/4f0f6455bf344f1a353ccc79a17b5d21 to your computer and use it in GitHub Desktop.
python obfuscator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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