#esoteric-python

1 messages · Page 15 of 1

dreamy pier
#

5 min

maiden blaze
#

@dry mirage can einspect put a non hashable object into a set

#

asking for a friend

#

specifically i want to make a self referential set

#

my friend*

versed eagle
#

idk about einspect but fishhook can

languid hare
maiden blaze
languid hare
#

adding a hash method onto the target class (or object) would work i guess

#

!e

import fishhook
@fishhook.hook(set)
def __hash__(self): 
  return 0

x = set()
x.add(x)
print(x)
night quarryBOT
#

@languid hare :white_check_mark: Your 3.11 eval job has completed with return code 0.

{set(...)}
maiden blaze
#

hmm

dry mirage
#

but brb 👀

dry mirage
# maiden blaze <@233059161401720832> can einspect put a non hashable object into a set
from ctypes import pointer

from einspect.structs import PyObject
from einspect.structs.py_set import PySetObject, SetEntry

s = set()
item = [1, 2, 3]

obj = PySetObject.from_object(s)
obj.smalltable[0] = SetEntry(key=pointer(PyObject.from_object(item)), hash=123)
obj.fill += 1
obj.used += 1

print(s)
>> {[1, 2, 3]}

obj.smalltable[1] = SetEntry(key=pointer(PyObject.from_object(s)), hash=456)
obj.fill += 1
obj.used += 1

print(s)
>> {[1, 2, 3], set(...)}
#

haven't made the SetView yet but this will be the struct implementation

maiden blaze
#

damn

languid hare
#

does accessing work Thonk

dry mirage
#

like what access pithink

languid hare
#

nvm missaw

#

thought was a dict

dry mirage
#
print(s.pop())
print(s.pop())
languid hare
#

does membership testing work Thonk

dry mirage
#

__contains__ tries to hash the list, so it'll fail there with TypeError

languid hare
#

sad but expected

bitter granite
#

Afternoon all,
Has anybody been working with the signature inspection by any chance?
I wonder what your thoughts are on the following:

from inspect import signature

def something(arg1: date):
  ...

sig = signature(something)
for p in sig.parameters.values():
  print(p.annotation.__class__)

I have not tested the above, just simplified from my code. But the challenge I have is that the class represented there should return a date argument, but in fact return a string.
Am I doing something wrong?
h

earnest wing
#

#type-hinting may be helpful depending on your use case, but in a nutshell you should use typing.get_type_hints() if you want forward references to be evaluated

bitter granite
#

Thanks @earnest wing.
How would you do a a check to verify the compatibility between the signature in a method and a given argument passed at a run-time?

So far I was introspecting, and parsing the signature, then verifying what sort of type(arg) was given.

I can't use the isinstance as I might have a data type not declared in my generic method file.

#

I tried, without success, to store a reference to the original data type. Since this approach didn't work, when I parse the signaure I store the data type in a string format

versed eagle
#

I tried, without success, to store a reference to the original data type
why didn't it work/what about it didnt work

#

if you can get the local and global namespace the function is defined in you should be fine

#

first, check locals for the type
if can't find it there, check the globals
if can't find there, check builtins

bitter granite
versed eagle
#

if you can get the namespace the function is defined in, you can use the string to get the class reference

#

func.__module__ and func.__qualname__ will get you the namespace as a string

#

so if you parse that then you can get the classes from the strings

bitter granite
#

So parsing is the best approach I have

#

I'll give it a try later. Thanks for the hint

versed eagle
#

np, im happy to help out

bitter granite
#

Hello @versed eagle not sure what's the time your end ... I did try the func bits above, but they return me the module name where the function is stored rather than the proper class of the argument I'm inspecting.

Am I missing something from your suggestion?

versed eagle
#

f"{func.__module__}.{func.__qualname__}" is the namespace where the function is

versed eagle
sick hound
#
import secrets,marshal

def Pingu(message: str):
    xstrip = ''
    xstrip += str(len(message)*50-5^1)

    for letter in message.strip(): 
        xstrip += str(ord(letter))
        xstrip += bin(int(ord(letter)))

    CPILE = compile(f"""har_{xstrip} = None""", secrets.token_hex(), 'single').co_code
    CPILE_FOL = marshal.dumps(CPILE).hex()
    return CPILE_FOL.upper()

print(Pingu('hello'))

Is this a kinda good hashing function

rugged sparrow
#

No, that would be constant

#

The co_code for that should always be a LOAD_CONST 0, STORE_NAME, 0, LOAD_CONST, 0, RETURN

#

Or something equivalent

#

!e ```py
import secrets,marshal

def Pingu(message: str):
xstrip = ''
xstrip += str(len(message)*50-5^1)

for letter in message.strip(): 
    xstrip += str(ord(letter))
    xstrip += bin(int(ord(letter)))

CPILE = compile(f"""har_{xstrip} = None""", secrets.token_hex(), 'single').co_code
CPILE_FOL = marshal.dumps(CPILE).hex()
return CPILE_FOL.upper()

print(Pingu('hello'))
print(Pingu('goodbye'))

night quarryBOT
#

@rugged sparrow :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | F30A000000970064005A0064005300
002 | F30A000000970064005A0064005300
rugged sparrow
#

@sick hound ^

sick hound
#

....

long fulcrum
#

any way to golf this further

for i in sys.argv[1:]:j=str(Fraction(i));print(j+("/"not in j)*"/1")```
sick hound
#

!e ```py
from types import CodeType
exec(CodeType(
0, 0, 0, 0, 30, 0, b"\x97\x00\x02\x00e\x00d\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00d\x01S\x00", ("Hi", None), ("print",), (), "", "", "", 0, b"", b""
))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hi
sick hound
#

istg

sick hound
#

!e

from types import CodeType
exec(CodeType(
0, 0, 0, 0, 30, 0, b"\x97\x00\x02\x00e\x00d\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00d\x01S\x00", ("Hellooo", None), ("print",), (), "", "", "", 0, b"", b""
))
night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hellooo
sick hound
#

Wait how is this like?
whats the bytes for?

#

i mean like its clear on what it does ("Hellooo", None), ("print",), (),

#

so whats the point

sick hound
#

Yeah

#

ok

#

first tuple are consts, second are names

#

the bytecode specifies what to do with the consts and names

#

Yeah but why? would you need that.

#

python does it all the time behind the scenes

#

ever noticed __pycache__?

#

Yeah

#

thats cached bytecode from your .py source files

#

cpython does all the pythoning in bytecode, your source code is just compiled before its executed

#

ahhhh

#

!e ```py
from types import CodeType
import dis
dis.dis(CodeType(
0, 0, 0, 0, 30, 0, b"\x97\x00\x02\x00e\x00d\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00d\x01S\x00", ("Hi", None), ("print",), (), "", "", "", 0, b"", b""
))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 |           0 RESUME                   0
002 |           2 PUSH_NULL
003 |           4 LOAD_NAME                0 (print)
004 |           6 LOAD_CONST               0 ('Hi')
005 |           8 PRECALL                  1
006 |          12 CALL                     1
007 |          22 POP_TOP
008 |          24 LOAD_CONST               1 (None)
009 |          26 RETURN_VALUE
sick hound
#

here's how the disassembly of that looks like

sick hound
#

like print() seems simpler

sick hound
#

but why do it the simple way when you can do this

#

this is esoteric python afterall

#

no but really, if you want to do fucked up shit like generating a class without using class:

#

here you go

#

inline assembly

sick hound
sick hound
#

not actual assembly assembly

#

but python assembly

#

i see

sick hound
#

ile take a look at that

manic flax
#

one line for statements

#

I only got to 8

#

I tried to use it but it gave me no output

[((z:=i) if i < 5 else None) if i < 10 else None for i in range(10 + 1)]

polar plover
#

On phone so can't write up a proper example, but I use them in this one line program of mine py (pg:=__import__("pygame"),__import__("pygame.locals"),ri:=__import__("random").randint,sc:=pg.display.set_mode((600, 600)),cl:=pg.time.Clock(),sp:=pg.Vector2(10,10),sb:=[],di:=pg.Vector2(10,0),nf:=lambda:globals().update(fo=pg.Vector2(ri(0,59)*10,ri(0,59)*10)),nf(),[(sb.append(pg.Vector2(sp)),sb.pop(0),sp.__iadd__(di),(sb.clear(),sp.update(10,10))if(sp in sb or not(0<=sp.x<=600and 0<=sp.y<=600))else None,(sb.insert(0,pg.Vector2(-10,-10)),nf())if sp==fo else None,sc.fill((0,0,0)),pg.draw.rect(sc,(255,0,0),(fo.x,fo.y,10,10)),pg.draw.rect(sc,(255,255,255),(sp.x,sp.y,10,10)),[pg.draw.rect(sc,(255,255,255),(p.x,p.y,10,10))for p in sb],[((1/0)if ev.type==pg.locals.QUIT else di.update({pg.locals.K_w:(0,-10),pg.locals.K_s:(0,10),pg.locals.K_a:(-10,0),pg.locals.K_d:(10,0)}.get(ev.key,di))if ev.type==pg.locals.KEYDOWN else None)for ev in pg.event.get()],pg.display.update(),cl.tick(10),)for _ in iter(int,1)])

manic flax
#

wghat the hell

polar plover
#

It's snake!

manic flax
#

holy hell

polar plover
#

and it is not even golfed to the max (notice the 2 char variable names)

