#esoteric-python
1 messages · Page 102 of 1
!e
__debug__ = False
print("test")```
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | SyntaxError: cannot assign to __debug__
ef
go to your command line
!e
print(_:={"__debug__":False}["__debug__"])
and write python and then write print(__debug__) it should be True
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
False
exit, and write python -O, and print(__debug__) it should be False
interesting
interesting
what does the -o mean?
-O : remove assert and __debug__-dependent statements; add .opt-1 before .pyc extension; also PYTHONOPTIMIZE=x
wack
!e
"attempt at an infinite loop with a list comprehension without memError #4390" print(_:=["_"], (_, _.append(_), _.pop())for _ in _)
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print(_:=["_"], (_, _.append(_), _.pop())for _ in _)
003 | ^
004 | SyntaxError: Generator expression must be parenthesized
hm
!e
print([[i.append("e"), i.pop(0), print("e")][2] for i in [["e"]] for j in i])
huh
!e
print([[i.remove("e"), i.add("e"), print("e"), i][3] for i in [{"e"}] for j in i])
why i.pop(0)? doesnt .pop already just pop the last item in the list
i.pop(0) pops the first element
oh
!e
print([[i.remove("e"), i.add("e"), print("e"), i][3] for i in [{"e"}] for j in i])
!d set
!e
print([[i.clear(), i.add(__import__("random").choice("1239ajv90jeq909qjvj9qej")), print("e"), i][3] for i in [{"e"}] for j in i])
forgot a "
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | e
002 | e
003 | [{'j'}, {'j'}]
!e
print(lambda x: if (y := 6) == x: ...)
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(lambda x: if (y := 6) == x: ...)
003 | ^
004 | SyntaxError: invalid syntax
walrus no worky in lambda 😭
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Ellipsis
wack
how does walruses work in list comprehension?
its one of the things i use in my obfuscation algorithm to generate print statements
!e
print(chr(ord(True.__str__()[0]).__sub__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__()))))))))))))).__add__(chr(ord(True.__str__()[1]).__sub__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True.__int__().__add__(True))))))))))))))).__add__((....__class__().__str__())[2]).__add__(....__class__().__str__()[2]).__add__(chr(ord(True.__str__()[1]).__sub__(True.__int__().__add__(True.__int__().__add__(True.__int__()))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Hello
__debug__.__bool__().__int__()
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name '__path__' is not defined
__bool__ not bool()
well true == 1 so anything that returns true yea
!e
print(__name__.__bool__.__int__())```
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: 'str' object has no attribute '__bool__'
?
i just used ascii values from the string True in this
bool() falls back to __len__ if __bool__ doesnt exist iirc
!e
print(__name__)
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
__main__
!e
print(__name__.__str__()[0])
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
_
!e print(__name__.__len__().__bool__().__int__())
@next flame :white_check_mark: Your eval job has completed with return code 0.
1
interesting
!e
print(__name__.__bool__())
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: 'str' object has no attribute '__bool__'
quirky
!e
py print(chr(ord(__name__.__len__().__bool__().__str__()[0]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))))))))).__add__(chr(ord(__name__.__len__().__bool__().__str__()[1]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__()))))))))))))))).__add__((....__class__().__str__())[2]).__add__(....__class__().__str__()[2]).__add__(chr(ord(__name__.__len__().__bool__().__str__()[1]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | py print(chr(ord(__name__.__len__().__bool__().__str__()[0]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))))))))).__add__(chr(ord(__name__.__len__().__bool__().__str__()[1]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(
... (truncated - too long)
Full output: https://paste.pythondiscord.com/siyinixedu.txt
um
wait oh
invalid syntax
!e
print(chr(ord(__name__.__len__().__bool__().__str__()[0]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))))))))).__add__(chr(ord(__name__.__len__().__bool__().__str__()[1]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__()))))))))))))))).__add__((....__class__().__str__())[2]).__add__(....__class__().__str__()[2]).__add__(chr(ord(__name__.__len__().__bool__().__str__()[1]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Hello
pretty cool
now just need to get rid of those pesky numbers
and boom
greatest obfsc algorithm out there
oh i put 3
!e
print(__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__().__add__(_:=__name__.__len__().__bool__().__int__()))))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
10
!e
print(bool(__doc__))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
False
!e
print(__doc__.__bool__().__int__())
@sick hound :white_check_mark: Your eval job has completed with return code 0.
0
here's a 0
!e
print(__doc__.__bool__().__add__(__name__.__len__().__bool__().__int__()))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
1
lmfao
you know your codes good when theres more underscores then any other character
!e
print(chr(ord(__name__.__len__().__bool__().__str__()[__doc__.__bool__().__int__()]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))))))))).__add__(chr(ord(__name__.__len__().__bool__().__str__()[__name__.__len__().__bool__().__int__()]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__()))))))))))))))).__add__((....__class__().__str__())[__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())]).__add__(....__class__().__str__()[__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())]).__add__(chr(ord(__name__.__len__().__bool__().__str__()[__name__.__len__().__bool__().__int__()]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Hello
faq
there's still a 2
!e
print(chr(ord(__name__.__len__().__bool__().__str__()[__doc__.__bool__().__int__()]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))))))))).__add__(chr(ord(__name__.__len__().__bool__().__str__()[__name__.__len__().__bool__().__int__()]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__()))))))))))))))).__add__((....__class__().__str__())[__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())]).__add__(....__class__().__str__()[__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())]).__add__(chr(ord(__name__.__len__().__bool__().__str__()[__name__.__len__().__bool__().__int__()]).__sub__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Hello
oh yes
!e
eval(chr(112).__add__(chr(114).__add__(chr(105).__add__(chr(110).__add__(chr(116).__add__(chr(40).__add__(chr(34).__add__(chr(72).__add__(chr(101).__add__(chr(108).__add__(chr(108).__add__(chr(111).__add__(chr(44).__add__(chr(32).__add__(chr(87).__add__(chr(111).__add__(chr(114).__add__(chr(108).__add__(chr(100).__add__(chr(33).__add__(chr(34).__add__(chr(41).__add__(chr(10).__add__(""))))))))))))))))))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Hello, World!
numbers
this was my old obfuscation algorithm
literally just
letter = ord(letter) letter = f"chr({letter}).__add__(" parentheses_count += 1
generates stuff like this but i broke it earlier by feeding it random stuff
ah lmfao
also not sure why but this one only understands single line statements
translated its just print("Hello, World!")
lmfao
full output of it is this
tbf that obf algo wouldn't be too bad
a bunch of random variables so anyone trying to dump it gets them
to decompile
!e
print(__import__("codecs").decode("uggcf://zrqvn.qvfpbeqncc.arg/nggnpuzragf/781621755261353995/802537966877933578/vzntr0.wct", "rot13"))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
https://media.discordapp.net/attachments/781621755261353995/802537966877933578/image0.jpg
which translates to trollar
ah its my global trollar algorithm
lmfao
def trollarglobal(count): global msg msg = "global trollar;" msg = msg*(int(count))
then you call it with random.randint
i see
either way you gotta use them improvements smh, no need for random Trues or random numbers!!!
!e
2.__mul__(3)
huh
is there no such thing as mult
its __mul__
ah
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | 2.__mul__(3)
003 | ^
004 | SyntaxError: invalid syntax
!e
print(very_real_constant:=(__import__(\"base64\").b64decode(\"InRyb2xlZCI=\")))
oh
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | SyntaxError: unexpected character after line continuation character
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | SyntaxError: unexpected character after line continuation character
waht
wha
!e
-1.__abs__()
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | -1.__abs__()
003 | ^
004 | SyntaxError: invalid syntax
!e
print((__import__("base64").b64decode("InRyb2xlZCI=")))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
b'"troled"'
troled
why is it a binary?
!e
print(__doc__.__bool__().__int__().__sub__(__name__.__len__().__bool__().__int__()))
oop
uhhh
scammeddd
wait no
i'm just dumb
!e
print(__doc__.__bool__().__int__().__mul__(__name__.__len__().__bool__().__int__()))
there
!e
print(__doc__.__bool__().__int__().__mul__(__name__.__len__().__bool__().__int__()))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
0
!e
print((__doc__.__bool__().__int__().__sub__(__name__.__len__().__bool__().__int__())).__str__()[3])
huh
!e
print((doc.bool().int().sub(name.len().bool().int())).str()[0])
@sick hound :white_check_mark: Your eval job has completed with return code 0.
-
yep
ah nice
yea lol
wonder how i can convert python functions into a string and get characters inside them
True -> __name__.__len__().__bool__()
0 -> __doc__.__bool__().__int__()
1 -> __name__.__len__().__bool__().__int__()
2 -> __name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())
etc etc
!e
print(__main__.__bool__())
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name '__main__' is not defined
huh
!e
print((__name__)if(__name__)==(__main__)else(print("hi")))
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name '__main__' is not defined
i guess so
!e
print((name)if(name)==("main")else(print("hi")))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__main__
also for the long numbers
never really understood the concept of if __name__ == __main__
you could try to use __mul__ and do prime factorization
anything under that if statement will run if the file is being ran directly, not imported
there's also __pow__
theres probably so many dunder methods i can abuse but dont know how
there's a bunch
there's A LOT
!e
print(0.__truediv__(0)) # troll
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(0.__truediv__(0)) # troll
003 | ^
004 | SyntaxError: invalid syntax
what
0 . or (0).
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ZeroDivisionError: division by zero
troled
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
True
or is that possible
@tribal moon :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: 'int' object has no attribute '__not__'
hm
what does __not__ apply to
!e
print(__debug__.__rshift__(__debug__))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
0
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(True.__int__().(dir(bool)[1]))
003 | ^
004 | SyntaxError: invalid syntax
damn
use getattr
?
also you don't have to use __int__()
yea ik im just used to using it
maybe try getattr(True, dir(bool)[1])
!e
print(getattr(True, dir(bool)[1]))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
<method-wrapper '__add__' of bool object at 0x7f8c57896180>
bool has __gt__??
!e
print((_) if True.__bool__().__gt__(True.__bool__().__int__()))
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print((_) if True.__bool__().__gt__(True.__bool__().__int__()))
003 | ^
004 | SyntaxError: invalid syntax
damn i guess i just forgot how to do that
use __gt__ effectively
that looks cool
what is the (_) for?
oh its undefined
I managed to make an object self such that
print((n:=[__import__('random').randint(1,100)for _ in range(100)]),(lambda l:None if len(l)<1 else l[0]if len(l)==1 else self(l[0]>l[1]and[l[0]]+l[2:]or l[1:]))(n),sep='\n')
returns
[30, 47, 66, 49, 82, 36, 85, 69, 36, 84, 92, 5, 19, 2, 91, 25, 57, 68, 93, 60, 86, 65, 10, 18, 22, 52, 8, 50, 30, 7, 75, 69, 91, 27, 11, 5, 92, 81, 50, 89, 80, 22, 15, 36, 42, 62, 37, 6, 93, 94, 35, 33, 39, 58, 59, 15, 90, 79, 45, 56, 22, 20, 57, 37, 82, 32, 47, 95, 53, 46, 96, 96, 13, 43, 10, 86, 43, 44, 49, 94, 12, 86, 60, 19, 18, 95, 4, 41, 76, 14, 52, 72, 46, 85, 27, 78, 75, 14, 5, 69]
96
Your challenge for today is to figure out how I did it ahahahaha
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
lel
!e ```py
print(dir(debug))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
!e ```py
print(debug)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
True
oh ye I should paste some things I worked on before knowing this server exists
!e
print((lambda f: lambda x: '' if x == 0 else (lambda f: lambda x: '' if x == 0 else '*' + f(f)(x - 1))(lambda f: lambda x: '' if x == 0 else '*' + f(f)(x - 1))(x) + '\n' + f(f)(x - 1))(lambda f: lambda x: '' if x == 0 else (lambda f: lambda x: '' if x == 0 else '*' + f(f)(x - 1))(lambda f: lambda x: '' if x == 0 else '*' + f(f)(x - 1))(x) + '\n' + f(f)(x - 1))(5), end="")
@lavish shore :white_check_mark: Your eval job has completed with return code 0.
001 | *****
002 | ****
003 | ***
004 | **
005 | *
yay
!e print(dir)
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
<built-in function dir>
!e print(dir(complex))
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__bool__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', 'conjugate', 'imag', 'real']
!e ```py
=4
a=lambda:+=1
a()
print(_)
@floral meteor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | a=lambda:_+=1
003 | ^
004 | SyntaxError: invalid syntax
haw
!e ```py
=4
a=lambda :+=1
a()
print(_)
@toxic jewel :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | a=lambda _:_+=1
003 | ^
004 | SyntaxError: invalid syntax
huh
can u try +1 instead of +=1
does int have some sort of increment fcn?
that mutates it, not returns a new instance
then i'll have to make one
And negative even smaller ones.
!e ```py
class (int):
def INC(s):s+=1;return s
def DEC(s):s-=1;return s
__=(4)
.INC()
print()
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
4
what even
me thonk hang on
me still thonk
alright now I type
neh
my last two brain cells are like...
https://open.spotify.com/track/5tkmVEqglyP80CsQI8ggMT?si=srqxdHqGQ4aqxmllZ61DeQ
no spoilers pls but it looks like black magic to me
is it ||self = (lambda x:max(x)) ||?
I might need more example outputs considering how every time the list is random...
!e ```py
from sys import _getframe
ftyp = type(lambda:0)
def self(*args, **kwargs):
f = _getframe(1)
return ftyp(f.f_code, f.f_globals)(*args, **kwargs)
n = [30, 47, 66, 49, 82, 36, 85, 69, 36, 84, 92, 5, 19, 2, 91, 25, 57, 68, 93, 60, 86, 65, 10, 18, 22, 52, 8, 50, 30, 7, 75, 69, 91, 27, 11, 5, 92, 81, 50, 89, 80, 22, 15, 36, 42, 62, 37, 6, 93, 94, 35, 33, 39, 58, 59, 15, 90, 79, 45, 56, 22, 20, 57, 37, 82, 32, 47, 95, 53, 46, 96, 96, 13, 43, 10, 86, 43, 44, 49, 94, 12, 86, 60, 19, 18, 95, 4, 41, 76, 14, 52, 72, 46, 85, 27, 78, 75, 14, 5, 69]
print((lambda l:None if len(l)<1 else l[0]if len(l)==1 else self(l[0]>l[1]and[l[0]]+l[2:]or l[1:]))(n))
@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.
96
@floral meteor ^
🤯
self when called, basically calls its calling function, ie py def f(): f() would be the same as py def f(): self()
noice
@floral meteor now implement _getframe with no imports
hehe nope
Why not?
Here's a hint, trace back objects have a reference to the current frame
And frame objects can be stepped up
huh. k.
here was my sys implementation, but with extra
class _self_reference():
def __call__(self,*args,**kwargs):f=lambda *a,**k:None;f.__code__=__import__('sys')._getframe(1).f_code;return f(*args,**kwargs)
__getitem__ =lambda self,n:lambda*args,**k:[((f:=(lambda*a,**w:None)).__setattr__("__code__",__import__('sys')._getframe(n+1).f_code)),f][1](*args,**k)
self=_self_reference()
you can input by self[n](*args,**kwargs)
I never looked into this side of Python tbh
I guess I should type dir(x) more
yes
!e ```py
try: 1/0
except ZeroDivisionError as cursed: print(dir(cursed.traceback.tb_frame.f_code))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'co_argcount', 'co_cellvars', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', 'co_kwonlyargcount', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_posonlyargcount', 'co_stacksize', 'co_varnames', 'replace']
ahhaaaahhahahahahahahahah MUAHAHAHAHAAHAHA
writes note to self to recursively call dir on things
tree traversal 😈
!e ```py
try: raise Exception
except Exception as e:print(e.traceback.tb_frame.f_back)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'f_back', 'f_builtins', 'f_code', 'f_globals', 'f_lasti', 'f_lineno', 'f_locals', 'f_trace', 'f_trace_lines', 'f_trace_opcodes']
(f_back is None is the frame is the uppermost frame)
Rot13 is dumb thxbye
I updated it, now it delegates to int
!e
print(str((3).__add__(((__import__("random").randint(1,10000000), __import__("random").randint(1,10000000).__floordiv__)))))
@plucky wedge :white_check_mark: Your eval job has completed with return code 0.
NotImplemented
your trying to add a tuple of (int, methodtype)
!e
print(str((3).__add__((__import__("random").randint(1,10000000), __import__("random").randint(1,10000000).__floordiv__))))
@plucky wedge :white_check_mark: Your eval job has completed with return code 0.
NotImplemented
!e
print((__debug__.__bool__().__int__().__add__((__debug__.__bool__().__int__().__add__((__debug__.__bool__().__int__()))))).__str__().__add__(__import__("random").randint(__debug__.__bool__().__int__(), __debug__.__bool__().__int__().__str__().__mul__(10000000.__str__()))))
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print((__debug__.__bool__().__int__().__add__((__debug__.__bool__().__int__().__add__((__debug__.__bool__().__int__()))))).__str__().__add__(__import__("random").randint(__debug__.__bool__().__int__(), __debug__.__bool__().__int__().__str__().__mul__(10000000.__str__()))))
003 | ^
004 | SyntaxError: invalid syntax
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
!e
print(__debug__.__bool__().__doc__)
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
001 | bool(x) -> bool
002 |
003 | Returns True when the argument x is true, False otherwise.
004 | The builtins True and False are the only two instances of the class bool.
005 | The class bool is a subclass of the class int, and cannot be subclassed.
try doing import this
!e
import this
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
001 | The Zen of Python, by Tim Peters
002 |
003 | Beautiful is better than ugly.
004 | Explicit is better than implicit.
005 | Simple is better than complex.
006 | Complex is better than complicated.
007 | Flat is better than nested.
008 | Sparse is better than dense.
009 | Readability counts.
010 | Special cases aren't special enough to break the rules.
011 | Although practicality beats purity.
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ocazuwoqob.txt
that returns hello world right
what does that do
it's the same as !=
i already like it
!e ```py
from future import barry_as_FLUFL
print(1 <> 2)```
@tribal moon :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | print(1 <> 2)
003 | ^
004 | SyntaxError: invalid syntax
whats Barry_as_FLUFL lol
what
It was an Arpil's Fools joke, saying Guido van Rossum retired as BDFl (benevolent dictator for life), and having Barry Warsaw (I think) as FLUFL (friendly language uncle for life)
i thought the future was pointless
!e
print((<> := !=), ! <> 2)
one of the things was the <> operator
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print((<> := !=), ! <> 2)
003 | ^
004 | SyntaxError: invalid syntax
sad
are there any other secret operators or keywords in Python?
I'm not sure there are
what was the last keyword you learnt
it works in my terminal
yeah the bot doesn't work with <>
it's because <> messes everything up
if you restart your shell, you'll still be required to use <>
point is: __future__ has all kinds of backports from Python 3 to Python 2, or even between version to increase backwards compatibility
oh, I got one
I don't think future is useful now?
!e ```py
from future import braces
maybe back in the days of early Python 3
@naive roost :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | SyntaxError: not a chance
lmao
one major thing in the transition from Python 2 to Python 3 was from __future__ import print_function (if I remember correctly)
!e
import __future__; print(dir(__future__))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['CO_FUTURE_ABSOLUTE_IMPORT', 'CO_FUTURE_ANNOTATIONS', 'CO_FUTURE_BARRY_AS_BDFL', 'CO_FUTURE_DIVISION', 'CO_FUTURE_GENERATOR_STOP', 'CO_FUTURE_PRINT_FUNCTION', 'CO_FUTURE_UNICODE_LITERALS', 'CO_FUTURE_WITH_STATEMENT', 'CO_GENERATOR_ALLOWED', 'CO_NESTED', '_Feature', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'absolute_import', 'all_feature_names', 'annotations', 'barry_as_FLUFL', 'division', 'generator_stop', 'generators', 'nested_scopes', 'print_function', 'unicode_literals', 'with_statement']
wow i didnt expect that to work not gonna lie
oh, right, the with statement too
!e
import __future__ as f; print(dir(f.__doc__))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
__future__ is kind of a meta-module that modifies Python's behaviour for compatibility with future code
there's also antigravity
it's cute, but probably won't work well here
it can't
!e
import __future__ as f; print(dir(f.__doc__.__bool__()))
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: 'str' object has no attribute '__bool__'
aw i thought it would return true
thought i had even more characters to feed into my equation-inator 😔
rn it just generates long equations like these, any tips on making it longer?
!e
print(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__().__add__(_:=__debug__.__bool__().__int__()))))))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
12
oh, wow, I just looked at the changelog for Python 3.9, and the parser had trouble with != in debug mode when barry_as_FLUFL was imported. They corrected it because people they knew would still do stupid things with it 😂
__future__ imports aren’t actual imports
they change Python's behaviour too much to be considered simply imports
I believe strings dont have a __bool__ because it has a __len__ and that can be used to determine whether a value is truthy or falsey, if __len__ is 0 it's falsey, otherwise it's truthy (if no __bool__ is defined ofc)
They are detected early in the compilation in order to enable an experimental feature
They don’t actually run
That’s True
!e
import __future__ as f; print(dir(f.__doc__.__str__().__len__()))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
you call dir on the int
you're returning dir(int)
oh lol
!e
print(__import__("__future__").__doc__.__str__().__len__().__int__().__bool__())
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
True
obfuscate the string
oh yes
turn it into dunders
i need to feed this into my equation-ator
!e
print(__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__().__add__(_:=__import__("__future__").__doc__.__str__().__len__().__int__().__bool__()))))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
10
muahahahahaha
That could make a really nice design, if each function was highlighted in a different color
heres the source code btw
import sys
with open("writeoff.txt", "w") as f:
temp=int(sys.argv[1])-2
f.write("print(__import__(\"__future__\").__doc__.__str__().__len__().__int__().__bool__().__add__(")
for i in range(temp):
f.write("_:=__import__(\"__future__\").__doc__.__str__().__len__().__int__().__bool__().__add__(")
f.write("_:=__import__(\"__future__\").__doc__.__str__().__len__().__int__().__bool__()" + ")" * int(temp+2))
you can doc a lot of python modules
Don’t encourage him 
Well done! Do more! 
anyone know some really long built in imports i can abuse?
!e
import rlcompleter; print(dir(rlcompleter))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['Completer', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__main__', '__name__', '__package__', '__spec__', '_readline_available', 'atexit', 'builtins', 'get_class_members', 'readline']
!e
``import rlcompleter; print(rlcompleter.doc.str().len().int().bool())`
@sudden willow :warning: Your eval job has completed with return code 0.
[No output]
huh
?
why none
idek lol
!e
import rlcompleter; print(rlcompleter.__doc__.__str__().__len__().__int__().__bool__())
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
True
oh its because i put `
!e
!e import rlcompleter; print(rlcompleter.doc.str().len().int())`
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | !e
003 | ^
004 | SyntaxError: invalid syntax
is a thing
i guess
!e
import rlcompleter; print(rlcompleter.doc.str().len().int())
ah i just got rid of all my underscores
!e
import rlcompleter; print(rlcompleter.__doc__.__str__().__len__().__int__())
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
1329
docs change length so you probably shouldn't use them l o l
i like future more bcuz more underscores
im converting the big number from len to a bool which == True
could round it off by dividing it by itself implementing even more dunders
.
you should do random dunders
so like
there's __name__
and then __future__.__doc__()
etc etc
wack
!e
import rlcompleter; print((rlcompleter.__doc__.__str__().__len__().__int__().__truediv__(rlcompleter.__doc__.__str__().__len__().__int__()).__bool__().__int__()))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
True
now thats what i like to see
!e print((import("rlcompleter").doc.str().len().int().truediv(import("rlcompleter").doc.str().len().int()).bool()))
wait
oop
@sick hound :white_check_mark: Your eval job has completed with return code 0.
True
more
im using this for refrence https://docs.python.org/3/py-modindex.html
trying to find long imports
wait __main__ is an import??
it is?
!e
print(dir(__import__("__main__")))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__']
btw could you send me your obfsc algo
its on my other pc
ah rip
or my number algorithm?
numbers are easy enough
yea
its my algorithm to generate long equations 1 at a time
very old piece of code now lol
!e
def get_whole_num(num):
if num == 0:
return "__doc__.__bool__().__int__()"
return f"__name__.__len__().__bool__().__int__().__add__({get_whole_num(num-1)})"
print(get_whole_num(5))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__doc__.__bool__().__int__())))))
ooh
thats good
think im gonna add random to my code so itll vary between __name__.__len__().__bool__().__int__() and others like that such as __debug__.__int__()
lmao
!e
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
print(prime_factors(20))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
[2, 2, 5]
kk
im on a chromebook with no enter key nor left arrow key this is so challenging
!e
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
print(prime_factors(20))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
{2: 2, 5: 1}
kk
can i fit a += into a lambda or is that not possible
was thinking of having like a _subtractasciivalue(value) and an _addasciivalue(value) inside a print
!e
print(
_addasciivalue := lambda value: value += __debug__.__int__(),
_subtractasciivalue := lambda value: value -= __debug__.__int__()
)
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | _addasciivalue := lambda value: value += __debug__.__int__(),
003 | ^
004 | SyntaxError: invalid syntax
:(
just use .iadd
!e
def get_whole_num(num):
if num == 1:
return "__name__.__len__().__bool__().__int__()"
return f"__name__.__len__().__bool__().__int__().__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mult__({foo(prime_factors)})"
print(foo({2: 2, 3: 2}))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))
!e print(name.len().bool().int().add(name.len().bool().int()).pow(name.len().bool().int().add(name.len().bool().int())))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
4
kk
I wanna make a dunder code obfuscator
and add it to my lambda obfuscator I finished a long time ago
so like value.__iadd__()?
!e
def get_whole_num(num):
if num == 1:
return "__name__.__len__().__bool__().__int__()"
return f"__name__.__len__().__bool__().__int__().__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mult__({foo(prime_factors)})"
print(foo({2: 2, 3: 2}))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__mult__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))
!e print(name.len().bool().int().add(name.len().bool().int()).pow(name.len().bool().int().add(name.len().bool().int())).mult(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int())).pow(name.len().bool().int().add(name.len().bool().int()))))
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: 'int' object has no attribute '__mult__'
!e
def get_whole_num(num):
if num == 1:
return "__name__.__len__().__bool__().__int__()"
return f"__name__.__len__().__bool__().__int__().__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mul__({foo(prime_factors)})"
print(foo({2: 2, 3: 2}))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__mul__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))
!e name.len().bool().int().add(name.len().bool().int()).pow(name.len().bool().int().add(name.len().bool().int())).mul(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int())).pow(name.len().bool().int().add(name.len().bool().int())))
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
oops
!e print(name.len().bool().int().add(name.len().bool().int()).pow(name.len().bool().int().add(name.len().bool().int())).mul(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int())).pow(name.len().bool().int().add(name.len().bool().int()))))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
36
oh nice
!e
print(
_addasciivalue := lambda value: value.__iadd__(__debug__.__int__()),
_addasciivalue(1)
)
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 3, in <module>
003 | File "<string>", line 2, in <lambda>
004 | AttributeError: 'int' object has no attribute '__iadd__'
!e print(dir(int))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
!e
def get_whole_num(num):
if num == 1:
return "__name__.__len__().__bool__().__int__()"
return f"__name__.__len__().__bool__().__int__().__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mul__({foo(prime_factors)})"
def get_big_num(num):
return foo(prime_factors(num))
print(get_big_num(300))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__mul__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__pow__(__name__.__len__().__bool__().__int__()).__mul__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))))
rip python
l o l
wait no my internet just bad
!e print(name.len().bool().int().add(name.len().bool().int()).pow(name.len().bool().int().add(name.len().bool().int())).mul(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int())).pow(name.len().bool().int()).mul(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int().add(name.len().bool().int())))).pow(name.len().bool().int().add(name.len().bool().int())))))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
300
very cool
there's a dunder num gen if you want
this is like church encoding but worse
lmfao
*slightly optimized dunder num gen
!e
print(
_addasciival := lambda value: (
new_value := value += 1,
print(new_value)
@sudden willow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | new_value := value += 1,
003 | ^
004 | SyntaxError: invalid syntax
whyyyyyyyyyyyyyy
won't work here
!e
print(
_addasciival := lambda value: (
new_value := value.__add__(True.__int__()),
print(new_value)
)
yes another ) missing
oh yea lmfao
going to repl 😎
!e
print(
_addasciival := lambda value: (
new_value := value.__add__(True.__int__()),
print(new_value)
)(1))```
oh i need to call it
!e
print(
_addasciival := lambda value: (
new_value := value.__add__(True.__int__()),
print(new_value)),
_addasciival(True.__int__())
)
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
001 | 2
002 | <function <lambda> at 0x7f4e85833040> (2, None)
not sure how to make it not print the function address
wait
!e
print(
(_addasciival := lambda value: (
new_value := value.__add__(True.__int__()),
print(new_value)
))(1))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | 2
002 | (2, None)
not too worried about it tho
?
the <function <lambda> at 0x7f4e85833040> (2, None)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
2
there?
wait i dont need to print inside print do i
!e
print(
(_addasciival := lambda value: (
new_value := value.__add__(True.__int__())),
_addasciival(True.__int__())
))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
(<function <lambda> at 0x7f55d8b2c040>, 2)
nice
!e
print(
(_addasciival := lambda value: (
new_value := value.__add__(True.__int__())),
_addasciival(True.__int__())
)[1])```
huh
@sick hound :white_check_mark: Your eval job has completed with return code 0.
2
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
btw can you give me all the ways that you can think of getting 1 with dunders?
!e
from random import choice
def get_whole_num(num):
a = ["__name__.__len__().__bool__().__int__()"]
if num == 1:
return choice(a)
return f"{choice(a)}.__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mul__({foo(prime_factors)})"
def get_big_num(num):
return foo(prime_factors(num))
print(get_big_num(300))```
!e
from random import choice
def get_whole_num(num):
a = ["__name__.__len__().__bool__().__int__()"]
if num == 1:
return choice(a)
return f"{choice(a)}.__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mul__({foo(prime_factors)})"
def get_big_num(num):
return foo(prime_factors(num))
def convert_word(word):
if len(word) == 1: return f"chr({get_big_num(ord(word))})"
return f"chr({get_big_num(ord(word))}).__add__({convert_word(word[1:])})"
print(convert_word("Hello World"))```
uh
to pycharm we go
@sick hound ord() accepts one character
!e
def get_whole_num(num):
a = ["__name__.__len__().__bool__().__int__()"]
if num == 1:
return choice(a)
return f"{choice(a)}.__add__({get_whole_num(num-1)})"
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return {i:factors.count(i) for i in factors}
def foo(prime_factors):
if len(prime_factors) == 1:
return f"{get_whole_num(list(prime_factors.keys())[0])}.__pow__({get_whole_num(list(prime_factors.values())[0])})"
a = list(prime_factors.keys())[0]
return f"{get_whole_num(a)}.__pow__({get_whole_num(prime_factors.pop(a))}).__mul__({foo(prime_factors)})"
def get_big_num(num):
return foo(prime_factors(num))
def convert_word(word):
if len(word) == 1: return f"chr({get_big_num(ord(word))})"
return f"chr({get_big_num(ord(word[0]))}).__add__({convert_word(word[1:])})"
print(convert_word("Hello World"))```
wait oh i could
but i just did recursion
cause it's easier
!rule 2
2. Follow the Python Discord Code of Conduct.
woa that rule seems really important..
whoaa
up to 11k pages
amazing
the CoC doesn't prohibit swearing
thank fr*ck
whatdafaq
hm
time to find an algo
that
hm
convert to binary and try that way?
actually ternary
!e
print(
(editascii := lambda x: editedvalue := x.__add__(__debug__.__int__())), editascii(__import__("__future__").__doc__.__str__().__len__().__int__()))
hm
!e
print(
((editascii := lambda x: editedvalue := x.__add__(__debug__.__int__())), editascii(1))[1])
wdymmmmmmmmm
kekw
well presumably the character that it's pointing at is the invalid one
try adding brackets around the assignment expression
:= is literally the lowest-precedence operator in the language, so lambda x: y := z is equivalent to (lambda x: y) := (z)
!e
from random import choice
from math import log
def basic_num(num):
a = ["__name__.__len__().__bool__().__int__()"]
c = ["__doc__.__bool__().__int__()"]
if num == 0:
return choice(c)
b = [choice(a) for _ in range(num)]
return b.pop(0) + ''.join(map(lambda x: f".__add__({x})", b))
def optimised_num(num):
a = []
while num > 5:
pows = [int(log(num) / log(i)) for i in range(2, 6)]
nums = [(i + 2) ** j for i, j in enumerate(pows)]
max_ = max(nums)
num -= max_
i = nums.index(max_)
a.append(f"{optimised_num(i + 2)}.__pow__({optimised_num(pows[i])})")
a.append(basic_num(num))
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
def convert_string(word):
a = [f"chr({optimised_num(ord(i))})" for i in word]
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
print(convert_string("__future__"))
nice
@sick hound :white_check_mark: Your eval job has completed with return code 0.
chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()))).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()))).__add__(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__le
... (truncated - too long)
Full output: https://paste.pythondiscord.com/utogezunun.txt
now instead of chr, make it dunders
Any difference between a magic method and a dunder?
they are just different names
Manually implement chr for the characters u need
If that's possible I feel it'll be very ugly
can't
cause that'll require strings
and chr > strings
!e
from random import choice
from math import log
def basic_num(num):
a = ["__name__.__len__().__bool__().__int__()"]
c = ["__doc__.__bool__().__int__()"]
if num == 0:
return choice(c)
b = [choice(a) for _ in range(num)]
return b.pop(0) + ''.join(map(lambda x: f".__add__({x})", b))
def optimised_num(num):
a = []
while num > 5:
pows = [int(log(num) / log(i)) for i in range(2, 6)]
nums = [(i + 2) ** j for i, j in enumerate(pows)]
max_ = max(nums)
num -= max_
i = nums.index(max_)
a.append(f"{optimised_num(i + 2)}.__pow__({optimised_num(pows[i])})")
a.append(basic_num(num))
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
def convert_string(word):
a = [f"chr({optimised_num(ord(i))})" for i in word]
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
print(eval(convert_string("__future__")))
oop
a dunder is not always a magic method, but a magic method is always a dunder
for instance __class__ is a dunder attribute to an instance
!e ```py
print((0).class)
Ohh dunder is referring to the use of double underscore eh?
Thanks c:
simply "double under", yeah
I can make one for you
how?
here: py __builtins__.__dict__[__builtins__.__dir__()[__debug__.__add__(__debug__).__rmul__(().__class__.__name__.__len__()).__add__((__debug__.__add__(__debug__)).__add__((__debug__.__add__(__debug__))))]]
this should work
I remember you can encode and decode like that with memoryview and bytearray
I don't remember how to do it anymore
the fuck is this
def chr(n):
return __name__.__class__.__call__(b'__magic__'.__class__.__call__((n,)), 'ascii')
``` there is more room left for obfuscation, but this is a nice start (only works fore ascii)
picking it by index may be unportable across python versions
that's the chr function
there are strings oh no
how do i use this
__builtins__.__dict__[__builtins__.__dir__()[__debug__.__add__(__debug__).__rmul__(().__class__.__name__.__len__()).__add__((__debug__.__add__(__debug__)).__add__((__debug__.__add__(__debug__))))]](anything in here)
(anything in here) is where it calls it
!e ```py
print(builtins.dictbuiltins.dir()[debug.add(debug).rmul(().class.name.len()).add((debug.add(debug)).add((debug.add(debug))))])
@naive roost :white_check_mark: Your eval job has completed with return code 0.
A
how does this work?
why is there a __magic__ there
yes
oh wait my bad
i didn't see the "b" @tribal moon
it's going to be a bytes class
alright, bytes can take an iterable of ints from which to construct itself
so I use b'__magic__'.__class__.__call__ to get the bytes constructor
!e
print(bool(__builtins__))
huh
!e print(builtins.len)
!e print(builtins.bool())
fuck
then I use __name__.__class__.__call__ to get the string constructor, since it has a 2 arg form str(bytes, encoding)
why is bool(builtins) true
!e print(builtins.len())
!e print(builtins.int())
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: module 'builtins' has no attribute '__int__'
huh
faq
!e
from random import choice
from math import log
def basic_num(num):
a = ["__name__.__len__().__bool__().__int__()", "__debug__.__int__()", "__builtins__.__dict__.__len__().__bool__().__int__()"]
c = ["__doc__.__bool__().__int__()"]
if num == 0:
return choice(c)
b = [choice(a) for _ in range(num)]
return b.pop(0) + ''.join(map(lambda x: f".__add__({x})", b))
def optimised_num(num):
a = []
while num > 5:
pows = [int(log(num) / log(i)) for i in range(2, 6)]
nums = [(i + 2) ** j for i, j in enumerate(pows)]
max_ = max(nums)
num -= max_
i = nums.index(max_)
a.append(f"{optimised_num(i + 2)}.__pow__({optimised_num(pows[i])})")
a.append(basic_num(num))
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
def convert_string(word):
a = [f"__builtins__.__dict__[__builtins__.__dir__()[__debug__.__add__(__debug__).__rmul__(().__class__.__name__.__len__()).__add__((__debug__.__add__(__debug__)).__add__((__debug__.__add__(__debug__))))]]({optimised_num(ord(i))})" for i in word]
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
print(eval(convert_string("Hello World!")))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Hello World!
so all dunders now pog
!e py print(__builtins__.__dict__.__len__())
rip
@terse mortar :white_check_mark: Your eval job has completed with return code 0.
146
Fixed it
unrip
Mmhm
__builtins__.__dict__.__len__().__bool__().__int__()
@sick hound :white_check_mark: Your eval job has completed with return code 0.
True
ok so theoretically
i could
obfsc a python program
with just dunders
yeah
i'll use chr tho
hey so... i keep on getting name "fetch" is not defined
kekw
fuck
i'm dumb
!e print(dir(bool))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
!e print(True.real)
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
1
huh
i have a very nice obfsc algo now
kekw
def basic_num(num):
a = ["__name__.__len__().__bool__()"]
c = ["__doc__.__bool__().__int__()"]
if num == 0:
return choice(c)
b = [choice(a) for _ in range(num)]
return b.pop(0) + ''.join(map(lambda x: f".__add__({x})", b))
def optimised_num(num):
a = []
while num > 5:
pows = [int(log(num) / log(i)) for i in range(2, 6)]
nums = [(i + 2) ** j for i, j in enumerate(pows)]
max_ = max(nums)
num -= max_
i = nums.index(max_)
a.append(f"{optimised_num(i + 2)}.__pow__({optimised_num(pows[i])})")
a.append(basic_num(num))
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
def convert_string(word):
a = [f"chr({optimised_num(ord(i))})" for i in word]
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))```
finally no syntax errors
!e
print(
_:=lambda _:(_ := _.__add__(__debug__.__int__())),
__:=lambda _:(_ := _.__sub__(__debug__.__int__())),
print(__(_ := 1))
[0])
@sudden willow :x: Your eval job has completed with return code 1.
001 | 0
002 | Traceback (most recent call last):
003 | File "<string>", line 4, in <module>
004 | TypeError: 'NoneType' object is not subscriptable
hm
!e
print(
(_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),
__:=lambda _:(_ := _.__sub__(__name__.__len__().__bool__().__int__())),
print(__(True)))[__doc__.__bool__().__int__()])
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | <function <lambda> at 0x7feb7e0b4040>
why does it still return the function name?
!e
print(
(_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),
__:=lambda _:(_ := _.__sub__(__name__.__len__().__bool__().__int__())),
print(__(__name__.__len__().__bool__().__int__())))[__doc__.__bool__().__int__()],
print(_(__name__.__len__().__bool__().__int__()))
)
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 2
003 | <function <lambda> at 0x7f6641851040> None
"finally no syntax errors" - then gets a type error
finally code i can condense into one line!
!e
((_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),__:=lambda _:(_ := _.__sub__(__name__.__len__().__bool__().__int__())),print(__(__name__.__len__().__bool__().__int__())))[__doc__.__bool__().__int__()],print(_(__name__.__len__().__bool__().__int__())))
i like tuples
and walrus
😭
Combine it with the fixed point combinator for all dat recursion o:
Tho ur avoiding variables so maybe not
How to Hello World:
!e ```py
def varGetter(var):
#Returns the variable's name as string
#Has problems with value types
for key, val in list(globals().items()):
if val is var:
return key
for letter in varGetter((Hello_World:=(H:=(e:=(l:=(l:=(o:=(_:=(W:=(o:=(r:=(l:=(d:="Hello World")[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])):
exec(f"print({letter}[-1], end='')")
@low apex :white_check_mark: Your eval job has completed with return code 0.
Hello World
!e ```py
(
(
lambda _, , ___, : getattr(
builtins,
().class.name[ << ]
+ ().iter().class.name[().rmul(-1)]
+ [].class.name[ % ]
+ chr()
+ ().class.name[ >> __],
)
)(
(lambda _: _).code.co_nlocals,
(lambda _, __: _ | __).code.co_nlocals,
(lambda _, __, ___: _ | __ | ___).code.co_nlocals,
(
(lambda _, __, ___: _ & __ & ___).code.co_nlocals.rmul(
(lambda _, __, ___: _ | __ | ___).code.co_nlocals
)
+ (True.rmul((lambda _, __: _ | __).code.co_nlocals))
).rmul(
(
lambda _, __, ___, ____, _____, ______, _______, ________, _____, __________:
_
).code.co_nlocals
),
)
)(
(
lambda , , , , : hex.class.name[
.rmul( * ) - ______
].upper()
+ hex.class.name[.rmul( * ) - _____ - ]
+ hex.class.name[] * 2
+ hex.class.name[.rmul( * )]
+ chr(.rmul() + )
+ Warning.qualname[ - True]
+ hex.class.name[.rmul( * )]
+ Warning.qualname[]
+ ().class.name[]
+ {}.class.name[ - True]
+ chr(.rmul() + ___)
)(
(
lambda _, __, ___, ____, _____, ______, _______, ________, _________, __________: (
_
)
).code.co_nlocals,
(lambda _, __, ___: _).code.co_nlocals,
(lambda _, __, ___, ____: _).code.co_nlocals,
(lambda _, __: _).code.co_nlocals,
(lambda _: _).code.co_nlocals,
)
)
Even better ^^ lol
why not a list comprehension?
Because I didn't think about it at the time
Why does no-one care about my esonum :(
@last locust
getattr.__call__(getattr.__call__.__call__(discord, "DiscordException"), "__str__").__call__(eval("error"))
um
Nice lmao
Actually don't think that works
I get an error saying getattr needs two args
weird way of error.__str__()/str(error)
since i finally made my editascii lambdas i shall now craft my hello world statement
muahahahahaha
even though its gonna be atleast 10k characters due to me starting at 1
very cool
perhaps so but yours is executed much better
how exactly did you do it tho
do what
your algo
i converted all of the characters to ascii using ord and then eval'd them
ah
doesn't really work though because causing any error prints the original code through an error
for me you need an eval kekw
thats the thing with python eval/exec
make an error with your code inside the eval, it prints the original code
huh guess it doesn't do it with this
!e
from random import choice
from math import log
def basic_num(num):
a = ["__name__.__len__().__bool__()"]
c = ["__doc__.__bool__().__int__()"]
if num == 0:
return choice(c)
b = [choice(a) for _ in range(num)]
return b.pop(0) + ''.join(map(lambda x: f".__add__({x})", b))
def optimised_num(num):
a = []
while num > 5:
pows = [int(log(num) / log(i)) for i in range(2, 6)]
nums = [(i + 2) ** j for i, j in enumerate(pows)]
max_ = max(nums)
num -= max_
i = nums.index(max_)
a.append(f"{optimised_num(i + 2)}.__pow__({optimised_num(pows[i])})")
a.append(basic_num(num))
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
def convert_string(word):
a = [f"chr({optimised_num(ord(i))})" for i in word]
return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))
a = convert_string("print('Hello World!')")
print(eval(a))
print(a)```
yea there
you can just run it though an eval
and get the original code
encode it using base64
and then run with exec
wait what
that's
big brain
so big brain
still 2k+ chars
fuck
dunder encoding is hard
l o l
looks like a bash script alright
lmfaoo
I thought base64 made text longer
Encode text as png /s
lmfaoo
!e print(dir(__import__("builtins")))
!e
(
(addtoascii := lambda _: (__ := _.__add__(__import__("builtins").__name__.__len__().__int__().__bool__().__int__()),
subfromascii := lambda _: (__ := _.__sub__(__import__("builtins").__name__.__len__().__int__().__bool__().__int__()))),
(__import__("builtins").print(subfromascii(1))
)))
huh
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | NameError: name 'subfromascii' is not defined
Scope?
!e
try:
for letter in [key for key, val in list(globals().items()) if val is (Hello_World:=(H:=(e:=(l:=(l:=(o:=(_:=(W:=(o:=(r:=(l:=(d:="Hello World")[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])][0]:
exec(f"print({letter}[-1], end='')")
except IndexError:
for letter in [key for key, val in list(globals().items()) if val is (Hello_World:=(H:=(e:=(l:=(l:=(o:=(_:=(W:=(o:=(r:=(l:=(d:="Hello World")[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])[:-1])][0]:
exec(f"print({letter}[-1], end='')")
@low apex :white_check_mark: Your eval job has completed with return code 0.
Hello World
Did how to Hello World 2.0
Thanks to to your suggestion about list comprehension
Turns out doing it twice does the trick
my obfuscator has a pretty logo but the algo is incredibly bad
!e
eval(chr(112).__add__(chr(114).__add__(chr(105).__add__(chr(110).__add__(chr(116).__add__(chr(40).__add__(chr(34).__add__(chr(72).__add__(chr(101).__add__(chr(108).__add__(chr(108).__add__(chr(111).__add__(chr(44).__add__(chr(32).__add__(chr(87).__add__(chr(111).__add__(chr(114).__add__(chr(108).__add__(chr(100).__add__(chr(33).__add__(chr(34).__add__(chr(41).__add__(chr(10).__add__(""))))))))))))))))))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Hello, World!
but the problem is if you error
!e
eval(chr(11).__add__(chr(114).__add__(chr(105).__add__(chr(110).__add__(chr(116).__add__(chr(40).__add__(chr(34).__add__(chr(72).__add__(chr(101).__add__(chr(108).__add__(chr(108).__add__(chr(111).__add__(chr(44).__add__(chr(32).__add__(chr(87).__add__(chr(111).__add__(chr(114).__add__(chr(108).__add__(chr(100).__add__(chr(33).__add__(chr(34).__add__(chr(41).__add__(chr(10).__add__(""))))))))))))))))))))))))
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | File "<string>", line 1
004 | rint("Hello, World!")
005 | ^
006 | SyntaxError: invalid syntax
rint
oh yes
!e
(
(_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),
__:=lambda _:(_ := _.__sub__(__name__.__len__().__bool__().__int__())),
print(
chr(_:=[_(x) for x in range(ord("H"))][-1])
)
)
)
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
H
Ooh, writing an entire obfuscator 👀
!e
(
(_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),
__:=lambda _:(_ := _.__sub__(__name__.__len__().__bool__().__int__())),
print(
chr(_:=[_(x) for x in range(ord("H"))][-1]), chr(_:=[_(x) for x in range(ord("e"))][-1]),
chr(_:=[_(x) for x in range(ord("l"))][-1]), chr(_:=[_(x) for x in range(ord("l"))][-1]),
chr(_:=[_(x) for x in range(ord("o"))][-1])
)
)
)
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | File "<string>", line 5, in <listcomp>
004 | TypeError: 'int' object is not callable
huh
oh wait
wait am i stupid
oh lol my dumbass replaced my lambda
!e
((_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),print(chr(__:=[_(x) for x in range(ord(chr(72)).__int__())][-1]).__add__(chr(__:=[_(x) for x in range(ord(chr(101)).__int__())][-1]).__add__(chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-1]).__add__(chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-1]).__add__(chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-1]))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Hello
finally a simple hello statement everyone can understand
A nice amount of ) at the end
A tribute to lisp /s
ord() is so useful
wait im so dumb im using normal print!
!e
(
(_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),
(__import__("builtins").print(
chr(__:=[_(x) for x in range(ord(chr(72)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(101)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(44)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(32)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(87)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(114)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(100)).__int__())][-1]).__add__(
chr(__:=[_(x) for x in range(ord(chr(33)).__int__())][-1])
))))))))))))))))
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Hello, World!
dat indent tho
it can all easily be condensed down into a single line
just made it more readable by doing indents
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
you wanna talk about esoteric
that converter is about as esoteric as it gets
it all being on one line helps
thank
if someone were to ask a question regarding this
I would look at it
and then pretend I didn't see the question
Working on a code injection thing based on spongepowered's mixin, if anyone's interested in providing ideas or suggestions, let me know
!e
[] = []
@thorn steeple :warning: Your eval job has completed with return code 0.
[No output]
!e
[] = ["hello"]
print([])
@thorn steeple :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ValueError: too many values to unpack (expected 0)
I didn't know you could unpack with lists
!e ```py
[a, b, c] = [1, 2, 3]
print(f"a = {a}, b = {b}, c = {c}")
@low apex :white_check_mark: Your eval job has completed with return code 0.
a = 1, b = 2, c = 3
interesting
!e py [a, b, c] = [1, 2, 3] print(f"{a = }, {b = }, {c = }")
@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.
a = 1, b = 2, c = 3
you beat me to it...
I actually prefer it over the tuples for single item expansions. foo, seems really weird
the gun operator?
right, I see 😄
!e py x ,= [1] print(x)
@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.
1
!e x ,= [1]
@bitter iris :warning: Your eval job has completed with return code 0.
[No output]
!e x ,= [1]; print(x)
@bitter iris :white_check_mark: Your eval job has completed with return code 0.
1
!e print(import('requests'))
@bitter iris :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'requests'
lol snekbox wont let u
🤷♂️ wanted to try
also @bitter iris maybe #bot-commands ?
yea snekbox has no internet connection
ah, only for trying, not gonna spam further dw 😄
alright
Read only file system, no networking, no forking
good to know the limitations
definitely, if not impossible
isn't snekbox just a wrapper for https://github.com/google/nsjail
We use https://git.pydis.com/snekbox, which relies on https://github.com/google/nsjail
Yep, it is
pypy had some progress over sandboxing
The limitations are at the kernel level
There isn't really anything done at the CPython level
well, it's not a language-level sanbox
yeah, makes sense to restrict in that way
in the past, I wrote something like that for a website of mine, though it was just using docker which might be a lot heavier then the nsjail
In fact, they are pretty similar
i wonder what syscalls are filtered
They both use kernel limits in order to simulate an isolated environment
this is the pypy sandbox that I mentioned earlier btw ^^
The best current way of ~sorta controlling stuff is using audit hooks. They cover almost all of the IO calls, so you might just watch them and kill the process though is is not something that you might want to try out in the production since this is not their usual use case (I guess #esoteric-python is the perfect place to talk about this stuff :D)
you still cant do a good sandbox with that because python has ways of running arbitrary assembly (you technically dont even need imports to do it)
running arbitrary assembly
whoaaa
you technically dont even need imports to do it
that sounds intriguing, would you mind explaining it a bit
I honestly wouldn't use language level isolation if the language wasn't designed with that in mind
yeah, it makes more sense to isolate the interpreter from the critical system than to isolate the language within the interpreter
!e
print(str((3).__add__(__import__("operator").floordiv(__import__("random").randint(1,10000000), __import__("random").randint(1,10000000)))))
@plucky wedge :white_check_mark: Your eval job has completed with return code 0.
3
you probably don't need the str(), but looks cool nontheless 😄
