#voice-chat-text-1
1 messages · Page 17 of 1
hi
Hey
are they giving out advice or smthg
they are talkin abt gaza and israel war
oh alr seems interesting
I'm just deleting text after I decide it's not interesting enough
no pls send
😂
ye ye
dont hold back
still going through the list
found a pure-asyncio implementation of a chat system
https://gist.github.com/afeistel/8f05ff74b843baebd44fc3f7644ae344
https://gist.github.com/afeistel/3ff7258d8669879f571d0f641a2b9d23
this feels like a podcast and i like it
fr
OpenAI might also rate-limit based on geography
the same way they ban certain regions
what happens when someone is too lazy to use complex numbers:
https://gist.github.com/afeistel/b32ade307373dbe2e4c71806c4bbf1c4
gabriel is statin facts
@turbid silo i think even the literates are cringe and dumb
yeah I think the same
GitHub cuts out the preview, sadly
I wish i could understand what it is
program to solve polynomial equations
using binomial ?
for any number of terms
polynomials of degree 5 and above can't be solved analytically
which is why it uses derivatives and binary search
@quick radish your voice is low
note: the algorithm is very inefficient
the proper approach to solving polynomials is the fundamental theorem of algebra
and that requires complex algebra
which is easy but not in C
quadratic time complexity + errors near duplicate roots
ness do you own a cat ?
I just realized we have ness and nas
oh yea
@stuck bluff I think the political talk is done
Python indexes begin at 0.
😂
@mild flume "Tsargrad"
@misty sinew i was sad that u left
i should be studying 
😂 same here
mb it's time wen i live
leave*
vc
same honestly
I'm leavin less talk later ?
yeah , have a good one bye 
✅ @vocal ivy can now stream until <t:1697671407:f>.
Join the challenge or watch the game here.
¯_(ツ)_/¯
@quaint cape I've got to go 👋
I have to revoke your streaming permissions though, as we require a mod to be in the channel if someone is streaming if that person doesn't have permanent streaming permissions.
!unstream 266030641382948865
❌ This member doesn't have video permissions to remove!
@quaint cape's stream has been suspended!
!voicevirify
You are not allowed to use that command.
yoo
@royal ridge 👋
Back in a sec, getting coffee
Population Bomb + King's Rock
expected base power is 117.24 (STAB on Maushold but 75 attack isn't amazing)
expected flinch chance is 41.61% (insane af)
they're fun to read
but if i saw these comments when debugging, i'd throw out the whole vm
@near meadow Your mic was stuck open and all we heard was background noise
Please fix it
@drowsy ginkgo If you're wondering why you can't talk, check out the #voice-verification channel
That'll tell you what you need to know about the voice gate
Force of habit to mention it, sorry
thanks n nvm
I needed a help with my code
I had posted one in the python help box
could you please help me w it
I got an answer but its of no avail
I have no idea where to insert what
hence tried the VC
@drowsy ginkgo What's the question? Or do you have a link to your help question?
Sorry for the delay, my attention is split
50-50 shot, got the bigger half
Americans: Make european yearly salary in 3 months
Sysadmins are generally poorly paid
Troof
BTW, according to Levels, MEDIAN salary for Software Engineers in San Francisco is 240k
Wonder how much cost of living eats from that...
WFH = We Fart Hard
Its dis
from tkinter import *
import tkinter as tk
from tkinter import ttk,Tk,Label,PhotoImage
import subprocess
from PIL import Image,ImageTk
def main():
app=tk.Tk()
ob=LoginPage(app)
app.mainloop()
class LoginPage:
def init(self,win):
self.win=win
self.win.geometry("1350x750")
self.win.title("Pharmacy Management System | Login")
self.title_lbl=Label(self.win,text="Pharmacy Management System",bg="green",fg="white",bd=10,relief=GROOVE,font=("bahnschrift",27,"bold"))
self.title_lbl.pack(side=TOP,fill=X)
self.login_lbl=Label(self.win,text="Login Here",bg="pink",fg="blue",bd=10,relief=GROOVE,font=("bahnschrift",27,"bold"))
self.login_lbl.pack(side=TOP,fill=X)
self.main_frame=Frame(self.win,bg="White",bd=12,relief=GROOVE)
self.main_frame.place(x=315,y=185,width=720,height=250)
self.login_as_frame=LabelFrame(self.main_frame,text="Login as:",bg="white",bd=9,font=("bahnschrift",27),relief=GROOVE,pady=20)
self.login_as_frame.pack(side=TOP,fill=BOTH)
self.login_as_adm=Button(self.login_as_frame,text="Admin",bd=4,width=15,font=("bahnschrift",15))
self.login_as_adm.grid(row=0,column=2,padx=10)
def user_submit_func():
test()
def test():
# Path to your script
script_path = "C:/Users/DELL/Documents/Programs/Userlogin.py"
# Call the script using Python
subprocess.call(["python", script_path])
self.login_as_user=Button(self.login_as_frame,text="User",command = user_submit_func,bd=4,width=15,font=("bahnschrift",15))
self.login_as_user.grid(row=0,column=4,padx=10)
if name == "main":
main()
Like I need some clarity as to where I must insert the line of code to get a nice background image
@arctic vault https://pdm.fming.dev/latest/
(Invoke-WebRequest -Uri https://pdm.fming.dev/install-pdm.py -UseBasicParsing).Content | py -
@arctic vault Slight modification to the command they say to use to install it
Should be within the LoginPage class
Modification of the win
Sorry
self.win
im making a Stock Trading Bot in Python, any ideas? Like image recognition, Machine Learning or anything else?
why would you need image recognition if stocks are just numbers given to you?
i thought like if a script could like read all the things
in the stock market
like all the candles
but i think thats kinda stupid
idk
an idea, rarely used for such projects: follow laws
it's legal
or wdym?
In most case it's going to be less of a hassle on your end to just use APIs that they provide
Although I'm not sure of ones that are free. Haven't really looked into stock stuff before
you can scrape yahoo finance which isn't not illegal
unless you're a business, then it's illegal af
"read all the things" is already likely not fully legitimate
depending on the definition of "all"
is it legal, Yes or No
depends
Would certainly violate their terms of service
Which would make it something we couldn't/wouldn't help with
i dont understand anything
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
personally i wouldn't take the direct statement of an online random as fact when it comes to law. simply do your research, we can only provide advice lol
thanks ❤️
the things you use have terms of use
follow them and you likely won't end up in trouble
also follow like laws and stuff
#imnotalawyer
but do you guys still have any ideas?
it can also be legal but still illegitimate/bannable/etc.
as in you will get problems even if not in court
i don't know quite what your end goal is
@vocal ivy Yo
yo-yo
hi
Lunaaaaaaaa
sup
having a blast today
(if you see anything about explosions on the news, ignore it)
Going out with a bang
*making others
Nice
lol why chat 1 today
People were doing math things in VC0 so some of us moved down here. Math stuff was done, convo shifted to here.
Happens a lot
yea lota tend to turn away from math stuff
I mainly didn't want to interrupt
that makes me wonder if me being a vc lurker is rude
not necessarily
Not at all
A lot of people treat VC as a podcast or background noise
lurking isn't inherently rude, especially in a public forum iirc
it's only rude if you intentionally listen to private conversation; then it turns into eavesdropping.
or, as my pops calls it, ear hustling
i dont know any stock market millionaires - no full time day traders
absolute value is just magnitude
change my mind
Lepracaun is cool movies
I always liked the idea, but never the execution
I think the first movie was the only one with a genuine shot at being a decent film
hi
its got Warwick Davis ... very cool dude
there is echo you in garage today @torpid cloud
too many people in vc1 im switching to 0
David Lynch may do a directors cut of Dune , maybe
O _ O
The only echo is in my head
Lynch was embaressed by , DUNE , he ran away from it .. thats amazing
i saw asoka , she always looks so smug ,
I could see that
"Back in my day we had a hoop, a dirt road, and a lightsaber. And we damn well liked it!"
rosario dawson , hope she makes a pile of money - her character looks smug
wombats shit cubes - what ?
hint: ||mate in two||
@fringe flower
https://youtu.be/RkhfglMFk7s
I might be bad at shooting games, but I hope @InternDotGif doesn't make a rookie mistake when he forgets I was the 6th grade CHESS CHAMPION in FPS CHESS!
Check out my NEW TIERS of membership for exclusive videos, art and potentially more!
😄 Become a Member and Support Blitz! http://bit.ly/BlitzMember
Keep in touch with more Blitz!
★ T...
were going backwards ...
solution: ||Qxg8+ Kxg8 Re8#||
Please allow me to reintroduce myself...Forty Licks is back! Released on CD over 20 years ago, the definitive greatest hits collection is out officially on vinyl for the first time as a limited edition 4LP. Also available digitally and in Dolby Atmos, with three tracks new to streaming. Buy/listen now: https://therollingstones.lnk.to/40Licks
#T...
21 soundtrack - You Can't Always Get What You Want
I do not own anything.
this is a cool version
i like blackjack
there was gonna be a british version of Dune , mick jager waszz gonna be in it
was
ngl i don't remember this from the movie
listening again this sucks ass lol
both
I'm sorry to hear that. What happened? I thought you were living with your girlfriend
If you're fine with me asking
this usny my placr
this isnt my place and i can hear you
oh well tgat relationship is
... off
seems like it will always be
its alright i love her
so she got that at least
just sucks to be put throygh understading why
I can only imagine
Do you at least have a safe place to stay and all that?
@misty sinew Hit the wrong button?
lol
fav windows tools:
Revo Uninstaller
WinDirStat
fav windows software: fedora media writer
this was not directed at you 😩
camtasia was nice
Unregistered HyperCam 2
soundsystem 9000 instantly started playing in my head
HyperCam 1.6 captures the action from your Windows 9x or NT screen and saves it to AVI (Audio-Video Interleaved) movie file. Sound from your system microphone is also recorded.
#Solitaire is a popular game and this video shares some simple tips, tricks and strategies to help you solve this card game. Watch the video for all the details (provided by #HowToSolvePuzzles ) This is also called #KlondikeSolitaire and can be played with a regular deck of cards or can be played on your phone or tablet.
pro tip on how to win at poker:
have a shit ton of aces up your sleeve, works every time
my gf and i are dressing up as mr fantastic and invisible woman from the fantastic 4
I'm a server booster!
@trim violet Yo
HI
I have seen you share this atleast 3 times, since I joined...
hot topic in our server
Yeeeaaahhhh I like to show off how weird it is
It's interesting hearing people react to it
yea
I don't get why anybody would use trackball mouse
Same reason I got the keyboard
The ultimate precision mouse for power users. Harness the power of Logitech Flow and seamlessly move content between three computers. Scroll through documents and web pages faster and easier with the speed adaptive scroll wheel. Powers up for an entire day in just three minutes. A sculpted, hand ...
I don't hurt
I only saw it once, that too was in a old museum
i'm not
i spilled coke all over my bed
I'm little late, but how was/is your Halloween?
sugar-free coke
if i do trick-or-treat here in india, they will put cash in my bag
not pictured is area mostly surround passaic county calling it goosey night and bergen county cabbage night
/etc/issue
i got my degree from the college of winterhold
/dev/ratio
/l/ratio
i need some idea for a web thingy
twitter x clone
i had a idea for a twitter clone
you know how reddit allows you to reply to any comment
so that but display it as a tree
but then i realized thats nothing different from reddit
ok reddit clone
is the fraternity systems real?
i've heard it exists
or is it just exaggerated for television
I was watching a tv series 'freaks and geeks'
i find it facinating
we got camdem, trenton, paterson, asbury park, etc
but tbf none of them are that terrible
but also this is coming from a paterson boy
zonk
gtg
bye @lethal wadi!!!
i thought german syntax similar to english?
there are cases when they put the verb at the end
we indians are very inclined to use Subject–object–verb in english
this is nice
thank you for sharing
like irl?
Check out the #voice-verification channe- oh you got it, right
I'm never sure how many people actually read the rules
ban
funny thing is i have been in the discord multiple times and verified but if you leave and rejoin it resets
Under the same account?
yea
yea that would be my other one aswell
Cool cool
Not a problem, was just checking how far back your messages went and it popped up
hardware
wait no thats mine 🤣
I feel like theres other ones...
Look at that adorable bastard
give mic perms ❤️
i dont even have a hot cousin 😭
get it urself 😂
haha
You'll get there naturally, sorry
i have before on other accounts 😢
show hemlock proof
Which other accounts? The two I found (this and the other) wouldn't have qualified
can you search user ids ?
Yep yep
ofc
456226577798135808
@misty sinew
yea
Deleted 😭
Do you have access to any of these accounts, btw?
discord didnt like me
no proof then ig
I can see it if there's info in the bot
Nope they are deleted see above
It's bouncing the userid, yeah
I don't have a way to validate it, bot bounced it back
It'll feel shorter than you think
Plus you're still able to participate via chat here
im shorter then the 3 days ☠️
Colored role and symbol and our appreciation
damn
We wanted to make sure we weren't making a walled off area or playing favorites
Oh alr
@misty sinew Arabic is pretty good
I don't know it but I learnt the basics of it
They have something like that in the Vatican, but it's called Pope per view.
anyone else here from australia ?
i got my first 3d printer at the start of july this year and soon im going to get a rasberry pi to update its software and run octoprint
yes
perhaps you should delete this screenshot
Yeah might as well remove it
gimme mic perms?
how come ?>
aussie brother 🙂
mica theme
undercover
best country
it's easily one of the countries
Oh yeah that is a client mod huh
its a shame they cant just allow it
lol they would but for nitro users
Which honestly, people would pay for. But yeah, client mods are against ToS, so not displaying that you use it would be best
discord at this point just wants your money
🤣
But like that's the point of them
ofc
but like there phone app is dog balls
and even there desktop app is somewhat laggy on a high end pc
i heard that working for discord is more toxic then a bo2 cod lobby
No idea
good pay tho
are userscripts or userstyles against the tos aswell?
what about opening the console
But they aren't actively hunting for them so long as aren't interferring with the service
But I wouldn't bank on that always being the case
Still best not to broadcast that you use them
At least here
btw tos are not legally binding
Legally no
but it's better to follow them when reasonable
But they can still eject you from the service
the problem is i have a budget gaming laptop with a ryzen 5 5600h but it gets really hot
yeah i know that but i need a laptop for school and it is hard to transport a pc every week
@misty sinew Good thanks, you?
@past beacon that hurts
How exactly is it called?
Just because you are a pianist performing in front of a huge crowd, doesn't mean you can't be cheeky to the mouse who lives in the piano!
WB Kids is the home of all of your favorite clips featuring characters from the Looney Tunes, Scooby-Doo, Tom and Jerry and More!
#WBKids #KidsCartoons
Scooby-Doo! available on digital!
MORE VIDEOS HERE ►h...
!stream 737321460435124285
✅ @last cove can now stream until <t:1697845646:f>.
replit
voice chat drama 😮
You have a very low threshold for the definition.
mild drama still drama 🥺
Probably a lot 😄
Ah yeah. Have you ever used Latex?
For security purposes?
In production, no.
For secure random numbers, you should use the secrets module, rather than random.
After 4 hours of fighting with google script and chatGPT and google sheets, I made so little progress on my project 😢
This is so frustrating
virtualenv .venv
hi @quaint cape
Hello there 😄
@last cove
Yeah, apparently it was a bad idea to leave the server temporarly, it reset the verification @last cove

Yeah i understand why they make those policies 🙂
you dont ?
So, you working on something or looking for something ? 😄 @last cove
What kind of something ? 🙂
heyyyy
Hello!
Yes I am why ? 🙂
Oh okay , what about you @indigo patrol ? 🙂
building on python @last cove ?
not bad mate
just here, nothing to do
I'm looking for someone who knows Angular
Not my field :/
good morning
i took a trip out there over the summer
is this community college or acutal university?
@last cove ^
now university
but was the blackhat thing during those times
or were you always at uni
my college network was ass, but its miles better than my highschool network
?
did anyones social life take a nosedive after covid?
wtf is a e tag?
@misty sinew there is a powertoys thing that does that
wait macos does that?
deadass?
wym
its messy geopolitics
yeah dont worry too much about it tbh
its not fun
real
what project are you working on?
dumb question does anyone use git clients or raw dog cli
hello!
god my dogs just want so much attention
so riddled with anxiety and need to be babied all the time
anyone watching cs2 iem sydney?
i felt that
Sry @mild flume I jus saw your message.. When I try inserting it into the code as shown(left pic) I get an output as shown(top right) whereas I wanna Insert an image in the background of this (bottom right)
kinda waking up
just realised
uhh i learnt a new programming lanugage today
which is?
qbasic or something
never heard of that 🥱
haha me neither before today
lol
uhh i felt like it
best answer award of the century 😂
asked my dad how do i code something for dos (dosbox) and he said i should try it
dont check my bio
7 langs ik
its 9 not 7
damn
@umbral rose come back 
also i lost a tooth today
howz life chris
im 13 they should be out already
im 13 too, They arent out 👌
i have a lot of baby teeth left
me too 👌
me too 👌
👌
👌
👌
stop
👌
@umbral rose howz the django app going
(name)

gru wtf
NO
damn
||not|| me too 👌
👌
@timber zenith gone crazy
tf
nitro abuse hah
i couldnt send a dos executable

no shit sherlock
we are just having our own convo here 😂
well yeah but like it doesnt even work on modern windows
why delete it
nah
thats what i thought
BRO LET ME START UP GTA
hah ya
335 lines of code for a scrim server no one joins 😭
I wrote a whole bot for my server
300 lines
nobody fucking joined
DECLARE
a NUMBER;
PROCEDURE squareNum(x IN OUT NUMBER) IS
BEGIN
x := x * x;
END;
BEGIN
a:= 23;
squareNum(a);
dbms_output.put_line(' Square of (23): ' || a);
END;
/
wow
what is that
Is that the thing u showed me day b4 ystrday
never learning that 🥱
what does it even do
like whats the point of it
@umbral rose keep explaining, just saying i dont understand 😭
like just use a normal language for once
jesus why is it so hard to update gta
god knows
AND THERES AN UPDATE?
@umbral rose why?
oh its a quick one
oh
oh alr
oracle..
yee oracle creats that stuff
oracle dosent want humans to exist 😭
ye i see
I mean it kinda looks like plain english
but really just random stuff
yee
wait so print() is dbms_output.put_line()
SET SERVEROUTPUT ON;
look how nested this damn thing goes
damn state machines
case 's':
if (currentLineLength() > 1) {
switch (scanner.start[1]) {
case 'e': return checkKeyword(2, 2, "lf", TOKEN_SELF);
case 't':
if (currentLineLength() > 2) {
switch (scanner.start[2]) {
case 'e': return checkKeyword(3, 1, "p", TOKEN_STEP);
case 'r':
if (currentLineLength() > 3) {
switch (scanner.start[3]) {
case 'i': return checkKeyword(4, 2, "ng", TOKEN_STRING);
case 'u': return checkKeyword(4, 2, "ct", TOKEN_STRUCT);
}
}
break;
}
}
break;
}
}
break;
beautiful ;)
it's literally peak performance; this is the optimal structure for this
a trie
agony
if it works don't touch it 1. rule of programming xD
yea of course i also just start with building an ia when i don't even know the basics lol
shouldn't state machines have a single switch statement?
leetcode can't help you develop complex systems
No, they can go down arbitrarily from what I know; you can assume the conditions in the earlier cases become the new state for the inner switches
The accurate thing to say here is that I'm following a trie to suss out what keywords are where
What you have can be turned into a single switch statement
this might perform worse than a linear search
enlighten me then; I assumed it goes infinitely down, but if there's a way to remove the nesting, let's see
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
@timber zenith
https://paste.pythondiscord.com/DBHQ
@timber zenith
https://youtu.be/DMQ_HcNSOAI?si=FzXEqmXJq_GFyIa0
Interesting video on optimizing finding keywords from source-code. Theres a program gperf which lets you generate such code.
I had a week of fun designing and optimizing a perfect hash table. In this video, I take you through the journey of making a hash table 10 times faster and share performance tips along the way.
00:00 why are hash tables important?
00:31 how hash tables work
02:40 a naïve hash table
04:35 custom hash function
08:52 perfect hash tables
12:03 my p...
certainly a lot cleaner
I'll have to change the outer function because this is recursive, but it's worth a try
thanks, jan
cool video , new ideas
Oh no
!e python import uuid print(int(uuid.uuid4()))
@elder wraith :white_check_mark: Your 3.12 eval job has completed with return code 0.
174479915618312426451847650642786708195
lol
My university has those banned in examinations. They insane
is this python? I am trying ot find the case and switch keywords
It's C.
oh okay, I thought it might have been java
Nnnope. Just ol' C. I'm writing a compiler for a little homebrew toy language.
nice. I am looking for another project for my homelab
@fleet estuary 👋
@fleet estuary Check out the #voice-verification channel, that'll tell you what you need to know about the voice gate
And for text talking, that'd be here
tks brow
class Recipe(models.Model):
title = models.CharField(max_length=50)
description = models.CharField(max_length=255)
slug = models.SlugField()
preparation_time = models.CharField(max_length=50)
servings = models.CharField(max_length=50)
servings_unit = models.CharField(max_length=50)
preparation_steps = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
is_published = models.BooleanField(default=False)
cover = models.ImageField(upload_to='recipes/covers/%Y/%m/%d',blank=True,default="")
category = models.ForeignKey(Category,on_delete=models.SET_NULL,null=True)
#author = models.CharField(max_length=20,blank=True,default="user")
def __str__(self) -> str:
return self.title
def validateTicketType (ticketType) :
return ticketType in { 1 , 2 , 3 }
def getCustomerPurchse (soldTickets,ticketPrices) :
name=str(input("Enter customer name: "))
sold=int(input("How many tickets would "+str(name.capitalize())+" like to purchase? "))
print("Available Ticket Types and Prices:")
for i in range(len(ticketPrices)):
typee, price = ticketPrices[i]
print(str(i + 1) + ". " + typee + " - " + str(price) + " QAR")
VIP = 0
Standard = 0
Child = 0
for x in range(1, sold + 1):
while True:
try:
tictype =int(input("Choose ticket type for ticket "+str(x)+":"))
if validateTicketType(tictype):
if tictype == 1:
VIP += 1
elif tictype == 2:
Standard += 1
elif tictype == 3:
Child += 1
break
else:
print("Invalid ticket type, re-enter.")
except ValueError:
print("Invalid ticket type, re-enter.")
PurchseTicket = [len(soldTickets) + 1, name, 'VIP', VIP, 'Standard', Standard, 'Child', Child]
soldTickets.append(PurchseTicket)
return soldTickets
def calculateCustomerCost(customerTickets, ticketPrices):
cost = 0
tickets = 0
for i in range(2, len(customerTickets), 2):
typee = customerTickets[i]
number = customerTickets[i + 1]
for x in range(0, len(ticketPrices), 2):
if ticketPrices[x] == typee:
price = ticketPrices[x + 1]
cost += price * number
tickets += number
break
return cost, tickets
def getWinningCustomers(soldTickets, ticketPrices):
highNumber = 0
richGuy = []
for c in soldTickets:
feloos, _ = calculateCustomerCost(c, ticketPrices)
if feloos > highNumber:
highNumber = feloos
richGuy = [c[1]]
elif feloos == highNumber:
richGuy.append(c[1])
return (highNumber, richGuy)
#-------------------------------------------------
ticketPrices = [['VIP', 100], ['Standard', 50], ['Child', 25]]
soldTickets = []
print("Welcome to Qatar Formula 1 Ticket Booking System!")
while True :
try:
hihi=input("Would you like to enter information for a customer? (Type 'no' to exit):")
if hihi.lower() == 'yes' :
getCustomerPurchse (soldTickets,ticketPrices)
print("Order Summary for",str(name.capitalize()),":")
print("----------------------------------------")
customerTickets=soldTickets
(cost, tickets) = calculateCustomerCost(customerTickets, ticketPrices)
print("Customer Name",str(name.capitalize()),":")
print("Number of Tickets:",str(tickets))
print("Chosen Ticket Types:",['VIP', VIP, 'Standard', Standard, 'Child', Child ])
elif hihi == 'no' :
print("Thank you for using Qatar F1 system!")
break
except ValueError:
print("just type yes if you like to join us or no if you want to exit")
hi
hi
Is Code Vaild?
`# By Charlie
import turtle
import time
import random
delay = 0.1
Score
score = 0
high_score = 0
Set up the screen
wn = turtle.Screen()
wn.title("Snake Game by @Charlie")
wn.bgcolor("green")
wn.setup(width=600, height=600)
wn.tracer(0) # Turns off the screen updates
Snake head
head = turtle.Turtle()
head.speed(0)
head.shape("square")
head.color("black")
head.penup()
head.goto(0,0)
head.direction = "stop"
Snake food
food = turtle.Turtle()
food.speed(0)
food.shape("circle")
food.color("red")
food.penup()
food.goto(0,100)
segments = []
Pen
pen = turtle.Turtle()
pen.speed(0)
pen.shape("square")
pen.color("white")
pen.penup()
pen.hideturtle()
pen.goto(0, 260)
pen.write("Score: 0 High Score: 0", align="center", font=("Courier", 24, "normal"))
Functions
def go_up():
if head.direction != "down":
head.direction = "up"
def go_down():
if head.direction != "up":
head.direction = "down"
def go_left():
if head.direction != "right":
head.direction = "left"
def go_right():
if head.direction != "left":
head.direction = "right"
def move():
if head.direction == "up":
y = head.ycor()
head.sety(y + 20)
if head.direction == "down":
y = head.ycor()
head.sety(y - 20)
if head.direction == "left":
x = head.xcor()
head.setx(x - 20)
if head.direction == "right":
x = head.xcor()
head.setx(x + 20)
Keyboard bindings
wn.listen()
wn.onkeypress(go_up, "w")
wn.onkeypress(go_down, "s")
wn.onkeypress(go_left, "a")
wn.onkeypress(go_right, "d")`
``# Main game loop
while True:
wn.update()
# Check for a collision with the border
if head.xcor()>290 or head.xcor()<-290 or head.ycor()>290 or head.ycor()<-290:
time.sleep(1)
head.goto(0,0)
head.direction = "stop"
# Hide the segments
for segment in segments:
segment.goto(1000, 1000)
# Clear the segments list
segments.clear()
# Reset the score
score = 0
# Reset the delay
delay = 0.1
pen.clear()
pen.write("Score: {} High Score: {}".format(score, high_score), align="center", font=("Courier", 24, "normal"))
# Check for a collision with the food
if head.distance(food) < 20:
# Move the food to a random spot
x = random.randint(-290, 290)
y = random.randint(-290, 290)
food.goto(x,y)
# Add a segment
new_segment = turtle.Turtle()
new_segment.speed(0)
new_segment.shape("square")
new_segment.color("grey")
new_segment.penup()
segments.append(new_segment)
# Shorten the delay
delay -= 0.001
# Increase the score
score += 10
if score > high_score:
high_score = score`
`.format(score, high_score), align="center", font=("Courier", 24, "normal"))
time.sleep(delay)
wn.mainloop()`
???
cpython would gladly help
Charlie charlie are you in?
is it working
I want to read some python code to learn I am an intermediate does anybody know any github repos that I could read or just some code?
@distant tinsel +1 btw, i also need that suggest tho
@fast relic I am pretty new to programming if you could help me that would be sweet!
also yeah does anybody more have any code to read?
cpy 
spy 
hi
imagine waiting entire day for python library to build wheel and terminal crashes 🙃
imagine getting timed out for 10 minutes for trying to hit the 50 message requirement
You have my full sympathy and emotional availability
great, the path to healing starts with meeting the 50 message requirement
a
b
c
d
e
f
haha it won't catch me this time!
g
How will you meet the 3 day requirement, though
Do you have a time accelerator?
Hmm I think the messages in voice chat may not count
@stuck bluff hi)
I'd be curious how this works under the hood-- Some Python code, even in Nuitka, cannot be serialized properly and converted into C in any real clean way; and that can create vulnerabilities in C transpiled code or obfuscation.
@proper zealot Generally speaking when we're talking about 'breaking' PyArmor, we really only want to pull out configuration details, network calls, syscalls, etc. From a security perspective, the actual source code isn't critically important to us.
yea source code means nothing to me its just the 3 encryption keys
I'd just focus on making sure those functions are encrypted-- it'll also make it easier for it to be audited by security researchers (which you may or may not want) but allow us to write exceptions in AV software and whatnot.
unless your gonna tell avast to chill thats my main problem 🤣
the rest actually dont go off that much
Having transparent code actually makes that easier. You can email Avast yourself often.
Or av vendors in general.
There's reporting procedures for auditing and exempting false positives.
pickle needs to be inaccessible, for reasons
(in addition to everything else)
yeah, just so it never gets exposed through whatever interfaces there are
code = """
(eval\\
('print(555)'))
"""
!e
print('hi')
@lost sedge :white_check_mark: Your 3.12 eval job has completed with return code 0.
hi
!e
(eval\
('print(555)'))
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
555
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
555
!d ast
Source code: Lib/ast.py
The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like.
An abstract syntax tree can be generated by passing ast.PyCF_ONLY_AST as a flag to the compile() built-in function, or using the parse() helper provided in this module. The result will be a tree of objects whose classes all inherit from ast.AST. An abstract syntax tree can be compiled into a Python code object using the built-in compile() function.
!e
global_vars = []
global_vars.append("__built")
global_vars.append("__build_class")
global_vars.append("__debu")
global_vars.append("__doc__")
global_vars.append("__impo")
global_vars.append("__loade")
global_vars.append("__nam")
global_vars.append("__packag")
global_vars.append("__spe")
import os, re
def testscript(python_script):
allowed_functions = set(["print", "len", "range", "str", "int", "mhash", "True", "False", "input"])
for x in global_vars:
if x in python_script:
# get the line number its on
print(f"Variable {x} is being used in the script, script blocked")
return f"Variable {x} is being used in the script, script blocked"
if "import" in python_script or "__code" in python_script:
print(f"Import statement detected, script blocked")
return f"Import statement detected, script blocked"
print('script got through')
code = "eval('amport tame;prant(tame.tame())'.replace('a', 'i'))"
testscript(code)
@lost sedge :white_check_mark: Your 3.12 eval job has completed with return code 0.
script got through
it'd be interesting for that first part to do anything given allowed_functions isn't used
literally a button
!e
𝙚x𝙚c("print('hello world')")```
@runic cliff :white_check_mark: Your 3.12 eval job has completed with return code 0.
hello world
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
42
for same-ish reason
though this one actually wouldn't parse
can compile escape?
compil𝙚
Send something and ill test it
no, I meant can you use compile to escape the sandbox somehow?
you'd need exec/eval still, I think
Send code and ill test it
ctrl+w but stronger
!e
def f():
pass
print(f.__globals__[f.__dir__()[8]])
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
<module 'builtins' (built-in)>
This is the tree I started barking up lol
!e
def f():
pass
object.__getattribute__(f.__globals__[f.__dir__()[8]], 'ex' + 'ec')('print(555)')
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
555
does this still pass?
I'm looking at modifying __code__ objects now.
rejects newlines?
just added __globals__ __getattribute__
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
10
@proper zealot
!e
print(32 <= ord('\n') <= 126)
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
False
anyways
code = "object.__getattribute__((lambda:_).__globals__[(lambda:_).__dir__()[8]], 'ex' + 'ec')"
I don't need newlines
for char in python_script:
if 32 <= ord(char) <= 126:
pass
else:
if ord(char) == 9 or ord(char) == 10 or ord(char) == 13:
pass
else:
print("non ascii character detected, script blocked")
global_vars.append("__built")
global_vars.append("__build_class")
global_vars.append("__debu")
global_vars.append("__doc__")
global_vars.append("__impo")
global_vars.append("__loade")
global_vars.append("__nam")
global_vars.append("__packag")
global_vars.append("__spe")
global_vars = []
global_vars.append("__built")
global_vars.append("__build_class")
global_vars.append("__debu")
global_vars.append("__doc__")
global_vars.append("__impo")
global_vars.append("__loade")
global_vars.append("__nam")
global_vars.append("__packag")
global_vars.append("__spe")
global_vars.append("__getat")
global_vars.append("__glo")
@proper zealot
if ord(char) in (9, 10, 13):
or with a set
Why
thank you im tired
this is why we are best friends
more semantically correct + O(1) lookup
but in this case it's more or less equivalent
import base64
import zlib
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
mykey2 = "buifweguifuiweguhrvghouihgofoisnoyuignyhoeyorvvgosnvhsaoigosnvhsavgosnvhsaoivgosnvhsaoivgosnvhsaoioifivhownoiftuyoaiseruyiontrfviyuAIO"
mykey3 = "bfksaujfbagndfjbsdgjbbuifweguifuiweguhrvghovgosnvhsaoiuihgofoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaiseruyiontrfviyuAIOsdfuhxsnfuvisbibfksaujfbagndfjbsdgjbs"
izip = zip
keys = [mykey1, mykey2, mykey3]
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
for x in keys:
message_ascii = [ord(char) for char in encrypted_message]
key_ascii = [ord(char) for char in x]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
temp = compress_data("temp")
print(temp)
print(len(temp))
print(decompress_data(temp))
!e
import base64
import zlib
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
mykey2 = "buifweguifuiweguhrvghouihgofoisnoyuignyhoeyorvvgosnvhsaoigosnvhsavgosnvhsaoivgosnvhsaoivgosnvhsaoioifivhownoiftuyoaiseruyiontrfviyuAIO"
mykey3 = "bfksaujfbagndfjbsdgjbbuifweguifuiweguhrvghovgosnvhsaoiuihgofoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaiseruyiontrfviyuAIOsdfuhxsnfuvisbibfksaujfbagndfjbsdgjbs"
izip = zip
keys = [mykey1, mykey2, mykey3]
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
for x in keys:
message_ascii = [ord(char) for char in encrypted_message]
key_ascii = [ord(char) for char in x]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
temp = compress_data("temp")
print(temp)
print(len(temp))
print(decompress_data(temp))
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | b'eNorKctPBQAEeQG/'
002 | 16
003 | temp
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | b'eNp9mWnT1ba2rf/aPjQ5OQGSTUIgkAZZjS2rs3pZsiz99TtfdjhZt4p7P1BUsRa2l6QxxjOmYz4YTohMPMu2ou0I/R5c25Y2Z9gpvbzHSlbT+bUvnVc97BZmzYlpllrWTcyMGLZ8ubKNTO13kKuURyIcPrTDi6wkaY4XJ6jIsp7iMFW8ePHctRWTYfx48ep53+LSB3Kub+bydyQcueWUJqebu9MvVCJJm9zQuutEUZFMZ5y7ckMFGiJty8W+Pls7PRHmqsJGRO0Yfu63yCNRGYWOsSu2zLv2lpsbl72num6vG33/9rs5BXZrVzR//PfrYMg+CfVKH8mhWUXSbffTiZDnOu5U+l3ZggrTolCE73th09ULLbV5Tc3GiuirilY7s/Sa9VUHx9EtOjpzydOzrAYlyO+njBQ+PattQX5+9axTL3qHpV8OEsLGuiYyt1D7iDrL5ZY2vnn+duwUMa84LVHsTi1hKdl0Rm+HYTu7XkUM3Nydl6xa1GcoKrFzTr0i9a3r23KJdDsXuu789fN/26mZPoKNNCN5HD0wbUPNR3SkelF4CEfp2CtTr3Ggwcwhdo9HlfLKv3/6wbo0yzzT8F4KJBFziOap1g326uSHTn1Fwgor27bXiYfc1XpFeh6HKWVFZuFpvHj3p8BcchJPiVayX+zMREubdylcFK5wX9CKQ8b8arOfsAxR7l6IQPyMi96TPYNgsziuKGaxHpTZdNS/3v1Rr2UEFAVVmp2XPKjapeurT+fFz0mJHW4XKJ6Fxx+f/VmK8EzwXKm/lkSI9B0npa3cGAmD1xDM6GczISR7rH72yvYEmqBFUjhzygqmvz4b/AAGa6kwBY0MuWlV8BgFXSSpPaZM82+vn1U+Pd8ygXXe6X7MFp798ZmBRu8Ldjl6fk9HNro7KqTYMuz21LvT68r7SSnmWhxw7zgjPGInE3SwH/B8SLpSaM5RxMFPNfcpHb1YG3T/8pmm56kpNQrLxYBGlrq1
... (truncated - too long)
Full output: https://paste.pythondiscord.com/EN3GR6AZR4NBH6VVLVFHYZOBKA
!e
import base64
import zlib,time
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
mykey2 = "buifweguifuiweguhrvghouihgofoisnoyuignyhoeyorvvgosnvhsaoigosnvhsavgosnvhsaoivgosnvhsaoivgosnvhsaoioifivhownoiftuyoaiseruyiontrfviyuAIO"
mykey3 = "bfksaujfbagndfjbsdgjbbuifweguifuiweguhrvghovgosnvhsaoiuihgofoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaiseruyiontrfviyuAIOsdfuhxsnfuvisbibfksaujfbagndfjbsdgjbs"
izip = zip
keys = [mykey1, mykey2, mykey3]
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
for x in keys:
message_ascii = [ord(char) for char in encrypted_message]
key_ascii = [ord(char) for char in x]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
time1 = time.perf_counter()
temp = compress_data("temp"*2000)
print(len(temp))
print(time.perf_counter()-time1)
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 6720
002 | 0.010057621169835329
!e
import base64
import zlib,time
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
mykey2 = "buifweguifuiweguhrvghouihgofoisnoyuignyhoeyorvvgosnvhsaoigosnvhsavgosnvhsaoivgosnvhsaoivgosnvhsaoioifivhownoiftuyoaiseruyiontrfviyuAIO"
mykey3 = "bfksaujfbagndfjbsdgjbbuifweguifuiweguhrvghovgosnvhsaoiuihgofoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaiseruyiontrfviyuAIOsdfuhxsnfuvisbibfksaujfbagndfjbsdgjbs"
izip = zip
keys = [mykey1, mykey2, mykey3]
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
for x in keys:
message_ascii = [ord(char) for char in encrypted_message]
key_ascii = [ord(char) for char in x]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
time1 = time.perf_counter()
temp = compress_data("temp"*15000)
print(len(temp))
print(time.perf_counter()-time1)
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 36432
002 | 0.08636451279744506
!e
import base64
import zlib,time
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
mykey2 = "buifweguifuiweguhrvghouihgofoisnoyuignyhoeyorvvgosnvhsaoigosnvhsavgosnvhsaoivgosnvhsaoivgosnvhsaoioifivhownoiftuyoaiseruyiontrfviyuAIO"
mykey3 = "bfksaujfbagndfjbsdgjbbuifweguifuiweguhrvghovgosnvhsaoiuihgofoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaiseruyiontrfviyuAIOsdfuhxsnfuvisbibfksaujfbagndfjbsdgjbs"
izip = zip
keys = [mykey1, mykey2, mykey3]
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
time1 = time.perf_counter()
temp = compress_data("temp"*15000)
print(len(temp))
print(time.perf_counter()-time1)
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 852
002 | 0.018660324160009623
try the same data with these keys
k1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
k2 = '\x00\x13\x02\x15\x16\x10\r\x13\x0b\x07\x12\x07\x13\x03\r\x17\x1b\x16\x11\r\n\r\x00\x00\x0e\x10\n\x01\x1a\x00\x15\x1b\x06\x0e\x10\x0e\x12\x06\x0b\x1e\x08\r\x16\x19\x15\x19\x05\t\x19\x1b\x1d\x17\x07\x1a\x14\x06\x01\x00\x00\x15\x01\x1f\x1b\x1d\x0e\x0f\x12\x06\x14\x00\x0f\x00\x1c\x04\x16\x06\x04\x11\x08\x1c\x1d\x18\x1e\x1b\x12\x0e\x06\x1f\x01\x06\x05\x06\x19\x1f\x1d\x0e\x06\x0f\x1b\x1c\x1f\x06\x17\x01\x1c\x12\x1c\x1a\x10\x0f\x1b\x1b\r\x1d\x07\x1f\x1a\x1c\x0740&\x1c\n\x12\x07\x0e\x0e\x1a\x17\x134?&\x11\x17\x00\x04\x11\x0e\x14\x14\x1c\x0c\x13\x0b\x16\x02\t\x11\x0e\x18\x14\x14\x0c\x08\x1f\x0b\x1b'
keys = [k1, k2]
output should be the same
multiple keys only matter on large inputs
!e
import base64
import zlib,time
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
mykey2 = "\x00\x13\x02\x15\x16\x10\r\x13\x0b\x07\x12\x07\x13\x03\r\x17\x1b\x16\x11\r\n\r\x00\x00\x0e\x10\n\x01\x1a\x00\x15\x1b\x06\x0e\x10\x0e\x12\x06\x0b\x1e\x08\r\x16\x19\x15\x19\x05\t\x19\x1b\x1d\x17\x07\x1a\x14\x06\x01\x00\x00\x15\x01\x1f\x1b\x1d\x0e\x0f\x12\x06\x14\x00\x0f\x00\x1c\x04\x16\x06\x04\x11\x08\x1c\x1d\x18\x1e\x1b\x12\x0e\x06\x1f\x01\x06\x05\x06\x19\x1f\x1d\x0e\x06\x0f\x1b\x1c\x1f\x06\x17\x01\x1c\x12\x1c\x1a\x10\x0f\x1b\x1b\r\x1d\x07\x1f\x1a\x1c\x0740&\x1c\n\x12\x07\x0e\x0e\x1a\x17\x134?&\x11\x17\x00\x04\x11\x0e\x14\x14\x1c\x0c\x13\x0b\x16\x02\t\x11\x0e\x18\x14\x14\x0c\x08\x1f\x0b\x1b"
mykey3 = "bfksaujfbagndfjbsdgjbbuifweguifuiweguhrvghovgosnvhsaoiuihgofoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaiseruyiontrfviyuAIOsdfuhxsnfuvisbibfksaujfbagndfjbsdgjbs"
izip = zip
keys = [mykey1, mykey2]
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
for x in keys:
message_ascii = [ord(char) for char in encrypted_message]
key_ascii = [ord(char) for char in x]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
time1 = time.perf_counter()
temp = compress_data("temp"*15000)
print(len(temp))
print(time.perf_counter()-time1)
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 1088
002 | 0.06199347600340843
I meant output not time
oh lol
k2 is just mykey2^mykey3 from original
must be at least min(map(len, keys))
so to get any reasonable level of security you need keys of varying sizes
preferably prime
i always add timestamps to every packet
keys should also be non-ascii
!e
import base64
import zlib,time
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeygyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeygyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
izip = zip
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
temp = {"timestamp":time.time(),"test": "test"}
print(compress_data(temp))
time.sleep(0.01)
temp = {"timestamp":time.time(),"test": "test"}
print(compress_data(temp))
time.sleep(0.01)
temp = {"timestamp":time.time(),"test": "test"}
print(compress_data(temp))
time.sleep(0.01)
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co908A30jPIMiIuPdvb2D5ESlmZyCA32ZOJlEPUQAQASsArm'
002 | b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co908A30jPIIiA6Lc/D2D5ESlmZyCA32ZOJlEPUQAQARqQrZ'
003 | b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co908A30jPIOCIsPdPD2D5ESlmZyCA32ZOJlEPUQAQARQgrT'
oh, wait, previous algorithm was, like, broken
this ignores the first key
Btw @proper zealot
def compress_data(data):
compressed_data = zlib.compress(data.encode(), level=9)
compressed_data = base64.b64encode(compressed_data)
compressed_data = __xor(compressed_data.decode())
return compressed_data
def decompress_data(compressed_data):
decompressed_data = __xor(compressed_data)
decompressed_data = base64.b64decode(decompressed_data)
decompressed_data = zlib.decompress(decompressed_data).decode()
return decompressed_data
Should be perhaps faster and smaller compression size
and more security
Maybe idk
because compressed stuff is harder to mess with
only problem is the xor make invis char that can get lost in packet
should also be dealing with bytes at this point
has happend before thats why its likke that
import re
global_vars = []
global_vars.append("__built")
global_vars.append("__build_class")
global_vars.append("__debu")
global_vars.append("__doc__")
global_vars.append("__impo")
global_vars.append("__loade")
global_vars.append("__nam")
global_vars.append("__packag")
global_vars.append("__spe")
def testscript(python_script):
for char in python_script:
if 9 <= ord(char) <= 126:
pass
else:
print("non ascii character detected, script blocked")
allowed_functions = set(["print", "len", "range", "str", "int", "mhash", "True", "False", "input"])
if "eval" in python_script or "exec" in python_script:
print("eval or exec detected, script blocked")
for x in global_vars:
if x in python_script:
print(f"Variable {x} is being used in the script, script blocked")
if "import" in python_script or "__code" in python_script:
return "Import statement detected, script blocked"
def isallow(char):
tem = False
if char.isalpha():
tem = True
if char.isdigit():
tem = True
return tem
function_assignment_pattern = r'(\w+)\s*=\s*(\w+)(?:\(([^)]*)\))?'
function_call_pattern = r'(\w+)\s*\('
quote_pattern = r'\'[^\']*\'|"[^"]*"'
quoted_strings = re.findall(quote_pattern, python_script)
script_lines = python_script.splitlines()
for i in range(len(script_lines)):
script_lines[i] = script_lines[i].strip()
built_in_functions_assigned = []
function_assignments = re.findall(function_assignment_pattern, python_script)
for variable, func, func_args in function_assignments:
if func in dir(__builtins__) and func not in allowed_functions:
print(func)
line_number = script_lines.index(f"{variable} = {func}({func_args})") + 1 if func_args else script_lines.index(f"{variable} = {func}") + 1
built_in_functions_assigned.append((variable, func, line_number))
for variable, func, line in built_in_functions_assigned:
if func in allowed_functions:
pass
else:
print(f"Built-in function {func} is being assigned to a variable '{variable}' at Line {line} NOT ALLOWED, script blocked")
user_defined_functions = []
built_in_functions = []
function_calls_with_line = [(func, idx + 1) for idx, line in enumerate(script_lines)
for func in re.findall(function_call_pattern, line)]
filtered_function_calls_with_line = [(func, line) for func, line in function_calls_with_line
if not any(func in quoted for quoted in quoted_strings) and not script_lines[line - 1].strip().startswith('def')]
for func, line in filtered_function_calls_with_line:
if func in dir(__builtins__):
built_in_functions.append((func, line))
else:
user_defined_functions.append((func, line))
for variable, line, args in function_assignments:
for func, func_line in filtered_function_calls_with_line:
if variable == func and line == func_line:
user_defined_functions.append((variable, line))
for func, line in built_in_functions:
if func in allowed_functions:
pass
else:
print(f"Extracted built-in function call: {func}() (Line {line}) NOT ALLOWED, script blocked")
for func, line in user_defined_functions:
pass
return False
code = """
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'
"""
testscript(code)
exec(code)```
Hahahah bruh
yea
there is ZeroMQ to abstract away some difficult parts of TCP
FWIW it doesn't actually work lol
"join the cult!
join the cult!"
, as this xors the first key twice
yea
i just stuck with 1 key tbh and will probs make it 512 long
having timestamps in all packets will make it extremly hard to figure out anything anyway
each block key should be derived, not repeated
at which point you get a regular stream cipher
you also need an HMAC to verify the data isn't tampered with
@proper zealot :x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | py
004 | ^^
005 | NameError: name 'py' is not defined
!e
import base64
import zlib,time, random
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeygyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeygyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
izip = zip
def __xor(message):
# Convert the message and key to lists of ASCII values
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
# Perform XOR operation on each ASCII value
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def compress_data(data):
data = __xor(str(data))
compressed_data = zlib.compress(data.encode(), level=9)
compress_data = base64.b64encode(compressed_data)
return compress_data
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
temp = {"timestamp":time.time(),"test": "test", "random":random.randint(1,10)}
print(compress_data(temp))
time.sleep(0.01)
temp = {"timestamp":time.time(),"test": "test", "random":random.randint(1,10)}
print(compress_data(temp))
time.sleep(0.01)
temp = {"timestamp":time.time(),"test": "test", "random":random.randint(1,10)}
print(compress_data(temp))
time.sleep(0.01)
@proper zealot :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co/wcYn0jPONioqLcfb2D5ESlmZyCA32ZOJlEPVwDXaT5ZBgZpDz9PFwlwEAtWgNZg=='
002 | b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co/wcYn0jPOJjg8LjHL3YOdmlQmM9Q+REpZmd3P2DBHmYxfiYAoJCYt0lgEAtD4NoA=='
003 | b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co/wcYn0jPOPjoqMdfb2D5ESlmZyCA32ZOJlEPVwDXaT5ZBgZpDz9PFwlQEAtUoNYw=='
(there's quite a high change it's just easier to bundle PyNaCl)
((encryption library made with bindings for libsodium))
how would they even tamper the encrypted json without breaking it
Cant
also, encoding before xor not after might make sense
yea but xor creates breaking chars in the packet that was creating errors on the other side
@lost sedge csgo 2 ?
1018242801
@lost sedge join vc when you ready we all miss u
same with rem
I thought of this as I went to bed but if you’re running this code user side, users running potentially malicious code on their own computers isn’t really your problem— if they type it in and run it, they’re responsible.
However, if you’re evaluating it remotely, it makes sense to use NSjail a la our Snekbox here in pydis
i was wanting some code to be ran client side
to make the game self sustained
If someone tries to exploit their own computer, that makes them silly.
The only time you should really worry about this is if users can arbitrarily evaluate untrusted code on their own system (say, I send a bit of code through and you run it as another user) or if your server infrastructure itself evaluates code.
only thing is scripts can be shared to other players
There’s some stipulations, but I bookmarked an article about Python bytecode trickery before I ran off to bed.
Exec can indeed evaluate bytecode. Which means you’d end up writing very expensive regex to try and detect everything.
i block the word exec and eval and now ascii
!e
import base64
import zlib,time, random
mykey1 = "niovtynvyugyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeygyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeygyusnyoisnoyuignyhooivgosnvhvgosnvhsaoisaoivgosnvhsaoivgosnvhsaoisnoyuignyhoeyorvgosnvhsaoifivhownoiftuyoaisereyorvgosnoyanomyufgnyosgnyiod"
izip = zip
def __xor(message):
message_ascii = [ord(char) for char in message]
key_ascii = [ord(char) for char in mykey1]
encrypted_ascii = [message_ascii[i] ^ key_ascii[i % len(key_ascii)] for i in range(len(message_ascii))]
encrypted_message = ''.join(chr(ascii_val) for ascii_val in encrypted_ascii)
return encrypted_message
def decompress_data(compressed_data):
de = base64.b64decode(compressed_data)
decompress_data = zlib.decompress(de).decode()
data = __xor(decompress_data)
return data
print(decompress_data(b'eNoFwdEJgDAMBcAp/HOYUlpfgmIt0dBSeNl/C++2m6gSkOJsFsKRo7e6lDrpK53tDUykzxQzP1Lt4IAz6yVl/wFYExLh'))
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
{'111111111': 111111>602.0011926, '1111': '1111', '111111': 7}
I didn't use the key for this
What if instead of giving you code at all, I just pass in bytecode?
It passes all the tests, but when exec is called, it’s called on bytecode instead of any actual… regular Python code?
so, for example, this way I can overwrite test with whatever I choose if it's the same length
Pretend this bytecode actually runs and doesn’t error. There’s a way to craft this bytecode in a manner that doesn’t error, I just need to navigate the article I bookmarked to figure it out.
How did you fit all of it into discord
There’s a stack overflow article about exec’ing bytecode somewhere out there
It didn't let me
Gratuitous use of backspaces
I removed all his comments and newlines
@proper zealot one of the reasons to reorder compression and xor
the way it is now, it's almost trivial to change the data
!e
import base64
import zlib
print(base64.b64encode(zlib.compress(bytes([a ^ b ^ c for a, b, c in zip(
b"{'111111111': 1111118203.1525962, '1111': '1111', '111111': 2}", # what we want to get
b"{'timestamp': 1698998203.1525962, 'test': 'test', 'random': 2}", # a guess
zlib.decompress(base64.b64decode(b'eNoT9ZOWl5SRZZKQEI/zD473Dwv0Co/wcYn0jPONioqLcfb2D5ESlmZyCA32ZOJlEPVwDXaT5ZBgZpDz9PFwlwEAtWgNZg==')))]), level=9)))
@delicate wren :white_check_mark: Your 3.12 eval job has completed with return code 0.
b'eNoFwdENgCAMBcAp/HMYg+BrIwoJSgoxr/tv4d1yE0kcEjtLc6EFtxyH8pqT336WxzGwvU0xQpXUDho6g2bB+gNZ/hLy'
a common mitigation for this issue:
https://en.wikipedia.org/wiki/HMAC
wikipedia preview is slightly ugly because it's made for a white background
Did you remove it yourself
yes
<>
<https://en.wikipedia.org/wiki/HMAC>
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@rugged kernel
hi
@rugged kernel
well thats gonna take a bit
I'd just use zmq_curve for this
http://api.zeromq.org/master:zmq-curve
I'd expect it to do MAC too
are those tool specific to networking? or is it a network specifically in a "graph" sense (as an implementation detail)?
Rust's async is great
any
would most likely help
true
i still stragle to use async but once it works its good
alot
i need to always check the documentation
did
i
lol
lol
yeah @lost sedge i always have been in this server
Ik
very low-level, C-like almost (in implementation)
doesn't really have a notion of an event loop
but still feels like normal sync
lol
is C#'s async built on top of an event loop? I'd expect so
Ok logan we're going to have a very long and fast conversation about something
@rugged kernel
It's 50 msgs?
not sure ive sent messages in the past
what topic tcp or udp
are you writing your own algorithms or just composing others?
no, that's spam
No
sometimes
when i do my encryption
That's sending the message 3 words at a time
depends on the intent, I'd say
i use ca certs and public and
privet
keys to encrypt and decrpt
i make a send script
Pgp
techniclty