manic flax
#

ye

#

I use lists instead of tuples for doing one line

#

vivax how do you one line for statements with a break condition inside of it?

#

example of what I mean

for i in range(10):
  # do smth
  if i == 5: break
polar plover
#

For loops get tricky to do breaks in, you would need to raise an exception then catch it

#

So best is really to try and avoid the need, like if it is to exit a program you can instead crash it with 1/0

manic flax
#

[((SOME CODE) if CONDITION else None) if i < MAX_I else CODE AFTER STATEMENT for i in range(MAX_I + 1)]

#

I use this but it does not work on my program

#

it works on testing

#

but just doesn't work when I actually use it

#

[((z:=complex(z*z+c)) if abs(z) > 2 else None) if i<M else (print("#" if i+1 == M else ".", end="\n" if x+1 == W else "")) for i in range(M+1)]

#

this is how I used it on my actual code

#

I forgor

#
for i in range(M):
    z = z*z+c
    if abs(z) > 2: break
 print("#" if i+1 == M else ".", end="\n" if x+1 == W else "")

unobfuscated version

polar plover
manic flax
#

no it didnt

#

lemme show you

#

everything is the max iteration (9)

#

it shoulkd look like this

#

the numbers represent how much iteration it had passed without breaking out

polar plover
manic flax
#

nope

#

if it is it should show a circle

#

it looks like this

polar plover
#

it should break on abs(z) > 2, but currently that is the only time it executes the loop body

manic flax
#

ye

#

the else None is very slow because it waits until the final iteration and not actually break

#

is there any alternative to this?

polar plover
#
([(z:=complex(z*z+c))for i,_ in zip(range(M+1), iter(lambda: abs(z) > 2, True))], print("#" if i+1 == M else ".", end="\n" if x+1 == W else ""))

this maybe

#

that should stop when the condition is True

manic flax
#

syntax error 👀

polar plover
#

ops

manic flax
polar plover
#

there edited

#

so we basically use iter(lambda: BREAK_CONDITION, True) as a form of while loop, then use zip to combine it with the range (and zip will stop when one of them runs out)

manic flax
#

oh okay

#

but y'know

#

i is not defined

polar plover
#

oh shoot, comprehensions dont leak that do they

#

I am not sure what the best way of solving that is, I guess you could bind i to another name in the loop body

#

or we could do [... for globals()["i"],_ in zip(...)]

manic flax
#

I'm starting to not understand

polar plover
#

basically comprehensions have their own scope for the iteration variables (in this case i) meaning after the comprehension ends it is not saved

manic flax
#

oh ok I now understand

#

so on the last iteration I define a variable?

polar plover
#

you could also just define it each iteration, should be simpler

manic flax
#

okay

#

OH SHIT

#

it formed the mandelbrot contours

#

it workkedd omgggg

#

5 lines to go

#

thank you

#

heres the image it formed

polar plover
#

nice!
np 😄

manic flax
#

I amm so happy right now

#
[W:=64,H:=32,M:=128,[[[r:=(x-W/2)*4/W-1,I:=(y-H/2)*4/H,c:=r+complex(0,I),z:=complex(0,0), ([(z:=complex(z*z+c),e:=i)for i,_ in zip(range(M+1), iter(lambda: abs(z) > 2, True))], print("#" if e == M else ".", end="\n" if x+1 == W else ""))] for x in range(W)] for y in range(H)]]

finally, mandelbrot in 1 line of code

#

!e

[W:=64,H:=32,M:=128,[[[r:=(x-W/2)*4/W-1,I:=(y-H/2)*4/H,c:=r+complex(0,I),z:=complex(0,0), ([(z:=complex(z*z+c),e:=i)for i,_ in zip(range(M+1), iter(lambda: abs(z) > 2, True))], print("#" if e == M else ".", end="\n" if x+1 == W else ""))] for x in range(W)] for y in range(H)]]
night quarryBOT
#

@manic flax :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | ................................................................
002 | ................................................................
003 | ................................................................
004 | ................................................................
005 | ................................................................
006 | ................................................................
007 | ................................................................
008 | ................................................................
009 | ................................................#...............
010 | ..............................................#.................
011 | .............................................###................
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/unotijefov.txt?noredirect

unique heath
#

lol

quartz wave
#

170 ```py
M=128
for y in range(H:=32):
for x in range(W:=64):c=(x-W/2)4/W-1+(y-H/2)4/H1j;z=0j;print(end=".#"[len([z:=zz+c for i in range(M+1)if abs(z)<3])==M+1]+"\n"*(x+1==W))

#

165 ```py
M=128
for y in range(H:=32):
for x in range(W:=64):c=(x-W/2)4/W-1+(y-H/2)4/H1j;z=0j;print(end=".#"[len([z:=zz+c for i in range(M+1)if abs(z)<3])==M+1])
print()

#

162 ```py
M=128;W=64
for y in range(H:=32):x=0;exec('z=c=(x-W/2)4/W-1+(y-H/2)4/H1j;print(end=".#"[len([z:=zz+c for i in range(M+1)if abs(z)<3])==M+1]);x+=1;'*W);print()

quartz wave
#

157 ```py
M=128;W=64
for y in range(H:=32):x=0;exec('z=0;print(end=".#"[len([i for i in range(M+1)if abs(z:=z*z+(x-W/2)*4/W-1+(y-H/2)4/H1j)<3])>M]);x+=1;'*W);print()

low lynx
#

can't all the W/2 and 4/W stuff be replaced with just their numerical values to reduce characters

quartz wave
low lynx
#

ah

quartz wave
#

but i mean if we're just gonna stick to those values might as well just do it

low lynx
#

also replace (x-W/2)*4/W-1 with x*4/W-3?

quartz wave
#

oh

#

ok

low lynx
#

also probably same thing with the y bit

gleaming linden
#

Use 129 for M and put -~ in front of abs?

#

Nvm I misread the listcomp

#

I think you can get rid of the [] in len()

quartz wave
gleaming linden
#

len doesn't work on generators?

low lynx
#

no

gleaming linden
#

Ah

quartz wave
#

anyways 146 ```py
M=128;W=64
for y in range(H:=32):x=0;exec('z=0;print(end=".#"[len([i for i in range(M+1)if abs(z:=zz+x4/W-3+4j/H*y-2j)<3])>M]);x+=1;'*W);print()

low lynx
#

probably because you'd have to iterate over the entire generator to find the length

sick hound
#

example of how to obfuscate something like "import sys"

quartz wave
quartz wave
# sick hound example of how to obfuscate something like "import sys"
(_____________________:=(__:=__builtins__.__getattribute__((___:=__name__.__class__.__doc__.__getitem__((___________:=(______:=(___:=__name__.__getitem__((_____:=__name__.__class__().__len__()))).__add__(___).__add__(___).__len__()).__mul__((________:=(_______:=(___:=__name__.__getitem__(_____)).__add__(___).__len__()).__mul__(_______).__add__(______))).__add__((__________:=_______.__mul__((_________:=_______.__mul__(_______).__invert__().__neg__())))))).__add__(__name__.__class__.__doc__.__getitem__(___________)).__add__(__name__.__len__().__class__.__doc__.__getitem__(_____)).__add__((______________:=(______________:=__name__.__ne__(__name__).__invert__()).__neg__().__truediv__(______________.__add__(______________).__neg__()).__rpow__(______________).__class__).__name__.__getitem__(_______)).__add__(__name__.__class__.__class__.__doc__.__getitem__(_______)).__add__((________________:=__name__.__class__.__base__).__name__.__getitem__(_____)).__add__(______________.__doc__.__getitem__((__________________:=__name__.__eq__(__name__).__pos__()))).__add__(__name__.__class__.__class__.__doc__.__getitem__(_____)).__add__(__name__.__class__.__doc__.__getitem__(___________)).__add__(__name__.__class__.__doc__.__getitem__(___________)))))((______________________:=__name__.__class__.__doc__.__getitem__(_____).__add__(__name__.__class__.__class__.__doc__.__getitem__(__________________)).__add__(__name__.__class__.__doc__.__getitem__(_____)))))
``` python 3.11.0 only
gleaming linden
#

Is this something like jsf*ck?

#

Why can I tell what's going on

sick hound
#

i do not understand

quartz wave
sick hound
#

so i guess it works

#

lemme test it

#

howd you get this anyway

sick hound
gleaming linden
quartz wave
gleaming linden
#

Jsf*ck does a similar thing

quartz wave
#

you're wrong 🙂

gleaming linden
#

Smh

quartz wave
#

you got the "joining individual chars" part right though

#

i should probably write an algorithm to use substrings

#

actually nvm substrings aren't needed there

low lynx
#

what if you take the obfuscated code and run that through the obfuscator again

gleaming linden
quartz wave
gleaming linden
#

Ah ok

#

It just uses __import__

quartz wave
#

i wrote an algorithm from scratch to get numbers

#

why it works or why it's the way it's idk

gleaming linden
#

I don't see any __import__ in the code

quartz wave
# quartz wave why it works or why it's the way it's idk

what's weird is that sometimes bigger numbers have shorter obfuscations ```py

