PyFuck (yoyolin0409)
PyFuck is an Python Program Obfuscation Method by User:yoyolin0409. Also check out PyFuck and JSFuck so you'll know what I want to do. This Python Program Obfuscation Method only use the following valid characters: "rep=()[]+'*" and "eval", ".clear", ".count", "chr".
First, simply add `
from pathlib import PurePosixPath import operator truediv=operator.truediv exec(eval())
` and that's it.
How to make "<"?
repr(type(0))[0]
How to make ">"?
repr(type(0))[12]
How to make "-"?
repr(complex(1,operator.neg(1)))[2]
How to make ","?
chr(44)#...
How to make "."?
repr(float(0))[1]
How to make Alphabet?
True
[]=[] is True, ()=() is True, so T is repr(([]==[]))[0].
T=repr(([]==[]))[0] r=repr(([]==[]))[1] u=repr(([]==[]))[2] e=repr(([]==[]))[3]
False
[]=() is False, ()=[] is False, so F is repr(([]==()))[0].
F=repr(([]==()))[0] a=repr(([]==()))[1] l=repr(([]==()))[2] s=repr(([]==()))[3] e=repr(([]==()))[4]
Int Type Text
c=repr(type(0))[1] l=repr(type(0))[2] a=repr(type(0))[3] s=repr(type(0))[4] or repr(type(0))[5] Space=repr(type(0))[6] '=repr(type(0))[7] or repr(type(0))[12] i=repr(type(0))[8] n=repr(type(0))[9] t=repr(type(0))[10]
Float Type Text
/=repr(truediv(PurePosixPath("a"),PurePosixPath("b")))[16]
f=repr(type(1/2))[8]
l=repr(type(1/2))[9]
o=repr(type(1/2))[10]
a=repr(type(1/2))[11]
t=repr(type(1/2))[12]
Complex Type Text
j=chr(47) c=repr(type(1,1j))[8] o=repr(type(1,1j))[9] m=repr(type(1,1j))[10] p=repr(type(1,1j))[11] l=repr(type(1,1j))[12] e=repr(type(1,1j))[13] x=repr(type(1,1j))[14]
Where is "type"?
t=repr(eval('[].clear'))[5]
y=chr(121)#...
p=repr(eval('().count'))[28]
e=repr(eval('[].clear'))[14]
How to get number?
1=int([]=[]) 2=int([]=[])+int([]=[]) 100=((int([]==[])+int([]==[])+int([]==[])+int([]==[])+int([]==[]))*(int([]==[])+int([]==[])))**(int([]==[])+int([]==[]))
Tips
Think carefully about where the strings and parentheses are in your code.
Exmaple
Output "a"
First Step
exec(eval('"'+'p'+'"'+'+'+'"'+'r'+'"'+'+'+'repr(type(0))[8]'+'+'+'repr(type(0))[9]'+'+'+'repr(type(0))[10]'+'+'+'"'+'('+'"'+'"'+"'"+'"'+'+'+'repr(([]==()))[1]'+'+'+'"'+"'"+'"'+'"'+')'+'"'))
........
Last Step
In normal circumstances, the first step is enough. If you really replace all the characters, what about the last few...? Haha, it's "chr". In the end, the program will become a mess of "chr", "+", "=", "[]", and "()". And that's the end. It has already been proven that Python can actually use only chr(), but I made it more complicated. There is no example that can get to the last step because it's too complicated.