#esoteric-python
1 messages · Page 8 of 1
does it work or what
it does nothing
and when I told copilot > make smth that compiles code from this source
it didn't work
don't trust copilot
i said don't trust copilot smh
yea
but this is INSANE
HOW THE FUCK DID IT DO THAT
ITS AN AI NOT MADE FOR IT
YET IT DOES IT
TF
btw i also added a function to obfuscate the index
see it in the latest revision of the file
>>> __builtins__.__getattribute__(__name__.__len__().__class__.__doc__.__getitem__((__:=(____:=(___:=(__:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(__).__len__()).__mul__(___).__add__(__name__.__eq__(__name__))).__mul__((_______:=(_____:=(__:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(__).__add__(__).__len__()).__mul__((______:=___.__mul__(___).__add__(_____))))).__add__((___________:=___.__mul__((__________:=___.__mul__((_________:=_____.__mul__(_____).__add__((________:=___.__mul__(___))))))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(__)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__name__.__ne__(__name__))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________:=_____.__mul__((______________:=___.__mul__((_____________:=___.__mul__(____)))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_______________:=______.__mul__(__________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((________________:=______.__mul__(______)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_________________:=_____.__mul__((__________________:=___.__mul__(_____)))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__)))(__name__.__len__().__class__.__doc__.__getitem__(_________________).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________________:=_____.__mul__(____))))).__doc__[(______________________:=___.__mul__((______________________________:=___.__mul__((_____________________________:=___.__mul__((____________________________:=___.__mul__((___________________________:=___.__mul__((__________________________:=______.__mul__((_______________________:=___.__mul__(________))).__add__((_________________________:=_____.__mul__((________________________:=_____.__mul__(_____))))))))))))))))]
'Z'
now here is how long it takes to get just Z
figured it out
haha thats kind of funny
must be the first AI to deobfuscate python code
I guess it understands the code and guesses the names
anyone know how to deobf pyarmor obfuscation
first time in this channel
just had a fucking stroke
Oh good jesus christ
m
Those all don't work anymore
there's no dot in there
also that's a tuple with 2 elements
Thanks
so I got an obfuscated file which I wish to deobf but I can't figure out how
Source Generated with Pycdc | Pyxtractor from pystyle import Colorate, Colors import c - 1589be3c
anyway to cross platform Marshal
? so i can obfuscate in 3.10 and use in 3.7
or prevent ValueError: bad marshal data (unknown type code) which results when obfuscating in 3.10 and executing in 3.7
If you're calling marshal.dump yourself, you can pass the optional version argument
its not the py version
read into version on marshal
I know.. I've just seen that 3.7 uses the same version as 3.10
odd i have obfuscated print('example') with marshal using 3.10 and it wont run in 3.7 let alone 3.8,3.9 etc
Can someone help me deobfuscate this file or guide me on how to deobfuscate it?
https://controlc.com/1589be3c - Pastebin link
Source Generated with Pycdc | Pyxtractor from pystyle import Colorate, Colors import c - 1589be3c
Can you please use a normal pastebin that doesn't have ads?
!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.pythondiscord.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.
the code is too big for pastebin itself
it dosent have ads tho
i was using an ad blocker my bad
These just replace X with Y
It would be nice to have a math function which in the end generates a working code.
Use xdis
xdis??
did you Google it?
Not rlly havent looked into it
could i replace my obfuscator that uses marshal with xdis?
yes?
mk
yandere dev
YOU HAVE BEEN WARNED
>>> transform.transform(
"""from functor import pure, (<$>), unrelated
print(str <$> pure 1)"""
)
from hoopy.magic import *
from functor import pure
__import_operator__(__name__, 'functor', 0, '<$>')
from functor import unrelated
print(__operator__(__name__, '<$>')(str, __partial_apply__(pure, 1)))
Hey, I'm trying to golf a 38 line script for fun and this is how far I got, I'm happy so far. But maybe some of you have an idea on on how to golf this even more, possibly even into a oneliner(?). Thanks!
j,k=set(),set()
for i in open("c").readlines():h,l=i.split();j.add(h);k.add(l)
print(j-k)
Easier to read version:
j, k = set(), set()
for i in open("c").readlines():
h, l = i.split()
j.add(h)
k.add(l)
print(j - k)
j,k=set(),set()
for h,l in map(str.split,open("c")):j.add(h);k.add(l)
print(j-k)
Thank you, these are great tips :)
im a bit late to the party, but
# not shorter sadly, but it is a 1 liner expression, so theres that
(j:=set(),k:=set(),{(j.add(h),k.add(l))for h,l in map(str.split,open("c"))},print(j-k))
# slightly golfed version of whats above that isnt an expression
# still not shorter than what L3v has, though
j=set();k=set();{(j.add(h),k.add(l))for h,l in map(str.split,open("c"))};print(j-k)
If you only have characters, you could take advantage of the equal spacing with something likepy a=open('c').read() print(set(a[::4])-set(a[2::4])) but if not, you could use the fact that str.split without arguments can split on both spaces and newlines with something like```py
a=open('c').read().split()
print(set(a[::2])-set(a[1::2]))
To get it to one line, you can define `a` with a walroos (e.g. `set((a:=open('c').read())[::4])`) or just join everything with semicolons
print({*a[::2]}-{*a[1::2]})
print({*(a:=open('c').read())[::4]}-{*a[2::4]})
print({*(a:=open('c').read().split())[::2]}-{*a[1::2]})
full working versions
more than what?
a=open('c').read().split()
print({*a[::2]}-{*a[1::2]})
is 54, yours is 55
ok
In general walrus isn't worth it if you need to add parentheses
Wow, thanks guys, I didn’t expect this could be golfed even more. I‘m new to golfing, but it‘s kinda fun tbh
Also u can do something like j=k=set()
Am I correct?
No, sets are mutable and both variables would be assigned the same set, or to be more exact the same reference that points to the same set in memory. That means that if I add something to j, the change will also be in k, because they are the same set with two different variable names. Actually I did that at first because I didn’t think of it, but I already had my headaches with that exact problem so I could quickly fix that.
Ah yeah
You are right
Now that you mentioned it i remember having the same issue
When i was golfing my snake code :p
Yeah, it‘s pretty confusing the first time you have it and hard to debug/google.
question: say I want to map a function over an iterable while providing some positional arguments, in a functional-ish (as in the paradigm) way. functools.partial only allows for setting the first positional arguments and creating a whole lambda slows everything down a lot because that's unnecessary calls. inline iterators are significantly slower than map/starmap. my solution so far is to use itertools.zip_longest with an empty sequence and a fill value: starmap(operator.pow, zip_longest(range(10), [], fillvalue=4)). any other, perhaps not this clumsy, solutions?
(also zipping with itertools.repeat seems to be slightly faster, why? is it just because I have to initialize the empty list? doesn't seem like it)
!e
import timeit
# repeat
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, zip(range(10000), itertools.repeat(4, 10000))))", setup="import itertools, operator", number=100))
# zip_longest
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, itertools.zip_longest(range(10000), [], fillvalue=4)))", setup="import itertools, operator", number=100))
@shadow dome :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 0.18810307048261166
002 | 0.21333063952624798
the repeat solution seems to be pretty much just as good as partial in terms of speed
even slightly better in fact
huhh
!e
import timeit
# partial
print(timeit.timeit("_ = list(map(functools.partial(operator.pow, 4), range(500)))", setup="import functools, operator", number=5000))
# repeat
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, zip(itertools.repeat(4, 500), range(500))))", setup="import itertools, operator", number=5000))
@shadow dome :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 2.2367286067456007
002 | 1.7939610872417688
oh wow that's a lot more different than I expected even
huh
even weirder: itertools.cycle seems to be even quicker
and itertools.cycle([4]) is a bit slower than itertools.cycle(itertools.repeat(4, 1)) (edit: this might be wrong; the difference is very tiny)
(both are quicker than a bare itertools.repeat
!e
import timeit
# partial
print(timeit.timeit("_ = list(map(functools.partial(operator.pow, 4), range(500)))", setup="import functools, operator", number=5000))
# cycle
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, zip(itertools.cycle(itertools.repeat(4, 1)), range(500))))", setup="import itertools, operator", number=5000))
@shadow dome :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 1.8840272314846516
002 | 1.723915133625269
welp
that's inconsistent -_-
partial took 2.2 last time -_-
whatever, it's still slower
have I just proven functools.partial useless in most cases in terms of efficiency?
why is it almost 5% faster?
...why don't you include the .partial() call in the setup?
i think at this point we're just comparing creation times
it's all useless to apply that benchmark to real code if you're including the creation time 🙂
!e ```py
import timeit
partial
print(timeit.main(['-s', "import functools, operator;p = functools.partial(operator.pow, 4)", '-n', '5000', "_ = list(map(p, range(500)))"]))
cycle
print(timeit.main(['-s', "import itertools, operator;p = itertools.cycle(itertools.repeat(4, 1))", '-n', '5000', "_ = list(itertools.starmap(operator.pow, zip(p, range(500))))"]))
types.MethodType
print(timeit.main(['-s', "import types, operator; p = types.MethodType(operator.pow, 4)", '-n', '5000', "_ = list(map(p, range(500)))"]))
extracting the creation of partial slows it down
because it has to look up the global var I'm assuming ...?
@quartz wave :warning: Your 3.11 eval job timed out or ran out of memory.
[No output]
ok so according to what i benchmarked they all have like the same speed
it's really similar but the difference is statistically significant
operator.pow contributes to the majority of the slowing i think
!ti py import types, operator; p = types.MethodType(operator.pow, 4) ```py
_ = list(map(p, range(500)))
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
1000 loops, best of 5: 343 usec per loop
!ti py import itertools, operator;p = itertools.cycle(itertools.repeat(4, 1)) ```py
_ = list(itertools.starmap(operator.pow, zip(p, range(500))))
the difference will become more noticeable if I replace pow with add ig...
lemme try
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
1000 loops, best of 5: 340 usec per loop
!ti py import functools, operator;p = functools.partial(operator.pow, 4) ```py
_ = list(map(p, range(500)))
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
1000 loops, best of 5: 428 usec per loop
yep the difference is more significant
oof
it's supposed to work generally
with positional arguments and keyword arguments
I mean, that's kinda what I'm doing here?
also... new info about the speed differences in cycle vs repeat lol
you're using only one argument
then one more for the actual call
!ti
import itertools, operator
p = itertools.repeat(4, 1000)
_ = list(itertools.starmap(operator.add, zip(p, range(1000))))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
500000 loops, best of 5: 908 nsec per loop
!ti
import itertools, operator
p = itertools.cycle(itertools.repeat(4, 1))
_ = list(itertools.starmap(operator.add, zip(p, range(1000))))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
2000 loops, best of 5: 86.5 usec per loop
wow that's...
that's a lot faster
ig that's cuz under the hood it does iteration < 1000 and that's unnecessary branching?
the remaining 499999 loops basically just create an empty list with overhead
itertools.repeat() runs out doesn't it
yes but that's the point here?
the length of the repeat object is the same as of my iterable?
!ti ```py
import itertools, operator
p = itertools.repeat(4)
```py
_ = list(itertools.starmap(operator.add, zip(p, range(1000))))
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 82.9 usec per loop
wait you can do that?
yeah i just looked at help(itertools.repeat)
💀 _ _
yes but then for the other loops it's empty since the counter has run out
got it
thanks lol
so we just beat partial
at speed
for most uses
because in most cases that is how partial is used
!ti ```py
import itertools, operator
p = itertools.repeat(4)
```py
_ = list(map(operator.add, p, range(1000)))
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 74.9 usec per loop
oh yeah we can do that too
in python 3.10 there's no noticeable difference between repeat(4, 1000) and repeat(4)...
instead of using itertools.starmap()
!ti ```py
import itertools, operator
p = itertools.repeat(4)
```py
_ = [*map(operator.add, p, range(1000))]
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 74.5 usec per loop
@shadow dome probably like the fastest we can go
probably
unless a list comprehension with zip() does better
also creating the list uses up memory; to actually evaluate the speed of the iterator isn't it better to use all(..)?
I don't think so
idk
you can avoid even more time by using a deque with maxlen=0
but it's very minor
small lists are pretty fast
we aren't using small lists at all ...?
can you show an example?
!ti
import itertools, operator
p = itertools.repeat(4)
# To remove list creation altogether
all(map(operator.add, p, range(1000)))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 76.2 usec per loop
this is interesting...
!ti
import itertools, operator, collections
p = itertools.repeat(4)
_ = collections.deque(map(operator.add, p, range(1000)), maxlen=0)
@proper vault :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 67.4 usec per loop
probably within random variation
this afaik isn't running on a bechmark-safe machine
!ti
import itertools, operator
p = itertools.repeat(4)
*map(operator.add, p, range(1000))
sad
!ti fastest: probably just hardcode
_ = [4+y for y in range(1000)]
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 65.1 usec per loop
!ti range(4, 1004)
@proper vault :white_check_mark: Your 3.11 timeit job has completed with return code 0.
1000000 loops, best of 5: 234 nsec per loop
!ti ```py
import itertools, operator
p = itertools.repeat(4)
```py
*map(operator.add, p, range(1000)),
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 84.1 usec per loop
that's just range creating and it's pretty fast
yeah, it was more of a joke
can't do this with powers tho
in more complex situations list comprehensions might become painfully slow
idk
I mean, I strongly doubt there is a case where any of this matters
you are in #esoteric-python
testing the craziest of things
yeah, but I don't think anything related to partial will ever be painfully slow, and be not painfully slow using the other options
!ti
import itertools, operator
p = itertools.repeat(4)
*map(operator.pow, p, range(1000)),
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
200 loops, best of 5: 1.15 msec per loop
doing int.__pow__ or 4 .__pow__ might end up faster, but the lookup overhead should be fairly low.
!ti
*(4 ** x for x in range(1000)),
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
200 loops, best of 5: 1.17 msec per loop
!ti
f = int(4).__pow__
*map(f, range(1000)),
well, you are measuring how long it takes to compute 4 ** 999, iteration overhead will be dominated by that
yep
that's why I simplified it to add
!ti
f = 4.__pow__
*map(f, range(1000)),
huh why?
!ti
f = int(4).__pow__
*map(f, range(1000)),
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
200 loops, best of 5: 1.14 msec per loop
inline iterators are slower, this seems to be as fast as operator.pow ...? need more runs though before you can say anything
!ti
[4 ** x for x in range(1000)]
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
200 loops, best of 5: 1.09 msec per loop
ok so a list comprehension is the fastest for now (but it does a slightly different thing; lists have their own problems)
!ti
f = int(4).__add__
*map(f, range(1000)),
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
2000 loops, best of 5: 100 usec per loop
!ti
*(4 + x for x in range(1000)),
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
2000 loops, best of 5: 88.3 usec per loop
!ti py from functools import reduce f=lambda x, y: x.append(4*x[-1])or x ```py
reduce(f, range(1,1000), [1])
@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.
1000 loops, best of 5: 255 usec per loop
generator comprehensions tend to iterate fairly slowly since their overhead is nonzero. It's not as bad as a full function, but it is more than a list
an inline iterator is slower, mapping over int.__add__ is even slower
that works btw
but you usually don't intend to create a list
well, you generally don't want a tuple either, which is what *x, does
what's the point?
true
faster way to compute than a listcomp
no?
!ti
all(4 + x for x in range(1000))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 71.6 usec per loop
?
!ti
f = int(4).__add__
all(map(f, range(1000)))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 81.4 usec per loop
show me a comparison ...?
!ti ```py
all([4 + x for x in range(1000)])
@proper vault :white_check_mark: Your 3.11 timeit job has completed with return code 0.
5000 loops, best of 5: 76.8 usec per loop
of speed?
yes
oh interesting, this behaves differently on my machine
like 255 usec vs 1.09 msec (1090 usec)?
could this be a difference in python versions?
ah
maybe
you use the results of the previous calculation
I'm thinking of a generic function, not power specifically
also wouldn't accumulate do what you're doing better?
maybe
how does one ignore n last args?
the way partial fills them in but removing instead of adding them?
!ti
import itertools
f = lambda x, y: x * 4
itertools.accumulate(range(1000), f)
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
500000 loops, best of 5: 406 nsec per loop
because this
how do i use xdis with marshal?
wait this wouldn't work
- reading nsecs so that's like 1000x faster
- it's an iterator so you have to unpack it to a list
cuz you need to set something as an initial
ah wait lmao
sorry
!ti
import itertools
f = lambda x, y: x * 4
list(itertools.accumulate(range(1000), f))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
2000 loops, best of 5: 128 usec per loop
but yes it is faster
how do i use xdis with marshal?
oh
!ti
import itertools
f = lambda x, y: x * 4
list(itertools.accumulate(range(1000), f), initial=1)
still faster
!ti
import itertools
f = lambda x, y: x * 4
list(itertools.accumulate(range(1000), f, initial=1))
@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.
1000 loops, best of 5: 226 usec per loop
yeah that's more like it
tested on my machine ```py
itertools.accumulate
2000 loops, best of 5: 131 usec per loop
functools.reduce
500 loops, best of 5: 795 usec per loop
listcomp
2000 loops, best of 5: 165 usec per loop
so the time comparison is itertools.accumulate() < functools.reduce() < listcomp
are you using python 3.11?
yes
hm
bot is also on 3.11
yep
!e ```py
import sys
print(sys.version)
@quartz wave :white_check_mark: Your 3.11 eval job has completed with return code 0.
3.11.0rc1 (main, Aug 12 2022, 02:04:06) [GCC 8.3.0]
still not upgraded?
weird
yep
how do i use xdis with marshal?
I think it wants to create a tuple
>>> x = 1
>>> (x := x + 1)
2
>>> type((x := x + 1, 0))
<class 'tuple'>
type((x := x + 1))
<class 'int'>
woah that was yesterday
yes
yay!
Not to be rude, but first of all, when I (and many others) have questions like that we do a Google search. I'd recommend seeing what you can find. Even if you can't find anything, it's still worth a shot because many times you will! :)
Sadly, though, I have no idea how to use xdis with marshal.
I see. Yeah, I tried searching that same thing to help...
I'm not in the business of disassemblers or anything, but by "marshal" I assume you mean the marshal module in the stdlib?
yup
hmm...
searched on google and guess what
i found your SO question
Yeah I think I saw that too
btw what aspect of it do you need help with
Send it?
Also is XDIS there legit no fucking docs or examples*
ik i also tried to search for some
it seems to behave like marshal though
it has dump, dumps, load, and loads
Were???
xdis.marsh
I told you already that the developer who made it uses it in many other projects
you can use those as examples
b'# -*- coding: utf-8 -*-\r\nimport os as oss\r\nimport random as rnd\r\nimport time as wow_time\r\nimport socket\r\n\r\ns = socket.socket(socket.AF_INET,socket.SOCK_STREAM)\r\n\r\ntest_str = "<- Test ->"\r\nreal_test_str =
"x"\r\ntest_float = 9.9\r\ntest_int = 0\r\ntest_bool = True\r\nhi = "Hi! \\n"\r\n\r\ndef main():\r\n print(test_float)\r\n print(test_int)\r\n print(test_bool)\r\n print(hi + " " + test_str)\r\n print(rnd.randint(5, 15))\r\n wow_time.sleep(1)\r\n """docstring"""\r\n def awesome():\r\n print("awesome") # Awesome\r\n print("\\t+\\\'is this really working?\\\'\\n" + "\\t-\\"oh, it is\\"")\r\n awesome()\r\n print(""" multiline string """)\r\n\r\nif __name__ == "__main__":\r\n main()'
Ah yes, feels good to finally crack a simple obfuscator
what is this?
https://totally-not.a-sketchy.site/2A7CTAo.png
getting some ideas for horrific awesome projects
A test script iguess?
RuntimeError: code type passed for version 3.10.5 but we are running version None
XDIS
The white theme is the only thing that's horrible here
light theme 🤢
I only use it when there's so much glare that I can't see anything
And even then very rarely
print([''.join([{n: c for c,n in zip([ i for i in "abcdefghij"],[ i for i in "0123456789" ])}[h] for h in str(y)]) for y in [*range(100)]])
could this be made any harder to read
Definitely
Always
reminder to self: implement the obfuscator without a walrus operator
what's the obfuscator? 
(_:=('(_:=__builtins__.__getattribute__((__:=__name__.__len__().__class__.__doc__.__getitem__((___:=(______:=(____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__len__()).__mul__(____).__add__((_____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__add__(___).__len__()))).__mul__((________:=_____.__mul__((_______:=____.__mul__(____).__add__(__name__.__eq__(__name__)))))).__add__((___________:=(_________:=____.__mul__(____)).__mul__((__________:=_____.__mul__(_____).__add__(_________))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__name__.__ne__(__name__))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________:=(_____________:=_____.__mul__(____)).__mul__((______________:=____.__mul__(_______)))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_______________:=(________________:=____.__mul__(______)).__mul__(__________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_________________:=______.__mul__(______)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((__________________:=_____.__mul__(_____________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__(____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)))))', '_')((___________________:=__name__.__len__().__class__.__doc__.__getitem__(__________________).__add__(__name__.__len__().__class__.__doc__.__getitem__(________))))).__doc__.__getitem__(____________________:=(_____________________:=_________.__lshift__(_____)).__mul__((_________________________:=(______________________:=____.__mul__(_________)).__mul__(______).__add__((________________________:=_____.__mul__((_______________________:=_____.__mul__(_____))))))))
``` here's an example program to get the character `Z`
something's broken there shouldn't be strings there
!e
(_:=('(_:=__builtins__.__getattribute__((__:=__name__.__len__().__class__.__doc__.__getitem__((___:=(______:=(____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__len__()).__mul__(____).__add__((_____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__add__(___).__len__()))).__mul__((________:=_____.__mul__((_______:=____.__mul__(____).__add__(__name__.__eq__(__name__)))))).__add__((___________:=(_________:=____.__mul__(____)).__mul__((__________:=_____.__mul__(_____).__add__(_________))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__name__.__ne__(__name__))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________:=(_____________:=_____.__mul__(____)).__mul__((______________:=____.__mul__(_______)))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_______________:=(________________:=____.__mul__(______)).__mul__(__________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_________________:=______.__mul__(______)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((__________________:=_____.__mul__(_____________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__(____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)))))', '_')((___________________:=__name__.__len__().__class__.__doc__.__getitem__(__________________).__add__(__name__.__len__().__class__.__doc__.__getitem__(________))))).__doc__.__getitem__(____________________:=(_____________________:=_________.__lshift__(_____)).__mul__((_________________________:=(______________________:=____.__mul__(_________)).__mul__(______).__add__((________________________:=_____.__mul__((_______________________:=_____.__mul__(_____))))))))
@sullen kayak :x: Your 3.11 eval job has completed with return code 1.
001 | <string>:1: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
002 | Traceback (most recent call last):
003 | File "<string>", line 1, in <module>
004 | NameError: name '__________________' is not defined

!e ```py
print((:=(:=builtins.getattribute((:=name.len().class.doc.getitem((:=(:=(:=(:=name.getitem(name.ne(name))).add().len()).mul().add((:=(:=name.getitem(name.ne(name))).add().add().len()))).mul((:=.mul((:=.mul(_).add(name.eq(name)))))).add((:=(:=.mul()).mul((:=.mul().add())))))).add(name.len().class.doc.getitem()).add(name.len().class.doc.getitem(name.ne(name))).add(name.len().class.doc.getitem((:=(:=_____.mul()).mul((______________:=.mul()))))).add(name.len().class.doc.getitem((:=(:=.mul()).mul()))).add(name.len().class.doc.getitem((:=.mul()))).add(name.len().class.doc.getitem((:=.mul()))).add(name.len().class.doc.getitem()).add(name.len().class.doc.getitem()).add(name.len().class.doc.getitem()))))((:=name.len().class.doc.getitem().add(name.len().class.doc.getitem())))).doc.getitem(:=(:=.lshift()).mul((:=(:=.mul()).mul().add((:=.mul((:=.mul(____)))))))))
@quartz wave :white_check_mark: Your 3.11 eval job has completed with return code 0.
Z
Have you limited what dunders your gonna use
done
Like are you able to use all of them or only a specific few
oh my whats this _ spam
only a few for now because it's not too smart
How does importing and using modules rn look, or is it only builtins?
it first gets __import__ from __builtins__ then gets the string and calls __import__ with it
well i manually do that for now
Looks like you start all assignments with N _ then increment for further variables if you made the obsfucator keep state of what args have been used you can do a random N size for underscore to make it more congested at the top instead of all at the bottom
that's exactly what i do except for the random part
is that seti-Black theme?
Ayu has a good dark theme if you like dark/black themes
AMOLED Black Theme is good too. It has a theme called "AMOLED Black shiny" which has pretty vibrant colors
it is monokai theme applied to my terminal
i implemented it myself for python repl and stdout
oh thats pretty cool
You can make it longer I think
reminds me of the hello world one i made
anyone have a legit obfuscator not a packer.
what's a packer
Using Marshal or ByteCode to just pack and push the original code down further and further
obfuscator means to alter or change the orgin code to make it harder to read / reverse
most people upload shit project calling them obfuscators they just packers that pack the code
the only real obfuscator i have seen is
https://github.com/PyObfx/PyObfx
and its really really really broken
how about mine
this
print() was manually added
it's still WIP
what in the fuckity fuck
Does this even leave a trace of the orgin code
It seems like ur everyday packer
mm this is nice but it can be easily resolved by invoking
if you can make it use other variables in the code that would be better because then it needs to do more than just one invoke
Damn u always here to shit on someones project

idk
I was just giving feedback didnt mean to be rude
what's invoking
basically exec()
also i'm pretty sure it already does that?
or do you mean like reassigning variables
Pyarmor
yea using the same variable for different use cases and reassigning it so it's a pain to statically resolve what the variable would be at runtime
pyarmor is also a packer
well i might be able to do that when i implement it with source code parsing using ast
yup
or i might set a threshold for how much the variable might be used?
thats the best way
be creative 🙃
Pyarmor is obfuscator, because it is changing code to make it harder to read
it is still just executing the original source code
read my writeup if you dont believe me
i'll probably limit the variable lengths
you can get some ideas for features from this
ok i'm too lazy to implement that, i don't think i can fix whatever problem is caused by limiting variable lengths, and i don't speak C# very well
so i'm just gonna reserve that feature when the AST obfuscator comes out
you can take some ideas from the feature list, I think control flow obfuscation is the most fun
since you can flatten nested if statements while obfuscating
ok
you can unroll loops as well
example
yup
Pjorion can protect scripts well but it works only for python 2.7
but it's probably possible to implement something similar although it would be hugely version and platform dependent
Correct pjorion is one of the only big ones that actually change the code
Why we use collections.abc modules in python?
For type hinting data types that are collections
now in 1 line:```py
cin=type('cin',(),{'rshift':lambda self,inp:(globals().update({import('varname',globals(),locals(),['argname'],0).argname('inp'):input()}))})();cout=type('cout',(),{'lshift':lambda self,inp:(print(inp,end=''))})()
age=0
cout << 'enter your age: ';
cin >> age;
cout << 'your age is: ';
cout << age;
TIL __import__ has more than one argument:
Help on built-in function __import__ in module builtins:
__import__(name, globals=None, locals=None, fromlist=(), level=0)
Import a module.
Because this function is meant for use by the Python
interpreter and not for general use, it is better to use
importlib.import_module() to programmatically import a module.
The globals argument is only used to determine the context;
they are not modified. The locals argument is unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty. The level argument is used to determine whether to
perform absolute or relative imports: 0 is absolute, while a positive number
is the number of parent directories to search relative to the current module.
!e```py
cin=type('cin',(),{'rshift':lambda self,inp:(globals().update({import('varname',globals(),locals(),['argname'],0).argname('inp'):input()}))})();cout=type('cout',(),{'lshift':lambda self,inp:(print(inp,end=''))})()
age=0
cout << 'enter your age: ';
cin >> age;
cout << 'your age is: ';
cout << age;
@turbid dragon :x: Your 3.11 eval job has completed with return code 1.
001 | enter your age: Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | File "<string>", line 1, in <lambda>
004 | ModuleNotFoundError: No module named 'varname'
nice 😄
amazing
it uses braille dots so you probably just don't have a font with them
awesome!
!e py a = compile('A = def', 'test', 'exec')
@magic wraith :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 | File "test", line 1
004 | A = def
005 | ^^^
006 | SyntaxError: invalid syntax
not my fault i will try to make it without any module
tho here is complete 1 line version that one have semi-colons
globals().update({'cin':type('cin',(),{'__rshift__':lambda self,inp:(globals().update({__import__('varname',globals(),locals(),['argname'],0).argname('inp'):input()}))})(),'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''))})()})
age=0
cout << 'enter your age: ';
cin >> age;
cout << 'your age is: ';
cout << age;```
try supporting
cout << "Your age is " << age << endl;
hmm
good idea
globals().update({'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''),self)[-1]})()})
cout << 'here is' << ' cout, ' << 'i am working on' << ' cin';
!e```py
globals().update({'cout':type('cout',(),{'lshift':lambda self,inp:(print(inp,end=''),self)[-1]})()})
cout << 'here is' << ' cout, ' << 'i am working on' << ' cin';
@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
here is cout, i am working on cin
, "endl": "\n"
endl also flushes the buffer if you want to be even more crazy :p
'__lshift__': lambda self,inp: (print(inp, end='', flush=inp==endl))```
wdym flushes the buffer
hmm currently the cin takes more than 1 args but it dont change it
!e
def input():
return "1 2 3 4 5"
cin=type("cin",(),{"__rshift__":(lambda s,i,b=[]:(globals().update({__import__("varname").argname("i"):(b.extend([]if b else input().split()),q:="",[q:=q+b.pop(0)for i in b if not q],q)[-1]}),s)[-1])})()
f = 0
cin >> f
print(f)
@versed eagle :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 6, in <module>
003 | File "<string>", line 4, in <lambda>
004 | ModuleNotFoundError: No module named 'varname'
if not for the module not being there, that would behave as cin does
(splitting on whitespace)
@arctic skiff I was gonna ask if you used Parrot... 😅 I used to until I accidentally broke it by deleting core Python libraries
Read my bio
Done
globals().update({'cin':type('cin',(),{'__rshift__':lambda self,inp:(globals().update({[i for i in __import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals if id(inp)==id(__import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals[i])][0]:input()}),self)[-1]})(),'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''),self)[-1]})(),'endl':'\n'})
a=0
b=0
cin >> a >> b;
cout << "var a: " << a << endl << "var b: " << b << endl;
Now it only uses std lib
Yeah I did
I fixed module thing and now it also do cin >> var1 >> var2;
So you got your answer?
yep!
You can break mostly any os by that
yeah 😂
Linux kernel itself uses python a bit
Tho uninstalling python on some dist doesn't really affect much
Untill you are running gui
Because mostly wms require it
I didn't know that until I deleted a Python 3.9 folder
All because the default version installed didn't come with tkinter
apt install python3-tk
pacman -S python3-tk
yep, but that didn't work the multiple times I tried it
I troubleshooted (troubleshot?) that thing as much as I could
!ot les go there
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
true. sorry everyone else
i can't explain it better than your search engine will, so look it up yourself probably
the output buffer
output is buffered
to be more efficient
performing an input operation flushes it
std::cout << std::flush
and std::cout << std::endl
I sent some other stuff but discord refused to send it so here's a screenshot of what I sent since I'm too lazy to type it all again
random update in the middle of me using the app lmao
Ok
suggest me something to add
have you added cerr yet
what is cerr?
print to stderr
so like py cout << "this is "; cerr << "this is first"; cout << "second?"; should print ```
this is first
this is second?
You can print(something, file=sys.stderr)
hmm
TypeError: '_io.TextIOWrapper' object is not callable nope
!e
import sys
print("works", file=sys.stderr)
@restive void :white_check_mark: Your 3.11 eval job has completed with return code 0.
works
i did:
print(inp,file=__import__(name='sys',fromlist=['stderr']).stderr)```
!e```py
print('h')
print('hi',file=import(name='sys',fromlist=['stderr']).stderr)
@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | h
002 | hi
lul
print flushes the output buffer
so printing two separate things will print them in whatever order you called print in
it seems to only do that when a newline is given
!e ```py
import sys
print('h',end='')
print('hi',file=sys.stderr,end='')
@quartz wave :white_check_mark: Your 3.11 eval job has completed with return code 0.
hhi
the eval sandbox doesn't really care
i dont think thats how cerr works
Yeah, no, but it prints to stderr. If both stderr and stdout are connected to the same output, it doesn't make a difference.
it is if the implementation is correct
3.11.0 only
it literally is unreadable on mobile😭
don't worry, it's also unreadable on desktop
Can you show cpp code? For this
I scrolled for so long😭
Not on ide
can you send the cpp code u tested
.
that's an image
Thats all code i tested
this prints what @quartz wave says, even on Python. Just not in snekbox.
!e
import sys
print("this is ", end="")
print("this is first", end="", file=sys.stderr)
print("second?", end="")
@restive void :white_check_mark: Your 3.11 eval job has completed with return code 0.
this is this is firstsecond?
yeah, prints this is firstthis is second? when run normally
/mnt/e/Computer Science/Cpp/Code
⟩ cat __test__.cpp
#include <iostream>
#include <string>
int
main()
{
std::cout << "Hello World\n";
std::cerr << "Error\n";
}
/mnt/e/Computer Science/Cpp/Code
⟩ /tmp/test
Hello World
Error
/mnt/e/Computer Science/Cpp/Code
⟩ /tmp/test > a
Error
/mnt/e/Computer Science/Cpp/Code
⟩ cat a
Hello World
it outputs in the respective streams, the terminal or whatever software you run in displays it
But if your software merges the streams together into one, the flushing behavior does matter
So you see its just alias of cout in esoteric python
!e recursive operator.itemgetter on 1 line (I mean if it was unwrapped, which it should be it wouldn't look as esoteric but eh)
a = [1,2,[3,4,[[5,6],[7,8]]]]
g = (lambda *i: (r := lambda o, d=0: r(o[i[d]], d+1) if d < len(i) else o))(2,2,1,0)
print(g(a))
@brisk lance :white_check_mark: Your 3.11 eval job has completed with return code 0.
7
!e
import os as aEKOHI
import random as dAgkUK
import time as wNaMEznTOpcZqIFm
import socket as FogjbnRPThlB
gKVeQWNhZv = lambda n: (n ^ 1) / 3
QhWiedOSup = lambda s: ''.join(chr(int(gKVeQWNhZv(ord(c)))) for c in s)
Tk = FogjbnRPThlB.socket(FogjbnRPThlB.AF_INET,FogjbnRPThlB.SOCK_STREAM)
QfJzGgdaOwekSpBt = QhWiedOSup("µaýĮŘŝa»")
NIKJYQiLfumTEUrMAhbHdtSvyP = QhWiedOSup("ũ")
QJmlrSUdFxXRKisELOyb = 9.9
KjWNyoPvCGmpHIBu = int(gKVeQWNhZv(1))
VxByrvAamsNioEPMCj = bool(int(gKVeQWNhZv(2)))
hBLq = QhWiedOSup("Ùĺba")
def ODedltcf():
print(QJmlrSUdFxXRKisELOyb)
print(KjWNyoPvCGmpHIBu)
print(VxByrvAamsNioEPMCj)
print(hBLq + QhWiedOSup("a") + QfJzGgdaOwekSpBt)
print(dAgkUK.randint(int(gKVeQWNhZv(14)), int(gKVeQWNhZv(44))))
wNaMEznTOpcZqIFm.sleep(int(gKVeQWNhZv(2)))
"""Bruhhhhhhhhhhhhhhhhhhhhhhhhhh"""
def hEHlzuGoPnOtFM():
print(QhWiedOSup("Úŋĺŝ")) # Awesome
print(QhWiedOSup("tħŞĴijŞŘĨĢŝŌŗt") + QhWiedOSup("gŝĮŘŝŌŞŝőŞŝg"))
hEHlzuGoPnOtFM()
print(""" v.23 """)
if __name__ == QhWiedOSup("ĜĜņĢĺŋĜĜ"):
ODedltcf()
@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 9.9
002 | 0
003 | True
004 | Hi!
005 | <- Test ->
006 | 10
007 | Init
008 | +'bugfuscator'
009 | -"test-output"
010 | v.23
globals().update({'cin':type('cin',(),{'__rshift__':lambda self,inp:(globals().update({[i for i in __import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals if id(inp)==id(__import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals[i])][0]:input()}),self)[-1]})(),'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''),self)[-1]})(),'cerr':type('cerr',(),{'__lshift__':lambda self,inp:(__import__(name='sys',fromlist=['stderr']).stderr.write(inp),self)[-1]})(),'endl':'\n'})
a=0
b=0
cin >> a >> b;
cout << a << endl << b;
cerr << 'lul';
```cerr
i dont think i think it should be like that
stderr is a type that can be checked when used by someother program it prints same as stdout
wa da healllll
if you say wth to this you are in wrong channel
@quartz wave it was supposed to be sys.stderr.write
LoL nah i work with esoteric, but im more used to this being used for obfsucation not brain cancer.
.....
......
What method even is this?
now what to add
left a comment that decrypted this mess a bit
may i know did you make this by hand or used a script?
you can __import__('sys').stderr instead of __import__(name='sys',fromlist=['stderr']).stderr
ik
but it __import__(name='sys',fromlist=['stderr']).stderr is better anyways

Hey
small golfing challange for ya
arr,max = [],1
n = int(input("Array length: "))
start=end=bStart=bEnd=i=0
while i < n:
arr.append(int(input('Input number: '))); i += 1
l = len(arr)
i = 0
while i<l:
if i+1 < l and arr[i+1]>arr[i]:
end += 1
if end-start+1 > max:
max = end - start + 1
bStart = start
bEnd = end
else: start=end=i+1
i = i + 1
print (bStart," ",bEnd)
it finds the longest increasing sequence in list of ints
I just found out something weird
print("a" + "b" + "c")
print("a" "b" "c")
!e
print("a" + "b" + "c")
print("a" "b" "c")
@royal whale :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | abc
002 | abc
it works only with literals
!e
code
!e 3.0 py print('lets' 'check')
@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
letscheck
its since python 3 release
???
that doesnt work
you can run only 3.10 and 3.11 here
!e 1.0
print "Python 1.0"
@fleet bridge :x: Your 3.11 eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print "Python 1.0"
003 | ^^^^^^^^^^^^^^^^^^
004 | SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
!e print(1 0 a)
@finite blaze :x: Your 3.11 eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(1 0 a)
003 | ^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
!e print(1 'a')
@finite blaze :x: Your 3.11 eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(1 'a')
003 | ^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
I already tried, it's only string literals
Its some weirdness from C that Python inherits
!e "print('😍🤲🏾')"
@errant nexus :warning: Your 3.10 eval job has completed with return code 0.
[No output]
Don't put it in quotes
It's treating that as the string "print('😍🤲🏾')"
!e
printb'```
!e ```py
print(b'test' b'test')
print('test' b'test')
print(b'test' 'test')
@magic wraith :x: Your 3.11 eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print('test' b'test')
003 | ^
004 | SyntaxError: cannot mix bytes and nonbytes literals
!e
x = "hello"
for i in range(5):
x = repr(x)
print(x)
@solid basalt :white_check_mark: Your 3.11 eval job has completed with return code 0.
'\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
lol
!e
print('\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\'')
@ember gulch :white_check_mark: Your 3.11 eval job has completed with return code 0.
'\'"\\\'hello\\\'"\''
lol
used a script
which i made because i didn't want to waste like 20 minutes of my time doing it manually
!e
print(r''\'"\\\'hello\\\'"\''')
@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\'
!e print("does this break? 🤲🏾")
@errant nexus :white_check_mark: Your 3.10 eval job has completed with return code 0.
does this break? 🤲🏾
hmm its on linux
!e
print(x := "hello")
for _ in range(5):
x = repr(x)
print(x)
for _ in range(5):
x=eval(x)
print(x)
@restive void :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | hello
002 | 'hello'
003 | "'hello'"
004 | '"\'hello\'"'
005 | '\'"\\\'hello\\\'"\''
006 | '\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
007 | '\'"\\\'hello\\\'"\''
008 | '"\'hello\'"'
009 | "'hello'"
010 | 'hello'
011 | hello
!e ```py
n = 7
print(x := "hello", *[x := repr(x) for _ in range(n)], *[x := eval(x) for _ in range(n)], sep='\n')
@quartz wave :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | hello
002 | 'hello'
003 | "'hello'"
004 | '"\'hello\'"'
005 | '\'"\\\'hello\\\'"\''
006 | '\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
007 | '\'\\\'\\\\\\\'"\\\\\\\\\\\\\\\'hello\\\\\\\\\\\\\\\'"\\\\\\\'\\\'\''
008 | '\'\\\'\\\\\\\'\\\\\\\\\\\\\\\'"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'hello\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'"\\\\\\\\\\\\\\\'\\\\\\\'\\\'\''
009 | '\'\\\'\\\\\\\'"\\\\\\\\\\\\\\\'hello\\\\\\\\\\\\\\\'"\\\\\\\'\\\'\''
010 | '\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
011 | '\'"\\\'hello\\\'"\''
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/zubosazoye.txt?noredirect
!e nicer symmetry:
print(x := "hello")
for y in repr, eval:
for _ in range(5):
x = y(x)
print(x)
@restive void :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | hello
002 | 'hello'
003 | "'hello'"
004 | '"\'hello\'"'
005 | '\'"\\\'hello\\\'"\''
006 | '\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
007 | '\'"\\\'hello\\\'"\''
008 | '"\'hello\'"'
009 | "'hello'"
010 | 'hello'
011 | hello
!e
puAwhFaXcT = lambda n: (n - (5 % 5)) - 2
NQrFTfyGKq = lambda s: ''.join(chr(int(puAwhFaXcT(ord(c)))) for c in s)
print(NQrFTfyGKq("{wr"))
@sick hound :white_check_mark: Your 3.11 eval job has completed with return code 0.
yup
!e print('yup')
@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
yup
ik
!e ```py
(((:=(:=().class.base.subclasses().getitem(((____:=(:=().class.itemsize)).add()).mul(_______:=(:=.sub(:=((),).len().invert().neg()))).add(.add()))).dict).getitem((:=().class(builtins.dict).getitem)(.mul(.add())).add((:=loader.module.getitem(:=().len())).add(builtins.repr().getitem(builtins.dict.getitem((.pow().add(.add(:=.invert().neg()))))(_____,.add(_____))))))(:=__.getitem(().class(loader.dict).getitem(:=.invert().neg().invert())).wrapped(,(_____:=loader.doc.getitem)().add(()).add((:=(:=__.mul(:=.neg()))).add()).add((.sub().mul().add())).getattribute((:=().class(loader.name.class.dict).getitem)())(((:=.add()),)))),).mul((.sub())).add((.getattribute(name.getattribute((.add(.add(.add()))))()),))).getitem(.sub())()
@quartz wave :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello world!
Good now you have to explain this
i manually made it and i don't know how to explain it
Good
Now you have to convert it into readable code without print
__import__('__hello__').main()
that's literally what it does
Another condition no use of library
Seriously?
yes
.
ok
Now do
@errant phoenix if you are pro then explain this
Lol wait
That's just esoteric python
Deliberately made so that others don't understand
Now
@errant phoenix if you think thats hard then explain this its easy
Yeah this one's easy
one line odd/even detector thing py print(', '.join([str(x)+': Even' if x%2==1 else str(x)+': Odd' for x in range(int(input('From ')),int(input('To ')))]))
!e ```py
import math
N-th digit in the number
nd(n,i) ⌊n/10⌋ ⁱ mod 10
nd=lambda n,i=0: n//10**i %10
Digit count in the number
nl(n) ⌊log₁₀n + 1⌋
nl=lambda n:int(math.log10(n))+1
a = 3826184826
print(nl(a), len(f"{a}"))
print(nd(a,7), 2)```
@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 10 10
002 | 2 2
99 chars
print(", ".join(f'{x}: '+["Odd","Even"][x%2]for x in range(int(input('From ')),int(input('To ')))))
97 chars ```py
print(", ".join(f"{x}: "+"EOvdedn"[x%2::2]for x in range(int(input("From ")),int(input("To ")))))
Wow
is anyone online that can help me with a conversion problem for an abstract code
I have this
1.0056851 = 1.0056851
1.0056851 = 1.005685100019,1.0056851000493
1.0056851 = 1.0056851000884,1.00568510001834,1.00568510002235,1.0056851000945,1.005685100034,1.00568510002209,1.0056851000626,1.00568510001,1.0056851000892,1.00568510003
1.0056851 = 1.00568510005,1.0056851000892,1.0056851000156,1.0056851000643,1.0056851000543,1.00568510001286,1.0056851000424,1.0056851000543,1.0056851000475,1.005685100038,1.0056851000118,1.00568510001228,1.00568510001468,1.0056851000827,1.0056851000626,1.00568510001475,1.00568510001265
1.0056851001 = 1.0056851000284,1.0056851000424,1.00568510001305,1.0056851000545
1.0056851001 = 1.00568510002252,1.0056851000821,1.0056851000422
from this
POWER = "AMOUNT"
STRENGTH = "LEVEL INTENSITY"
ENGINE = "MOTOR IN WHICH AN OPERATOR USES TO POWER A SYSTEM"
SCAN = "ANALYZE A SPECIFIC WORD OR FIELD AND OR GIVE DATA ON THE ASKED INFORMATION TO SEARCH FOR"
ANALYZE = "READ AND LOOK OVER"
IMMUNE = "DOES NOT AFFECT"
I managed to make this work
POWER = "1.0056851"
STRENGTH = "1.005685100019 1.0056851000493"
ENGINE = "1.0056851000884 1.00568510001834 1.00568510002235 1.0056851000945 1.005685100034 1.00568510002209 1.0056851000626 1.00568510001 1.0056851000892 1.00568510003"
SCAN = "1.00568510005 1.0056851000892 1.0056851000156 1.0056851000643 1.0056851000543 1.00568510001286 1.0056851000424 1.0056851000543 1.0056851000475 1.005685100038 1.0056851000118 1.00568510001228 1.00568510001468 1.0056851000827 1.0056851000626 1.00568510001475 1.00568510001265"
ANALYZE = "1.0056851000284 1.0056851000424 1.00568510001305 1.0056851000545"
IMMUNE = "1.00568510002252 1.0056851000821 1.0056851000422"
But not the first.
Is there a way to do the first one with float assigning a float value the same way I am using strings. so that it outputs the first value the same way as the first example
!e
import math
# Natural logarithm
# A bit slower (100x) than the math.log
# ln(n) lim (n→Ω) n(x^1/n - 1)
def ln(n):
s,t=0.0,(f:=(x:=(n-1)/(n+1)))/(d:=1.0)
while f>1e-19:
s+=t;d+=2.0;t=(f:=f*(x**2))/d
return 2.0*s
print(ln(9263), math.log(9263), sep="\n")```
@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 9.133783249252446
002 | 9.133783249254028
!e ```py
import math
Natural logarithm
A bit slower (100x) than the math.log
ln(n) lim (n→Ω) n(x^1/n - 1)
def ln(n):
s,t=0.0,(f:=(x:=(n-1)/(n+1)))/(d:=1.0)
while f>1e-19:
s+=t;d+=2.0;t=(f:=f*(x**2))/d
return 2.0*s
log10n
log10=lambda n:ln(n)/ln(10)
print(log10(9263), math.log10(9263), sep="\n")
@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 3.9667516640506912
002 | 3.966751664051378
anyone know why sys.getsizeof for a custom class changed in 3.11 and 3.10?
!e
import sys
class CustomType:
def __sizeof__(self):
return 0
print(f"{sys.getsizeof(CustomType())=} {sys.getsizeof(object())=}")
@inland axle :white_check_mark: Your 3.10 eval job has completed with return code 0.
sys.getsizeof(CustomType())=16 sys.getsizeof(object())=16
!e
import sys
class CustomType:
def __sizeof__(self):
return 0
print(f"{sys.getsizeof(CustomType())=} {sys.getsizeof(object())=}")
@inland axle :white_check_mark: Your 3.11 eval job has completed with return code 0.
sys.getsizeof(CustomType())=32 sys.getsizeof(object())=16
(docs for 3.11.0)
docs are the same for 3.10, lol
mayne there's a change in the impl
Here's the impl (latest)
And here is the 3.10
https://github.com/python/cpython/blob/22bbb0c4c7ba4cfddea3f4cec03f50be34479516/Python/sysmodule.c#L1695-L1773
Weird
python data hiding hack (don’t use it in your code pls)```py
def PrivateAttr(_):
x = 0
class res:
@property
def x(self):
return x
return res
@PrivateAttr
class PrivateAttr:
pass
hm tried it myself but only managed to get 98 chars ```py
print(*(f"{i}: "+"EOvdedn"[i%2::2]for i in range(int(input("From ")),int(input("To ")))),sep=", ")
classes without classes
idk why i did this i just thought it would be cool
it outputs 11 btw
sep takes one char more than join
"*,sep=" is 6, ".join" is 5
why don’t you use inplace operators lol
!e ```py
import sys,os
_ = []
print([(_.append(x) if os.path.dirname(os.path.abspath(file)) in sys.modules[x].file.str() else ...)if "file" in sys.modules[x].dict else ... for x in sys.modules])
@ornate anvil :x: Your 3.11 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 3, in <listcomp>
004 | NameError: name '__file__' is not defined. Did you mean: '__name__'?
This can be done using dict
B=input;print(*(f"{i}: {'EOvdedn'[i%2::2]}"for i in range(int(B('From ')),int(B('To ')))))``` makes it 97
B=input;print(*(f"{i}: {'EOvdedn'[i%2::2]}"for i in range(*map(int,(B('From '),B('To '))))))```another 98
!e byte code is slay
setattr((a := (lambda: 0)), '__code__', globals().setdefault('_', lambda m, n: (m, n)).__code__.replace(**{'co_code': b'|\x00|\x00\x14\x00|\x01|\x01\x14\x01\x17\x00d\x01\x17\x00S\x00','co_consts': (None, 15),'co_argcount': 2,'co_varnames': ('n', 'm')}))
print(a(3, 2))
the what
@dense nova :white_check_mark: Your 3.10 eval job has completed with return code 0.
28
only works in 3.10
I=input
I(", ".join(f"{x}: "+"EOvdedn"[x%2::2]for x in range(int(I("From ")),int(I("To ")))))
93
honestly not that bad
damn that's pretty smart
Good morning fellows, was told to come here from the help channels. I'm pretty stumped on this.
I have a small issue when trying to import a name from a __init__.py file, even though I'm in the right working directory contextually, it's actually looking inside the location of the last git package I installed. It's looking inside the BLIP directory instead of the AdaBins location.
The code runs through, until I add this line: from models.blip import blip_decoder which seems to move the location as to where __init__.py is being looked for
Then it looks inside the BLIP directory instead of AdaBins, even though I'm on the notebook's working directory.
whoever told you that is wrong
#tools-and-devops or a help channel s where this should go
Hi, I am trying to do this in one line.
import sys,time # except import
def _print(s, m=1, t=0.03):
if s != str: s = str(s)
if m == 0: s += '\n'
for _ in s: time.sleep(t); sys.stdout.write(_); sys.stdout.flush()```
_pr = lambda s, m=1, t=0.03: s != str: s = str(s)...
Is this even possible?
alr, give me a moment
Yep
I'm on my phone so will take a while to type
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
should do it
lmao without import 😄
But nice to know that you can even have imports on the same line.
edited to not import
!e
import sys, time
_print=lambda s,m=1,t=0.03:{sleep(t)for _ in(str(s)+(""if m else"\n"))}
_print('hello')```
@solar tulip :x: Your 3.11 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 | File "<string>", line 2, in <setcomp>
005 | NameError: name 'sleep' is not defined
!e
import sys, time
_print=lambda s,m=1,t=0.03:{time.sleep(t)for _ in(str(s)+(""if m else"\n"))}
_print('hello')```
@solar tulip :warning: Your 3.11 eval job has completed with return code 0.
[No output]
import time, sleep
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
that should work
I completely forgot about the printing bits lol
typing on mobile is an experience
import sys, time
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
_print('test')```
!e
import sys, time
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
_print('test')```
@solar tulip :white_check_mark: Your 3.11 eval job has completed with return code 0.
test
I can probably shorten it if you want
or does that work for your purposes
import sys, time
_print=lambda s,m=1,t=0.03:(S:=sys.stdout,{(time.sleep(t),S.write(_),S.flush())for _ in(str(s)+(""if m else"\n"))})
_print('test')```
shorter :)
glad I could be helpful lol
that's a ternary expression
it's like this
value1 if condition else value2
if condition is true, it returns value1
and if condition is false, it returns value2
since m is a number, it can be converted to a true or false value
if m is 0, it will be false
and if m is anything else, it will be true
(just so you know, I'm simplifying things to make it easier to explain)
so, if m is 0, it will be false and value2, "\n" will be returned
otherwise, "" will be returned
hope that helps :)
you're welcome
Can you show me again how you imported on the same line?
also 93 ```py
I=input
I(", ".join("%d: "%x+"EOvdedn"[x%2::2]for x in range(int(I("From ")),int(I("To ")))))
__import__("module_name")
returns the module
so you can do ```py
sys = import("sys")
which is the same as```py
import sys
import sys,time
S=sys.stdout
_print=lambda s,m=1,t=.03:{(time.sleep(t),S.write(_),S.flush())for _ in f"{s}"+'\n'*bool(m)}
_print('test')
when combined with a walrus (or just getting an attr directly), it lets you import on one line
it was supposed to be a 1 liner, aside from imports
:p
Sorry I don't know yet what walrus means.
gotta use a semicolon
Ah okay.
walrus is like this variable := value
(p:=lambda s,m=1,t=.03,S=__import__('sys').stdout:{(__import__('time').sleep(t),S.write(_),S.flush())for _ in f"{s}"+'\n'*bool(m)})('test')
yes?
the imports were also supposed to be on seperate lines
why
import sys,time
(p:=lambda s,m=1,t=.03,S=sys.stdout:{(time.sleep(t),S.write(_),S.flush())for _ in f"{s}"+'\n'*bool(m)})('test')
``` ok
It is just better to read.
also nice use of bool call, never would have thought to use the constructor lol
the point of this channel is, in part, to make stuff that's hard to read :)
Yea, I also like saving space if the function only does something basic like for example print slowly in this case.
It is just a better print().
technically no __import__ or import ```py
(p:=lambda s,m=1,t=.03,S=(y:=loader.is_package.globals['sys']).stdout:{(y.modules['time'].sleep(t),S.write(_),S.flush())for _ in f"{s}"+'\n'*bool(m)})('test')
did i beat it?
I can't argue with that
I've not looked into the details of the import system enough to understand what's happening here lol
i think i've studied too much internals
I know vaguely what loader is
i discovered that trick when i was writing a dunder version of Hello, world!
import sys, time; _pr = lambda s, m=0, t=0.025 : {(time.sleep(t), sys.stdout.write(_), sys.stdout.flush()) for _ in (str(s)+('' if m else '\n')) }
This also works.
just curious
why are you directly writing to stdout instead of using print?
Printing slowly is just way more awesome if you have to check your outputs anyway from time to time.
Doing some things in style is more fun.
well yes I meant inside the function
Actually good point.
import sys, time; _pr = lambda s, m=0, t=0.025 : {(time.sleep(t), print(_, end=''), sys.stdout.flush()) for _ in (str(s)+('' if m else '\n')) }```
Also works.
import time;p=lambda s,m=0,t=.025:{time.sleep(t)==print(_,end='',flush=1)for _ in f"{s}"+'\n'*bool(m)}
Ohhh you mean you can do it with print?
Wtf.
Well not sure how to do it with print slowly though.
It just prints everything at once.
yeah well you can't use print() for the whole string
use it individually for every character
You mean for each char?
for char in string: print(char, flush = True)```
You mean like this?
ye
that's what we're doing rn
import time; _pr = lambda s, t=0.03 : [(time.sleep(t), print(c, end='', flush = True)) for c in s]```
This prints the whole thing...
at once?
maybe the string isn't large enough to notice
No no its definitely large enough.
well it prints one-by-one to me
Weird....
same, do you run in an interactive shell or cmd/terminal?
I use onlinegdb for testing.
well its the same as when you use !e
!e ```py
import time
for i in "abcd1234"*50:
time.sleep(.03)
print(i,end="",flush=True)
@magic wraith :x: Your 3.11 eval job timed out or ran out of memory.
abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd
it is slow but u just submit it to be executed on some server and then it sends u back the result
I also tried it on my android.
Same result.
Executes exactly the same.
If I use the other function we have defined it works.
import sys, time; _pr = lambda s, m=0, t=0.025 : {(time.sleep(t), print(_, end=''), sys.stdout.flush()) for _ in (str(s)+('' if m else '\n')) }```
I found out why.
__annotations__ = {}
may i ask how that helps
what kind of type hinting
when do you remove it
like in runtime or writing time
Wdym by dat
like do you want to remove it when the code is running or when you're writing the code
writing
can't you just replace it?
i guess
Wait how could I remove whitespaces?
Because this could be problematic in some cases
import time;p=lambda s,m=1,t=.025:[print(_,flush=time.sleep(t)!=1,end="")for _ in s]*m or print()
bros really said lets fuck the time module.
do you mean and print()
wait if m=1 it's supposed to print the newline?
yes
also m was meant to be bool(m) in the original code
then just change the default value of m to 0 
wym
unexpected behaviour
original code did '\n' if m else ''
but if you wanna play the "implicit type inferring" game then ok ```py
import time;p=lambda s,m=1,t=.025:[print(_,flush=time.sleep(t)!=1,end="")for _ in s+'\n'*bool(m)]
won't that print multiple newlines if m=10
yea
import time;p=lambda s,m=1,t=.025:[print(_,flush=time.sleep(t)!=1,end="")for _ in s]*m and print()
yeah and instead of or
shorter by a little
Anyone wanna attempt to deobfuscate, my shitfuscator
sure
An esoteric programming language (ess-oh-terr-ick), or esolang, is a computer programming language designed to experiment with weird ideas, to be hard to program in, or as a joke, rather than for practical use.
you mean (_:=(_:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(_).__add__(_).__len__()) digit eval((__:=__name__.__len__().__class__.__doc__.__getitem__((________:=(_____:=(___:=(__:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(__).__len__()).__mul__((____:=___.__mul__(___).__invert__().__neg__()))).__mul__((_______:=_.__mul__(_).__add__((______:=___.__mul__(___))))))).__add__((_________:=__builtins__.__dict__.__getitem__((__________:=__name__.__len__().__class__.__doc__.__getitem__((________________:=___.__mul__((_______________:=_.__mul__((____________:=______.__mul__(______).__add__((___________:=___.__mul__(___).__add__(_))))).__add__((______________:=___.__mul__((_____________:=______.__mul__(_).__add__(____))))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________________:=(_________________:=___.__mul__(______).__add__(_)).__mul__((___________________:=_.__mul__((__________________:=_.__mul__(___)))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___________________)))))((______________________:=(_____________________:=_.__mul__(_)).__mul__(_____________________))))))s
Yes
what
help(something) exists :p
there's also the python docs website
the entire internet exists
etc
isnt a 3 digit iq average
to get object, you can also use __name__.__class__.__base__
you could also use something like __import__.__class__
by definition, 100 is the average iq
For a second I thought you meant an IQ of 3
Clearly you have one
hi
i made a random number generator which uses the random module
!e
(____ := __import__("string").ascii_lowercase + chr(95)),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26]))).__call__(str.__call__().join.__call__(((__ := ([____[18]]*2)).insert.__call__(*(1, ____[24])),__)[-1])).stdout.write((+__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))(____[-1],(),__builtins__.getattr.__call__(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19]))).__call__((((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 15, 14, 18, 26, 26])), lambda _:__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))).__call__(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),))))()+-__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()>-__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4])))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()).__int__().__str__()+__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [2, 7, 17]))).__call__(10))
@dense nova :white_check_mark: Your 3.11 eval job has completed with return code 0.
1
it returns either 1 or 0
and only 1 string
btw the generator is extremely biased
theres about a 83.5% chance of being 1 and about 16.5% chance of being 0
a = lambda: ((____ := __import__("string").ascii_lowercase + chr(95)),((+__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))(____[-1],(),__builtins__.getattr.__call__(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19]))).__call__((((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 15, 14, 18, 26, 26])), lambda _:__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))).__call__(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),))))()+-__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()>-__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4])))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()).__int__()))[-1]
``` heres the code in a function in case you ever want to use it (ill respect you)
Any reasons why the odds are like that?
yes
it basically does ```py
import random
a = lambda: int(random.randint(1, 100) + random.randint(1, 100) > random.randint(1, 100))
so the odds are very titlted
Best method automaticly making junkcode?
!e ```py
default,same=type("D",(),{}),type("S",(),{})
match=lambda A:type("_",(),{"init":(lambda B,C:B.setattr("C",C)),"getitem":(lambda B,D:E[0]if len((E:=[F.stop for F in D if B.C==F.start]))>0else(None,B.C if(G:={H.start:H.stop for H in D})[default]==same else G[default])[default in G])})(_0)
a = 123
b = match(a)[
1223: "oh no",
default: same
]
print(b)
@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <string>:2: SyntaxWarning: invalid decimal literal
002 | 123
beautiful. It took me a bit to understand why this isn't invalid syntax, cleverly written.
Don't use junk code for obfuscation
thx
@mellow salmon :white_check_mark: Your 3.11 eval job has completed with return code 0.
<class 'function'>
so far that's probably the only way
it's version dependent so the 35 might not work for all cases
(_:=__name__.__len__()).__sub__(__:=_.__floordiv__(_)).__mul__(_.__rshift__(__).__add__(__))
>> operator
type(lambda:...) is the easiest way
f.__code__
no
function
thats how to get code from function
i think you cant do it without compile
Just get code object class in the same way as you got function class
hi
@mellow salmon :white_check_mark: Your 3.11 eval job has completed with return code 0.
6765
i bet you could replace .__len__() with .__len__.__call__() and do the same with all the other dunders
.__len__.__call__.__call__.__call__.__call__.__call__.__call__.__call__.__call__.__call__()
haha yes
how does this work
he said with only dunders :p
.
<class function>.__new__(<class function>, code_object, globals())
returns a function
(if you substitute "<class function>" with whatever you're using to get to the class)
code_object would be some code object that you edited to be what you want it to be
and globals() is for global variables
can just be {} if you arent going to use global variables
if you are, you need to get to globals, which you can do using dunders like this:
__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__name__.__len__().__class__().__sizeof__().__sub__(__name__.__len__().__class__().__invert__().__neg__())))
so the final expression would be something like this (indentations so you can see whats going on)
<class function>.__new__(
<class function>,
some_edited_code_object,
__builtins__.__getattribute__(
__builtins__.__dir__().__getitem__(
__name__.__len__().__class__().__sizeof__().__sub__(
__import__.__sizeof__().__class__().__invert__().__neg__()
)
)
)()
)
Hi, I figured I should ask here:
What's the best way to preprocess python without the user having to change a lot of stuff? I do not want to change the actual source code, just modify it in memory and pass it to python
you could write a frontend that you call instead of python that preprocesses the code then passes it onto the interpreter
then alias it to python so the user can invoke it as if it were normal python
you could also fork cpython and have a preprocessor run before parsing the file
then distribute a compiled version of your code to the user
it would run a lot faster, and be a nicer solution than aliasing, but its a lot more work
And how do I do the preprocessing? I found some stuff using codecs or import hooks
if you want to preprocess a module, you can just use an import hook
i thought you mean like this
user@host:~$ python somefile.py
and then it preprocesses it before it runs it
distribute python dll along?
And I dont want to fork cpython either
you could have the user put all of their code inside a string, then pass that into a function
then do some string manipulation on it before execing it
Is it possible to set a custom encoding in python as default?
I want the user to run the code as usual
then aliasing python is probably your best bet
Or I could have a main file that sets up the import hooks and then imports the files that I want modified right?
you could have a module that the user imports at the top of their file
that sets up import hooks
Yeah and have some function install or smth like that
But its kinda annoying that I will need at least 2 files then
I guess I will go with that
you could make a module that sets up import hooks, reads __main__.__file__, preprocesses it, then execs that
then, to keep the actual __main__ from running, it could exit() afterwards
so that only the preprocessed __main__ runs
then you can just pass around a module that users import
?
what would install be for?
Setting up the import hooks
Or ig its not neccessary but I will have to make sure that its not unexpected behaviour
When do I import the module that sets up the hooks then tho? And which file do I run?
And I dont like that it would be an unused import
the best workaround imo for this
I tried something like this a while back and worked perfectly
How did you run the module that sets up import hooks?
you can import builtins, then replace builtins.__import__
in your module
and it will hook imports
I know but thats not what I meant
What advantages does this have?
Its supposed to preprocess the main file right?
But Im also importing it from the main file no?
fibonacci = lambda number: pow(2 << number, number + 1, (4 << 2 * number) - (2 << number) - 1, 2 << number)
``` use the 3rd argument of `pow()`, it's so much better
doesnt importlib have a class that I can override that manages loading the module?
Otherwise I would also have to implement finding the module
importlib has classes that you can use in the function that you replace __import__ with
or just do __builtins__.__import__
no need to import builtins
nope, cause in some implementations, __builtins__ is a dict (builtins.__dict__) in modules (and only modules)