o.c();o.on(1000) # o.c() resets the obfuscator
'(:=(_____:=(:=(:=(:=name.getitem((__:=name.class().len()))).add().len()).mul().invert().neg()).mul()).mul((:=.lshift((:=(:=name.getitem()).add().add().len())))))'
o.c();o.on(10000)
'(
:=(:=(:=(:=(:=name.getitem((:=name.class().len()))).add().len()).mul((:=.mul().invert().neg()))).mul()).mul(___))'

fading flint
#

I dead

dense nova
#

💀 💀 💀

dense nova
#

im going to make a list of the numbers 1 to 50 in super obfuscated python

versed eagle
sick hound
#

i want to try to make import time

glacial lichen
#

Hi guys

#

I am new to python

#

Can you guys help me

versed eagle
#

which obfuscates

sick hound
#

idk how to use github

#

do i just copy the code

zenith geode
#

wtfrick flake8

#

dont use lambda, use a def

#

okay

sick hound
#

too much trolling 😢

zenith geode
sudden mulch
#

repo?

snow beacon
snow beacon
sick hound
fleet bridge
#

sudo google how to install git

sick hound
versed eagle
#

I would say so

#

but I'm not the person to ask
it's a conflict of interest for me, since I've contributed to it

sick hound
#

would you say its atleast good enough where someone who's never deobfuscated wouldn't be able to easily deobfuscate it by watching a tutorial

versed eagle
#

again, conflict of interest
but I would say that it's relatively hard to deobfuscate, compared to most obfuscators (most of which just pack the source and then exec it)
to my knowledge there's no tutorials that would cover how to deobfuscate it

sick hound
#

Alright appreciate it

serene stratus
sick hound
manic flax
#

!e

M=128;W=64
for y in range(H:=32):x=0;exec('z=0;print(end=".#"[len([i for i in range(M+1)if abs(z:=z*z+(x-W/2)*4/W-1+(y-H/2)*4/H*1j)<3])>M]);x+=1;'*W);print()
#

What the hell

#

@quartz wave (sorry for ping) i respect you

dense nova
#

!e

M=128;W=64
for y in range(H:=32):x=0;exec('z=0;print(end=".#"[len([i for i in range(M+1)if abs(z:=z*z+(x-W/2)*4/W-1+(y-H/2)*4/H*1j)<3])>M]);x+=1;'*W);print()
night quarryBOT
#

@dense nova :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | ................................................................
002 | ................................................................
003 | ................................................................
004 | ................................................................
005 | ................................................................
006 | ................................................................
007 | ................................................................
008 | ................................................................
009 | ................................................#...............
010 | ..............................................#.................
011 | .............................................###................
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/zutotehote.txt?noredirect

dense nova
#

wow

#

mandelbrot set

bitter granite
#

A little advice guys. How can I remove from a list a complex object?
I've a list with many of these: [{'groupType': 'and', 'filters': [{'dimension': 'country', 'expression': 'AFG', 'operator': 'equals'}]}]

I tried to pass the whole of the above a string representation, but that doesn't work, the same as a compound object.

Since I've a list with many of them, and ideally I'd like to remove all whose dimension is country ... I was trying to find an elegant way that does not require method recursion.

#

using the del is not an option as it changes the index and it will skip items.

dreamy pier
#

or from the end

#

and del will work

#

also you can do just a list comprehension like ... for k, v in ... if v[filters][dimension] != country

#

better go to help channels instead

#

!e

