#networks
1 messages · Page 12 of 1
django rest
You can't send multipart (form with file) and application/json at the same time
Show the source to the Django rest framework view?
serializer:
class PostSerializer(TaggitSerializer, ModelSerializer):
tags = TagListSerializerField()
class Meta:
model = Post
fields = ("title", "body", "image", "alt", "tags", "pin", "status")
view:
class PostViewSet(ModelViewSet):
permission_classes = (IsAuthenticatedOrReadOnly,)
queryset = Post.published.all()
serializer_class = PostSerializer
i have a cli client like this:
async def post(title, body, image, alt, status, tags: str, pin):
token = "some token"
files = {
"image": open(image_file, "rb"),
}
data = {
"title": title,
"body": body.replace("\n", ""),
"alt": alt,
"status": status,
"tags": tag_list,
"pin": pin == "y"
}
data_en = json.dumps(data)
headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
async with httpx.AsyncClient(http2=True) as client:
response = await client.post(url="localhost:8000/api/", data=data, headers=headers, files=files)
Try posting in #web-development your Django and client code
did that 🙏
hey, sir can i ask you?
i alr understood, routing protocols like RIP,EIGRP&OSPF benefits from multicast, so whoever subscribe to x muticast can receive and listen to the packet
but, i dont understand things like PIM,IGMP like arent they alr subscribe to listen their particular subscribed multicast in these routing protocol(RIP,EIGRP&OSPF), and they alr have their own algo model to find the best path, so whats the point of PIM or IGMP?
Basically PIM and IGMP are used to manage multicast traffic.
PIM isn't really tied to a specific unicast routing protocol (thus the name protocol independent multicast) which gives it flexibility.
IGMP on the other hand is more of a local network to manage local memberships and optimize traffic flows
how is it going is it fixed?
hi🙌
yes
header needed to change
Could be your router is blocking the UDP port, you may have to look at its settings
Ok
Guys , anyone have any idea how can I get the raw response header in text string format (either in ascii or utf) from an api request?
Can you show the code you have so far?
Any idea where I can find some docs/examples for an auto-finder system using <broadcast> in socket to make the connection between two devices in the same network (with the ability to choose which device to connect to) and when the device is selected, create a P2P connection between these two? (Using sockts)
owo?
anyone here familiar with tailscale? Just dowloaded it on win 11 and it does the blue circle thingy for like half a second then nothing. please help.
If the documentation doesn't solve the issue then you should look for their support. https://tailscale.com/kb/1022/install-windows
I'm building a Python code optimization tool called codeflash.ai and I've managed to speed up an important section of the python requests library. I'm thinking of getting this merged upstream. Do you know what would be the right way contributing to python itself? Should I talk to any particular python developer about the optimization I have?
I am working on a progresstracker (iterables, functions and logs) called ProgressPal (https://github.com/levi2234/Progresspal). It works great and as intended. It works by making a post request to a flask server which then handles the visualization and data processing. This works great when the site is hosted locally and the requests are sent to localhost. However when I publicly host this site through built in vscode port forwarding, sending requests to that webadress do not seem to get through to the flask webapp. I have a feeling this has something to do with the https protocol but I'm not sure. Also check ProgressPal out! It is a different take on progress trackers such as tqdm and rich and is very extensive.
this is really cool, will you add tracking full scripts? it would be nice to be able to start/upload a script
additionally, have you tried port forwarding without using vscode?
is there any dtls library for python 3.7
Hey everyone!
I’m Greedo, and I run DM Techs, a digital agency specializing in:
🌐 Website Development
📱 Mobile App Creation
📈 Digital Marketing & SEO
📍 Google My Business Services
If you’re looking to grow your online presence or need tech solutions, feel free to reach out. Always happy to connect and collaborate! 😊
?
import asyncio
from mee6_py_api import API
SERVER_ID = 1201216512212615198
USER_ID = 995049309902999714
mee6API = API(SERVER_ID)
async def fetch_leaderboard():
print(await mee6API.levels.get_user_level(USER_ID))
asyncio.run(fetch_leaderboard())```This is throwing me this error:```server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.```What credentials am I supposed to be supplying? And how?
Hello 👋🏽
Trying to code a RAT that allows me to control another computer on the same private wifi but the tcp is not connecting
I was following the winsock docs in C to make the tcp connection using my host server and the guest vm as the client but it didnt work. then I tried using another laptop on my same private wifi as the client but it still wouldnt connect to my server socket.
The code works and the sockets connect when I run the server and client on the same pc using localhost so the code is not the problem it seems to be network settings specifically the router maybe.
Im pretty sure I had the setup right, I was listening on the port, turned off firewall. entered in the wifi IP adress of the server into my client socket so it knows where to connect but nothing worked. is there anything else to try? or its probably just a setting on my router. i dont own the router so i cant change or view the settings.
Is there anything I can do to make my RAT? I just want to be able to control another computer or VM in my house for learning experience.
Hi Paul are you port forwarding?
if it’s not your code then I’m sure the issue is simply just port forwarding
I’m pretty sure it’s basically my router is probably the problem
I made a rat and did the same thing but I was successful I was able to control and turn on my other pc webcam
I can’t change it tho since it’s my mommy’s I can’t change the settings
and you were able to do it in python? I thought u had to make them in C to use the socket library. or u not on widnows
!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.
U can basically use any lang
Ya but don’t you need C to connect via winsockets api
u can connect with a python client
just py file_name.py in your terminal and hit enter
Hey Guys 👋
anyone here who have completed Computer Networking A Top Down Approach by Jim Kurose
Or any other networking book
<@&831776746206265384>
!cban @worthy saddle spam
:incoming_envelope: :ok_hand: applied ban to @worthy saddle permanently.
Portaligner is a Node.js package designed to linearize requests from multiple ports onto a single port. This is particularly useful for applications that are limited to accepting connections from only one open port, such as those hosted on platforms like Render.https://github.com/SanshruthR/PortAligner
Linearize requests from multiple ports onto a single port. Currently monitoring: https://dockerhost.onrender.com/5000 - SanshruthR/PortAligner
:incoming_envelope: :ok_hand: applied timeout to @tranquil prairie until <t:1734705723:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
import time
import socket
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as udp_socket:
udp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
udp_socket.bind(('0.0.0.0', 0))
while True:
udp_socket.sendto("test broadcast".encode(), ('255.255.255.255', 4446))
print("broadcast sent")
print(f"Socket bound to: {udp_socket.getsockname()}")
time.sleep(2)```
I have an issue where I can run this code on a different laptop on my network and have it show up in Wireshark on my laptop, but not vice versa.
On my laptop, I can run this only by replacing "255.255.255.255" with that other laptop's IP address and have it show up on Wireshark on both devices. Otherwise, it'll show up as sent on my device's Wireshark but not show up as received on the other device.
There's a chance that hosting Minecraft LAN worlds are also not working on this laptop but I haven't tested it yet, which may be a related issue.
Oh what the fuck all UDP messages are being sent from vEthernet instead of wifi on my laptop.
Of course I'll need to figure out how to get it to go through the correct adapter.
Resolved, had to go into device manager, disable the ethernet adapter, then restart.
Hi someane have a list for network projects in python?, I saw a lot of theory of networks but I want more aplication in programming.
The netmiko python module can be used with the connect handler to ssh into devices and execute commands.
Also you can use snmp to get information from devices depending on what you wanna do
O thank you I gonna watch netmiko, I want reinforce my concept about tcp model or osi model and analyze network across python.
For sure. I think David bombal has some network automation stuff as well, it def reinforce the basics that you've mentioned.
OHH I'm gonna watch
requests library is open source in github, fork, do changes, PR
yep, already have it open. looks like it will be hard to get attention from the maintainers to get it merged https://github.com/psf/requests/pull/6853
Hi everyone, I have a problem which I've been stuck on for a while.
I want to make a client-server TCP app, however I want to be able to constantly accept connections whilst also being able to message all clients at once through the server app. Which ever route I go down I always end up with multiple while loops. I have looked into threading and attempted to put the client, address = socket.accept into its own thread and broadcast operations on another however this still does not work. Any advice?
https://pastebin.com/PkHbLBCA here is my code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Okay gotta be totally honest but that change is just unnecessary and making a change for the sale of it 😅 you've saved 400 micro seconds at best. And has come at the cost of arguably making the code and formatting a bit harder to read
Also worth noting that imports are cached, you can do:
for _ in range(20):
import bar
And the global code will only be ran once under normal conditions
I have only read the code
I think the for loop on line 29 is the issue
The range function generally skips the last value you give it so range(0, 10) will return 0, 1, 2, …, 7, 8, 9 but NOT 10
What could be happening here is the last element of the list gets skipped because you added -1 to the len in the range
So if you had one client connected len - 1 would be 0 so the for loop wouldnt run
If you had two only the first client would receive the message
This is just an addon, you can directly iterate over lists in python without range, so you could do:
for client in client_sockets:
client.send(message.encode())
Client would be an instance of each client socket in the list
Sorry for the bad formatting, i am away from my desktop
This helped thank you: I also realised that my threads stopped when the main thread stopped too. So I just added another while loop to the main thread to keep it running. Probably not the best practice but oh well
Glad to have helped, ah, maybe you could run Server Console Control in the main thread then?
!rule 6
how to intercept packests in python?
you can just use wireshark(or pyshark module to be exact)
This is a statement that is only true if the module (your source code) it appears in is being run directly, as opposed to being imported into another module. When you run your module, the __name__ special variable is automatically set to the string '__main__'. Conversely, when you import that same module into a different one, and run that, __name__ is instead set to the filename of your module minus the .py extension.
Example
# foo.py
print('spam')
if __name__ == '__main__':
print('eggs')
If you run the above module foo.py directly, both 'spam'and 'eggs' will be printed. Now consider this next example:
# bar.py
import foo
If you run this module named bar.py, it will execute the code in foo.py. First it will print 'spam', and then the if statement will fail, because __name__ will now be the string 'foo'.
Why would I do this?
- Your module is a library, but also has a special case where it can be run directly
- Your module is a library and you want to safeguard it against people running it directly (like what
pipdoes) - Your module is the main program, but has unit tests and the testing framework works by importing your module, and you want to avoid having your main code run during the test
Hello
is anyone here good with p2p Networks and could help by explaining me how I should organise one so its not hard to bootstrap and maintain whilst keeping it intact and hard to overthrow
Good day everyone!!!
Please is anyone familiar with python Twisted Library??
Which server company can I use to host it lively
Hello, you can run it on any python server. And you can run python on pretty much any cloud computing provider. Eg Amazon GCP Azure etc. Is there a reason you're using twisted and not trio?
For easier connection and DatagramProtocol
But may be in the future because now I already code everything with twisted in my project
But can you give me a video or a guide lines to do so!!
No with twisted!!
?
It's the same as any other python app
Twisted is a bit tricky in that a failure can cause it to stop listening, but the event loop will keep ticking over
can anyone help ive been having this issue, whenever i try to send a command from a desktop to b desktop, it needs to be encrypted, but if its encrypted it can't be executed as a windows command
decrypt it?
can you show your code?
its fixed now, i just made it ignore the errors, it really scrappy tho and leaves some characters
:incoming_envelope: :ok_hand: applied timeout to @robust aspen until <t:1735896155:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
Do you guys have any clue on how to get 1080p feed at 30 fps from rtsp feeds? im using mediamts and later viewing it from mpv
:incoming_envelope: :ok_hand: applied timeout to @mighty steppe until <t:1736437349:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
Hey, do you guys have any good resources for neural networks? I have done things with CV2 before, but havent really touched NEAT or PPO. Any resourses that would for example, beat a game of snake, or play a game of minecraft, or something basic like 2048. Anything is good really.
This one's really good, I call it: building the shit from scratch
That's covered by #data-science-and-ml
I not asking for a finished product. Im asking for resourses to practice and learn. Whats the point of finding something if I dont know how to do it myself? I will take the blame of maybe not being clear, but maybe not being a dick about it is better?
Sorry didn't mean to be a dick, was just tryna joke. Tbh never used a library for neural nets, but if u wanna learn, I just struggled through a few vids about making one from scratch and now I understand many of the concepts. It is complicated math, but for the most part u can ignore it and let the computer handle that
typical
Bro, read the above
this
Implement tracerouting and test your implementation with YAHOO.com. To use
Select UDP as the transport layer protocol and choose any port. How many hops
are along the path and what are their IP addresses.
(b) Vary the transport layer protocol and port. Are your results different?
Why not)?
(c) TTL/Hop Limit is usually increased by one with each packet. What could be the point?
to choose the order arbitrarily? What disadvantage does this result in?
Bro