(lambda: [globals().__setitem__('Test', type("Test", (object,), {"say_hello": (lambda self, i: [globals().__setitem__('''__RV''', None), [[globals().__setitem__('result', "Hello, ")] if i == 1 else [globals().__setitem__('result', "world!")], globals().__setitem__('__RV', result)]].clear() or globals()['__RV'])})), globals().__setitem__('test', Test()), globals().__setitem__('a', test.say_hello(1)), globals().__setitem__('b', test.say_hello(2)), globals().__setitem__('result', a + b), (_:=(__:=__builtins__.__getattribute__((___:=__name__.__class__.__class__.__doc__.__getitem__((______:=(___:=__name__.__getitem__((_____:=__name__.__class__().__len__()))).__add__(___).__len__())).__add__((________:=(________:=__name__.__ne__(__name__).__invert__()).__neg__().__truediv__(________.__add__(________).__neg__()).__rpow__(________).__class__).__doc__.__getitem__((_________:=__name__.__eq__(__name__).__pos__()))).__add__(__name__.__len__().__class__.__doc__.__getitem__(_____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(_________)).__add__(__name__.__class__.__class__.__doc__.__getitem__(_____))))(result)))])()
night quarryBOT
#

@dreamy pier :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hello, world!
dreamy pier
#
class Test:
    def say_hello(self, i):
        if i == 1:
            result = "Hello, "
        else:
            result = "world!"
        return result

test = Test()
a = test.say_hello(1)
b = test.say_hello(2)
result = a + b
print(result)
#

!e

(lambda: [(_:=(__:=__import__((___:=__name__.__class__.__doc__.__getitem__((____:=__name__.__class__().__len__())).__add__(__name__.__class__.__class__.__doc__.__getitem__((_____:=__name__.__eq__(__name__).__pos__()))).__add__(__name__.__class__.__doc__.__getitem__(____)))))), (______:=(_______:=__builtins__.__getattribute__((________:=__name__.__class__.__class__.__doc__.__getitem__((__________:=(________:=__name__.__getitem__(____)).__add__(________).__len__())).__add__((____________:=(____________:=__name__.__ne__(__name__).__invert__()).__neg__().__truediv__(____________.__add__(____________).__neg__()).__rpow__(____________).__class__).__doc__.__getitem__(_____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(_____)).__add__(__name__.__class__.__class__.__doc__.__getitem__(____))))((_____________:=_.version))))])()
night quarryBOT
#

@dreamy pier :white_check_mark: Your 3.11 eval job has completed with return code 0.

3.11.1 (main, Dec 21 2022, 08:38:55) [GCC 8.3.0]
bitter granite
#

Thanks @dreamy pier working in the reversed mode did the trick and helped to simplify the code

dry mirage
#

python/cpython#76357

dry mirage
#

is this still working or seems to be broken again?

#

doesn't seem to be possible anymore to hack on a __class__ cell to make super() work in a module level function with no class

potent comet
# dry mirage doesn't seem to be possible anymore to hack on a `__class__` cell to make `super...

For efficiency, in 3.11+ various special cases for functions have been moved into opcodes added to the beginning. That way function calls don't need to check to see if a closure is present etc, it happens automatically. You'll probably need to add them - specifically, COPY_FREE_VARS(n) copies n freevars from the closure to the frame. There's also MAKE_CELL(i) which initialises a cell in that locals slot.
https://docs.python.org/3/library/dis.html#opcode-COPY_FREE_VARS

sick hound
#

!e ```py
@type.call
class cout:
def lshift(s,*v):
print(*v,end="",flush=True)
return s

cout << "This is real" << "\n"

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

This is real
dreamy pier
sick hound
#

it does have a few issues, if you'd do ```py
a = 0
b = 0
cin >> b

it'd assign it to a
earnest wing
#

!e ```py
import dis
dis.dis("a = 0; b = 0; cin >> b")

night quarryBOT
#

@earnest wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 |   0           0 RESUME                   0
002 | 
003 |   1           2 LOAD_CONST               0 (0)
004 |               4 STORE_NAME               0 (a)
005 |               6 LOAD_CONST               0 (0)
006 |               8 STORE_NAME               1 (b)
007 |              10 LOAD_NAME                2 (cin)
008 |              12 LOAD_NAME                1 (b)
009 |              14 BINARY_OP                9 (>>)
010 |              18 POP_TOP
011 |              20 LOAD_CONST               1 (None)
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/ufiqawedih.txt?noredirect

earnest wing
#

Should be doable with bytecode inspection

#

!e ```py
import dis
dis.dis("a = 0; b = 0; cin >> b >> a")

night quarryBOT
#

@earnest wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 |   0           0 RESUME                   0
002 | 
003 |   1           2 LOAD_CONST               0 (0)
004 |               4 STORE_NAME               0 (a)
005 |               6 LOAD_CONST               0 (0)
006 |               8 STORE_NAME               1 (b)
007 |              10 LOAD_NAME                2 (cin)
008 |              12 LOAD_NAME                1 (b)
009 |              14 BINARY_OP                9 (>>)
010 |              18 LOAD_NAME                0 (a)
011 |              20 BINARY_OP                9 (>>)
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/ucuyilulod.txt?noredirect

earnest wing
#

Yeah in the >> you would fetch the previous frame, check the current instruction - 1, and check the co_names at that index

fleet bridge
#

no you cant:```py

dis('cin >> a[b]')
0 0 RESUME 0

1 2 LOAD_NAME 0 (cin)
4 LOAD_NAME 1 (a)
6 LOAD_NAME 2 (b)
8 BINARY_SUBSCR
18 BINARY_OP 9 (>>)
22 RETURN_VALUE


in this case `cin` should assign to `a[b]` like this: `a[b] = something`

last instructions are: ```py
6 LOAD_NAME                2 (b)
8 BINARY_SUBSCR
``` so you cant know where you should assign to from looking at them
quartz wave
#

with a little bytecode tinkering we can

fleet bridge
#

I was replying to this:

Yeah in the >> you would fetch the previous frame, check the current instruction - 1, and check the co_names at that index
With a lot of bytecode pain you of course can do it

quartz wave
#

ok

quartz wave
#

the instruction can also be checking co_varnames, co_cellvars, or co_freevars

dreamy pier
fleet bridge
#
cin >> a
cin >> a.b
cin >> a[b]
cin >> (a, b)
cin >> (a, *b)
# cin >> [a, b][c] # assign only to a or b // no that doesnt make any sense

# some complex example:
cin >> a.b()[c, d]

# some invalid examples:
cin >> 1
cin >> []
cin >> a()

it also cant work without defining variable before cin >>. To do that you should:

  1. patch bytecode (like @supports_cin decorator)
  2. set bytecode trace function
  3. ?
#

some time ago i was implementing cfor iterator. It looked like this: py for x in cfor( 'i, j = 3, 4', 'i * j < 1000', 'i += 1; j += 2', 'i ^ j', ): print(i, j, x) it is equivalent to this in C: ```c
for (int i = 3, j = 4; i * j < 1000; i += 1, j += 1) {
int x = i ^ j;
// body
}

quartz wave
fleet bridge
# fleet bridge some time ago i was implementing `cfor` iterator. It looked like this: ```py for...

its broken, it works only with global variables, i dont know how to fix it: ```py
from future import annotations
from types import CodeType
from typing import Any, Iterator
import sys

class cfor:
_init: CodeType
_cond: CodeType
_inc: CodeType
_val: CodeType

def __init__(
    self,
    init: str = '',
    cond: str = 'True',
    inc: str = '',
    val: str = 'None',
) -> None:
    self._init = compile(init, '<cfor initialisation>', 'exec')
    self._cond = compile(cond, '<cfor condition>', 'eval')
    self._inc = compile(inc, '<cfor increment>', 'exec')
    self._val = compile(val, '<cfor value>', 'eval')

    self.ns = sys._getframe(1).f_globals

def __iter__(self) -> Iterator[Any]:
    ns = self.ns

    cond = self._cond
    val = self._val
    inc = self._inc

    exec(self._init, ns, ns)
    while eval(cond, ns, ns):
        yield eval(val, ns, ns)
        exec(inc, ns, ns)

i: int
j: int

def main() -> None:
for x in cfor(
'i, j = 3, 4',
'i * j < 1000',
'i += 1; j += 2',
'i ^ j',
):
print(i, j, x)

if name == 'main':
main()

#

PyPy is a python interpreter written in python.
So it can run python code. But what interpreter is running PyPy? Can PyPy run itself?

quartz wave
fleet bridge
#

oh, there is a big file libpypy3-c.dll, probably it is a CPython interpreter and all PyPy's code

cloud fossil
earnest wing
#

so ```py
annotations = ...
a: int
cin >> a # all is good in the world

#

alternatively, you can do the whole thing in a class scope letting you control all variable access lmao

#
class Main(C):
  a: int; # or int: a; for fun
  b: float;
  cin >> a >> b;
  cout << "Your values are " << a << " and " << b << "!";
quartz wave
# earnest wing so ```py __annotations__ = ... a: int cin >> a # all is good in the world ```
from sys import _getframe
from ctypes import pythonapi, c_void_p, c_int
PF_LTF = pythonapi.PyFrame_LocalsToFast
PF_LTF.argtypes = [c_void_p, c_int]

@lambda c:c()
class __annotations__(dict):
    def __setitem__(self, name, typ, *, builtin_can_init={int, str, tuple}):
        frame = _getframe(1)
        if name in frame.f_locals:
            if isinstance(type(frame.f_locals[name]), typ):
                return super().__setitem__(typ, name)
        if typ in builtin_can_init:
            frame.f_locals[name] = typ()
        else:
            frame.f_locals[name] = None
        if frame.f_locals is not frame.f_globals:
                PF_LTF(frame)
        return super().__setitem__(typ, name)
``` this can work
sick hound
quartz wave
#

updated with constants ```py
from sys import _getframe
from ctypes import pythonapi, c_void_p, c_int
PF_LTF = pythonapi.PyFrame_LocalsToFast
PF_LTF.argtypes = [c_void_p, c_int]

@lambda c:c()
class annotations(dict):
def setitem(self, name, typ, *, builtin_can_init=[(int, 0), (str, ""), (tuple, ())}):
frame = _getframe(1)
if name in frame.f_locals:
if isinstance(type(frame.f_locals[name]), typ):
return super().setitem(typ, name)
for btyp, default in builtin_can_init:
if isinstance(typ, btyp):
frame.f_locals[name] = default
break
else:
frame.f_locals[name] = None
if frame.f_locals is not frame.f_globals:
PF_LTF(frame)
return super().setitem(typ, name)

quartz wave
sick hound
#

so it just effectively transforms the class A into an instance of itself

sick hound
#

-> A is no longer the class A, but an instance of class A

#

interesting

#

i wonder how that looks in bytecode

quartz wave
sick hound
#

yeah its just Abc = (lambda _:_())(__build_class__(class_builder, "Abc"))

#

aka Abc = (lambda _:_())(Abc)

#

seems like lower decorators go first

fleet bridge
fleet bridge
earnest wing
versed eagle
#

should go type: name = value; instead of name: type = value;

versed eagle
#

thats a fun idea

gleaming linden
#

we just need to combine it with this now

versed eagle
#

thats what i was going to do

#

i have this as a module

#

and i wanna put cfor in it

fleet bridge
quartz wave
versed eagle
#

it does it's best to convert it from whatever the value is to the correct type

#

so if you set it's type to str, you can set the value to just about anything

#

and it'll just happily work

#

it ends up calling type_of_var(value)
so in this case, it's int(5.3)

quartz wave
# versed eagle it ends up calling `type_of_var(value)` so in this case, it's `int(5.3)`

i think i broke it ```pycon

test = type('',(),{'new':lambda _,x:x})
test: a = 5
test a
a
Traceback (most recent call last):
File "<stdin>", line 6, in getitem
KeyError: 'a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 9, in getitem
KeyError: 'a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 12, in getitem
AttributeError: module 'builtins' has no attribute 'a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 14, in getitem
NameError: a is not defined

versed eagle
#

do type: test = ...

#

and it should work

versed eagle
#

well, i gtg

#

lmk if you find a bug or there's anything you want me to add

#

have a nice day everyone

muted cipher
#

That moment when it should return NameError but it returns three other errors too

versed eagle
#

that's because they're not using the modular version

#

i had to make it do that to make it short enough to send in discord, but in the actual module, it just prints the NameError

quartz wave
# versed eagle do `type: test = ...`

did not fix it ```pycon

type: test = type('',(),{'new':lambda _,x:x})
type test
test: a = 5
test a
a
Traceback (most recent call last):
File "<stdin>", line 6, in getitem
KeyError: 'a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 9, in getitem
KeyError: 'a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 12, in getitem
AttributeError: module 'builtins' has no attribute 'a'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 14, in getitem
NameError: a is not defined

versed eagle
#

hm

#

are you using the module?

#

or is it copied from this

quartz wave
versed eagle
#

ah
that one is outdated

quartz wave
#

ok

versed eagle
#

if you want to use that instead

#

put these at the top of your main file, or before you run anything else in a REPL

from __future__ import annotations
import c
#

and then it should be enabled

quartz wave
#

and um ```pycon

type: test = type('',(),{'new':lambda _,x:x})
test: a = 5
a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\c.py", line 29, in getitem
raise NameError(f"{item} is not defined")
NameError: a is not defined

versed eagle
#

hm

#

that's not meant to happen

quartz wave
#

test somehow converted to int ```pycon

test
<class 'int'>

versed eagle
#

thats very much not meant to happen

#

ok im gonna go try to fix this brb

#

im pretty sure i found the problem

#

it might work now

#

but dont trust that

#

nope

#

still breaks

#

ah i know why it breaks

versed eagle
#

fixed it

#

i think

#

probably works now

#

yep

#

it works

#

at least, with my limited testing

#
>>> from __future__ import annotations; import c
>>> type: test = type("", (), {"__init__":(lambda s, A:None)})
>>> test: b = 1
>>> test
<class '__main__.'>
>>> b
<__main__. object at 0x7f6e0c327040>
#

@quartz wave sorry for the ping but you seemed like you wanted to use the module and now it works so I thought I'd let you know

bitter granite
#

Morning folks,
I'm getting confused on the role of the __all__ . Somehow I thought this would have also avoided the IDE not to see a particular class from the autocomposing, but this doesn't seem to be the case?

Can somebody advice? I'm sure I'm doing something wrong.

Pretend a directory structure like this:

= dir_with_my_packace
|__ module1.py
       |___ Class A
       |___ Class B
|__ module2.py 
      |___ Class C

In my dir_with_my_package I put the file __init__.py with the following content:

  from dir_with_my_packace.module1 import ClassA
  from dir_with_my_packace.module2 import ClassC

__all__ = ['ClassA', 'ClassC']

But in the IDE, when I do type dir_with_my_packace. ClassB is shown too.
What am I doing incorrecty?

restive void
sick hound
#

keyword args can be considered esoteric themselves jesus fucking christ

#

"Store the last n consts on the stack into keywords from const pool i, n being len(consts[i])" statements dreamed up by the utterly deranged

lucid night
#

Esoteric phyton

fossil rapids
#

Hi do you know a mathematical function that takes a number and doing some funky and complex stuff but in the end returns the same value?

#

Almost non readable function

sick hound
#

make one

#

should be relatively simple

low lynx
#

depends on what inputs you want to accept

#

if it's just integers i'd probably abuse taylor series and the like by truncating them and then rounding when the terms become negligibly small

twin reef
#

It only works for positive integers though

#

If f(n) is amount of coprimes with n less than n, then sum of f(n) for each n that divide k is k

quartz wave
fossil rapids
#

Ok guys i really appreciate

fossil rapids
quartz wave
sick hound
#

A lambda that replaces functools.reduce. ```py
red = lambda f, a: f(((a := (*a,)), [f(t, a[i+1]) for i, t in enumerate(a[-1:])])[1][-1], a[0])

print(red(lambda a, b: a + b, [1, 2, 3]))

low lynx
#

i raise you recursion

red=lambda f,a,r=None:red(f,a[1:],a[0]if r is None else f(r,a[0]))if a else r

comes with an initial value as well

earnest wing
#

call stack begging for mercy

sick hound
long fulcrum
#

is there any way to golf this?

sum(map(int,str(i)))```
#

(sum of digits)

fleet bridge
#
>>> sum(int(x)for x in str(x))
6
>>> sum(int(x)for x in f'{x}')
6
>>> sum(map(int,str(x)))
6
>>> sum(map(int,f'{x}'))
6
long fulcrum
#

ty

simple sphinx
#

is there a good way to import the same file multiple times?

#

preferably in a way such that each instance won't overrides the other one's variables

versed eagle
#

hm

#

import it, store that into a list
remove it from sys.modules

#

then repeat?

simple sphinx
#

good idea, ill try it one sec

#

altho I think it overrides some global variables

versed eagle
#

if it's removed from sys. modules, it should create a new instance

simple sphinx
#

one sec im testing

versed eagle
#

!e

import sys
l = []
import time
l.append(time)
del sys.modules["time"]
import time
print(l[0] is time)
night quarryBOT
#

@versed eagle :white_check_mark: Your 3.11 eval job has completed with return code 0.

False
versed eagle
#

two different instances of time

#

might not work with some modules

#

bc some are needed

#

but that should work in general

simple sphinx
#

for my use case it works as I just want the user to not know Im running their code in threads

#

thanks a lot 🙂

versed eagle
#

np

karmic pumice
#

How could i make a 1-liner out of this? I guess i'm missing something but i kinda dont understand what 🤷

'''
Convert rgb to hex

def rgb(r, g, b):
    buffer = ''
    for i in [min(r, 255), min(g, 255), min(b, 255)]:
        if i not in range(0, 256):
            buffer+='00'
        else:
            if len(str(hex(i)[2:])) == 1:
                buffer+=f'0{str(hex(i)[2:])}'
            else:
                buffer+=str(hex(i)[2:])
                
    return buffer.upper()
'''

def rgb(r, g, b):
    return ''.join(['00' for i in [min(r, 255), min(g, 255), min(b, 255)] if i not in range(0, 256) else (f'0{str(hex(i)[2:])}' if len(str(hex(i)[2:])) == 1 else str(hex(i)[2:]))]).upper()

earnest wing
#
rgb=lambda r,g,b:"".join(f"{min(255,max(0,a)):2X}"for a in(r,g,b))
#

might need [2:] haven't tested

karmic pumice
#

i mean this does work however it doesn't work correctly in cases like (0, 0, 0)

split kestrel
#

you could use bytes.hex

rgb = lambda r, g, b: '#' + bytes(min(255, max(0, n)) for n in (r, g, b)).hex()```
karmic pumice
#

woah, this is exactly what i needed, thanks, ill look into how it works 👍

versed eagle
#

haven't tested it though

#

so idk

#

actually, generator is shorter than map here

rgb=lambda*c:'#'+bytes(min(255,max(0,n))for n in c).hex()```
pearl socket
#

!e

class _int_t:
    def __init__(self, ln, s):
        self.ln = ln // 8
        self.s = s
    def __gt__(self, other):
        return int.from_bytes(other[0:self.ln], 'little', signed=self.s)
@type.__call__
class reinterpret_cast:
    def __lt__(self, other):
        return True
uint32_t = _int_t(32, False)
int32_t = _int_t(32, True)
uint16_t = _int_t(16, False)
int16_t = _int_t(16, True)
uint8_t = _int_t(8, True)
int8_t = _int_t(8, True)

if __name__ == '__main__':
    print(reinterpret_cast<uint32_t>(b'pytn'))
    print(reinterpret_cast<int32_t>(b'cast'))
    print(reinterpret_cast<uint16_t>(b'to'))
    print(reinterpret_cast<int16_t>(b'in'))
    print(reinterpret_cast<uint8_t>(b't'))
    print(reinterpret_cast<int8_t>(b's'))
night quarryBOT
#

@pearl socket :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 1853127024
002 | 1953718627
003 | 28532
004 | 28265
005 | 116
006 | 115
versed eagle
#

did discord update the colours for markdown formatting

#

i think it's different now

versed eagle
pearl socket
#

ah nice

meager zinc
#

!e This can be cleaned up pretty easily, and it cheats a bit but it works```py
class Number:
def init(self, value):
self._in_middle = False
self._value = value

def __lt__(self, other):
    return other._value if isinstance(other, Number) else other

def __eq__(self, other):
    return self._value == other._value if isinstance(other, Number) else self._value == other

def __pos__(self):
    if self._in_middle is False:
        self._value += 1
    self._in_middle = not self._in_middle
    return self

def __neg__(self):
    if self._in_middle is False:
        self._value -= 1
    self._in_middle = not self._in_middle
    return self

def __str__(self):
    return str(self._value)

class NonPythonLoop:
def init(self, start, end, _):
self._curr = start
--self._curr
--self._curr
self._end = end

def __bool__(self):
    ++self._curr
    return not self._curr == self._end

incr = Number(5)
print(incr)

++incr
++incr
print(incr)

--incr
print(incr)

print()

loop = NonPythonLoop(i := Number(0), i < 5, ++i)
while loop:
print(i)

night quarryBOT
#

@meager zinc :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 5
002 | 7
003 | 6
004 | 
005 | 0
006 | 1
007 | 2
008 | 3
009 | 4
versed eagle
#

nice, though the loop only increments

meager zinc
#

yeah

#

I think you would either need to use a lambda or use some backtrace magic

versed eagle
#

why not have Number.__pos__ and Number.__neg__ set an attribute on itself
and then the loop can check that attribute on _ to see what to do

meager zinc
#

possibly

#

but that would only work for ++ and --

#

also ++++incr is possible

#

which looks absolutely stupid

low lynx
#

you could also do

print(+-incr)
print(-incr)
print(+-+incr)
#

also don't you mean to flip in_middle before modifying the value? because rn +incr should increment it I think

earnest wing
#

<@&831776746206265384> ads

fallen heath
#

!tempban 1062653593162891335 14d It seems like you're only here to post an ad. Please reread our rules before coming back.

night quarryBOT
#

:incoming_envelope: :ok_hand: applied ban to @ornate fractal until <t:1674644977:f> (14 days).

split salmon
#

!e py __import__('pickle').loads(bytearray(map((lambda x:x-4),__import__('gzip').decompress(bytearray(map((lambda x:x-1 if x!=0xff else x),[1,1,1,92,39,114,106,209,1,145,131,49,206,133,104,59,52,171,26,6,102,198,214,43,198,6,6,154,63,3,10,139,161,11,163,221,179,147,139,161,115,163,221,139,131,221,203,181,159,3,153,94,77,200,12,70,188,135,126,50,160,41,206,79,41,45,225,77,104,51,12,244,212,115,76,148,185,20,2,3,195,26,153,226,108,255,3,100,191,154,235,1,9,140,32][::-1]))))))

night quarryBOT
#

@split salmon :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hello world!
versed eagle
#

+lvalue doesn't increment

vague cairn
#

I admit I'm not clear what you're doing but it feels like you meant to do this:

        return (other._value if isinstance(other, Number) else other) > self._value

    def __eq__(self, other):
        return (other._value if isinstance(other, Number) else other) == self._value```
low lynx
#

it increments and then skips the next increment

#

skipping the increment and then incrementing is probably better

versed eagle
#

i think it just needs to start with self._in_middle as True

#

instead of starting as False

low lynx
#

yeah that'd work too

versed eagle
low lynx
#

i was kinda ambiguous there as well with "should" instead of would

#

my b

versed eagle
#

iirc someone implemented incrementing and decrementing with frame hackery and bytecode parsing

#

here, cereal did decrementing

finite blaze
#

Yo

#

What would be the shortest way to check if all words in the list have the same length

versed eagle
#

as long as there's elements in the list and they're all iterables

finite blaze
#

That's not the shortest way

#

For example what i am doing rn looks like this

versed eagle
#

:P

finite blaze
#

Ah sorry

versed eagle
#

all good

finite blaze
#

Well, just for comparison I'll send my solution

versed eagle
#

ooh ok

finite blaze
#
len(k[0])*4==len(''.join(k[1,5]))
#

k is a list of words

#

There is 5 words in the list

versed eagle
#

ah

#

what do you do if you don't know the length of the list beforehand?

finite blaze
#

It doesn't matter in my case

versed eagle
finite blaze
#

Lets say that list will always have 5 elements

versed eagle
#

it returns true

finite blaze
#

Ooh you are right

versed eagle
dreamy pier
rugged owl
dreamy pier
low lynx
#

only works if the stuff in the iterable is hashable tho

dreamy pier
#

question was about "words" so i guess yes

fleet bridge
low lynx
#

oh wait yeah we're passing in the lengths

#

nvm then

primal isle
earnest wing
#

oops already mentioned

finite blaze
#

Thanks

versed eagle
versed eagle
sick hound
#

introducing things that were never meant to be: pseudo labels in python

versed eagle
#

oh hey
labels
I once implemented those
the only think I had was unconditional jumps though
never got around to adding conditionals :(

rough briar
#

my eyesyoucrazy

languid night
rugged sparrow
serene stratus
#

or rather, what can it achieve?

rugged sparrow
#

that specific file allows for loading an arbitrary address as an object (via a bug in the LOAD_CONST opcode)

sick hound
#

do i hear arbitrary code execution 🙂

sick hound
#

maybe actually

#

mhm

#

the python runtime still does python things, so you'd need to hide a python function or code object in memory, then load and execute it

#

i doubt you could get it to run shellcode

#

you're correct

#

but the ability to load arbitrary memory addresses as objects could still be damaging

#

it would be quite funny

#

it would

#

but i still have no idea how it works

#

well its quite simple, when a bug in the LOAD_CONST opcode allows an arbitrary address to be loaded as an object, it means that the virtual machine is not properly checking the address before loading it from memory, from there i assume you know the issues with that and how it could lead to exploitation

#

well yeah i know what it does

#

but i dont know how to get the overflow

#

oh i misunderstood

#

i do know that its something with EXTEND_ARG, and i have an assumption, but i have no idea otherwise

#

my assumption is that LC just goes into the const pool at index i and doesnt check if that index is actually still in the pool

#

If the index passed to the opcode is not within the range of the constant pool or if the constant pool entry at that index is not the expected type it could cause the program to access memory outside of the intended buffer, resulting in a buffer overflow vuln. It's something you should look into if youre interested

#

i certainly find python bugs interesting

sick hound
#

but if it is, that would be quite the funny

#

wouldn't be of that much use other than maybe obfuscation tho

#

yeah true

sick hound
#

it is indeed overflow/underflow

#

!e ```py
f=lambda s,k:"".join(chr([ord(c),(ord(c)+k-97)%26+97,(ord(c)+k-65)%26+65][c.isalpha()+c.isupper()])for c in s)

night quarryBOT
#

@sick hound :warning: Your 3.11 eval job has completed with return code 0.

[No output]
sick hound
#

!e


(lambda _, __, ___, ____, _____, ______, _______, ________:
    getattr(
        __import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
        ().__class__.__eq__.__class__.__name__[:__] +
        ().__iter__().__class__.__name__[_:][_____:________]
    )(
        _, (lambda _, __, ___: _(_, __, ___))(
            lambda _, __, ___:
                bytes([___ % __]) + _(_, __, ___ // __) if ___ else
                (lambda: _).__code__.co_lnotab,
            _ << ________,
            (((_____ << ____) + _) << ((___ << _____) - ___)) + (((((___ << __)
            - _) << ___) + _) << ((_____ << ____) + (_ << _))) + (((_______ <<
            __) - _) << (((((_ << ___) + _)) << ___) + (_ << _))) + (((_______
            << ___) + _) << ((_ << ______) + _)) + (((_______ << ____) - _) <<
            ((_______ << ___))) + (((_ << ____) - _) << ((((___ << __) + _) <<
            __) - _)) - (_______ << ((((___ << __) - _) << __) + _)) + (_______
            << (((((_ << ___) + _)) << __))) - ((((((_ << ___) + _)) << __) +
            _) << ((((___ << __) + _) << _))) + (((_______ << __) - _) <<
            (((((_ << ___) + _)) << _))) + (((___ << ___) + _) << ((_____ <<
            _))) + (_____ << ______) + (_ << ___)
        )
    )
)(
    *(lambda _, __, ___: _(_, __, ___))(
        (lambda _, __, ___:
            [__(___[(lambda: _).__code__.co_nlocals])] +
            _(_, __, ___[(lambda _: _).__code__.co_nlocals:]) if ___ else []
        ),
        lambda _: _.__code__.co_argcount,
        (
            lambda _: _,
            lambda _, __: _,
            lambda _, __, ___: _,
            lambda _, __, ___, ____: _,
            lambda _, __, ___, ____, _____: _,
            lambda _, __, ___, ____, _____, ______: _,
            lambda _, __, ___, ____, _____, ______, _______: _,
            lambda _, __, ___, ____, _____, ______, _______, ________: _
        )
    )
)
night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hello world!
sick hound
#

Yay

sick hound
#

cool

sick hound
sick hound
#

It’s esoteric python

dense nova
#

!e

f=lambda s,k:"".join(chr([ord(c),(ord(c)+k-97)%26+97,(ord(c)+k-65)%26+65][c.isalpha()+c.isupper()])for c in s)
print(f('abs', 2))
#

ord(c)+k

night quarryBOT
#

@dense nova :white_check_mark: Your 3.11 eval job has completed with return code 0.

cdu
dense nova
#

Ah

arctic skiff
versed eagle
# arctic skiff Good now explain how this works

using co_nlocals to index into a tuple of lambdas, then using co_argcount to get numbers from those
doing bitshifts with those numbers
doing some indexing into builtin type names to build a string
and so on

arctic skiff
#

Never heard of co_nlocals

versed eagle
#

it's an attribute of code objects

#

number of local variables for a function

rugged sparrow
burnt pasture
languid hare
#

agree, seems rather misleading to say that the bug is within python, unless you can provide python code that compiles to that malformed bytecode
(or maybe i misunderstand)

karmic pumice
#
euler = lambda steps: __builtins__.sum([1/(__import__('math').factorial(i)) for i in __builtins__.range(steps)])

how can i make this more esoteric? is there something for keywords like with builtin functions?

versed eagle
#

instead of for loop

#

iter instead of range

austere mauve
#
def a():
 try:
  a()
 except:
  a()
a()
#

It caused python core dump, but it seems like with newer versions it doesn't work.

#

Now prints a whole lot of traceback.

#

!e ```py
import sys
sys.setrecursionlimit(8) # speed up a little
def a():
try:
a()
except:
a()
a()

night quarryBOT
#

@austere mauve :x: Your 3.10 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 5, in a
003 | RecursionError: maximum recursion depth exceeded
004 | 
005 | During handling of the above exception, another exception occurred:
006 | 
007 | Traceback (most recent call last):
008 |   File "<string>", line 5, in a
009 |   File "<string>", line 7, in a
010 | RecursionError: maximum recursion depth exceeded
011 | 
... (truncated - too many lines)

Full output: too long to upload

austere mauve
winged turtle
#

what

karmic pumice
#

This is a hello world print

#

@winged turtle

winged turtle
#

what is the reason

#

why

#

who would ever type all of that

karmic pumice
#

It's the same thing as what you were trying to do

winged turtle
#

???

#

so I have to type all of that

karmic pumice
#

You were going to do multiple actions that could be done with just 1

winged turtle
#

lemme just type it really quick

#

how does the bot work

karmic pumice
#

!e and the code

winged turtle
#

!e print("test")

night quarryBOT
#

@winged turtle :white_check_mark: Your 3.11 eval job has completed with return code 0.

test
winged turtle
#

okay thanks

#

!e input("enter weight:")
Weight = int(input())
input("enter height:")
Height = int(input())
wh2 = WeightHeight**2
bmi = wh2
703
print(bmi)

night quarryBOT
#

@winged turtle :x: Your 3.11 eval job has completed with return code 1.

001 | enter weight:Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
winged turtle
#

so

#

that

#

or what

#

oh it screwed up

#

because of discord

karmic pumice
#

input() probally doesn't work with the bot 🤷‍♂️ for obvious reasons.

winged turtle
#

!e ```input("enter weight:")
Weight = int(input())
input("enter height:")
Height = int(input())
wh2 = WeightHeight**2
bmi = wh2
703
print(bmi)

night quarryBOT
#

@winged turtle :x: Your 3.11 eval job has completed with return code 1.

001 | enter weight:Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
karmic pumice
#

Your code is wrong tho

winged turtle
#

i did what I was told

karmic pumice
#

You're trying to do

input(text)
Var = input()
#

When you want to either do

#
Var = input(text)
#

Or

print(text, end="")
var = input()
winged turtle
#

!e Weight = int(input('enter weight:'))
Height = int(input('enter height:'))
wh2 = WeightHeight**2
bmi = wh2
703
print(bmi)

night quarryBOT
#

@winged turtle :x: Your 3.11 eval job has completed with return code 1.

001 | enter weight:Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
winged turtle
#

that?

#

wist one sec

karmic pumice
#

Yep

#

!code

night quarryBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

winged turtle
#

!e ```Weight = int(input('enter weight:'))
Height = int(input('enter height:'))
wh2 = WeightHeight**2
bmi = wh2
703
print(bmi)

night quarryBOT
#

@winged turtle :x: Your 3.11 eval job has completed with return code 1.

001 | enter weight:Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
winged turtle
#

there

karmic pumice
#

Yep

winged turtle
#

wair one sec

#

!e ```py
Weight = int(input('enter weight:'))
Height = int(input('enter height:'))
wh2 = WeightHeight**2
bmi = wh2
703
print(bmi)

night quarryBOT
#

@winged turtle :x: Your 3.11 eval job has completed with return code 1.

001 | enter weight:Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
winged turtle
#

I swear I saw color before

karmic pumice
#

It won't work with the bot anyways because of the inputs

winged turtle
#

am I stupid or is there actually a way to get colored text?

karmic pumice
#

You specify the language after first tree backticks

winged turtle
#

i did

karmic pumice
#

Not everything gets colored tho

winged turtle
#
print('hello word')
karmic pumice
#

Yep, it's just the fact that some stuff gets colored and some doesnt

winged turtle
#

what gets colored

karmic pumice
#

Keywords, some functions, etc etc. I don't really exactly know it

winged turtle
dire galleon
#

Does it even work on mobile

winged turtle
karmic pumice
#

!e

print(__builtins__.sum([1, 2, 3]))
night quarryBOT
#

@karmic pumice :white_check_mark: Your 3.11 eval job has completed with return code 0.

6
winged turtle
#

what

karmic pumice
winged turtle
#

ooo I just thought of something dun

winged turtle
#

lemme show u the right script

#

i dont think this app works

#

it gave me 0

karmic pumice
#

It's just weight / (height**2)

winged turtle
#

one sec

#

yeah

#

well

#

yeah pretty much

sick hound
#

What’s **

karmic pumice
#

Exponentiation

winged turtle
#

"to the power of"

#

lthat

#

that

#

thanks

#

im stupid

#

so like weight/(height^2)

karmic pumice
#

^ in python is bwise xor iirc

winged turtle
#

heres it done correctly

karmic pumice
#

!e

print((2^2), (0^1))
night quarryBOT
#

@karmic pumice :white_check_mark: Your 3.11 eval job has completed with return code 0.

0 1
winged turtle
#

huh

#

last time I tried that it added

karmic pumice
winged turtle
#

I have no idea but it works

#

wait

#

one sec

astral rover
#

seems like coincidence

#

should be using **2

karmic pumice
#

I think he doesn't understand that height needs to be in meters

winged turtle
#

who

karmic pumice
#

You

winged turtle
#

wdym

karmic pumice
#

The height you input should be in meters

winged turtle
#

that would give me an absurd number

karmic pumice
#

And then you need to use float instead of int

winged turtle
#

can you re write the script then

#

if you have time

karmic pumice
#

Writing from phone is such a pain lmao

languid hare
#

703 is probably conversion from metric/imperial

winged turtle
#

but no one puts it in meters

astral rover
#

i would

#

am i no one????

winged turtle
#

i was gonna make the script let u enter feet and inches

karmic pumice
#

Then it'd be a bit more complicated

#

You'd need to convert it to meters first

quartz wave
winged turtle
#

no you dont

#

just use inches

#

just convert it into inches and keep the script

quartz wave
#

that's probably where it came from

winged turtle
#

"yeah im 1.626 meters tall) 💀

karmic pumice
#

Wtf does 703 come from lmao

winged turtle
#

i have no idea

karmic pumice
#

What if someone is 6'10?

quartz wave
#

if inches are based on the metric system why are we having problems with converting

languid hare
#

(also not the appropriate channel)
anyway
1m = ~40 inches
1kg = ~2.2 pounds
40²/2.2 = ~750

quartz wave
winged turtle
#

(6*12)+10

#

whatever that equals

karmic pumice
#

Well if they enter 610 then it will break

#

Not really break but won't act as we need it to

quartz wave
#

that's how to write it

winged turtle
#

!e 18.707763671875/1.703125

night quarryBOT
#

@winged turtle :warning: Your 3.11 eval job has completed with return code 0.

[No output]
winged turtle
#

okay ill just use a calculator then

quartz wave
#

69 ```py
w,h=eval("int(input('enter %seight:')),"2%('wh',));print(w*703/h/h)

winged turtle
#

uhm

karmic pumice
#

K lmao this is esoteric enough ahaha

winged turtle
#

look.

#

same result

languid hare
karmic pumice
languid hare
#

also please move to an appropriate channel if possible

winged turtle
#

!e

sussy = 34
baka = 35
print (sussy + baka)
night quarryBOT
#

@winged turtle :white_check_mark: Your 3.11 eval job has completed with return code 0.

69
winged turtle
#

oh wtf

#

why does that not work

#

oh nvm

#

im stupid

#

wait a minute...

#

oh nvm yeah it works

quartz wave
#

72 but more esoteric ```py
print(eval(("int(input('enter %seight:'))*703/"2)[:-5]%('wh',)+'**2'))

languid hare
#

you could do a double eval instead of int pithink
inb4 rm rf height

winged turtle
winged turtle
#

@karmic pumice i think print is better after all. When you use input, it limits the amount of characters you can type

versed eagle
meager zinc
#

!e Credit to @gritty mesa and @subtle solar for the original concept in the TIL post (#1055288361629274112 message)
Turns out you can integrate an entirely different language in python. As a demonstration, here is brainf:

from __future__ import annotations

@lambda _:_()
class __annotations__:
    def __setitem__(self, v, p):
        if v.endswith("_BF"):
            s=[i:=0];c=''
            for o in p:c+=' '*i+[f'i+=1\n{" "*i}if i>=len(s):s+=[0]','i-=1','s[i]+=1','s[i]-=1','print(end=chr(s[i]))','s[i]=ord(__import__("sys").stdin.read(1))','while s[i]:','s','']['><+-.,['.find(o)]+'\n';i+=(92-ord(o))*(o in'][')
            exec(c);globals()[v]=s

var_BF: "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."

print(var_BF)
night quarryBOT
#

@meager zinc :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | Hello World!
002 | [0, 0, 72, 100, 87, 33, 10]
winged turtle
#

also im switching to insitux

versed eagle
winged turtle
#

well they brought me here

#

one sec

#

ill find it

#

NikIta#3695 told me to go there and then started teaching me stuff about python

#

here*

versed eagle
#

this channel is for esoteric python
we're happy to teach esoteric python, but this channel isn't for normal python or bot spam

languid hare
#

^

sick hound
#

Replit app is very garbage

winged turtle
sick hound
winged turtle
#

im on an iphone

sick hound
#

Ohh

#

Ok

#

I cant find an app to code in mobike cuz my laptop broke last week

fleet bridge
#
>>> print(object.__repr__(1))
<int object at 0x00007FFEC786D328>
sick hound
#

now introducing: yes ```py
print(True | True << True | True << (True | True << True) | True << (True << (True << True)) | True << (True | True << (True << True)) | True << (True << True | True << (True << True)))

#

!e print(True | True << True | True << (True | True << True) | True << (True << (True << True)) | True << (True | True << (True << True)) | True << (True << True | True << (True << True)))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

123
sick hound
#

How did you come up with that

sick hound
#

and optimized it

#

It’s just bitwise operators isn’t it?

#

it is

#

its basically just reconstructing the int one bit at a time

#
BT_TRUE = lambda: Constant(True)


def transform_bits(node: Constant):
    ic: int = node.value
    if ic == 0:
        return node
    bits = []
    while ic > 0:
        msk = ic & 0b1
        bits.append(msk)
        ic >>= 1
    conv_bits = zip(bits, range(len(bits)))
    conv_bits = list(filter(lambda x: x[0] == 1, list(conv_bits)))
    if len(conv_bits) == 0:
        conv_bits = [(0, 0)]
    sm = BinOp(
        left=BT_TRUE(),  # this will always be true
        op=LShift(),
        right=Constant(conv_bits[0][1])
    ) if conv_bits[0][1] != 0 else BT_TRUE()
    for x in conv_bits[1:]:
        sm = BinOp(
            left=sm,
            op=BitOr(),
            right=BinOp(
                left=BT_TRUE(),  # this will always be true
                op=LShift(),
                right=Constant(x[1])
            )
        )
    return sm
#

here is the ast

#

What’s ‘ast’?

sick hound
#

representing python source as a list of nodes

#

I see

sick hound
sick hound
#

but all you need to deobfuscate that is to put it into the python repl

#

Yeah, to the average readers they’ll have no clue what’s going on though

sick hound
#

you can manipulate that really easily and tell ast to turn it back into py source

#

which makes this entire thing a trillion times easier

#

Im not entirely sure what ast is still 😟

sick hound
#

which you can modify

#

and turn back into source

#

modifying source code is really easy with this

#

Interesting

#

Do you think you could run eval with using that type of obfuscation

#

wdym

#

!e
print(True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True))))))))))))))))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True))))))))))))))))
003 |          ^
004 | SyntaxError: '(' was never closed
sick hound
#

one more

#

!e
print(True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True | (True << (True)))))))))))))))))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | OverflowError: too many digits in integer
sick hound
#

Yeah I am not good with this 😂

sick hound
#

you were bitshifting left by 26815615859885194199148049996411692254958731641184786755447122887443528060147093953603748596333806855380063716372972101707507765623893139892867298012168193

#

aka a binary number with 1 one and 26815615859885194199148049996411692254958731641184786755447122887443528060147093953603748596333806855380063716372972101707507765623893139892867298012168193 zeroes

#

Whoops

#

#bot-commands

sharp moon
#

i love the idea of manipulating an ast

sick hound
#

I’m scared

sharp moon
#

like it kinda cuts out all the fluff of having to code in a text file, all these silly issues with whitespace go away

sharp moon
#

yes

sick hound
#

modify to your hearts content without having to worry about the actual source code

sharp moon
#

i want to get good at it

sick hound
#

its very easy to get good at it

sharp moon
#

are you good, if so where did you start?

sick hound
#

remember these 3 things:

  • smoke crack while using it
  • contemplate your life while using it
  • fix_missing_locations
sharp moon
#

lol

sick hound
sharp moon
#

the last one sounds useful

#

maybe the second

#

idk maybe crack is good too idefk

sick hound
#

Print the number 14 with it