its to be done for scapy
from scapy.all import *
def udp_traceroute(target, max_hops=30, port=33434, timeout=2):
"""
Führt ein Traceroute zu einem Ziel durch, nutzt UDP als Transport-Layer-Protokoll.
:param target: Ziel-Domain oder Ziel-IP (z. B. yahoo.com)
:param max_hops: Maximale Anzahl an Hops
:param port: Zielport für UDP-Pakete
:param timeout: Timeout für Antworten in Sekunden
"""
print(f"Traceroute zu {target} mit UDP:")
destination_ip = socket.gethostbyname(target) # Ziel-Domain auflösen
hops = []
for ttl in range(1, max_hops + 1):
# UDP-Paket mit spezifischem TTL-Wert erstellen
packet = IP(dst=destination_ip, ttl=ttl) / UDP(dport=port)
# Senden und auf Antwort warten
response = sr1(packet, timeout=timeout, verbose=0)
if response is None:
print(f"{ttl}: * (keine Antwort)")
elif response.haslayer(ICMP) and response[ICMP].type == 3: # Ziel erreicht
print(f"{ttl}: {response[IP].src} (Ziel erreicht)")
hops.append(response[IP].src)
break
elif response.haslayer(IP): # Hop gefunden
print(f"{ttl}: {response[IP].src}")
hops.append(response[IP].src)
else:
print(f"{ttl}: * (unbekannte Antwort)")
print(f"Anzahl der Hops: {len(hops)}")
print("Traceroute abgeschlossen.")
# Traceroute zu yahoo.com durchführen
udp_traceroute("yahoo.com")
doesn't work
Does anyone here use netmiko?
hello guys i need to do a large upload on sheets and the upload data to sheets is not working that well do you have any tip on how to fix it is showing the 503 api error
APIError: APIError: [503]: The service is currently unavailable.
Are you still facing this issue?
Yes, i guess is something related to the amout of tuples sent to the databank
hey guys
hey, I’m looking for developers who’ve won competitive programming or hackathon events and also python engineers we have a great project
what is the name of ur project
this channel isn't for that kind of networking though it might help to share what the project actually is
Last week something happened to my wifi
It operates normal when using yt and Google but gives no internet in other platforms (even in discord)
How?
Did you check the admin settings (that you get on http://192.168.0.1/ or smthn) if you have blocked every route except those two or something similar?
Also, how do you know it's the wifi but not a specific device? Did you try on multiple devices?
Other devices it worked normally
On which device does it not work?
On my phone
Okay so, it is safe to conclude that your WiFi is not at fault, right?
From what I can see, it might be that you tried adding some proxy to your phone but didn't remove it.
Do you know what a proxy is?
Vpn related??
Yeah.
Oh yeah
I remember switching to Singapore VPN b4 this incident
So ig i didn't disconnect it properly
If the vpn is not active now, then that should not be the problem.
Apparently it stops working from morning till 3pm and then my wifi works normally on all platforms
iNtErEsTiNg.
My phone acts weird in many ways
Like even after stopping tha alarm the sound goes off but the vibration stays unless i unlock my phone
Those shouldn't be a problem. Where are you from BTW?
India
And go to your WiFi settings (on phone) and check proxy
@upbeat cosmos lmk if this is none or not.
And deactivate any VPN for now.
I can't find "proxy" there in my wifi settings
I'mma direct you in DM.
PS. There was no proxy and I couldn't figure out the issue. Someone else take over :p
have you tried restarting your phone?
if not, at least try it even if it sounds silly
and don't use "Power off", specifically use the "Restart" option if you are on android or a "forced restart" if you are on iphone
hi
is there a way to set DNS when using httpx or request?
i want to test if a dns can resolve the URL
i've tried dnspython, but as far as i can tell the package has no way of accessing the status code, which i need to check for 403
cant you pre fetch the IP based on your domain, and then request that API?
hopefuly it will let you access whatever you're trying to access
use dnspython to get the IP address (A for IPv4 or AAAA record for IPv6)
then use httpx or requests library to .get(ip_address) and set the Host header for that request to the (sub)domain you originally queried.
any idea why on my debian vps print(socket.getaddrinfo("abcde", 12345)) returns the IP adress of the server instead of "getaddrinfo failed"? when the host exists it gives the correct ip adress
Our corp DNS has an A record for localhost=127.0.0.1
Is there any way that could possibly be useful?
I'm practically sure it's just junk.
That avoids IPv6 surprises in a good way. For example, if your app listens on 127.0.0.1:80, but the browser resolves localhost:80 to [::1]:80, then things break up. But of course, some people might prefer [::1] in certain cases. You cannot please everyone all the times.
I think it’s to protect from leaking localhost queries to authoritative DNS servers
the same thing is described in RFC: https://datatracker.ietf.org/doc/html/rfc6761#section-6.3
This document describes what it means to say that a Domain Name (DNS name) is reserved for special use, when reserving such a name is appropriate, and the procedure for doing so. It establishes an IANA registry for such domain names, and seeds it with entries for some of the already established special domain names.
seems quite reasonable to me
oes noes my dns knows that im visiting localhost /j
oes noes
oes noes
anyone know how to specifically extract gps data from pcapng files with scapy? i see its saved as a data block randomly within the pcapng file but it doesnt seem like theres any structure to when they're inserted lmao
nevermind i created my own solution
💡 Recentemente, dei o primeiro passo na minha jornada na programação e comecei meus estudos em Python! 🐍
Depois de muito refletir sobre meu futuro, decidi entrar no mundo da tecnologia e escolhi Análise e Desenvolvimento de Sistemas como minha área de atuação. Minha faculdade na FIAP começa no dia 24, mas já estou me antecipando e estudando para...
Is there a way to create a ngrok http tunnel with the free static domain using pyngrok? Or will I have to resort to using the cli?
welp that got closed
but i found this
so i may just use net-snmp directly, i didn't know it had python bindings
native ones
linkrot docs tho...
it doesn't get mad when i give it bs protocol names, and this suggsts it only supports des?
not sure if this is the right place for this.... but any suggestions for what type of server to look for to build your own vpn (probably do some other small projects with it too), not sure sure what to look for and heard a lot of the web servers like amazon are super sussy 😄
you can run a wireguard vpn on a potato
woah
made a geo-traceroute
you can check every hop in the map (every router in the the map)
I want a job!
get one, this totally isn't the place tho
Im
anyone here familiar with scapy and pcapng files? i'm struggling to extract custom blocks and doing something wrong here
Uhm
yooo
yooooooooooooooo
@bleak badge hey bro
Yoo waddup
hey guys so I was given this task at work to login to ciena devices (200 devices), check if port 9 is up, if it's up, clear the alarm in the NMS
not sure how to go about making python login to the devices using ZOC terminal and click the right buttons in the GUI to login, just like I do manually
does anyone know or have a link to where I could learn more ?
Hi, I have a question. Is there a channel where you can look for assignments or something like that? Because I'm a python programmer with a porfolio, but I don't know if it can be done here.
i know it has been a few days, bat have you solved this yet or is it still even relevant?
what do you mean with assignments, like a job?
I haven’t started lol
so, still relevant then?
Oh yeah still relevant
I have to check 500 ciena switches if port 9 is down
So I have to write the script otherwise I’ll finish the task by next year…
It’s for work
retorical question: how did 200 devices become 500 devices? 😅
They added more this week
Not cool
200 or 500 or 1000 dosent matrrr
wait a few more days and there will be thousands if it has that kind of continuous growth 😉
but yeah, i see what you mean
so, does it really need to be through the ZOC terminal software or will any ssh client do?
@burnt lake question above 👆
Through ZOC bc there’s a proxy and other bunch of stuff in between
Tbh I probably try a ssh client first then see what I run into
and that proxy can't be traversed with another ssh client?
my thinking is to use the python ssh client library named paramiko
if you end up in a situation where you have to use the ZOC terminal client and want to automate it, you might want to try doing that with PyAutoGUI
yes
!rule 9 - this isn't the place for that
<@&831776746206265384>
!cban 948232517335523430 nsfw
:ok_hand: applied ban to @rough turtle permanently.
hey, I found this on my google drive, donnoh if it'll help anyone here out 🙂
I was wondering if it would be possible to implement a small proof of work check in the users browser on the first load, then remember them for an hour, essentially sending them a nonce or some random seed and asking them to send the hashed result as a means of ddos protection
Is this possible in flask using the actual headers?
can anyone guide me with computer networking subject
I only have the syllabus. If anyone can help, please DM me. That would be a big help.
using just headers, probably not. hashing data requires logic (js) to achieve exactly what you want. you could implement a form of authentication instead?
Ideally, id load the nonce/seed into a html/js template using jinja, and once the page loads it'll immediately send the hash
that would certainly be possible with js
create a script tag that uses fetch (or similiar) to send a request once the page loads
but how are you solving ddos protection with that? the user still requests the page, unless you mean for that to be an intermediary page?
this ha been done quite a few years ago (june 2019) already at fastly, maybe you want to look in to their solution: https://www.fastly.com/blog/defend-against-credential-stuffing-attacks-proof-of-work
but i can see an attacker using this to just send crap towards the server that doesn't need to check out
i'm half way there
i'm having issues with connecting to jumpserver with paramiko
what kind of jumpseever is it, is it also ssh based or something else?
I wanted to basically reinvent the wheel from this:
It'll be proxied by nginx, then proxy my application server
what don't you like about that one that prompts you to reimplement it?
I'm writing it as a proof of concept to help myself understand more
I just wrote a fake crypto to learn Go, now I want to write this to better learn Python
a DDoS protection system needs performance
no matter how much i like the language it's something python doesn't excel at
I think it would be ample to write in Python for now given it's a proof of concept, and I can always re-write it in Go layer
later*
for the client side of things you could take a look at the following: https://dev.to/ratmd/simple-proof-of-work-in-javascript-3kgm
and for the server side in python you probably want hashlib to check the PoW
what are you basing your server on, fastapi maybe?
I'm using Flask currently
Would it be possible to achieve the browser side checks without JS at all, or is that just impossible?
flask is definitely good enough to begin with
I'm not super familiar with Python, I usually use Go/Mux routers
i think that is impossible, you need the browser to do work and i don't think html and css has enough features to solve this
I thought so, just checking
the server side part that verifies the PoW should be trivial
but you might need more code to fight abuse where someone is attacking the PoW checker itself
So the reason I'm making this at all is to use it in situations where traditional ddos protection isn't sufficient, if they fail the checksum or don't complete it in x amount of time I'm going to block their connection for 5 minutes
And there will be a connection queue to prevent delays that are too large
And id rather the pow/queue server go down instead of the application server
yeah, some kind of rate limiting or temporary blocking per ip is probably needed for too many failed PoW from an ip for this to be effective
ah, yes, that will be a challenge then
With Go, I could always just create concurrent threads for each request
And queue all failures, lowering their priority until they hit 0 from 5 being high priority
And if their priority is 0, make them wait after everyone else trying to login
but how do you know it's the same client for different connections when you are hosing over i2p?
i can only see that work for multiple requests on the same connection
for DDoS or even DoS cookies will be pretty ineffective as a means of identification if you need to identify a client to block them
rather a lack of cookie or cookie that doesn't validate correctly (if in a session table or signed like a jwt) or being used by too many clients at the same time would be able to trigger the need for new PoW
but i still don't see it as something to base blocking on over an anonymized network like i2p
Yeah it's an issue
On Tor I could just temp block the node
But i2p maybe it's not possible
but temp blocking a whole node is quite brutal as there might be quite a lot of collateral damage if the site is popular
What would you do?
it's a challenge, i don't see a very viable option to temp block a client other then to drop their connection, but then they can just connect again
defending against DDoS on anonymized networks is a challenge and it doesn't have really have a good solution as far as i know
distributed sites on anonymous networks is another story but things that is akin to hidden services is problematic to defend
What do you think about having a priority system, as well as dropping them?
clearly much better then nothing
depending on what you use your site for things like just publishing the content to the network might be an option
then you are not really hosting it yourself, it gets cached in the network and spread around by people accessing the content
but then there is no python component to it anymore and OT for this channel
How does caching work on those networks?
I've only ever heard of a web server being run behind a Tor or i2p proxy
content is published using the private key in a asymmetric key pair and the content can be accessed through the public key as an address
only someone with the private key can publish to that address and sign the content so that every node that reads and cache it knows that the content hasn't been tampered with
it's a central feature on certain networks that make the content distributed, like hyphanet (fka freenet) https://en.wikipedia.org/wiki/Hyphanet#Distributed_storage_and_caching_of_data
i think there might be something similar for i2p https://en.wikipedia.org/wiki/I2P#Publishing
anyways, i think this conversation is going too far off-topic for this channel now to be continued here unless you have anymore questions centered around python
@ember ledge oh yeah, you can pretty easily get better performance for your flask site by converting it to quart without too much effort https://quart.palletsprojects.com/en/latest/how_to_guides/flask_migration.html
will not help with offloading the PoW checking calculation but it will probably increase the performance of other parts, like delivering the content to the client and such
I feel like if I did use Python for the final version, I would just write the PoW code in C and call it from python
And just use Python + Flask for the app itself
I'll have a look into Quart though
Most of the pages are html/css only, heaviest thing I'm rendering is just images
it's almost the same as flask but with async python instead, it's a really easy transition and can be well worth it
and if you need to do a lot of io you can pair it with httpx which is very close to requests but async and aiofile (real asyncio) or maybe anyio (using worker threads and thus not as performant) for async file io
yeah, ssh witha private key
and it uses socks5, idk if that matters
it does, paramiko doesn't have any native support for socks5 as far as i know
but it can easily be combined with for example the python_socks module (pip install python-socks) to create the socks5 socket
and then use it with paramiko as the socket (using the sock parameter) that paramiko uses to runs on-top of
How can i build a wsgi server from scratch?
Not much documentation on how to accomplish this
Hello guys! Do you know if I have a startup and access to investors? Where can I find a Python developer who has worked with neural networks?
Is there such a developer here?
it is very unlikely you will find AI devs in a channel about computer network protocols
!rule paid also this
ask you question instead
Neural network is under #data-science-and-ml
So you know anything about network security
yes, but this channel is about networking with python not general networking as this is a python server
Where can I learn such things
how from scratch are we talking?
you could do it with the threading and socket module. asyncio if you're feeling lazy, select if not
let me know if you need any help, I've done a similar project in the past
without using wsgiref and gunicorn
i have been working on it for a while but I am beyond confused as to what the dictionary needs to contain. also i just dont understand what i have to send and receive from the flask application.
i am using socket
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.
was using this as a reference as to what to include in the dictionary but i've seen other sources say something different:
https://wsgi.readthedocs.io/en/latest/definitions.html
just an honourable mention but have you checked out asgi yet? its the newer (better) alternative to wsgi
never heard of it. just trying to understand this part so that i can replace it with gunicorn or something
Ive tried researching but cant find anything, so i assume the answer is no, but: does the socket module automatically do error checking/prevention of packet loss?
it depends on what protocol you're using, tcp does, udp doesn't, the socket module supports multiple protocols
You mean built in, or you have to do it yourself?
Yeah built in!
TCP (transmission control protocol) provides “reliable, ordered, and error-checked delivery”. It does this by adding a small header to the top of each message you send that contains information like order as well as a bit of data for error checking. The receiver can check the order of each message and re request any that it’s missed making the protocol reliable and ordered
oo0o we where just talking about this
what packet types would I need to send to my printer ip to get it to print something like hello on paper
not sure on that one, you'd have to do a little research there
Ohh yes i dont have to do that myself epic
So can can just do
s.send(p)```
?
Without any extra stuff?
oh no you cna do it for me
(i will have a thing that recieves packets and puts them in a list on the other side)
yeah although having a packet list is sorta odd 🤔 you usually wouldn't care about individual packets
is packed_list a list of bytes?
Im sending files so im splitting the bytes objects from open(path, 'rb') into 1kb chunks
sounds like a good plan 👍 maybe consider renaming packet_list to file_chunk_list or something as it implies something else
np
when using tcp or udp sockets you don't send packets yourself (you would need a raw socket for that, but don't, because then you need to create all the packet headers of the different layers yourself)
you just send data that is handed to the OS network stack to send it over the network using the protocol that you specified
tcp is a stream protocol, you don't need to chunk it yourself to fit into each packet, you just send relative large chunks of data to the OS network stack and it will take care of chunking it to fit the network path packet size for you
Agreed. 👍
Though, How about instead of the sockets being integrated in the OS Network Stack, we get them through a different pathway??
where can i learn about implementing peer-to-peer encryption in Python? i wanna make a chatting system with p2p encryption
you can use raw sockets to bypass much of the OS network stack and build the packets yourself from scratch
encryption is tricky if you need real security from it, there is a lot of possible pitfalls that can make the encryption useless against all but the most basic adversaries
this is even more of a problem when it comes to asymmetric encryption, which you would most certainly need to be able to scale such a project and not require participants to exchange a shared key with each other outside of that system before they can securely communicate with each other
https://signal.org/docs signal docs i guess? although its mainly a protocol outline and kinda dense
Eivl told me about Diffie-Hellman key exchanges, which were simple to make using random and hashlib
the real question is do you want to make it secure :p
duh
so the main problem you'll probably have is ensuring the other person is who they say they are
generally a 2-way authenticated key exchange goes something like this
before the connection, both sides have an "identity" public & private key of a signature algorithm
when the connection starts:
person 1 creates a "signed" ephemeral key by generating a diffie-hellman key pair, and signing it with their identity signature private key and sends it to person 2
person 2 creates a signed ephemeral key by generating a diffie-hellman keypair and signs it with their identity private key and sends it to person 2
both sides verify the key pairs are valid (come from the correct person) by using the identity public key
both sides combine their diffie-hellman keys to get a secret``` and then you can use whatever fancy shit to sustain the session
the problem is you need some way to make sure the other person's identity key are valid, and it isnt another person masquerading as person 1/2
usually this is done by a centralized key server/certificate authority, aka someone both sides can trust
oh damn
i'll try figuring that out
key exchange is hard
the way signal does it is firstly naively trusting the centralized server, and if you dont want to trust the server, you can give the other person your public key by a qr code
the way whatsapp does this (dont fact-check me on this) is it uses key transparency to make a stronger assumption that the centralized server isnt lying to you
first mistake, don't use the random module for anything that needs security, it's not secure and it even warns about just that very prominently at the start of its documentation
yeah, this isn't easy stuff and there are lots to think about like timing attacks and other side channels that can leak sensitive information such as the keys or at least hint at what they can be or contain
then you have algorithms, you want something strong that is tried and true, but you probably want to combine it with something newer as well that is hopefully quantum resistant (also called post-quantum), this is how Signal does it nowadays since the newer algorithms hasn't proven themselves during enough time yet, and they derive different keys to use for the different algorithms (layers of encryption) just incase any of the layers could be broken and reveal the private key for it
this is all just used to be able to exchange a shared ephemeral key for the symmetric encryption used to encrypt the actual data that you want to send, as we have only been talking about asymmetric encryption (private and public key pairs) before
you might think that was a joke or a sarcastic question, maybe partially it is but in a jokingly manner, but i think it's also a very true and sincere question, because it's fine and even very encouraged if you want to tinker with this stuff to learn, especially long-term, just know not to use it for anything sensitive that you need to be properly secure without extensive prior knowledge and probably decades of experience in the field and peer review
the last point there is key, don't try to make it secure by keeping the implementation a secret, it's never a good recipe for true security, it must be able to withstand thural investigation/examination/review and the only thing that must remain a secret should be the keys
unless it can live up to that it shouldn't be deemed secure and used for anything remotely sensitive
timing attacks are literally black magic
should i use the secrets module then?
yes, much better
what percent of android phones globally run on android 10 and lower vs android 10 and higher
not just the us and eu
Trust it or not, there are version distribution tracker like https://gs.statcounter.com/android-version-market-share/ Old versions won't die out completely as the hardware can stay healthy much longer. But a software vendor shouldn't support too many legacy platforms so as to save themselves from the burdens.
hi
:incoming_envelope: :ok_hand: applied timeout to @carmine sapphire until <t:1741562806:f> (10 minutes) (reason: duplicates spam - sent 4 duplicate messages).
The <@&831776746206265384> have been alerted for review.
!rule 5 9
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
9. Do not offer or ask for paid work of any kind.
thanks lex lli
my grandma's got a phone which has android 8 and is OOW
she only uses it for calls/whatsapp, and I mean only those two
yeah
why doesnt aiohttp support http/2😭
quick question about the sockets library does .recv(port) waits for the next recieved package or prints the package that was sent that second if there was one
Assuming you're using TCP, recv gives you some amount of bytes. If there are bytes that were received and not yet read, you'll get them immediately.
It is important to keep in mind that recv doesn't work in terms of packets. You can get bytes from multiple packets, only part of a packet, etc.
@timid garden ^
!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.
im thinking about starting to make a resume and upload projects, what are all the avenues. Github Repositories, Resume, anything else?
i hope you have read the channel topic and understand this channel is about computer communications networking using python and not social networking or professional networks
for the other type of networking that it looks like you are looking for you might find better luck in #career-advice
Not sure this is the correct channel, but I wouldn't now which is, so I apologize beforehand if it's not.
The below code:
import subprocess
command = "coverage run -m unittest && coverage report --fail-under=80"
code = subprocess.run(command, shell=True, check=False, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT).returncode
print(code)
Is yielding 5.
According to POSIX standards, 0 is success, and 1 is errors. What the hell is 5? lol
https://stackoverflow.com/questions/61432870/program-exited-with-code-5-geany-with-gcc access denied?
maybe?
It was a unittest thing: https://docs.python.org/3/library/unittest.html#unittest.main
An exit code of 5 indicates that no tests were run or skipped
👌
launched a networking simulation to my portfolio, anyone thats ever played with Cisco packet tracer let me know if they think its neat!
A network simulation tool that allows users to create and simulate network topologies for layers 1-3 of the OSI model.
I want a charged card checking tool?
hey, guys. I dont know if this is a feasible idea, but I’ve been thinking about distributed computing and how services handle large-scale processing. I recently came across a scenario where a server handles tasks like decoding audio streams, adding metadata, and compressing files, which seems pretty CPU-intensive. I’m curious about the possible ways to offload this workload efficiently.
In particular, I’m wondering:
- How would you approach implementing a system where clients handle more of the processing to reduce server load?
- What are the challenges with ensuring stability and security when distributing tasks to untrusted client devices?
- Are there better ways to optimize real-time decoding and file generation across multiple machines?
I’d love to hear any insights or resources on tackling this kind of problem, like when an app doesn’t provide an open API. Are there any common approaches or concepts for interacting with services in that case?
From experience, all CPU intensive tasks need to be managed using some king of task queue such as celery https://github.com/celery/celery , so you have more control of the resources and how many jobs can run simultaneously to avoid having the server hanging.
-
For security, are there any performance consideration ? Sending data over https shouldbe enough in termsof security, you can maybe add some symmetric encryption on top between you and the client device to further enhance it in case the client's device is compromised.
-
If it's possible to split the data you can have a Kafka cluster deployed and run processing in parallel on the audio streams. Or if it doesn't need to be realtime something like Pyspark https://spark.apache.org/docs/latest/api/python/index.html where you process the data in parallel and aggregate results
Distributed Task Queue (development branch). Contribute to celery/celery development by creating an account on GitHub.
That has been documented in books like Architectural Patterns as "master-slave" pattern, and usually you need to maintain a bunch of hosts and assign different roles to them in that pattern, https://www.oreilly.com/library/view/architectural-patterns/9781787287495/cab8e24d-5814-49ac-8514-2f3a0f1d9076.xhtml and https://en.wikipedia.org/wiki/Master–slave_(technology). Libraries like Celery might give you some building blocks to implement that pattern, but without enough context you might get lost.
that's neat, can you also add blinking to the terminal?
and make it flexable? because it acts weird on smaller screen or if zoomed in
yeah I might toss the blinking in
i'll see what I can do
Heya! I'm curious to know how a service like Discord works. How does their server handle so many wss connections at once?
For sending a message, I understand that the client can establish a connection and then send the message and then close the connection and repeat this however often they want.
Yes the handshakes will be expensive but at least the server won't get so much load.
But I cannot think of something similar for reads.
I presume that Discord has like 100k+ users active at the same time.
Just how many wss connections can a single server handle and how?
ping me btw, thanks :)
if anyone here can solve network related issues: https://discordapp.com/channels/267624335836053506/1353402504439791687
Memory is cheap. Bandwidth isn't. Keeping many connections open is a lot less of a load issue than constantly reestablishing them
The answer is download more RAM
Also, loadbalancers (the actual work is split amongst many servers), and cloud scaling (more load -> deploy more servers)
Do they close idle connections or something?
Or do they allow 100k+ ppl to connect simultaneously?
This should give you some idea of their approach: https://blog.bytebytego.com/p/how-discord-serves-15-million-users
Measuring GenAI Code’s Impact: Free Workshop (Sponsored) How is GenAI impacting software development? Join LinearB and ThoughtWorks’ Global Lead for AI Software Delivery to explore the metrics showing AI’s impact, unpack best practices for leveraging AI in software development, and measure the ROI of your own GenAI initiative.
Looks you'll have to use a v2 supporting proxy for the time being? https://github.com/aio-libs/aiohttp/issues/5631
I've found another networking library
that supports http 1.1 / 2/ 3
async + sync
its not as good as aiohttp on performance for http 1.1 but it beats it with multiplexing on http2
It's a really cool project, Im surprised nobody knows about it
There's a lot out there in the HTTP space.
Even in the early days, you had a number of options for servers.
when you lookup for async http libraries you only hear about aiohttp or httpx
fasthttp?
is that for python
Looked like there was a binding for it.
doesnt seem async
I don't think so.
Hi guys, does anyone here know about the facial recognition library? I have a project to show to my teacher today, I tested this application before, but today it keeps giving an error, I don't know what to do. I'm using flask and psycogap2
That belongs to #data-science-and-ml
how can i fetch all solana transactions as csv
Is it not part of BigQuery public datasets?
It is since 2022: https://console.cloud.google.com/marketplace/product/bigquery-public-data/crypto-solana-mainnet-us?project=ardent-girder-403621&inv=1&invt=AbtWYA
Spend smart, procure faster and retire committed Google Cloud spend with Google Cloud Marketplace. Browse the catalog of over 2000 SaaS, VMs, development stacks, and Kubernetes apps optimized to run on Google Cloud.
Is there a library or a way for me to automatically records all my external api calls like when I use requests or httpx?
You can check vcrpy
!pip vcrpy
Thanks
Wait so I use this python library for twilio, is it possible that I can record interactions with it as well, or I'll have to mock it instead?
!pip twilio
Is someone working with netmiko or paramiko?
Well they do mention which http libraries are supported, i guess you can use it if twilio uses one of those under the hood
Does anyone know how to get Google Speech-to-text imported in Python?
Probably not the right channel.
👍
That being said there's a google codelab for it https://codelabs.developers.google.com/codelabs/cloud-speech-text-python3#0
In this tutorial, you will learn to use the Speech-to-Text API with Python.
Ah, Thank You. Appreciate the help.
Im using the example code from the http.server docs
import socketserver
PORT = 8877
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()```
but I can only access the server from within my LAN. whats going on?
When you say "", TCPServer listens on 0.0.0.0, which is all the network interfaces on the machine. If you're not routing traffic to that machine from your internet router, it will only be reachable inside your LAN because your machine presumably has only private IP addresses.
should i put my computer's ip there?
Does your computer have a public IP address? If not, that won't help. You'll need to forward a port in your router if the machine only has private addresses.
The code can only take you that far, https://docs.lextudio.com/blog/self-hosting-series-why-cannot-my-web-server-iis-be-reached-from-anywhere-else-8da0e0b252ef If you want external traffic (from another LAN or WAN) to go to your HTTP server, a gateway must be configured, either a home router or a corporate one.
Hey, im trying to see which requests a website is sending, but some of them aren't showing on networking dev tools, are there any ways to hide them?
networking dev tools as in the network console in your web browser? Just making sure.
Make sure the 'All' filter is checked and that you don't have anything in the search field narrowing it down
Also you may want to use 'disable cache' if any requests might just be getting served from that last response without a network request
Whether that's happening or not is kinda based on the circumstances
yeah that one
it's on all
the request cant be cached its when sending a message
OK yeah then that's not it.
im confused
There's a 'Restore default and reload' thing under the gear icon if this is Chrome, it might help
Also are you sure the request is really happening? You could use Wireshark to verify.
also there's an "only show requests with SameSite issues" thing that could hypothetically accidentally be on?
it must work it's the request to send a message in a chat box
and you're receiving the request on the server-side, I take it?
yeah but does N(...) make a network request, or just set one up? It's hard to know from that
im trying to check that
it appears to be using XHR
it sends XHR request but just for metrics
At this point I would break out Wireshark and just double-check the request is really happening
its getting sent
That's really strange, I don't know of any way off the top of my head to 'hide' from the Chrome network console from client code
ill try a mitm
can I DM you?
Sorry I have to run for a bit, but I'll think about this while I'm away
Oh hmm.. I guess a Service Worker can do this?
They can intercept network stuff before it gets to the inspector I think
Can you
A) try looking for Service Workers on the Application tab
B) try Firefox just for grins?
sure np
ill try to investigate on service workers
hmm no service worker running
im lost
I want to make a hd 2r game in pycharm is it possible
Good day Folks, I am new to programming and i would like to learn python for automating tasks in the security engineering. Can anyone please suggest me the good place to begin.
I have no prior knowledge in coding
Maybe ask in #cybersecurity
#game-development is the channel for that kind of questions.
Hey people
I need a help regarding Pysnmp. Actually I have downloaded Pysnmp but I can not use built-in functions.
Despite installing different versions I am still lost.
https://stackoverflow.com/questions/79560473/problem-in-implementing-smnp-pysnmp-in-my-code
I have posted a full detailed question on stack overflow if you wanna read it.
From your error image, nextCmd appears to be part of pysnmp.hlapi.asyncio not pysnmp.hlapi. You need to import more stuff, and I suggest not using * with imports in general while you're at it.
Hmm, though the docs do show it being used the way you have it. Strange; I don't see it in the list of contants being exported by the hlapi module: https://github.com/pysnmp/pysnmp/blob/4891556e7db831a5a9b27d4bad8ff102609b2a2c/docs/source/docs/pysnmp-hlapi-tutorial.rst#L45
docs/source/docs/pysnmp-hlapi-tutorial.rst line 45
['bulkCmd', 'getCmd', 'nextCmd', 'setCmd']```
Excuse me, sir. I am currently developing an API using Flask and MongoDB with the flask-mongoengine library, but I encountered an error: OSError: [WinError 10038] An operation was attempted on something that is not a socket. Do you happen to know how I can resolve this issue, sir?
Here is the error I received.
It happened when I was using Flask with MongoEngine only
How did we read sender address from udp socket while using loop.sock_recv in python 3.10 version?
loop.sock_recvfrom is added from 3.11 version.
Does AbstractEventloop had asynchronous datagram support in 3.10?
Sorry sir, in this project I'm using Python 3.12. The error only occurs when using MongoEngine with Flask.
I was also seeking for some help.
I have never used flask and mongoengine. From error I can say that this stuff should not happen as this is something internal to package itself. You may want to look your code again for wrong usage of some variable.
I guess the trick was to use a ThreadPoolExecutor to do the blocking part in a separate thread?
I guess if you have an async “receive stuff” function you can do something like:
with ThreadPoolExecutor() as executor:
data, addr = await loop.run_in_executor(
executor,
lambda: sock.recvfrom(max_size)
)
I have created a little test script to calculate the server time on client side. This code is computation part. Can someone who have worked on synchronising server time on client side or related knowledge can review my code: https://paste.pythondiscord.com/WPMQ
can't speak much on the logic but 1e6 is easier to read than 10**6 in my opinion (they are the same value)
hi idk if this is the right place for this
im upgrading a chat system somone else built and right now the server and the client work good as long as they are both started on my pc(dont even have a secound pc if it works using diffrent pc's on same network)
what i want is for me to start the server script and my friend to be able to start the client script and connect to the server script i started
ok so what should i do
re: Tailscale, it's a bit different than Ngrok, in that it's more about 'people' and identities than it is about servers: https://tailscale.com/kb/1017/install
In the end it creates a secure route for your requests, but before that the setup is a bit different due to its focus on identity
You can use this if you don't want your friend on the 'client' side to ALSO need Tailscale https://tailscale.com/kb/1223/funnel
Hmm, Funnel still uses HTTPS though, I guess that might require you to modify your client code
I'm trying to think of the least-work approach for you to get up and running
well i really dont mind modifying it
the thing is as its a personal project just me and maybe 1 or 2 friends will test it
idk if we will even use this so that one friend will have tailscale thats not that big a deal
although in the future i would like for more of my friends to want to join as i upgrade the code
Yeah, I guess just expecting both the client and server to 'have' Tailscale at the moment is the easiest way
but if you could help me now that would be great thank you so much i appriciate it a lot
yea i think so
I guess there's this too now, haven't used this feature yet personally https://tailscale.com/kb/1084/sharing
(not necessary if the client is inside your network already)
How far have you gotten on that 'install' page?
installation complete
OK, and you added your Windows machine as a 'device'?
hold on let me have a look just a moment
Once you've done that, it should show up in https://login.tailscale.com/admin
https://tailscale.com/kb/1312/serve this is the serve command you're going to want once you're set up
If your app is running on your laptop on port 12345, you'd type tailscale serve 12345
This also uses HTTPS, I'm not 100% sure which tools have an approach that doesn't use it.. it's super common to see it this way.
OK, try running tailscale serve 5050 in a command/terminal window
does my server for the chat system need to be open or no before i run the command?
what do you think?
Hmm. It needs to be open before it will work, but I'm not sure if serve will check first to see if it's running or not.
I'd launch the server first the first time, you can try the other order later
yea alr ill open it then run the command
ok hold on i need to go enable server
serve
ok done
Available within your tailnet:
https://laptop.taild16507.ts.net/
|-- proxy http://127.0.0.1:5050
Press Ctrl+C to exit.
now what
Now in another window/terminal, you can launch the "client" code, and have it connect to laptop.taild16507.ts.net on port 443
why port 443 tho?
Because of the 'https' that tailscale stuck on there.
What I suspect is that you'll need to add some of this https://docs.python.org/3/library/ssl.html to 'handshake' with the SSL before the client code works, since it won't be expecting a secure socket
what about the header?
Oh actually, here we go https://tailscale.com/kb/1242/tailscale-serve
what you want is tailscale serve --tcp 5050
Try that instead
Serve content and local servers on your tailnet
USAGE
tailscale serve <target>
tailscale serve status [--json]
tailscale serve reset
Tailscale Serve enables you to share a local server securely within your tailnet.
To share a local server on the internet, use tailscale funnel
<target> can be a file, directory, text, or most commonly the location to a service running on the
local machine. The location to the location service can be expressed as a port number (e.g., 3000),
a partial URL (e.g., localhost:3000), or a full URL including a path (e.g., http://localhost:3000/foo).
EXAMPLES
-
Expose an HTTP server running at 127.0.0.1:3000 in the foreground:
$ tailscale serve 3000 -
Expose an HTTP server running at 127.0.0.1:3000 in the background:
$ tailscale serve --bg 3000 -
Expose an HTTPS server with invalid or self-signed certificates at https://localhost:8443
$ tailscale serve https+insecure://localhost:8443
For more examples and use cases visit our docs site https://tailscale.com/kb/1247/funnel-serve-use-cases
SUBCOMMANDS
status View current serve configuration
reset Reset current serve config
FLAGS
--bg, --bg=false
Run the command as a background process (default false)
--http uint
Expose an HTTP server at the specified port
--https uint
Expose an HTTPS server at the specified port (default mode)
--set-path string
Appends the specified path to the base URL for accessing the underlying service
--tcp uint
Expose a TCP forwarder to forward raw TCP packets at the specified port
--tls-terminated-tcp uint
Expose a TCP forwarder to forward TLS-terminated TCP packets at the specified port
--yes, --yes=false
Update without interactive prompts (default false)
--tcp uint
Expose a TCP forwarder to forward raw TCP packets at the specified port
``` is what we want
5050 is your uint (unsigned integer)
ok well i thats what i got from that command
tailscale serve --tcp 5050(this command)
OK try tailscale serve 5050 --tcp, maybe it wants those options after the port number
But that's not what the help says so I'm confused
surely you don't need tailscale serve 5050 --tcp 5050 that seems weird
invalid argument format
for this one
tailscale serve 5050 --tcp 5050
Error: invalid number of arguments (3)
try tailscale serve --help for usage info
Baffling
Try tailscale serve --tcp 5050 localhost:5050?
We're doing just what the examples show, very strange https://tailscale.com/kb/1313/serve-examples
C:\Users\Proba>tailscale serve --tcp 5050 localhost:5050
Available within your tailnet:
https://laptop.taild16507.ts.net:5050
|-- tcp://laptop.taild16507.ts.net:5050 (TLS over TCP)
|-- tcp://100.78.230.13:5050
|-- tcp://[fd7a:115c:a1e0::7201:e60d]:5050
|--> tcp://localhost:5050
Press Ctrl+C to exit.
Cool. I would try 100.78.230.13:5050 first from the client.
So set 100.78.230.13 as the SERVER_IP and 5050 as the PORT
alr
The '100.' address is the one Tailscale assigned to your machine
C:\Users\Proba\Desktop\ctf>python client.py
Enter your username:
testing1
Traceback (most recent call last):
File "C:\Users\Proba\Desktop\ctf\client.py", line 88, in <module>
send(temp)
File "C:\Users\Proba\Desktop\ctf\client.py", line 25, in send
client.send(message)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
when i tried opening a client on my machine
Yeah, hmm. My guess is that that's the TLS/SSL, let me ponder the quickest way to check that
Hmm, do you happen to have the openssl command installed on your machine? You probably don't as it's Windows..
openssl s_client -starttls -showcerts -connect 10.78.230.13:5050 is the command I'd like you to run
but I'm trying to think of the built-in Windows equivalent
I guess if you can launch PowerShell and try this? Test-NetConnection -ComputerName 10.78.230.13 -Port 5050
That's not exactly the same thing but might tell us something
Alternately you could install openssl but up to you https://slproweb.com/products/Win32OpenSSL.html
ok im doing this
Test-NetConnection :: 10.78.230.13 Ping/ICMP Test Waiting for echo reply
PS C:\WINDOWS\system32> Test-NetConnection -ComputerName 10.78.230.13 -Port 5050 WARNING: TCP connect to (10.78.230.13 : 5050) failed WARNING: Ping to 10.78.230.13 failed with status: TimedOut
ComputerName : 10.78.230.13
RemoteAddress : 10.78.230.13
RemotePort : 5050
InterfaceAlias : Wi-Fi
SourceAddress : 192.168.0.56
PingSucceeded : False
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False
shouldnt it be 100.78.230.13 instead of 10?
ComputerName : 100.78.230.13
RemoteAddress : 100.78.230.13
RemotePort : 5050
InterfaceAlias : Tailscale
SourceAddress : 100.78.230.13
TcpTestSucceeded : True
OK, that looks good.. Now the question is whether it has TLS/SSL on it or not.
On Windows, the best approach I can come up with is to install a powershell plugin, if you're OK with that
Hmm, testing it now on a Windows machine and it doesn't work the way I want
I use MSYS2 on Windows so I have all these commands, it's taking me a minute to figure out what to do on a 'bare' Windows install
alr thank you so much i appricaite what you are doing
OK how about this..
would you like the code so you can test it?
$tcpClient = New-Object System.Net.Sockets.TcpClient
$tcpClient.Connect("100.78.230.13", 5050)
# Send STARTTLS command if needed (depends on protocol)
$stream = $tcpClient.GetStream()
$writer = New-Object System.IO.StreamWriter($stream)
$reader = New-Object System.IO.StreamReader($stream)
$writer.WriteLine("STARTTLS")
$writer.Flush()
$response = $reader.ReadLine()
# Create SSL stream
$sslStream = New-Object System.Net.Security.SslStream($stream, $false)
$sslStream.AuthenticateAsClient("100.78.230.13")
# Display certificate information
$cert = $sslStream.RemoteCertificate
$cert | Format-List
Save that as 'checkcert.ps1' or any filename of your choice ending in .ps1 (the powershell script file extension)
then you can run it with c:\example_path\checkcert.ps1. Depending on your setup you may need to enable running scripts in powershell first
will my friend who will also have a client need to run this as well
Nope, this is just so we can understand what's going on
If you get an error saying that script execution isn't enabled, you can run Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser to turn that off
Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope CurrentUser will set it back to the default later if you want.
i cant get it to work god damn it
I'm probably missing some nice Windows trick here.. This is super straightfoward on UNIX systems. Hmm.
you know how to run this on lets say ubuntu server?
can you write a step by step guide from start to finish?
Sure, is the code somewhere I can look at? That will let me tailor it better.
i might be able to get my hands on anouther laptop running ubuntu server
i can send it to you if youd like
We could also try using something simpler than Tailscale at first
Tailscale is a whole zero-trust network with a lot of features
Like, this could be a lot less work potentially? Hmm. https://pinggy.io/
well on the ubuntu server other than this program i also want to be able (for the same friend same situation) to be able to connect to my jellyfin
It even has a Windows UI https://pinggy.io/app/
if you know something to do this where the host machine is a ubuntu server i will get my hands on one and i will do it there
Even on Ubuntu we still need 'something' to help us route traffic in from the internet, e.g. ngrok, tailscale, pinggy.. but that should all work. Jellyfin is pretty easy.
well if you have something that you know works ill use it
ill send you the code if youd like and if you can write a step by step guide ill do it
Well, I know Windows works too, it's just a matter of configuring things to suit your custom code
but again ill probably get my hands on anouther machine soon and it will run ubuntu server sssooo
Pinggy LOOKS like it will let you create a tunnel that doesn't use TLS
That's the problem we're facing right now with Tailscale, is that your client is trying to connect in the clear, and bumping into a secure handshake it wasn't expecting
I wanted to prove that with that openssl command but oh well, let's just assume that's the situation
If you have Wireshark you can also use that to check but we don't need to get into that if you don't already have it
thats why if you have something diffrent that you know works ill use it
OK then yeah at least on Ubuntu we'd be able to easily connect to your tailscale port and see what it is saying
The powershell thing I pasted should have worked but I guess that's a whole ecosystem to get familiar with
yea i guess so
so if you know something that i can use and make a step by step guide for ubuntu server that would be great ill send you the server code and the client code on dm now
OK sure I will try to write it up
ok thank you very much
Hello, I tried deploying a website using a windows virtual machine at azure and the public ip address the website is working fine but after changing dns, the website is still not live, can someone please guide me 🙂
have you given it a few minutes, it can take up to hours for DNS rules to propagate
hello guys i need serious help, has some here ever made a zero trust architecture in network topology using mininet and ryu controller.
could someone help me to not get this eror anymore i tried copilot but he cant do it
Click here to see this code in our pastebin.
its on visual studio 2022 profesional wpf
You might try #editors-ides but this server is centric on general Python, not variants like Python.NET or IronPython.
You might have better luck in #user-interfaces since your question is really about XAML. You may just need a <?xml version="1.0" encoding="UTF-8"?> declaration at the top? Your stuff looks valid to me at first glance, and the docs say Window can be a root node.
hello
hello
Topic - HTTP 1.0 vs HTTP 1.1
Hi so i have been reading that what makes keep alive connection better that HTTP 1.1 provides , so i was reading this paper from https://ant.isi.edu/~johnh/PAPERS/Heidemann97a.html
and it says that initially HTTP 1.1 was slower than HTTP 1.0 because of some errors at the application layer that server was sending two segments one full MSS (maximum segment size) which contains the content and another which contains only the header (in the initial packets) now it says that client doesnot sends an acknowledgment right away if it gets a partial segment, and if that happens it adds a 200ms ack delay, which was initially cauing HTTP1.1 to be slower, but i dont understand why the same problem was not faced in HTTP 1.0?
John Heidemann
Hey.
My ISP gives me a new IP every time I reboot the router.
Is there a way I can get a new IP without rebooting the router?
Because rebooting takes 30 seconds, and I need a new IP every second. Is that possible?
(i dont want to use proxies from internet)
I didn't/don't know the answer to this, but it's been bugging me... so I've been looking for writeups that might cover it.
Super interesting paper by the way, thanks for the link
My understanding is now this, if this helps at all:
- Early HTTP servers used
stdio, merging multiple small user-level writes into fewer big syscalls, avoiding partial segments in the first place - HTTP 1.0 closes the connection at the end of each response.. clients don't delay ACKs on FINs, so this ACKs all pending data immediately
- With no persistent connections, partial segments and mid-stream weirdness doesn't get a chance to happen
So I guess once cooler/later servers stopped isolating headers in separate segments, this all went away?
The other interesting reference I found is this https://conferences.sigcomm.org/sigcomm/1997/papers/p102.pdf
!rule 9
my apologies - removing the message
Oh. Found about ipaddress module in python today. Good that I do not need to regexp match the IP address to validate it.
Because rebooting takes 30 seconds, and I need a new IP every second. Is that possible?
lol, no
your ISP will kick you to the curb if you fuck with their address provisioning
And there is literally no reason you'd need an address every second. Switching addresses faster doesn't help you avoid being counterhacked or traced or whatever, this isn't a shitty TV show.
Oh, same! I found it's be a good idea, but I'm checked a code and it's something like garbage, instead of using regex pattern it's using some for cycles, splitting string and etc methods
I writed the following code for dealing with socket, socket do not accept iterable objects, only a subclass of tuple and i need the ipaddress validation and version check logic. Now I'm thinking is ipaddress module is good solution?
import ipaddress
import socket
import enum
class AddressVersion(enum.IntEnum):
IPv4 = 4
IPv6 = 6
class Address(tuple):
def __new__(cls, hostname: str = "0.0.0.0", port: int = 0, version: int = AddressVersion.IPv4, flow_info: int = 0, scope_id: int = 0):
instance = super().__new__(cls, (hostname, port))
instance.hostname: str = hostname
instance.port: int = port
instance.version: int = version
if version == AddressVersion.IPv4:
instance.flow_info: int = flow_info
instance.scope_id: int = scope_id
return instance
def encode(self) -> bytearray:
data: bytearray = bytearray()
data.append(self.version)
if version == AddressVersion.IPv6:
...
return data
def __str__(self) -> str:
return f"{self.hostname}:{self.port}"
What if use curio instead of asyncio? I know curio is not supported yet
For ipv6 match I think you can implement a check for something like this: [fd00:1245:4567:8901::2]:443. (Ipv6 address in braces) and port number after it.
And make sure you receive that and not other format.
So the port is passed separately to the constructor, so I'm thinking whether to write my own check or use the ready-made ipaddress
Is passed after the address. Yes.
Ipaddress only for ip address validation
If I were to write my own logic, I would use a regex pattern, but I'm not at all sure that it's not too overloaded for my project.
Yeah. That was my idea.
ipaddress.ip_address (https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_address) in the standard library has a helper function that do the parsing, so you could go look at that implementation if you want ideas.
#cybersecurity is a better channel for that.
Oh my bad! 🙂
can someone help me learn sockets
It's a big topic, What have you got so far?
Do you have some code?
That question can go as lengthy as a book https://www.amazon.ca/Mastering-Python-Networking-frameworks-automation/dp/180323461X/ So, only if you ask more specific questions, you might receive some hints.
Hey!
I’m working on a network engine that aims to implement a reliable protocol over UDP.
In my design, each network message is represented by a class with typed fields and logic to serialize/deserialize itself into binary form.
Currently, I'm trying to design a clean, scalable architecture for:
- Registering message types (each one has a unique ID),
- Dispatching incoming binary data to the correct message class,
- And then calling the correct handler to process that message.
The challenge is: I want to avoid too much boilerplate or tightly coupling responsibilities. For example:
I don't want message classes to register themselves.
I want to follow SOLID principles (esp. SRP).
I’m not sure if I should rely on singledispatch, manual registration, or something else.
Has anyone tackled this kind of pattern before?
Would love to hear how you'd approach message-to-class mapping and message-to-handler logic in a clean way.
So Message class is a container for fields, can be serialized/deserialized to binary data, dispatcher is a class that looks at the message id (first byte, but the structure will be specified by the message class, dispatcher doesn't know about Message structure) and chooses the right message class to deserialize the binary data, Handler is a class that has some method, it knows how to handle some message types, but the class itself can't find out
class SomeHandler:
@HandlerManager.register
def handle(message: SomeType) -> None:
# Do some business logic
I also want to make the dispatcher and handler system consistent, but how? Maybe no need to register in HandlerManager.register, and HandlerManager will be a metaclass that will find the registry from Handler.handle, so Handler.handle will be the only method to send
The handle is taking a message object, HandlerManager must choose the correct message handler depending on type, and dispather must choose correct deserializer depending on message id, should their architecture be related at all?
i remade this in school today
i used pickling to serialize my Message Class (make sure to not have a socket member because you can’t serialize it
pickle.loads and pickle.dumps
It's not a mine protocol, called RakNet, the networking engine written in C++, and I'm writing my own implementation in Python, so pickling isn't a correct solution, RakNet like other protocols, it has its own message structure and that's right, pickle is needed to just quickly get a fast implementation without going deep into protocols, but now I'm not working on the serialization and deserialization system, the dispatcher and the handler manager are the ones that send message instances or raw data to the right place
If you using pickle that's ok, but in my case pickle has nothing to do with this, I probably asked the question in the wrong channel, because the question is about how to register message classes in the dispatcher? There is some class with an ID attribute and it is inherited from the base class Message, there are many ways to do this, besides, should the logic of the dispatcher roughly coincide with the logic of the handler manager, because they have similar tasks, this is also my question, for example, some of the ways can be Message__subclasses__() or Message.__init_subclass__() or metaclasses, or maybe even manual registration, this is more of an architectural question
And another question is can be dispatcher instanced or dispatcher doesn't need instances
Is there going to be exactly one handler for every message type?
You look through docs on their serialization?
No, you can create a handler class and he can handle many types of messages, code example:
from RakNet.Protocol.Messages.Message import Message
# from RakNet.Protocol.Datagram import Datagram
class MessageDispatcher(type):
messages: dict = {}
def __new__(mcs, name, bases, attrs) -> object:
cls = super().__new__(mcs, name, bases, attrs)
mcs.messages[cls.id] = cls
return cls
@classmethod
def dispatch(cls, data: bytearray) -> object:
message: object = Message(data)
message.decode_header()
if message := cls.messages.get(message.id):
return message.decode(data)
This is message dispatcher
from functools import singledispatch
class HandlerManager:
@singledispatch
@classmethod
def handle(cls, message: object) -> None:
...
This is HandlerManager
from functools import singledispatch
from abc import abstractmethod, ABC
from RakNet.Protocol.HandlerManager import HandlerManager
class Handler(ABC, metaclass=HandlerManager):
@staticmethod
@abstractmethod
@singledispatch
async def handle(message: object, system: object) -> None:
...
@classmethod
@property
def messages(cls) -> dict:
return cls.handle.registry
This is abstract handler class
And this is example handler:
from RakNet.Protocol.Handler import Handler
from RakNet.Protocol.HandlerManager import HandlerManager
from RakNet.Protocol.MessageIndentifiers import MessageIndentifiers
class OpenConnectionReplyHandler(Handler):
@staticmethod
@HandlerManager.handle.register
async def handle(message: OpenConnectionRequestReplyOne, system: object) -> None:
peer._connection_event.set()
if system.connection_state is not ConnectionState.PENDING:
return
system.connection_state = ConnectionState.CONNECTING
system.mtu_size: int = min(peer.mtu_size, message.mtu_size)
system.guid: object = message.guid
system.security: bool = message.security
@staticmethod
@HandlerManager.handle.register
async def _handle(message: OpenConnectionRequestReplyTwo, system: object) -> None:
peer._connection_event.set()
if system.connection_state is not ConnectionState.CONNECTING:
return
system.guid: object = message.guid
system.mtu_size: int = message.mtu_size
system.security: bool = message.security
system.connection_state: ConnectionState = ConnectionState.CONNECTED
The exact question can be MessageDispatcher and HandlerManager consistent? Can both use same method for registration, i forgot give a message base class:
from __future__ import annotations
from RakNet.Utils.BinaryStream import BinaryStream
class Message:
def encode_header(self, stream: BinaryStream | None = None) -> BinaryStream:
stream: BinaryStream = stream or BinaryStream()
stream.write_unsigned_byte(self.id)
return stream
def decode_header(self, stream: BinaryStream) -> Message:
self.id: int = stream.read_unsigned_byte()
return self
def encode_payload(self, stream: BinaryStream | None = None) -> BinaryStream:
...
def decode_payload(self, stream: BinaryStream) -> Message:
...
def encode(self, stream: BinaryStream | None = None) -> BinaryStream:
stream: BinaryStream = stream or BinaryStream()
self.encode_header(stream)
self.encode_payload(stream)
return stream
@classmethod
def decode(cls, stream: BinaryStream) -> Message:
message = cls()
message.decode_header(stream)
message.decode_payload(stream)
return message
It might be abstract, but abstract classes can't be instanced, my dispatcher using instances to decode header
Docs and reverse engineering now, but it doesn't matter, now I have a lot of architectural questions, including those related to the network, I have a lot of solutions and it is not clear which is better, each of them may have flaws or look strange, the architecture is very complex
where does the protocol state go in this architecture?
What you mean?
You have reliable UDP, there's something tracking at least ack numbers and such
that is an important piece of the architecture
Yes, it is, I'm working on reliability, but in RakNet there is a channel system where packets are divided into channels with unique identifiers, each of which has its own numbering, it is even more complicated there, because my library is asynchronous, not only is the architecture complex, but you also need to worry about asynchronicity, performance, code purity
If you can't answer my question, it requires more context about my project? Then I won't waste your time
Now it's two thousand lines of code
And i don't publish on GitHub yet
You have a lot of indirection that seems to amount to @functools.singledispatch, and that doesn't actually interact with the hard-to-architect part of implementing a protocol -- state management.
This is problem, complex architecture, complex questions, and there is not even a link to github or something like that
Oh, you mean connection state? This is an example packet fields handler, so I'm using singledispatch because it's like method overloading in python, depending on the type of message it will process it correctly, there are different messages, for example the disconnecting message
You can call it packet if you prefer
yeah, that makes sense
I don't know why, but I'm trying to link raw data processing and field processing, this may sound completely illogical
But if you're asking about architecture, I can tell you that registering a single function for every message type is not quite an ergonomic way to implement a protocol.
Hmm, i can't dump all packet processing into one function, each packet should be processed differently, this is also a problem
I'm thought current singledispatch solution is the best in my case
it seems you are delving too deeply into my project, the connection state is needed to identify that the handshake stage has already started or passed
But this has nothing to do with the current problem, I tried to explain the problem clearly, but it seems to be unclear and vague, so I am very disappointed, I don't even know how to express my thoughts
I mean, if all you need is have one function per message type, you can throw that into singledispatch and it'll be fine
It's just a fairly annoying way to write a complex protocol
Interesting, how you imagine a universal handler function? Match-case or something else?
This is the point of protocols, there is no point in creating multiple types of messages if they can be processed in the same way, each message must have some purpose and be processed differently
Ah no, I mean sort of the opposite.
a common strategy I've seen looks like
class Handler:
def on_connection_reply_one(self, msg: ...) -> Handler:
raise self.invalid_msg(msg)
def on_connection_reply_two(self, msg: ...) -> Handler:
raise self.invalid_msg(msg)
...
class Connecting(Handler):
def on_connection_reply_one(self) -> Handler:
...
return Connected()
class Connected(Handler):
def on_data(self, msg: ...):
self.send_ack(msg)
self.data_queue.push(msg.data)
return Connected()
def on_fin(self, msg: ...):
return Disconnected() # maybe make it Optional and return None, up to you
...
``` it is a bit more boilerplate to get started (tho I'm sure there are many ways to reduce it), but the key is that each state has its own handling for messages.
it's not universal, but usually you will almost always end up with more abstractions than just message A calls on_message_A.
Oh! I was already thinking in a similar direction, but decided that it was more C-like code and settled on singledispatch
What about dispatcher, what are you thinking about metaclass registration?
I would probably just not bother tbh.
Hey @slow fern, your question is more suited for #python-discussion . This channel is for discussing computing networking.
Anyway, check out our curated list of resources on our website: https://www.pythondiscord.com/resources/?topics=if-you-havent-already-seen-our-resources-page
I reckon claude or some NN can just analyze and determine what is likely to yield better results
I'm using GPT, but it still doesn't help, mostly I have dialogues and spend several hours with him
And still no result
claude!!!!
You thinking claude is better than GPT-4o or DeepSeek?
For strictly coding yeah it has a good advantage
It more depends on prompt i think
fwiw i think it's gonna be hard to beat dict lookup performance-wise, e.g. going straight from the datagram to sth like dict[int, Handler]
singledispatch has some overhead
just uh.. guessing that performance is important for a UDP library
coming from somebody who just replaced almost all the fancy syntax sugar with dict boilerplate this week
your use case is different from what i'm working on (MQTT client) but i would still start with using builtins, dict is optimized to death
since MQTT is a complete protocol, i can do something like this to map the 4-bit identifier to a class which has a decode classmethod, you would have to build out this dict with registration; i don't know of a more efficient way to do this with pure Python
_ControlPacketClasses: Final[Mapping[int, type[MQTTPacket]]] = {
MQTTPacketType["CONNECT"]: MQTTConnectPacket,
MQTTPacketType["CONNACK"]: MQTTConnAckPacket,
MQTTPacketType["PUBLISH"]: MQTTPublishPacket,
MQTTPacketType["PUBACK"]: MQTTPubAckPacket,
MQTTPacketType["PUBREC"]: MQTTPubRecPacket,
MQTTPacketType["PUBREL"]: MQTTPubRelPacket,
MQTTPacketType["PUBCOMP"]: MQTTPubCompPacket,
MQTTPacketType["SUBSCRIBE"]: MQTTSubscribePacket,
MQTTPacketType["SUBACK"]: MQTTSubAckPacket,
MQTTPacketType["UNSUBSCRIBE"]: MQTTUnsubscribePacket,
MQTTPacketType["UNSUBACK"]: MQTTUnsubAckPacket,
MQTTPacketType["PINGREQ"]: MQTTPingReqPacket,
MQTTPacketType["PINGRESP"]: MQTTPingRespPacket,
MQTTPacketType["DISCONNECT"]: MQTTDisconnectPacket,
MQTTPacketType["AUTH"]: MQTTAuthPacket,
}
as for message-to-handler, since this is a pubsub protocol, at the top level you are adding any number of callbacks keyed by topic filters; in your case you could register handlers keyed by classes instead
maybe i'm missing something though, at a glance RakNet also seems like a complete protocol, are you trying to implement another protocol on top of it or something?
@summer aspen
Implementing in Python, existing implementations are trash
The raw dict is fastest, but in class and object accessing overhead i think dict = singledispatch, the difference is minimal maybe
This is not a usual way to register handlers, in this case I most specify the register function, it's more readable
the usual way?
to answer the original question, i have tacked this kind of pattern before, and my approach was to map ints to classes to find the decoders and then bubble the messages up through callbacks, where each layer represents a different part of the lifecycle (in case of MQTT there are connection and session layers, then a top-level client layer which only sees auth and pubsub)
i'm not very familiar with RakNet but it looks like you could do something very similar, have layer(s) to deal with connection state and pings and such, then the actual data bubbles up to the public interface
Hello, can i use my router as proxy without using any clients connected to my router (without port forwarding)?
You're asking if you can run some sort of proxy server directly on your router? You should research your specific router/firmware but I've never heard of a consumer router with that capability.
Sounds like an XY problem... What is the actual problem you want to solve?
what website are you requesting? also share the code and we can help you debug
#rules Rule 9
Do not offer or ask for paid work of any kind.
You should use a freelancer site instead.
hello, anyone used a free web service from Render before? i made a face recognition web api with python, the web runs but the api itself didn't work? (it have simple web frontend and a face rec ai/ml using deepface)
so in the Render dashboard log, it said it runs the python app every some minutes after succesfully running on a http address. basically it stops the server and running again every now and then, i feel like its a memory issue (bc its free maybe? haha) but im not sure
I think it is related to free tier current limitation on the service, if your app not used for few minutes it will spin down. If you need your service to be running continuously without spinning down, then time upgrading to a paid tier.
Yooo, I got a question. I'm trying to make an API that receives a video + some attributes, then post-processes the output and returns it back to the client. Can someone give me a tip on what I should look for to make this possible? I'm struggling a lot with this one T-T
Maybe start with a python client to interact with your API to do it? Might be quicker to sort out the problem there, just a script to upload your video and wait for the result. Then maybe when it takes too long and times out or something you can switch up your design a little bit, generate an ID and save it somewhere so that the client can check on the status of the processing of their video or something and point to where they can download it at. That's how I would start this simply and evolve it from there.
From a variety of places you can study the REST API design to cover such long running tasks. Microsoft has https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design#implement-asynchronous-methods and you can get started from "Implement asynchronous methods".
Hello, I am exploring possibility of creating a web app to control a LAB environment, resource divide, scheduling, version control of the configuration and rollback to baseline configuration through NETCONF, TFTP or other means. Does anyone here have any experience with it?
Thank you @errant temple @lyric oak
I think if you get started from a well established DevOps solution, and develop extensions to perform your lab specific tasks, then the entire management can be abstracted by a few typical workflows/executions, just like CI/CD for web apps. Scheduling and version control are already part of those DevOps solutions, so you just need to focus on the rest.
do you have any suggestions for the well established devops solution?
prolly means things like ansible
i have written a flask app that has GIT integration, configuration for devices is on there, uses netbox for inventory management and imports devices through API from there
then it's passed to ansible to reset the devices using configure replace tftp://<path> command
not all of my devices use NETCONF, so SSH and paramiko
was wondering if there is more elegant solution out there
in big short, git stores the local repo cloned from remote bitbucket to /srv/tftp location and netbox has all my stuff then passes it to playbook and triggers ssh connection to device telling it which file to get through TFTP and to trigger rollback to baseline
is there an easier way in mixed environment with different platforms like cisco, juniper, westermo?
Do all your devices have any single config mechanism in common, or are you for sure stuck with multiple “back ends”?
Sooo, Cisco IOS and IOS_XE can use same command configure revert <source/TFTP> force, but IOS XR uses configuration versioning and has commit system, different commands. JUNOS has something similiar to IOS XR but different commands yet again. Westermo is soooo niche and has no programistical capabilities, it doesn't even do spanning tree well .....
I think I could go down to 3? IOS XE, IOS XR and JUNOS can use NETCONF, i can ditch SSH through playbooks for those but that still leaves me with Cisco IOS and Westermo OS, sooo 3 backends.
Gotcha. Yeah, that’s inherently a little tricky to make “clean”; all I can really advise is to plan your “configuration back-end” abstraction carefully.
Yeah I figured, was kind of hoping for easy way out or an ideal, off the shelf solution falling into my lap
I’ve run into some products that kinda do this but only commercial ones. Not aware of an open solution.
I vibe coded a solution that works but it's .. janky
I'm a beginner in python and i write mac_changer using Python Can someone review my tool
my github -> https://github.com/ma1loc/mac_addr_changer.git
and if anyone has any idea, please feel free?
A MAC address changer script allows you to modify your network interface's MAC address (the physical address assigned to your network adapter). - GitHub - ma1loc/mac_addr_changer: A MAC ad...
Hi I have a question - I'm not super into the network end of python but I'm starting to get into requests so I can try to scrape webdata and compile statistics based on the site's provided info - it's a niche game site so there's no public DB I could pull from other than what the site provides. I'm running into an issue where the site is only providing up to the 10th entry in a unit grid of ~30 total (I'll have to do this for multiple pages) - It appears the site is dynamically pulling the rest of the data when you're on the site in a browser but doesn't provide the entirety of that data when doing a simple request. I'm not sure how I'd be able to prompt the JS that's doing the data retrieval to grab the rest of what I need. anyone have any insight? Fairly simple code as of now as I'm just trying to pull the data before storing or doing anything with it to make sure I can even get what I need:
import requests
from bs4 import BeautifulSoup as BS
url = "https://www.beyondallreason.info/units/armada-bots"
response = requests.get(url)
data = BS(response.text, 'html.parser')
print(data)
I'd look at the network tab of your browser's devtools when that request is made, perhaps it can be trivially replicated
a BAR enjoyer
After looking around for a while I tried coming up with a POST request mimicking one of the POSTs in the networking tab but I'm running into a 404 here on this and the other POST attempt with a different API the site seems to be calling
import requests
from bs4 import BeautifulSoup as BS
umami_api_post = {
"url":"https://api-gateway.umami.dev/api/send",
"headers":{
"Accept":"*/*",
"Accept-Language": "en-US,en;q=0.5",
"Cache-Control": "no-cache",
"Content-Type": "application/json",
"Origin":"https://www.beyondallreason.info",
"Pragma":"no-cache",
"Priority":"u=4",
"Referer": "https://www.beyondallreason.info/",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode":"cors",
"Sec-Fetch-Site":"cross-site",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0"
},
"request": {
"payload": {
"hostname": "www.beyondallreason.info",
"language": "en-US",
"referrer": "",
"screen": "1920x1080",
"title": "Armada Bots ★ Beyond All Reason RTS",
"url": "https://www.beyondallreason.info/units/armada-bots",
"website": "895a9739-a0e0-4fdd-94de-d2eb780fa2a0"
},
"type": "event"
}
}
response = requests.post(
url=umami_api_post["url"],
headers=umami_api_post["headers"],
json=umami_api_post["request"]
)
print(response)
I'm fairly certain this should work but I'm not sure if I need to make a session or if I need to do some different calls before doing a post?
how do you port forward??? I found my public ip and tried connecting but it doesnt work
when I use http://182.134.1.79:9572 it works
but not when i use http://my.public.ip:9572
.
Depends on your router, but “IP address” there probably needs to be your server’s LAN address, not the external address.
It always has to be
It has to know where to go on the internal side of the NAT
That is a public IP
Do you have multiple public IPs?
By probably I meant “definitely”, yeah
With databases can I use networking to update the database itself so if it's logged on to a different computer it's still connects that data
externally exposed ones like mysql/postgres/etc
If that' a question (you didn't use question mark), you should get started from the manual of the specific database you are working with. Most modern data products have remote management features built-in, or at least you can remote log in to the hosting OS.
I'm using mysql so I don't know if it has an automatic hosting and I'm new to stuff like this and I'd never done networking
You can connect and log in remotely (over the network) to a mysql database, yes. But you have to have that database exposed.
That's more about #databases than networks/networking.
Nice I used the OS system to encrypt the file and then have the program itself decrypt the file
Hi, i want to make a game online, where a player is host, and another is client, without using a server. is it possible ? how do i do it ?
The old approach has hosts do port forwarding. There are also various tunnelling technologies you can use to get a proper P2P connection, but they do kind of suck.
Steam (and probably others) also have servers you can use rather than hosting your own. This is how most modern small-lobby games work AFAIK.
My game is just a small python connect-4 school project. The socket is working, but how can i simply make it work on world without server ?
The simplest would probably be something like pinngy, but this isn't really a simple problem to solve.
What is pinggy ?
Is making a server making differents 2p games at the same time hard ? And how would i host it ?
pinggy is a tool for exposing your private services/webapps to the internet.. along the lines of ngrok and others in the same realm.
pinggy is pretty cool because it doesn't really care what protocol you use. a lot of the options only really want HTTPS
If your game is just for a small network, protocols like zeroconf can enable devices to discover each other, https://en.wikipedia.org/wiki/Zero-configuration_networking There are implementations in every major programming languages, and widely used in such scenarios. But if your game goes through the internet, then a server is what you need to make the rest simple.
I just updated to Ubuntu 25.04 last night and thus systemd networkd 257.4 and my IPv6 forwarding has broke - Anyone else hit this issue?
I saw and commented in https://github.com/systemd/systemd/issues/33414 - I've followed all the workaround here, but have not got my IPv6 forwarding back ... Any ideas?
tl;dr IPForward=yes seems deprecated, and you need to move to IPv[46]Forwarding=yes and set a default for each of those in networkd.conf / /etc/systemd/networkd.conf.d/forwarding.conf (I did the latter) ... All to no avail ...
ofc not, you have to open your router to the internet which is not recommended. use a hosting api instead
Look up instructions for your specific router if you actually want to port forward, but, you probably don't actually want to do that
ill probably do that then
ive heard cloudflare is good?
they're fine but if you host youll need to configure the DNS on your own (for a website at least)
Cloudflare is amazing but it depends what you want to host. Static HTML/CSS/JS is served free from Cloudflares cdn for free forever, they also offer a free tier of workers for a little bit more interactivity (this can include databases, buckets, and much more). If you have a python flask server or similar you'll need to probably rent a VPS somewhere, Hetzner is pretty cheap and does the job.
As for port forwarding, there's a guide I wrote that in this channels pins, I can walk you through it as well if that doesn't work
if you're wanting to host something yourself you'll need a static ip (or ddns)
Topic - NAT (Network Address Translation)
So I get how NAT works - my router has one public IP and all my devices share it when connecting to stuff online. The router keeps track of which device sent what request and routes responses back correctly. But the same is not possible if someone tries to send data to my private PC without me asking for it.
But here's my question: Why can't we just tag our private IPs onto our public IP somehow? Like if my public IP is 203.0.113.5 and my PC's private IP is 192.168.1.10, why can't we use something like 203.0.113.5:192.168.1.10 to let people directly connect to my PC? Maybe that way we wont need TURN and STUN servers? I am sure there must be a very good reason for this but still curious
Is it just because routers aren't built to handle this kind of addressing, or is there some deeper technical reason this wouldn't work?
Someone can correct me if this is wrong, but I think because the infrastructure the entire world is built on to understand only deals in a specific routing protocol which does not support that. In IPv4 you have 32 bits of information and none of them leave room to specify the internal IP address to connect to, and that's what we have available for routing, then on top of that specific protocol we have another one that is meant to be for a given application which the router (TCP or UDP) and those deal with none of that information. So with everything we have now there's nothing that can be used to route to specific addresses besides tracking which connections were initiated from where in the network. I think it's because .A) The protocol/infrastructure just doesn't exist and probably. .B) This subnet situation primarily exists to address the shortage of IPv4 addresses, with IPv6 there's more space for a lot more and everyone could. have a public one so it just isn't necessarily. But hypothetically there could probably be IPv[arbitrary-number] that has both the source ip, destination address, then actual destination address and it could work if routers were designed to use this arbitrary layer 4 protocol.
soo if you are correct its basically a lot of work to make it a standard to patch private IP with public IP, so people have created work arounds to work in the same system without causing a total new protocol launch
Yea, that sounds like the current situation, and on top of that the connectivity/IP shortage problem and situation with subnets is addressed by IPv6 which is currently supported by a lot of routers and devices a lot more so than this would ever be I imagine.
Also I'm relatively fluent in some of this but it's not my specialty, so some of what I said is a bit wrong looking up the specifics, but the crux of it still stands. IPv4 is a layer 3 protocol (network), TCP/UDP are transport protocols* layer 4.
by shortage you mean that if we started to patch private IP with public IP it will further reduce the combinations in 32 bit? something like that?
I mean since the reason we have subnets right now is because there aren't enough IP addresses to be assigned to every device, the solution wouldn't be to introduce entirely new variants of IP or transport protocol that every device would have to be modified to even use, the solution would just be to use version 6 of IP which has enough data sent per header to contain addresses of a larger size to be assigned, hence if you want people connected directly to your device, the solution is to not use a subnet, and to use IPv6 and have other people use IPv6, since there's 16 bytes of addresses and something like340282366920938463463374607431768211455 rather than only 4294967295.
so you mean i patch my private IP in it?
that sounds cool
I'll have to read about it now haha
Wdym
i mean if i use IPV6 i can patch my private IP In it?
No. In IPv6 you still only have a source address and destination address in the packet, and if you have a subnet the addresses on it won't be accessible to the public still. But you would be able to have a public IPv6 address for every device if you wanted from your ISP because there's more addresses available.
ok thats what you meant alright, so basically no need for subnets
Exactly
makes sense
Although I haven't used IPv6 on my devices personally so I don't recall if they're still natted or not generally, but basically IPv6 already can solve this connectivity problem, and many devices can still use it.
thanks this cleared some doubts, although am talking to another person talking about how it also causes privacy concerns
if it would have been possible
ive always wondered if LANS were a blessing in disguise, imagine every device being internet facing
how do i host online for free a python socket server ?
hi developer
i couldnt connect to my database which is hosted on azure It couldnt connect with an error for timout even I have public ip access in azure
Hello, Anyone wants to collaborate in developing networking tools or scripts for our portfolio?
aws offers a free tier for a year but otherwise your options for hosting python for free is quite limited (look out for free tiers that hosting services offer). you can host one for pretty cheap though ~$3 a month
Topic - need of ICE candidates when peers connected through SFUs in web rtc
Hey so i have been reading that how SFU solves the problem of peers sendind there feed to N-1 people, and share the ICE candidates with only the server instead of each other
But the question is in multiplayer gamees if the server processes the data and sends it to all players because its on a public IP so there is no NAT problem then why the same cant be happened when we are using SFU (a server to handle more than 2 peers) why we need manage ICE candidaates in that
i mean i dont get it , all peers talk to SFU and SFU returns data to them, you see? all are connected to SFU not to each other, they dont need to know about each other they know a public IP and can make a simple UDP connection with it , whats the deal here?
Why do i need to share my ICE candidates with the server? when it can talk to me without it as it does in games?
unfortunately there's no in between websockets and webrtc for unreliable transport, though theoretically you could fake a TURN server on the server side and use that instead of STUN, i looked into this a while back but never really answered the question..
and my understanding is most home users will need some way of getting UDP through NAT, if not ICE then some other homebrewed means which probably do the same thing
because there's no such thing as a UDP connection, just routing states which allow UDP to reach a destination
I mean we are doing the same thing when we are playing a game right? Or chatting through a sockey stream?
here is some reading material https://bford.info/pub/net/p2pnat/
and the short answer is you still have to send ICE candidates because you don't know if the server is behind the same NAT as you
actually, i guess not
send an empty list of ICE candidates and see what happens 
But the server Is on a public ip no? Where did the NAT came from?
the server sending datagrams back to the client may encounter a NAT, convention is a router will allow traffic back to the client on the same port it sent traffic from
this is not a connection, just a routing state which lasts until the NAT router(s) decide the state has ended
the combination of IP and UDP header gives you an implicit ICE candidate with every datagram, so you technically can't use UDP without implicitly sending at least one ICE candidate
and in the case of a relay server, this implicit ICE candidate should be enough to send messages back through a NAT
whether or not an SFU uses this implicit return address is probably an implementation detail
but it probably should, because the address in the headers is what the NAT is expecting to see
anyone know the root of my problem for not being able to ssh?
(MacOs - > Windows 11 using OpenSSH)
the request always times out
ping and traceroute work
And you're sure the Windows (server) side is allowing port 22 traffic through its firewall settings, and that OpenSSH is running there?
Can you ssh localhost on the Windows box? I guess that's the first test.
This feels so weird but makes all sense tbh
Man I love Dave: https://www.youtube.com/watch?v=REmuftIuTl0
Dave explains modems, ISDN, T1, T3, DS3, DSL, Cable, Fiber and more in this episode covering the scary story of the installation of new 5 gigabit home fiber service. For my book about life on the autism spectrum, check out: https://amzn.to/49y4ULG
Follow me on Facebook at fb.com/davepl where I post all the progress and projects not fit for ful...
(I too briefly started with 300 baud, oof)
Hey guys a question, I am doing a project, and wanted to know, does anybody here know how to scrape post ids, of a myBB forum?
topic - connection to webrtc SFU and signaling websocket
Hi so am trying to write a webrtc sfu server and for getting the SDP offer i need to use a websocket but am not sure how should i relay data from my tcp based websocket to my udp based sfu server?
usually I believe your signalling and sfu server are tightly interlinked, for example a websocket server and say, mediasoup can be controlled from the same codebase making it easier
Yeahh I did thought that but was just exploring the options. It just doesn't feels right transporting data that way just because of same codebase
here's a snippet from one of my setups:
socket.on(
'transportConnect',
async (
{ transportId, dtlsParameters }: { transportId: string; dtlsParameters: DtlsParameters },
ack
) => {
const transport = transportIdToTransport.get(transportId);
if (!transport) return ack({ error: 'Not Found' });
await transport.connect({ dtlsParameters });
ack();
}
);
I have very tight socket io/medialink coupling
NAT from the isp side
How else you could get access to the public network legally
Nowadays isp uses NAT as ipv4 itself isnt enough
Trying to find a way if we can reduce the need of TURN servers, lets see if i can find something
In my project, I wanted to detect outgoing requests from my device to a certain api's endpoint. I was wondering how I would go about doing that?
I realized that the "s" in "https" was made specifically to stop me. I gave up on that idea
well... the "s" technically can still let you do that
but it requires doing a MITM style decryption like you would have on some corporate system
You can look at SNI
Hello
I am having doubt regarding project i dont no where to start
can anyone help me please
What is it
Hey guys, I got a doubt...
I am trying to work with openssl python3.11.2v and I am trying to understand the codes since I am a newbie...
From what I see and what I want to know the encryption decryption happening is,
I use ssock.sendall(pt) and this input function returns to SSLSocket that uses def SEND to return self._sslobj.write(data)
...now from this, I don't understand much how things are carried forward for encryption decryption from SSLSocket sslobj.write stuff
What kind of new? 1) New to Python? 2) New to networking/SSL/TLS protocol? 3) New to openssl?
Well yea all of the above can say 😅
I do know python a bit but other Idk
Then you cannot skip any of steps to study Python, the protocol, and finally the library. I don't think that kind of a complex topic can be turned into just a few words.
!warn 1082970841010151525 Please see rule 9, you cannot post job adverts in this community.
:x: The user doesn't appear to be on the server.
Hello
!rule ads
!rule list
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
!rule
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
!rule
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
Hi! I'm having trouble... I was using Glitch til' now, but I need to change the web 'cause some new policies. So, I was wondering...
Do you know a web where I can...
- Have my own backward server
- Is free (or cheap)
- Has a permanent link
- Turns on auto when somebody enters (or it's on 24/7)
?
Thank you
is it possible to make a webrtc connection between a client behind symmetric NAT and an SFU? without TURN servers , using only STUN
you're looking for a virtual private server (VPS), you can find free ones like AWS but they only offer free for a year or you can get really cheap ones with hetnzer etc
hi, can someone help me creating a function that just grabs the ip of specific interface?
my script connects to a vpn, and there is a delay to get the ip, i need to wait for that and then get the ip, usually its tun0 interface
im using netifaces, but im having some errors with it , if anyone knows a simple way of doing that, i appreciate
Uuuuuh
Thank you, I'm going for github pages with a private server for the backend, but in the future I'll probably use Azure or AWS, really: Thanks.
What kind of errors?
The lib hasn't been updated in 4y and has C extension code, so this may be why it broke after a few years...
Psutil is actively maintained (so shouldn't have errors or you can easily report them) and has this https://psutil.readthedocs.io/en/latest/#psutil.net_if_addrs sounds like this would work
File descriptor in network programming working flow example ?
And now in English please...
What file descriptor? What flow? I can show you select waiting on network connections and stdin (<-file descriptor) - does it count?
my guy be asking for help the same way i google
Is select using for asynchronous multiple network request handling ?
Select has nothing to do with asynchronous programming.
It lets you queue I/O buffers and handle each one serially when selecting.
For network servers, it means you can have an infinite loop running as long as the server should, and check up on multiple client connections at the top of the loop, then inside handle each pending message not fully handled between the clients and the server.
A similarly behaving asynchronous server would schedule a handler task for every accepted connection and that handler task would loop pretty much indefinitely waiting for client messages, then answering them. This works because waiting in asynchronous programming means letting other tasks run in the meantime, so in the meantime other handler tasks could be resumed and then (continue to) write a message to a client.
With select you would be writing your own shoddy event loop, whereas with asyncio it's elegantly built into the module and has been refined for years by contributors who know what they're doing
I built my own using select, I don't think it's too "shoddy" lol
@upbeat elm an asynchronous server would be using some form of underlying socket selection to get around the blocking nature of read/write calls
Select/poll are not shoddy, they're just low-level. They're literally being taught at uni when learning posix stuff :c that's why it was my first thought when I saw file descriptors and network programming...
Because higher level stuff won't use "file descriptors" directly, they'll be hidden behind some kind of abstraction
Yeah my bad I forgot asynchronous networking with sockets means nonblocking sockets polled with select
Hello guys is there anyone who has yet taken the CCNA exam
No.
have you?
For the filterbar I am setting the parameters that you can filter by and I just want to know if I should add any more potential parameters. Im not network pro so I wanna know from you guys
Current paramters are
src_addr, dst_addr, length, flag, src_port, dst_port, protocol, and application
@whole mauve I showed you the app any thoughts?
Looks good for the most part though I would add source/destination ports as well. And regarding the application I assume this relies on reading the local machine and port state in order to determine the app involved or are you determining this another way?
Yeah source and destination ports are there
they are just under info
if you remeber the I originally had it and a flag column to the right of the application column
but majority of packets are UDP so there wasnt any point in giving it its own column
so the format it like this now
its like this now ^
Any thoughts on the filter options tho?
or is there really nothing else to networking in terms of the info you can filter by?
Well there are quite a lot of things to filter by at the packet level but the most important are basically source/dest IP and source/dest port. And of course time. At the packet level being able to filter by 'conversation' is very useful too for troubleshooting. Length is not as important as those other things for example.
I have, like a century ago, heh that cert expired long ago though 🙂
haha yeah it was a while ago
Well a little unethical but the length thing is something I wanted
I do realize this tool will actually make network cheating in video games a lot easier (generally a pretty exclusive community of people due to it being IMO a lot harder than traditional cheating) (NOT THE INTENDED PURPOSE OF THE APP I JUST FIND THIS A LOT OF FUN)
Do you know where I can find the other paramters to filterby?
Well I mean packet size and frame length themselves aren't unethical at all and are useful metrics depending on what you are doing since you can easily identify between certain packet types, data transfers, etc. Its just rare that one cares what the actual payload is in network troubleshooting since most often it is encrypted or just not relevant. Another filter would be MAC addresses as that is another common component used. And being able to filter by network (ie network/mask) and not just IP has a use as well.
Filtering by specific tcp flags is also useful. There are a number of other header specific filters depending on application like filtering for voice or you can get even more fancy like filtering for BGP messages or other routing protocols. to name a few. There are tons of different network packets and such so there isnt really one consolidated resource on filter options. It depends a lot more on target audience and purpose than anything else. Like if the main purpose is just snooping on a machine to see what traffic it is sending/receiving or can see that is different than like a packet analysis tool for diagnosing network problems.
Thank you so much for your input, its really been super helpful, and yeah I am going for a diagnostic lens I really just want it to be like THE networking app with just literally everything you could think of
sure thing. And on that note the filtering is the most important for sure though not everything needs a column of course but a detailed view of each packet would be required. Taking a look at Wireshark would be a good idea since it is pretty much the defacto standard for (free) packet analyzers. If you wanted to expand on that into other product features then some report generation based on captured data has uses as well. classic stuff like 'top talkers' or top protocols, etc are also quite useful. And very deep packet analysis tools provide a lot of insight for things like that at the cost of rather expensive software packages 😉
hi everyone, not sure if this is the right channel but im getting pretty frustrated with a difference between requests and httpx and can't figure out what's going on,
these two code snippets are somehow producing different results; the requests version gets a 200 while the httpx gets 403
r = requests.get(url)
print("requests headers:", r.request.headers)
print("status code:", r.status_code)
with httpx.Client() as client:
r = client.get(url, headers={'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'})
print("httpx headers: ", r.request.headers)
print("status code:", r.status_code)
i just copied over the headers to make sure everything was correct
well that does sound interesting
yeah i see no noticable differences here ```py
httpx.get("https://httpbin.org/get").json()["headers"]
{'Accept': '/', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Host': 'httpbin.org', 'User-Agent': 'python-httpx/0.28.1', 'X-Amzn-Trace-Id': 'Root=1-685c70f5-5777123a291fe65a0aa02441'}
requests.get("https://httpbin.org/get").json()["headers"]
{'Accept': '/', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.32.4', 'X-Amzn-Trace-Id': 'Root=1-685c70f9-1b1f037465615ef7590b7e57'}
the specific url im using is https://pubmed.ncbi.nlm.nih.gov/38035307/ if that's relavent?
🤣 ```py
import httpx
import requests
httpx.get("https://pubmed.ncbi.nlm.nih.gov/38035307/")
<Response [200 OK]>
requests.get("https://pubmed.ncbi.nlm.nih.gov/38035307/")
<Response [200]>
it gets weirder
uhmmm
wtf
that's so wierd
how does this have different behaviours
import requests
import httpx
url = "https://pubmed.ncbi.nlm.nih.gov/38035307/"
r = requests.get(url)
print("requests headers:", r.request.headers)
print("status code:", r.status_code)
r = httpx.get(url)
print("httpx headers: ", r.request.headers)
print("status code:", r.status_code)
should i clear network cache or something? honestly have no idea
those won't be caching unless you tell them to
requests headers: {'User-Agent': 'python-requests/2.32.4', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Accept': '*/*', 'Connection': 'keep-alive'}
status code: 200
httpx headers: Headers({'host': 'pubmed.ncbi.nlm.nih.gov', 'accept': '*/*', 'accept-encoding': 'gzip, deflate, br, zstd', 'connection': 'keep-alive', 'user-agent': 'python-httpx/0.28.1'})
status code: 200
loool
hahahaha
any other easy to use async http library?
i just need to get a bunch of data in one place but its like 400 pages so i dont want to wait everytime
hmm i don't think this is down to the library honestly
this is weird
i'd try it from a vpn or something and see if it's some sort of ip block
also the page you are trying to get doesn't actually hvae the 400 pages of content on it
oh wait i misread you
yea i have a bunch of different pages to select though, that was just the first one i saw
dont have one accessible rn, but it shouldnt matter no? cuz the requests version works
hmm
I finished coding the filterbar, adding stuff is easy too with the way I wrote it
lowkey a beatiful function
how the hell did I manage to break a docker network lol, I've been debugging this for hours, trying to figure out why my reverse proxy wasn't able to reach one of my services, only to find out that the network is apparently somehow just completely broken, still no idea how this can even happen.
b290e1360eda ~ ping 10.80.16.2
PING 10.80.16.2 (10.80.16.2) 56(84) bytes of data.
64 bytes from 10.80.16.2: icmp_seq=1 ttl=64 time=0.054 ms
From 10.80.16.4 icmp_seq=3 Redirect Host(New nexthop: 10.80.16.2)
From 10.80.16.4 icmp_seq=2 Destination Host Unreachable
From 10.80.16.4 icmp_seq=5 Redirect Host(New nexthop: 10.80.16.2)
From 10.80.16.4 icmp_seq=6 Redirect Host(New nexthop: 10.80.16.2)
From 10.80.16.4 icmp_seq=7 Redirect Host(New nexthop: 10.80.16.2)
64 bytes from 10.80.16.2: icmp_seq=8 ttl=64 time=0.026 ms
64 bytes from 10.80.16.2: icmp_seq=9 ttl=64 time=0.021 ms
64 bytes from 10.80.16.2: icmp_seq=10 ttl=64 time=0.018 ms
From 10.80.16.4 icmp_seq=11 Redirect Host(New nexthop: 10.80.16.2)
From 10.80.16.4 icmp_seq=13 Redirect Host(New nexthop: 10.80.16.2)
From 10.80.16.4 icmp_seq=16 Redirect Host(New nexthop: 10.80.16.2)
From 10.80.16.4 icmp_seq=22 Redirect Host(New nexthop: 10.80.16.2)
^C
--- 10.80.16.2 ping statistics ---
39 packets transmitted, 4 received, +9 errors, 89.7436% packet loss, time 38890ms
rtt min/avg/max/mdev = 0.018/0.029/0.054/0.014 ms, pipe 3
b290e1360eda ~ ping 10.80.16.4
PING 10.80.16.4 (10.80.16.4) 56(84) bytes of data.
64 bytes from 10.80.16.4: icmp_seq=2 ttl=64 time=0.018 ms
64 bytes from 10.80.16.4: icmp_seq=3 ttl=64 time=0.024 ms
From 10.80.16.2 icmp_seq=4 Redirect Host(New nexthop: 10.80.16.4)
64 bytes from 10.80.16.4: icmp_seq=5 ttl=64 time=0.021 ms
64 bytes from 10.80.16.4: icmp_seq=6 ttl=64 time=0.014 ms
From 10.80.16.2 icmp_seq=7 Redirect Host(New nexthop: 10.80.16.4)
From 10.80.16.2 icmp_seq=8 Redirect Host(New nexthop: 10.80.16.4)
64 bytes from 10.80.16.4: icmp_seq=9 ttl=64 time=0.018 ms
64 bytes from 10.80.16.4: icmp_seq=10 ttl=64 time=0.019 ms
64 bytes from 10.80.16.4: icmp_seq=11 ttl=64 time=0.015 ms
64 bytes from 10.80.16.4: icmp_seq=12 ttl=64 time=0.013 ms
From 10.80.16.2 icmp_seq=13 Redirect Host(New nexthop: 10.80.16.4)
From 10.80.16.2 icmp_seq=14 Redirect Host(New nexthop: 10.80.16.4)
64 bytes from 10.80.16.4: icmp_seq=15 ttl=64 time=0.019 ms
^C
--- 10.80.16.4 ping statistics ---
15 packets transmitted, 9 received, +5 errors, 40% packet loss, time 14312ms
rtt min/avg/max/mdev = 0.013/0.017/0.024/0.003 ms
I never even saw ping do redirects, somehow it seems like the two IPs are conflicting, it's an external docker network, I'll probs just recreate it, but if anyone has any idea what the hell did this I wouldn't mind hearing it, weirdest behavior I ever saw, could it be like a mac address conflict or something?
ping on reply please
(other IPs on the network are reachable without issues, just the 10.80.16.4 - forgejo and 10.80.16.4 - traefik seem to have some conflicting behavior)