sick hound
#

No no, with the bitwise operators

sharp moon
#

what does load do?

sick hound
# sick hound No no, with the bitwise operators
Call(
        func=Name(id='print', ctx=Load()),
        args=[
          BinOp(
            left=BinOp(
              left=BinOp(
                left=Constant(value=True),
                op=LShift(),
                right=Constant(value=True)),
              op=BitOr(),
              right=BinOp(
                left=Constant(value=True),
                op=LShift(),
                right=BinOp(
                  left=Constant(value=True),
                  op=LShift(),
                  right=Constant(value=True)))),
            op=BitOr(),
            right=BinOp(
              left=Constant(value=True),
              op=LShift(),
              right=BinOp(
                left=Constant(value=True),
                op=BitOr(),
                right=BinOp(
                  left=Constant(value=True),
                  op=LShift(),
                  right=Constant(value=True)))))],
        keywords=[])
sick hound
#

Load() means "load this name"

sick hound
#

Store() means "store it in this name"

sick hound
sick hound
sharp moon
#

so i wanna take this symbol that the interpreter should know about and i want to load it

#

is it loaded into the global dict

sick hound
#

print(True << True | True << (True << True) | True << (True | True << True)) this is the actual thing

sharp moon
#

is that the load destination?

sick hound
#

wdym

sharp moon
#

like loading to where?

#

current scope

sick hound
#

loading from current scope vars, yes

#

storing too

sharp moon
#

ah ok

sick hound
#

Name("abc", Load()) is basically abc

sharp moon
#

ah ok

sick hound
#

Name("abc", Store()) will never occur on its own, but basically means abc = something

sharp moon
#

ah yes

#

you would put the "something" in the args?

sick hound
#

this is how a Store() would look

sick hound
#

args are only for the Call node

#

aka a function call

sharp moon
#

ah ok only for callables

#

ah so args is an argument to the function call

sick hound
#

yes

#

certain nodes have certain arguments

sharp moon
#

i have an gui instance creator i will show you

#

it would be fun with ast

#

works with databases

sick hound
#

damn

sharp moon
#

its autogened editing ui so could code in it

#

and then save to like mongodb

sick hound
#
getattr(__import__("random"), "choice")([“sleep”, “don’t sleep”])
sharp moon
#

ah so store is with assign

#

i wanna learn thisssss

#

gonna download shittons of vids

sick hound
sick hound
#

how can I get the letters r and h using something like

str.__class__.__name__[3]
sharp moon
#

!e str.name[ 2]

#

!e print( str.name[ 2])

night quarryBOT
#

@sharp moon :white_check_mark: Your 3.11 eval job has completed with return code 0.

r
sharp moon
#

like this?

#

you have it no?

sick hound
#

Yeah

#

I can’t find an h one

sick hound
#

it exists

#

I just used hex

earnest wing
#

!e ```py
print(int.doc.doc.class.class.getattribute.str.str.str()[4])

night quarryBOT
#

@earnest wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

h
earnest wing
#

etc.

sick hound
#

!e
getattr(import(().class.eq.class.name[1] +().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + True.class.name[1] + round.class.name[11] + str.class.name[3])([1, 2])

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: module 'random' has no attribute 'chooce'. Did you mean: 'choice'?
sick hound
#

!e getattr(import(().class.eq.class.name[1] +().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + id.name[0] + round.class.name[11] + str.class.name[3])([1, 2])

night quarryBOT
#

@sick hound :warning: Your 3.11 eval job has completed with return code 0.

[No output]
sick hound
#

Hmm why’s it not choosing a number

last locust
#

!e py print(getattr(__import__(().__class__.__eq__.__class__.__name__[1] +().__class__.__eq__.__class__.__name__[2] + round.__class__.__name__[6] + dir.__name__[0] + round.__class__.__name__[14] + map.__name__[0]), round.__class__.__name__[11] + hex.__name__[0] + round.__class__.__name__[14] + id.__name__[0] + round.__class__.__name__[11] + str.__class__.__name__[3])([1, 2]))

night quarryBOT
#

@last locust :white_check_mark: Your 3.11 eval job has completed with return code 0.

1
sick hound
#

!e print(getattr(import(().class.eq.class.name[1] + ().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + id.name[0] + round.class.name[11] + str.class.name[3])([1, 2]))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

1
sick hound
#

Ah my fault

#

I’m gonna use this way too much 😂

sick hound
last locust
sick hound
#

!e print(getattr(import(().class.eq.class.name[1] + ().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + id.name[0] + round.class.name[11] + str.class.name[3])([100, 2]))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

100
sick hound
#

!e print(getattr(import(().class.eq.class.name[1] + ().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + id.name[0] + round.class.name[11] + str.class.name[3])([26485842168683588, 2]))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

2
sick hound
#

!e print(getattr(import(().class.eq.class.name[1] + ().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + id.name[0] + round.class.name[11] + str.class.name[3])([100, 2]))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

2
sick hound
#

!e print(getattr(import(().class.eq.class.name[1] + ().class.eq.class.name[2] + round.class.name[6] + dir.name[0] + round.class.name[14] + map.name[0]), round.class.name[11] + hex.name[0] + round.class.name[14] + id.name[0] + round.class.name[11] + str.class.name[3])([100, 2]))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

2
sick hound
#

But it printed 100 just now

quartz wave
sick hound
#

Oh

#

I think I should actually learn what it is before trying

#

Never knew you could can just import and print in one line

#

!e print(__import__('time'))e)

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(__import__('time'))e)
003 |                               ^
004 | SyntaxError: unmatched ')'
sick hound
#

Uh

#

!e print(__import__('time')e)

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(__import__('time')e)
003 |           ^^^^^^^^^^^^^^^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
sick hound
#

Hmm

#

Help

austere mauve
#

!e ```py
print(import('time'))

night quarryBOT
#

@austere mauve :white_check_mark: Your 3.11 eval job has completed with return code 0.

<module 'time' (built-in)>
sick hound
#

I want it to import time AND print “e”

austere mauve
#

!e

print(__import__("time"), "e")
night quarryBOT
#

@austere mauve :white_check_mark: Your 3.11 eval job has completed with return code 0.

<module 'time' (built-in)> e
austere mauve
#

Or

low lynx
#

!e

print(__import__('time') and 'e')
night quarryBOT
#

@low lynx :white_check_mark: Your 3.11 eval job has completed with return code 0.

e
austere mauve
#

!e ```py
(import("time"),print("e"))

night quarryBOT
#

@austere mauve :white_check_mark: Your 3.11 eval job has completed with return code 0.

e
sick hound
#

!e ```py
(import("time"),print("This code is to confuse my friends "))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

This code is to confuse my friends 
sick hound
#

Yay

#

Now time to find out how to import multiple modules

#

!e ```py
(import("time"), (import("random),print("e"))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     (__import__("time"), (__import__("random),print("e"))
003 |                                                       ^
004 | SyntaxError: unterminated string literal (detected at line 1)
sick hound
#

Probably bracket

#

!e ```py
(import("time"), (import("random),print("e")))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     (__import__("time"), (__import__("random),print("e")))
003 |                                                       ^
004 | SyntaxError: unterminated string literal (detected at line 1)
sick hound
#

Welp

#

Idk

#

!e import time, random print("e")

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

e
sick hound
#

@sick hound

#

is that what u wanted

languid hare
sick hound
#

!r
(__import__("time"), (__import__("random"),print("e")))

#

It’s !e lol

#

!e
(__import__("time"), (__import__("random"),print("e")))

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

e
sick hound
#

ye mistype

#

ty

sick hound
#

!e ```py
(import("time"), (import("random”),print("e")))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     (__import__("time"), (__import__("random”),print("e")))
003 |                                                        ^
004 | SyntaxError: unterminated string literal (detected at line 1)
sick hound
#

Remove one ) at the end

#

!e
(__import__("time"), (__import__("random"),print("e")))

#

Wait nvm

night quarryBOT
#

@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.

e
sick hound
#

!e ```py
(import("time"), (import("random”),print("e")))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     (__import__("time"), (__import__("random”),print("e")))
003 |                                                        ^
004 | SyntaxError: unterminated string literal (detected at line 1)
sick hound
#

What’s the difference

#

the quote

sick hound
#

Oh my god

#

!e ```py
(import(“time”), (import(“random”),print("e")))

night quarryBOT
#

@sick hound :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     (__import__(“time”), (__import__(“random”),print("e")))
003 |                 ^
004 | SyntaxError: invalid character '“' (U+201C)
sick hound
#

Yeahhh

#

"

#

#

There is a difference

#

You need to use the right quotes

#

Never knew there were different quotes

#

The more you know

#

You can’t print text with those bitwise ops or can you? @sick hound

sick hound
#


"
To really mess with someone’s mind you can also use these Chinese quotes I guess, I think they are different

sick hound
#

b64 just converts it into another string

#

i fail to see how that would help

#

Nvm

#

I forgot it has more than just numbers