#networks

1 messages · Page 36 of 1

lofty bough
#

Starlette redirects URLs ending with a / instead of serving them directly 😬

cedar forum
#

hmmm really it should be using relative URLs to ensure the scheme is the same, and that HTTPs stuff should be handled at the starlette level

#

nginx doesn't have response rewriting

#

I just checked forms api which is starlette and it also returns HTTP, in Flask you can overwrite the server name but no idea whether starlette has a similar thing

lofty bough
#

@cedar forum maybe you could see what happens online?
https://decorator-factory.su/

  1. log in with github
  2. create a post
  3. edit your post
  4. press save
    and watch your Networking tab
#

I get this

cedar forum
lofty bough
#

ah

cedar forum
#

trying to gather where there is some sort of option that has to be set

#

it pulls it off the host header I think, which internally will be http

#
 if host_header is not None: 
     url = f"{scheme}://{host_header}{path}" 
 elif server is None: 
     url = path 
 else: 
     host, port = server 
     default_port = {"http": 80, "https": 443, "ws": 80, "wss": 443}[scheme] 
     if port == default_port: 
         url = f"{scheme}://{host}{path}" 
     else: 
         url = f"{scheme}://{host}:{port}{path}" 
#

so not entirely sure how possible that all is without fiddling with internals, I can't see any exposed way to modify this

#

I guess you could see what Host header nginx is passing on and maybe update that - I don't know what rewrite it applies by default but if you overwrite that to keep a https in maybe it'd accept that

lofty bough
#

nginx passes the same decorator-factory.su host

lofty bough
#

so I might have to put yet another proxy? sounds a bit ridiculous!

#

AAAAAAaaaaaaa

#

this... regex...

#

@cedar forum I fixed it with adding

--proxy-headers --forwarded-allow-ips '*'
``` to uvicorn
The `'*'` is a bit worrying to me...  but it doesn't work without it ![lemon_infant](https://cdn.discordapp.com/emojis/735875923613581462.webp?size=128 "lemon_infant")
cedar forum
#

ahh

#

nice nice

lofty bough
#

@cedar forum am I doing something insecure with the *? Nginx sends requests from all kinds of IPs, like 172.28.0.1 and 172.28.0.4, so I can't just give a list of IPs

cedar forum
#

hmmmm

#

that's just docker networks by the looks of it

#

so yeah

#

you can't give a list of IPs

#

well

#

uh

#

hm

lofty bough
#

oh right, I'm stupid, yes

cedar forum
#

does it accept a CIDR

#

one sec

#

yeah it doesn't take a CIDR, otherwise you could explicitly set the docker range, you're fine setting to * providing you've got a configured firewall on the main machine and don't expose ports unnecessarily

lofty bough
#

yep

#

alright, thanks for the help joe

cedar forum
#

👍 np, thanks for letting me know the fix, that'll come in handy

lofty bough
#

I just edited my backend on the VPS with vim 😎

#

and I'm going to push to github from there like there's no tomorrow

storm saffron
#

.su domain is uh

#

interesting choice

rigid edge
#

i want to use W10 and python3 and create a socket to talk to WIFI on a raspi 3B+ to control a servo , theres different datagrams? , tcpip , udp , ??? , what is best to use for gui button , scale , click events

narrow oak
rigid edge
#

thanks AWKINK

#

-G

#

when running idle , i have to be ADMIN , so i can have client / server code run -- im just doing copy paste for now - any help to links to as many example is appreciated

#

i did a simple protocol for usb - serial to a microcontroller ---- now i want to try a raspi wifi link

spice void
#

Yellow to everyone

#

Any recommendations for pandas tutorial?

soft silo
#

socket.socket().recv(abc), is it that abc must be the power of 2?

still mauve
#

anyone have any funny server naming conventions I should use for my servers?

soft silo
#

um isn't this networking lol, why is this channel so offtopic'd or is batman something related to networking
edit: the original message got remove

prisma cobalt
#

thats the equivalent of doing, open("test", "r").read()

#

you dont close it or manage it or anything

dark trench
#

I am getting an error when I try to send data to my robot which is on another device on the same network through sockets from my Django Site, it is saying that ConnectionRefusedError at /robot/1, [Errno 111] Connection refused. If anybody knows what is causing this help would be great.
Full Code:
https://stackoverflow.com/questions/69238585/django-sockets-connectionrefusederror-at-robot-1-errno-111-connection-refus

ember ledge
#

hey

#

can somebody help me with this error please

prisma cobalt
# ember ledge

this looks like a CAPTCHA bypass, this breaks rule 5
on top of that, this isnt python and the error your getting doesnt relate to networking

clear bobcat
dark trench
#

if anybody could help me with a simple sockets question then please go to #help-cookie thanks

ember ledge
#

when using pretty much any request lib in python, I am triggering this sites cloudflare. I tried using cloudscraper and cfscraper, always getting a 403. does anyone have a workaround or any ideas?

high walrus
#

Hey guys do u know of any alternatives for ngrok which works with both tcp and udp which is free. I heard abt portmap but i am unable to use it with ubuntu 20 on my raspberry pi 4b arm64 ed.

lost bane
#

can someone help me with this error i am getting while trying to create an smtp connection

#

please help fast

light zealot
lost bane
#

thanks a lot @light zealot

light zealot
#

😄

lost bane
#

!close

clear bobcat
torn arrow
#

He just a good people who always remember to close after get help

light zealot
eternal oriole
lost bane
lost bane
gritty kayak
#

👍

narrow oak
#

threading.Thread objects have a name property which you can just reassign to any other string

#

I dont know if thats the name that vsc uses on the debugger tool though

#

a socket.socket() call does not return a new thread

#

just a socket instance

#

how many clients did you have open?

thorny patio
#

Can anyone here recommend a Python library for interacting with the Open Graph protocol? I'm using Python 3.

storm saffron
#

opengraph is just html tags, do you mean parse them from a page @thorny patio ?

final moss
#

hi can i ask question regarding DVR here

toxic mural
#

https://en.wikipedia.org/wiki/Distance-vector_routing_protocol ? you can ask away but it does sound like a very niche topic, so chance of someone else knowing about it are rather slim :(

A distance-vector routing protocol in data networks determines the best route for data packets based on distance. Distance-vector routing protocols measure the distance by the number of routers a packet has to pass, one router counts as one hop. Some distance-vector protocols also take into account network latency and other factors that influenc...

thorny patio
inland sapphire
#

i need to transfer files with raw bytes over a text based protocol. Im currently using base64 to do it but it adds too much extra data (~33% increase). Whats the best way to transfer raw bytes over a text based protocol while minimizing network usage and preferably minimizing resources used to process the files into a text friendly form?

inland rampart
inland sapphire
earnest blaze
#

Why is it then when two sockets from different networks are connected, only the network with the server in it needs to configure port forwarding?
The client will send something to the router on a specific port whic is then forward to the server,
but the server can just send back to the client without that network having port forwarding. Wouldn't the router also have to forward that to the client?

inland sapphire
ember ledge
#

Hey fellas, some jackass just tried Dossing me without hiding himself.

ember ledge
#

Interesting time it is reporting someone to the FBI isn't it.

thorn stratus
#

lmao DOS

pulsar vigil
#

😎

#

Port forwarding, that's a thing that simple don't get

#

Private network you mean interior IP address?

#

Wait, they connect "invisible" as part of my LAN?

karmic totem
#

okay so I'm trying to make my computer talk to another computer using socket, right now its working, but I'm still only using my computer to talk to myself, if it works using it like this, is it safe to say that it'll work between two different computers with different ips?

hoary drum
karmic totem
#

okay, do you have any tips for when I get to that point? as I do intend to have one computer constantly listening for request, its going to act as a datastore of sorts

hoary drum
#

if you want to grab a help channel and chat I am available

karmic totem
#

i'm kinda new to this discord server, how do "grab" a help channel?

hoary drum
#

unless you want to type it all out here. I don't think this channel is as active

karmic totem
#

idk, im fine with that if you are

hoary drum
#

so what's the project

karmic totem
#

mainly just make my own database, so I have a class that has a dictionary that acts as the datastore for now, it also has a socket.accept() to listen for functions sent to it. I want to be able to send a request to this computer with some data, and it will add it to the data store, so far I have that made and it works, I'm more of concerned about the fact that I don't know if ill be able to send request to it when I'm on a different computer that doesn't use the same network

#

right now the code just uses my ipv4, well thats the one i copy and pasted from command prompt when i did ipconfig

hoary drum
#

so are you sending between two physical computers on the same network right now, or just connecting from one comp to itself?

karmic totem
#

"or just connecting from one comp to itself?" this

#

i don't have to physical computers running windows 10 at my disposal to test right now

hoary drum
#

just for context, is this just a testing thing or is there a specific use case/application surrounding this?

karmic totem
#

should i just send the code that i have right now?

hoary drum
#

sure

karmic totem
#
import os, socket, json

class DataBase():

    def __init__(self,HostingIp: str, HostingPort: int):
        self.Ip = HostingIp
        self.Port = HostingPort
        self.db = {}

        self.Boot()


    #Boot up server function
    def Boot(self):
        s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
        s.bind((self.Ip,self.Port))
        s.listen()

        while 1==1 and input().lower()[0] != 'k':
            print('Waiting for conection...')
            conn, addr = s.accept()

            data = conn.recv(1024)

            #Return data in local DataBase
            def returnData(x):
                return json.dumps(self.db).encode('UTF-8')

            #Return info about the database (port, ip, etc when i make it more in depth)
            def returnInfo(x):
                return json.dumps({'IP': self.Ip,'Port': self.Port}).encode('UTF-8')

            #Just lists the functions in the db
            def DbHelp(x):
                return b', '.join(funcs.keys())

            funcs = {
                b'getData': returnData,
                b'DbInfo': returnInfo,
                b'DbCommands': DbHelp
            }

            #try and send the function return value, if its not a function or an error occours just return invalid
            try:
                conn.sendall(bytes(funcs[data](0)))
            except:
                conn.sendall(b'Invalid function')

    def changeDb(self,Key: str or int, Value: str or int or bool) -> None:
        self.db[Key] = Value```
#

here the database code

#
import Database as db

#Create database, this is ran off the computer that you create this with
db = db.DataBase('10.0.0.10', 4032 )```
#

and heres the code to make a database

hoary drum
#

what is your goal with this code

#

just to clarify why I ask, if you're trying to send traffic over the Internet, it usually makes sense to use a protocol normally used on the Internet, such as HTTP.

karmic totem
#

just make a database class that when created makes a database that can be connected to and used for datastoring

hoary drum
#

is this just a "learning" project? is the data you're sending coming from another application and/or going to be further processed?

karmic totem
#

more of just learning, i'm just getting into networking and though something like this would be a good starter project

#

and i may further process it, i guess a good way to describe this is more of just a way to send data to a off local place for storing

hoary drum
#

so if you had two computers in front of you on the same private network could probably just connect to the port on the listening side and send the data with your sending side script. if you were trying to do this over the Internet, you would need a static IP or dynamic DNS entry and a port forwarding rule on the router that serves that private network.

karmic totem
#

mmm, okay, is there anyway i could use on of the computers to host a static ip? or would that need to be done on a router thats config allows that

#

because im still in hs, so i don't really wanna be messing with my family's router lol

hoary drum
#

what kind of computer do you have? if you're just trying to learn things I would suggest using virtual machines

karmic totem
#

its just like a office computer, no graphics card

hoary drum
#

you would be able to set up different virtual computers/networks in your own sandbox

#

well what's it have for memory and available storage

karmic totem
#

2 tb of storage and 8gb of memory, i dont really think it's enough

#

i have a better computer at my dads house that has the same amount of memory but its probably faster, less available storage

hoary drum
#

well it may be more effort than it's worth, but you would see what I think you're trying to next: 2 IPs talking to each other

red geode
#

someone can help me? i'm trying different ways to listen the connection between a game server and the client

import _thread
import time
import socket

data = ''
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('', 51259))


# Define a function for the thread
def listening_thread():
    global data
    while True:
        data_raw, addr = sock.recvfrom(1024)
        data = data_raw.decode()
        print ("Received message inside thread:", data)


try:
    _thread.start_new_thread(listening_thread, ())
except:
    print("Error: unable to start thread")
    quit()


while True:
    print('Now I can do something useful while waiting in the main body.')
    if data:
        print('THE PACKET RECEIVED BY THE MAIN BODY IS: ' + data)
        data = ''
    time.sleep(2)

i tried different ways to listen and get the data, but nothing works
i know the dest ip and it can have differents ports
dest/source i'm looking for: 5.188.125.31

red geode
#

what u mean?

signal adder
#

this code I think is the server not? and the client? are both in the same machine?

red geode
#

i tried

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', 5056))

while True:
    data, addr = s.recv(1024)
    if data:
        print(f'data received: {data.decode("utf-8")}')
    else:
        print('a')

but it dont even connect to try the prints on the bottom part

earnest blaze
red geode
#

i'm thinking about to try another language to get the UDP packages data

earnest blaze
#

Is the client running on a different device than the server?

red geode
sinful sky
#

Hey, I was trying to send emails using smtp through socks5 proxy. Weird thing is sometimes simple emails like "what's up or how are you?" lands in spam. But if i send it gmail from browser using the same proxy it goes to inbox. I am not sure what is happening or what is causing this type of behavior.

rain condor
#

how do i show two way communication on a website ?
im trying to simulate payment gateway system so i wanna send info from payment gateway to "bank".
something similar to socket programming i guess

clear bobcat
#

Rather localhost pithink

faint elk
#
    headers = {"Authorization": f"Bot {TOKEN}"}
    path = f"/channels/{channel_id}/messages"
    url = BASE + path

    params = {
        "after": after_id,
        "before": before_id,
        "around": around_id,
        "limit": limit
    }

    response = httpx.get(url, params=params, headers=headers)
    return response.json()

Why does httpx.get(...) cause an error but requests.get(...) works as expcted

willow prairie
#

Anyone knows any python script that generates the arp table using snmp?

mellow knot
#

Hi everyone I want to learn a bit more about networking specifically so that I can make games with either clients/server, peer to peer or player hosted lobbies

#

can anyone link me to some good resources for where to learn how to do this and also how I can host it securely

#

btw I would also want to learn how to do this through both udp and tcp/ip since which one is better would depend on the game

viscid cobalt
#

Hey! So I've been trying to make a server with 2 clients but I don't know how this is what my code currently looks like with what I added to try add another client

#

serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

serverSocket.bind(("127.0.0.1",8080))

serverSocket.listen()

while(True):

    (clientConnected, clientAddress) = serverSocket.accept()
    (clientaltConnected, clientaltAddress) = serverSocket.accept()

    print("Accepted a connection request from %s:%s"%(clientAddress[0], clientAddress[1]))
    print("Accepted a connection request from %s:%s"%(clientaltAddress[0], clientaltAddress[1]))
   
    while True:
        dataFromClient = clientConnected.recv(1024)
        print(dataFromClient.decode())
    
    while True:
        dataFromClientalt = clientaltConnected.recv(1024)
        print(dataFromClientalt.decode())

    while True:
        dataserver = input("")
        clientConnected.send(dataserver.encode())


    clientConnected.send("Client Connected!".encode())
    clientaltConnected.send("Client Connected!".encode())```
prisma cobalt
#

solution: you could start a new thread to handle each client as they connect?

#

also the serverSocket.listen() function should require an integer argument specifying client backlog count

#

at least in python 3.9 it does

midnight slate
#

hey guys
i needed help in regarding laravel is this the best place to ask?
i ran theese jwt codes in my laravel but now the app is not working as i click a button only white shows shows..these were the JWT commands
php artisan jwt:secret
php artisan optimize
php artisan clear-compiled

dire goblet
crude ridge
#

Hello! Im kind of desperate so I'll ask here. Im trying to create an app to connect two pcs (both users know IPs and Port beforehand) and im trying to avoid making the users forward ports. Is there any way on python to stablish a direct connection between two PCs without making the users manually forward the port?? I've seen things like UPnP and hole punching but It's been imposible for me to see explanations that actually manage to do it without forwarding a port. I've also looked into trying to make some sort of connection like the one made by zerotier or hamachi but I didn't get useful results. Does anyone know any way?

crude ridge
#

This actually looks very promising. Thank you very much! (Still just in case, if anyone else knows of other ways please tell them)

worldly solstice
#

is that if u use free plan then u might get randomized big ip

crude ridge
#

I was looking into just make it over http and use port 80 but idk how that works

#

Or even if you can actually do that

worldly solstice
#

get the token download the suitable client

#

and run and pass the token

#

then use cli command

crude ridge
#

Will the app depend on ngroks service? The idea behind the app is to make it as a decentralized p2p network independent of any external service

worldly solstice
#

need too open http port
ngrok http 8080

crude ridge
#

I want to stablish a direct connection without having to use any server as mediator

#

Just the two pcs and well, the internet

worldly solstice
crude ridge
#

What I mean is does using ngrok mean the app will be making use of external servers provided by ngrok or whoever runs the service

worldly solstice
#

thats bit shit process

#

instead u can make a intermediate server and make the clients to connet to it

crude ridge
#

Then a server has to be supported, which is what im trying to avoid

#

Im guessing it's too weird. I'll have to settle with having the people open a specific port

worldly solstice
crude ridge
#

Yeah, it is

#

Maybe some sort of automatic port forwarding

worldly solstice
worldly solstice
#

no one will prefer to use ur app if u ask ur users to port forward in their pc

crude ridge
#

I mean, there are a lot of apps that do it

worldly solstice
crude ridge
#

I'll see what I can do

#

Thanks for the help ^^

mellow knot
#

similar idea to this would it be easy to make an app where the server is just used to let players make and connect to lobbies?

#

the lobbies would be user hosted

worldly solstice
#

hmmm kinda data loss may happen

worldly solstice
#

ok gtg

#

be back in 10mins

crude ridge
#

Wait, outrageous idea

#

The whole thing about ports is because of NAT right, which is a whacky horrible patch made to solve the lack of ipv4 addresses

#

Is it possible to just stablish the connection through ipv6?

#

Is that a thing already?

crude ridge
#

I think my best bet is to try to use UPnP right now

worldly solstice
#

@crude ridge get a public server for some moeny

#

and deploy ur work there

crude ridge
#

But that completely defeats the purpose

mellow knot
crude ridge
#

Im not really doing this for a very specific intention, it's mainly academic purposes

#

Im doing this to learn and probably as a part of my capstone project

mellow knot
#

^^ do let me know if you figure it out since I also want to do something similar

crude ridge
#

It's the best lead we have for now, but we haven't used it and tested it yet

mellow knot
#

have a look at this in your case you wouldn't need the server since its only used to get the ip addresses

#

although I'm not sure if this is secure or works with a firewall

#

actually seems this should work regardless of firewall but the connection will close after ~30 secs since the last message was sent

#

so you would need to constantly send messages to keep the connection open

#

@crude ridge

crude ridge
#

That's UDP

#

I'll look it up tho, thanks!

mellow knot
# crude ridge That's UDP

if you cant find a way to make it work with TCP I think you could emulate TCP with UDP and it will be fine

#

but you will end up having to write a lot more code

crude ridge
#

Yeah that's messy

#

But it's always an option

crude ridge
mellow knot
#

nice

main flicker
#

Where can I upload a file so that when I open the link it will download immediately without pressing anything?
please

untold aspen
#

Hello guys

#

how can I learn networking with python

ember ledge
#

Basically if you request some link one of the response headers should be
Content-Disposition: attachment

#

then the file will be downloaded

lethal pawn
#

Hey I have an ec2 instance and I installed xampp and now I am able to access it using it's IP on port 80, however I want to connect to mysql using python which I am not able to, can anyone help me on this?
Python script won’t be running on the localhost, I want to run it remotely

#

How can I access mysql hosted using xampp on aws from python? I can access xampp using AWS public IP

ember ledge
#

Can I keep an https socket in perpetual connection?

kind furnace
crude ridge
#

Ooooh

#

Will this manage port forwarding automatically?

kind furnace
kind furnace
# crude ridge Separate

Two choices then with easyrpc, 1) have one host which has the forwarding, both hosts running EasyRpcServers, have the un forwarded host create a server-proxy connect to forwarded host, then your channel is available for biderectional rpc …. Or 2) create a third party external host which also runs an EasyRpcServer and have each host create server proxies to this third host on the same namespace which enables the same channel of communication, check the docs for a more visual representation

crude ridge
#

In the end there's no way to scape the port forwarding curse

#

Thanks a lot for the help

mellow knot
#
#!/usr/bin/env python

# WS server that sends messages at random intervals

import asyncio
import datetime
import random
import websockets

async def time(websocket, path):
    while True:
        now = datetime.datetime.utcnow().isoformat() + "Z"
        await websocket.send(now)
        await asyncio.sleep(random.random() * 3)

async def main():
    async with websockets.serve(time, "localhost", 5678):
        await asyncio.Future()  # run forever

asyncio.run(main())
#

im going through the websockets getting started and am wondering how I can get this hosted on a server

#

I have a linode running rn and tried changing the localhost to the servers ip and did the same for the client but its not working

#

ohh actually nvm it works now turns out when changing the clients IP I have to specify the port as well but I deleted it when changing ips from localhost and didnt realise

mighty sand
#

Hey everyone !
I'm having an issue while requesting a lot of urls with aiohttp
I've created a class which I initialize with a semaphore and a max concurrent processes amount
then i call a method fetch_url which is basically doing this :

async def fetch_url(self, url):
    async with self.semaphore:
        async with (await self.get_session()).get(
            url, ssl=ssl.SSLContext()
        ) as response:
            response.raise_for_status()
            return await response.read()

(simplified without error and retries management)
then i call this a bunch of times within an asyncio.gather
and it works for some time but then i get that error :

[ERROR] 12:41:59 : Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x000002450EECFC10>
transport: <_ProactorSocketTransport fd=2216 read=<_OverlappedFuture cancelled>>

I've read online that this might be due to a CPU or RAM overload, but is it really the case ? and how could i fix that ?
(It works fine with requests so i guess it doesn't come from the websites i request, i just wanted to make it better with aiohttp)

Thanks for the help and don't hesitate to tell me if you need more infos or if this question is not suitable in this channel (i wasn't sure)

trim remnant
#

Does anyone know where to start learning pybluez, I am a little bit lost.

warm raven
#

Hello

quiet stirrup
#

hi where do U se the tryhackme token here?

ember ledge
#

anyone have experience with socket using python?

dark trench
ember ledge
uneven lily
#

Hey... So i am using a wpa2 enabled wifi and my neighbour above(a kid) who is learning cybersec... He knows what i am doing realated to the internet... Does this mean he knows the WiFi password? ping me back

swift dove
#

Hi, I was told to ask here, but since this is a Python discord, is it allowed to ask questions about Wireshark? I will use python with it, but right know I'm having issues identifying video streams packets, so it might be way off-topic.

mellow knot
#

Hi everyone I've built a webapp that communicates with a python backend using websockets, I'm trying to host the frontend on github and the backend on a linode rn but it wont work unless I use wss instead of ws but I dont know how to get an ssl certificate for my server can someone help?

#

if possible I would like to know of a free or at least the cheapest way to get this working since its just a learning project

clear bobcat
#

You can also create your own certificate

mellow knot
#

btw this SO has pretty much the same problem as me and I think it explains the issue a bit better

mellow knot
clear bobcat
mellow knot
#

yup

#

I'm just running the script on a linode

clear bobcat
#

I think that you should check Software as None of the above and System as pip pithink

#

Never used this configuration, I am running every server behind NGINX

mellow knot
#

thx will give it a try

mellow knot
clear bobcat
mellow knot
#

just the server ip?

clear bobcat
#

Try to put IP

mellow knot
#

no domain just using the ip address with a specific port

mellow knot
clear bobcat
#

However I am not sure that this will work pithink

mellow knot
#

yeah it doesnt 😦

#

so I need to get a domain name as well...

#

I thought the domain name was kind of just a redirect though to make your ip look nicer for users

clear bobcat
mellow knot
#

I remember reading something about it not working all the time

clear bobcat
#

GitHub provides own certs iirc

mellow knot
#

do you have any suggestions for what I should try doing to get this working?

clear bobcat
mellow knot
clear bobcat
mellow knot
#

have a look at this its the same problem pretty much

dark trench
#

I am having an issue with my django site running on a heroku server where when I try to connect to a socket running on a raspberry pi, it just "spins" for ~20 secs and then times out telling me to check the logs. Logs are attached, I think I have to change the server but I am unsure of what to change it to. Any help would be great.
(PLEASE PING IF REPLYING 🙂 )
https://imgur.com/a/op15OXb

clear bobcat
#

@mellow knot you have the solution 🙂 like I said, generate self-signed certificate

mellow knot
#

hmm will try but ideally i wouldnt want a warning

#
#

found this as well solution seemed to be to get a domain name for the server

#

issue is not sure how I can connect that domain name to my server got one from lCN but they pretty much just let me use their website builder to connect the domain name

#

not sure if im missing something or theyre just trying to lock me in to their services

cedar forum
#

you can’t get SSL certs for IPs (well, I think you can with someone like Digicert, but they are pricey)

#

I don’t know what ICN is but you might be able to amend DNS to assign a subdomain to the server (e.g. api.mysite.com)

#

if you can do that, you can use certbot or acme.sh to provision a free certificate from Let’s Encrypt

swift dove
# swift dove Hi, I was told to ask here, but since this is a Python discord, is it allowed to...

Well, I can't get to filter out the TCP packages that do contain parts of a streaming video.
Some of the transport protocols for streaming that I've found are RTP/HTTPStream/RTSP. But I'm struggling a lot trying to differ all the other noise. There might be more according to which protocol it uses and it might have another name if it's encrypted.
Is it possible to get the information on the host easily with a well made wireshark filter or such?

mellow knot
#

like this?

#

I put the servers ip in results

cedar forum
#

so api.domain

mellow knot
cedar forum
#

put api in the host name field, set the TTL to 300

mellow knot
mellow knot
cedar forum
#

time to live, it tells computers how long they should hold onto that record before checking it again

#

300 is 300 seconds which is 5 minutes

mellow knot
#

I need to make calls to this api very frequently so maybe once every second at least

cedar forum
#

no, that's not what TTL is for

#

unrelated things

#

I'd put 300 in there, it's just pretty standard

mellow knot
#

ahh ok thats good then

#

how come they put 86400 then?

#

if its not something that should change anyway wouldnt a longer time be better?

cedar forum
#

that's 1 day, it's up to you, but while setting up at least it's nice to have a short TTL in case a mistake is made

mellow knot
#

btw there shouldnt be any issues if I put the path to my cert and key in the server file on github right?

#
cert = "path to cert"
key  = "path to key"
ssl_context.load_cert_chain(cert, keyfile=key)
#

like that

cedar forum
#

no issues with the path, but don't put the contents there obviously

mellow knot
#

I have the certificate now and the servers running but it fails to connect

#
let websocket = new WebSocket(`wss://${DOMAIN}:${PORT}`);
#

thats what I have on the client

#

before adding the cert it was working with ws with the cert it doesnt work with either wss or ws

#

@cedar forum do you know what other info I might have to include to get it working?

#

thats the error message

mellow knot
#

finally got it working 🎊

#

thanks so much for the help
@cedar forum
@clear bobcat

dark bobcat
#

Anyone knows how to fix this

ember ledge
#

hey can anyone

#

suggest me very beginner level books for networking in python

ember ledge
ember ledge
ember ledge
# ember ledge But where to learn it from?
#

Just skip the hardware parts of this course.

#

Cables, connectors, wiring etc.

pearl forge
#

Does anyone control ad through Python instead of powershell?

young solar
#

hi

#

how I can learn python ?

clear bobcat
errant bayBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

young solar
modest barn
#

from netmiko, bar= net_connect.send_command('show bgp peer-template foo'). What do you guys recommend how i should parse through the output?

somber quiver
#

Anyone got any idea on why this port forwarding isn't working?

#

I've port forwarded before, I know how but for some reason this isn't working

#

I've also checked on 2 port checking sites, nothing

ember ledge
uneven lily
#

so my neigbour tried using fluxion on me to get my wifi password but failed... Is there any other method for me to hack his password for payback? Ping me pls.. I know its not really ethical, but he started this...

errant bayBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

uneven lily
#

oooh.. sorry

#

Can you guide on how to stat safe from them atleast @light zealot ?

minor marlin
#

!rule 0

errant bayBOT
#

:x: Invalid rule indices: 0

minor marlin
#

Illegal

earnest roost
#

Hey, I want to setup a livefeed from a camera I have on my computer to another computer (over 4G/5G) with the least delay possible. Should I use the socket or the websocket library? I'm not sure what's the difference exactly.

somber quiver
serene pewter
#

Can someone explain to me what is cname with an example, i have looked around sites and videos but i havent quite understand what it is

narrow oak
narrow oak
serene pewter
#

right?

narrow oak
serene pewter
narrow oak
#

not necessarily only subdomains

serene pewter
ember ledge
#

Im not sure if im right here but i'm using selenium and after i launch, it opens site and instantly closes. Any support?

floral gull
#

How can I rewrite this in python?

const wordEle = document.querySelector("#word");
const phonetics = document.querySelector(".phonetics");
const wordMeaning = document.querySelector(".word-definition");
const handle = async (e) => {
  if (e.keyCode === 13) {
    const word = e.target.value;
    const result = await fetch(
      `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`
    );
    const data = await result.json();
    resultDiv.style.display = "block";
    if (result.ok) {
      wordEle.innerText = data[0].word;
      phonetics.innerText = data[0].phonetics[0].text;
      audio.src = data[0].phonetics[0].audio;
      wordMeaning.innerText = data[0].meanings[0].definitions[0].definition;
      const synonyms = data[0].meanings[0].definitions[0].synonyms;
      let synonymsData = "";
      for (let i = 0; i < synonyms.length; i++) {
        synonymsData += `<p class="pills">${synonyms[i]}<p>`;
      }
      document.querySelector(".synonyms").innerHTML = synonymsData;
      return;
    } else {
      document.querySelectorAll(".meaningheading")[0].style.display = "none";
      document.querySelectorAll(".meaningheading")[1].style.display = "none";
      wordEle.innerText = data.title;
      wordMeaning.innerText = data.message;
    }
  }
};```
ember ledge
floral gull
#

I want to build a dictionary, but I don't know how to make data base in js, and for this I want to rewrite this app

atomic schooner
tame dagger
ember ledge
#

hey, im trying to decode a tcp packet, so i can resend the package in python, but i think it is decoded: ... .. .play_fab_title_id... .74a2b... .. .auction_sell_locked....... .. .auction_buy_locked...... .a. . .c.  .³xœ¥XÉŽ.E.®Y
does someone know how i could get the valuable data out of it and remove/decode the dots and other weird characters?

vital shard
#

how do I use the youtube API
with python
to make a youtube video one like higher
so how do I do it?

prisma cobalt
#

hmm that seems like it breaks ToS 😖

mellow knot
prisma cobalt
mellow knot
#

since I highly doubt that would be part of the api

vital shard
#

oh

#

well how do I use the youtube api then

prisma cobalt
fair kindle
#

one higher = queue next probably

prisma cobalt
#

"one like higher" tho 😕

indigo dirge
#

How essential is understanding the 7-layers of networking for run of the mill web development?

#

(i.e tcp/ip layer, application layer, hardware layer)

cedar forum
#

I’d say anything below TCP/IP isn’t super important though for basic web dev stuff

indigo dirge
#

Excellent. Thanks Joe

cedar forum
#

like you don’t need to know Ethernet frames/physical link and whatnot

#

but an understanding of HTTP, TCP, UDP and IP are all handy to have, and if you want TLS is also handy to know

indigo dirge
#

Wonderful, thanks again for the information

cedar forum
#

no problem! happy to explain any questions about any of those protocols or other bits of the OSI model if asked here 😄

#

also, if you want to see a more… realistic application of network layers I recommend looking up the “DoD model”

#

it’s a condensed version of the OSI model which in my opinion at least ties more to actual applications, or at least better organises things

#

so with that model it’s good to have an idea of application, host to host and internet, anything else for your standard backend web dev should be optional

atomic schooner
mellow knot
#

have a look at this I ended using the Synchronization example as a base for my application its fairly east to understand if you follow the examples

#

havent used rust before though but I think the python server will look the same regardless of client

dapper pulsar
#

last time i checked, cockroachdb and InterPlanetary File System were possible candidates

#

anyone interested in revolutionizing the package story in python by helping me with a prototype? 😉

#

good ideas are also appreciated

swift dove
#

Hey guys. I'm having some issues with Wireshark. Can someone give me a hand? I'm not quite certain that I'm properly setting up the capture or filtering correctly.

ember ledge
#

can anyone help me with selenium in dm?

ember ledge
#

heyy

#

im just learning sockets

#

and i need help with it

pearl forge
#

I’m trying to use Python to show all IP addresses and device names

#

Can anyone help?

swift dove
#

All these questions and barely any answers *cries in existencialism

sturdy flower
# pearl forge I’m trying to use Python to show all IP addresses and device names

Try this

import os
import socket
import multiprocessing
import subprocess
import os

def pinger(job_q, results_q):
"""
Do Ping
:param job_q:
:param results_q:
:return:
"""
DEVNULL = open(os.devnull, 'w')
while True:

    ip = job_q.get()

    if ip is None:
        break

    try:
        subprocess.check_call(['ping', '-c1', ip],
                              stdout=DEVNULL)
        results_q.put(ip)
    except:
        pass

def get_my_ip():
"""
Find my IP address
:return:
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
ip = s.getsockname()[0]
s.close()
return ip

def map_network(pool_size=255):
"""
Maps the network
:param pool_size: amount of parallel ping processes
:return: list of valid ip addresses
"""

ip_list = list()

# get my IP and compose a base like 192.168.1.xxx
ip_parts = get_my_ip().split('.')
base_ip = ip_parts[0] + '.' + ip_parts[1] + '.' + ip_parts[2] + '.'

# prepare the jobs queue
jobs = multiprocessing.Queue()
results = multiprocessing.Queue()

pool = [multiprocessing.Process(target=pinger, args=(jobs, results)) for i in range(pool_size)]

for p in pool:
    p.start()

# cue hte ping processes
for i in range(1, 255):
    jobs.put(base_ip + '{0}'.format(i))

for p in pool:
    jobs.put(None)

for p in pool:
    p.join()

# collect he results
while not results.empty():
    ip = results.get()
    ip_list.append(ip)

return ip_list

if name == 'main':

print('Mapping...')
lst = map_network()
print(lst)
errant bayBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

modest barn
#

What would be you guys recommendation for parsing multi lines out put from a netmiko net_connect.send_command("show version")?

woven vortex
#

Hey everyone 👋 . I have started learning about networking and I'm confused ( a lot!).

  • what is the difference between web servers and browser?
    -I understand that interaction between 2 things needs a protocol to specify how the conversation well be. Telnet is a protocol?
    3- what is sockets? and why it's differ from a browser?
earnest roost
#

Does anyone have an example of two python scripts communicating via websockets?

ember ledge
woven vortex
merry pollen
#

Would anyone want to work together on a python project through GitHib? I know the basics of python and am familiar with some of the common modules used and would like to gain more experience by coding more projects. I don't really care what the program would be, however I would like for it to be challenging.

If anyone would be interesting in doing so DM me or just respond to the message.

earnest roost
narrow oak
narrow oak
#

yes, if you know a domain you can always get the ip address, because computers communicate only using ips, so domains have to get resolved to that eventually

woven vortex
#
# this is my first server!

from socket import *

def createServer():
    serversocket = socket(AF_INET, SOCK_STREAM)
    try:
        
        
        serversocket.bind(('localhost' , 9000))
        serversocket.listen(5)
        while(1):
            (clientsocket, address) = serversocket.accept()

            read_data = clientsocket.recv(5000).decode()
            pieces = read_data.split("\n")
            if ( len(pieces) > 0 ) : print(pieces[0])

            data = "HTTP/1.1 200 OK\r\n"
            data += "Content-Type: text/html; charest = utf-8\r\n"
            data += "\r\n"
            
            data += "<html><body>this is my first time doing this lol, no body cares anyway!. </body></html>\r\n\r\n"
            clientsocket.sendall(data.encode())
            clientsocket.shutdown(SHUT_WR)

    except KeyboardInterrupt :
        print("\nShutting down ...\n");
    except Exception as exc:
        print("Error:\n");
        print(exc)

    serversocket.close()

print('Access http://localhost:9000')
createServer()

#

i get an error if i change the "localhost" to something else, why?

#

this is a simple server, ( i didn't build it, just following a tutorial).

#
  • is it okey if i choose any port?
storm saffron
#

What did you change localhost tk

#

To*

woven vortex
narrow oak
#

"localhost" simply refers to your own computer, and the port is a number in which the client attempts to connect to (checks if its a process running on that port)

#

"localhost" could be replaced with any ipaddress (also domain name) and your script (the client) would try to connect to it. "idksdj" is not a valid domain name thus it wont work

woven vortex
prisma cobalt
prisma cobalt
#

As for an error if it's not localhost, your hosting it yourself right on the same computer so you need to bind it to localhost

earnest roost
prisma cobalt
#

Ah well that's a bit more complicated

#

You first said a single variable lol

earnest roost
#

well I need to start somewhere...

#

I'm using twisted rn, it seems to do the job

mellow knot
#

maybe look into websockets and webrtc

carmine tulip
#

Hi guys, does fake_useragent work well?

#

I was just learning about the header portion of requests library and I wanted to see how I can make sure I am more private

proud swift
earnest roost
#

Ha, alright

prisma cobalt
#

Aka you can omit it without consequence

#

As the client, the only header you need for HTTP1.1+ is the host header

ember ledge
#
https://discord.com/api/v9/channels/{gcID}/call/ring

why does a post request to this not work

carmine tulip
#

maybe your missing the gcID

#

as you may be literally putting {gcID}

deep current
#

Does anyone know good ansible courses?

ember ledge
prisma cobalt
#

Please don’t advertise this here

ornate pulsar
#

For the sake of intuition, can I think of a pair of streams as two guys, each with an open end of a pipe that leads to a tap at the other guy?
What I mean is:
if I pour some water in my open end, I wont see the water level drop until the other guy opens the tap on his side?
And the only way for me to tell if the other guy sent me some water, is to open my tap and see if anything comes out?

I guess what I'm trying to wrap my head around here is the whole flush/drain thing (do I see the water level drop). Receiving is blocking (or awaited) and you're just sort of blindly attempting to get some water, while sending doesn't have to be. You can just pour some water, but you have the option to wait for the pipe to become empty first?

if I open my tap, just for long enough to fill a bucket with 1024 units of water, any water still in the pipe will stay there, and be the first to come out whenever I open my tap again?

thorn mirage
#

I need help making a messenger

#

(online)

#

not lan

ornate pulsar
thorn mirage
#

Chat with usernames no accounts

ornate pulsar
#

Usernames, no account? so like connecting as a guest basically? you just pick a name when you connect?

thorn mirage
#

yes

#

so when you connect:

#

" Username: "

#

console no gui

ornate pulsar
#

And for the most part network is network.
There's a few security aspects that come into play on WAN, but it's pretty much the same

#

again what kind of help are you looking for here? I'm slowly getting the sense that you are looking for a step by step guide, for the complete thing. If that's the case, you might want to start out a bit smaller.
You could play around with sockets a bit, and just see if you can have two processes send messages to each other. Then you can try to build a simple protocol or communication flow

#

And if you want it to work outside of your local network, you need to either forward some ports, or have a common server hosted somewhere

thorn mirage
#

oh no i have experience with python

#

i have been programing for 6 years?

#

...

#

hard keeping track

ornate pulsar
#

Right. I'm not saying you're not capable as programmer. It's just that judging by your understanding of networking, you may want to start with just that.
Take a little detour and get an understanding of the basic communication first. Once you've played around with that a bit, return to the messenger project.

#

Otherwise, I assure you that this will end with you copy/pasting a bunch of code that you don't understand, in which case you might as well just download an existing app

narrow oak
thorn mirage
#

ok

latent sage
#

Does anyone know if it’s possible to create a CNAME record to replace the given azure’s IP?

simple adder
#

Can someone please tell me the hex values assigned to these TLS cipher suites TLS_AES_128_GCM_SHA256 TLS_AES_256_GCM_SHA384 TLS_CHACHA20_POLY1305_SHA256

bronze rose
#

i know this is 2 months old but im kinda doing a similar thing but you can use netmiko for this and it makes it 100x easier lol

#
import netmiko
device = {
"device_type": "cisco_ios_serial",
# "username": "",
# "password": "",
"serial_settings": {"port": "COM3"},
"session_log": "my_output.txt",
'global_delay_factor':4}






conn = netmiko.ConnectHandler(**device)
conn.enable()
print(conn.send_command('sh inv'))
print(conn.send_command('sh env all'))
print(conn.send_command('sh post'))
print(conn.send_command('sh ver'))
print(conn.send_command('dir'))
print(conn.send_command('sh startup-config'))
print(conn.send_command('show vlan'))
print(conn.send_command('show ip int brief'))
conn.disconnect()

#

im glad im not the only person in the world trying to do networking automation stuff over serial in 2021

ember ledge
#

anyone good with sockets in python?

river steppe
#

Hello, I have a problem with sockets programming to

#

Anyone can help pls

indigo dirge
#

What is a socket?

dark trench
#

If you guys have any experience working with sockets and ngrok, I have an interesting problem I have not been able to solve combining django with sockets for networking between server and raspberrypi. Full question: https://stackoverflow.com/questions/69503197/ngrok-with-python-and-raspberry-pi

radiant vortex
#

But I’m also going to use serial cable as well for new devices

urban coral
#

i wanna program a chat room in python using socket programming
tutorials just host the server on localhost
wat if instead i wanna host the server on an actual server?? (n how to do it?)

steady horizon
#

You're going to need to host your server script on some hosting service and connect to the server's IP in the client scripts

urban coral
#

oh

#

ok

mild palm
#

what does this mean

#
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000017E88672100>```
#

I'm on windows 11

mild palm
#

but it works for someone else

#

same script

dark trench
#

If you guys have any experience working with sockets and ngrok, I have an interesting problem I have not been able to solve combining django with sockets for networking between server and raspberrypi. Full question: https://stackoverflow.com/questions/69503197/ngrok-with-python-and-raspberry-pi
Or Join
#code-help-voice-text

frigid escarp
#

Hi very important question. Does anyone know how to use wireshark? how do I find the number of packets sent between 2 IP addresses? Thank you

obsidian ice
#

can anyone suggest a good source to learn networking?

#

from basics

rose vine
rose vine
# obsidian ice from basics

So many sources bro...Youtube..google are good starts.. Learn the OSI Model. Learn subnetting. Learn layer 2 and layer 3 networking protocols..

balmy nova
#

what do u need help with

balmy nova
#

To start off I'd learn the OSI model, but not the TCP/IP model even though that is what's real, OSI has deeper understanding

mellow knot
#

Hi everyone is there a standard tool thats used for api documentation/design?

mellow knot
narrow oak
#

if you're using something like fastapi it has pretty good support with that and will generate api documentation automatically

mellow knot
#

I'm planning on writing the documentation for the core API first then developing it using the docs as spec

narrow oak
#

do you mean general restapi design patterns?

mellow knot
#

although I do also need to look into design patterns

narrow oak
#

I'd still look into openapi, theres also a "swagger-editor" which you can use to edit the openapi schema, there's also postman which is commonly used

#

im not aware of any "general" all-in-one solution, there are different tools for different parts of the job

mellow knot
#

how would you go about designing an api initially then?

narrow oak
mellow knot
#

thx 🙂

mellow knot
#

thats pretty much the last thing thats been tripping me up because I cant decide how I want to handle authentication

narrow oak
mellow knot
#

and I cant invalidate a single token

cyan igloo
#

Hey Everyone - stealth stage startup here with recently secured Series A... looking to bring onboard some Algorand devs with Python + Java experience 🙂 DM's open

mellow knot
#

I thought of maybe storing a randomly generated secret for each user instead of using a global secret that way I can change their secret when I need to invalidate a token

#

but everytime I look it up people say thats defeating the purpose of JWT's since its supposed to work without having to make any calls to the DB, ut in my case I plan to have only 1 DB linked to all my servers anyway

#

and then I also have to the issue with persistent sessions, I've seen the idea using refresh tokens but I dont see the point of it since I could just assign a token with no expiry date to serve the same purpose

dark trench
#

If you guys have any experience working with sockets and ngrok, I have an interesting problem I have not been able to solve combining django with sockets for networking between server and raspberrypi. Full question: https://stackoverflow.com/questions/69503197/ngrok-with-python-and-raspberry-pi
or join #help-pear

mellow knot
#

much easier to use the examples should give you everything you need in a few mins

dark trench
mellow knot
#

its different

dark trench
mellow knot
#

im saying try websockets instead of sockets you can achieve what you want a lot easier

dark trench
#

Like on a site

mellow knot
#

no it the client doesnt have to be a website

dark trench
mellow knot
#

it just has to be able to make calls to the websocket server so another python script can act as a client

unborn swan
#

hello, I'm writing a discord bot using a cloud IDE and everything is working. Now, I want to host the bot on my computer but I don't even know where to start. Could someone point me in the right direction, re: how to host a bot discord locally using python?

soft silo
#

what ip should i use to connect to the server

#

it is not localhost

soft silo
#

ok nvm

stark jolt
#

I'm looking for a TCP proxy

steady sage
narrow oak
mellow knot
#

I plan to have the tokens have an expiry date of 1week and on each request the client checks the tokens expiry date if its less than 1 day ask for a new token

#

what do you think of this approach?

#

this way I can invalidate a single token by changing that users secret (salt)

mellow knot
narrow oak
mellow knot
#

I'm thinking I could also change the salt every time I generate a new token this way if an attacker gets a users token, when one of them refreshes the other will need to sign in again

#

and I would know that the users token has probably been compromised

narrow oak
#

and once a token is expired the user has to enter all his credentials again

mellow knot
#

and one with a short expiry time that they will use for authentication

narrow oak
mellow knot
#

how is this more secure though?

#

is it because its being passed around less so its less likely to be intercepted?

#

I feel like if an attacker can acquire an authentication token then they can probably also get the refresh token

#

unless there is an attack I'm unaware of

narrow oak
#

if an attacker compromises a refresh token and then generates an access token then the actual user's access token would get invalidated by the server, so the user would require to enter his credentials again and then generate a new pair of access and refresh tokens

mellow knot
#

but this assumes that the user doesnt ask for a new token while the attack is happening

#

if the attacker waits until the user stops interacting with the server they have a window where this doesnt work

#

but the idea is similar to what I had in mind

#

I think what I could do instead is have tokens with 7 day expiry times but on every request I generate a new salt and a new token for the user

#

this way I dont risk anyone getting hold of the refresh token and the user will have to sign in on their next visit if their token was compromised

#

what do you think?

#

it effectively works the same way as the refresh token but without the issue with the attack window

#

only issue is I'm not sure how expensive it is to generate a new salt and token every time

narrow oak
mellow knot
mellow knot
#

I will store it in the db with their user info

#

so it only invalidates a single users token

narrow oak
#

I think your approach is probably just fine too

#

the whole point of jwt is thats it supposed to be "stateless", if you introduce some server-side state its just fine too

mellow knot
#

I'm thinking with my approach I can use tokens with no expiry time as well since it doesnt change anything security wise in my case from what I can see

mellow knot
#

with my approach the server still wont need to store any state about the user, it just has to be in the db

narrow oak
#

there can be problems if you want to introduce multiple devices of a sort in the future, then you might need to change some parts of the implementation though

narrow oak
#

if device b signs in then wouldnt that invalidate device a's token?

mellow knot
#

ahhh that is true

#

hmm I think what I can do is store a list of devices for the user

#

but to login with each device they need to type their password first

#

I would also need to store a salt for each of these devices

mellow knot
narrow oak
#

its not really a problem that the refresh token is trying to solve, thats more about the implementation detail of how a system uses jwt

mellow knot
#

I think I've figured a way around it

#

for each device the user signs in from store a salt related to that device

#

and in the payload have the device name so that I know which salt to use

#

instead of having to check against every devices salt

#

the salt is only 32bytes as well so there shouldnt be any issues with storage even if the user signs in to a lot of devices

#

@narrow oak do you know of some persistent unique value I can use to identify the device the client is running from though?

#

it doesnt have to be universally unique just very unlikely that two of the users devices have that same value

#

and it needs to never change

narrow oak
mellow knot
narrow oak
mellow knot
#

nice thats perfect then, if it changed I would end up adding a new device every time slowly storing useless data

#

unless I removed devices from the db after some time but I feel like that would cost too much compute for the storage its saving

#

thx for the help again, now my website is hopefully secure 🙂

dapper pulsar
#

any ideas how to realize P2P package distribution? any cool new tech that could be used to realize it?

frozen drum
#

bittorrent

thorny echo
#

What is a Subnet ?

ashen copper
#

You could ask that question to any search engine. Is there something in particular you're having trouble understanding about subnets?

carmine tulip
#

What does the q=0.8 mean in headers for a request? specifically in the accept parameter?
for example: "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",

#

This question I couldn't google 😦

#

the example has q=0.9 twice..

#

and q=0.8 once

ashen copper
#

I'm not sure why they used 0.9 twice, but the q parameter is used to denote preference - it must be a value between 0 and 1, 0 being least preferred encoding.

#

From the spec:

Each media-range MAY be followed by one or more accept-params, beginning with the "q" parameter for indicating a relative quality factor. The first "q" parameter (if any) separates the media-range parameter(s) from the accept-params. Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1 (section 3.9). The default value is q=1.
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

lusty ermine
#

Quality factor is something i need to research too

#

Atleast for now we know the value range

#

Im sure this value means different things for different webservers

carmine tulip
#

Ok; so random choices between 0.8 0.9 and 1 for scraping I guess.

#

The complicated part is parsing the robots.txt to make sure I am okay with the terms of service.... I wonder if there is a library for this that exists to parse robots.txt

bronze nova
#

@steady horizonAlr

steady horizon
#

I'm here

bronze nova
#

I get the classic timeout winerror10060

#

However if I ran the same code on my main computer I wouldnt get the error

steady horizon
#

🤔

bronze nova
#

If ip plays a role ill do some example ips
so my servers ip is 192.xxx.xx.1
and the clients is 192.xxx.x.254

steady horizon
#

Do your clients use the IP given by ipconfig (if you're on Windows) from your server?

bronze nova
#

I used ipconfig then just copied the ip

#

(in cmd)

steady horizon
#

I don't know what might be causing this then

bronze nova
#

Do you have any server-client networks that work I can take a look at them and see whats different?

steady horizon
#

I'm on my phone right now

#

Like, at a car

bronze nova
#

Oh rip uh

#

When will you be back home?

steady horizon
#

In no more than forty five minutes

bronze nova
#

Alright want to give it another shot in 45mins when ur back at ur pc?

steady horizon
#

Yes

bronze nova
#

Ok cheers dm me when ur back

steady horizon
#

Okay

soft silo
soft furnace
#

Hi everyone, I am trying to build a basic chat with sockets, but it will only work on my network. How can I make it cross network (two computers on different countries)?

<------------------------------------------------------------------------------------------------------------->
Server:

### imports ###
import socket
import sys
import time

### init ###
s = socket.socket()
host = socket.gethostname()

print(f"The server will start on {host}")
print("<--------->")

port = 64677
s.bind((host, port))

print("Server done binding to host and port successfully")
print("<--------->")

print("Server is waiting for incoming connections...")
print("<--------->")

s.listen(1)
conn, addr = s.accept()

print(f"{addr} has connected to the server")
print("<--------->")

print("Connected to chat server")
print("<--------->")
while True:
    # send msg
    msg = input(">> ").encode()
    conn.send(msg)
    # recv msg
    incoming_msg = conn.recv(1024).decode()
    print("Other: " + incoming_msg)

<------------------------------------------------------------------------------------------------------------->

Client:

### imports ###
import socket
import sys
import time

### init ###
s = socket.socket()
host = input("Enter the host name: ")
port = 64677
s.connect((host, port))

print("connected...")
print("<--------->")

while True:
    # recv msg
    incoming_msg = s.recv(1024).decode()
    print("Other: " + incoming_msg)

    # send msg
    msg = input(">> ").encode()
    s.send(msg)

<------------------------------------------------------------------------------------------------------------->

ember ledge
#

this looks so cool lol

clear bobcat
#

Also you need be accessible from different network (you need to have public IP)

soft furnace
soft furnace
#

I don't understand much in this subject

clear bobcat
prisma cobalt
#

i have a guide in pins

balmy nova
#

does anyone know why the loops are set? It doesn't make sense because there's no iterative values in the set variables

#

This is Scapy btw

ashen copper
#

What loops do you mean?

balmy nova
#

for loops

#

the list comprehensions

#

I understand why the middle loop is set

#

but not the first and last ones

ashen copper
#

I'm guessing that IP is returning a generator, so the comprehensions would consume the generator output

balmy nova
#

wdym generator

ashen copper
#

or if like me you prefer videos
https://www.youtube.com/watch?v=bD05uGo_sVI

Python Generators are often considered a somewhat advanced topic, but they are actually very easy to understand once you start using them on a regular basis. Actually, after you use generators for some time, you will often find them more readable and performant than other options.

In this video, we will look at what a python generator is, how a...

▶ Play video
#

The short version is, generators never produce all results at a time, they just produce one result at a time - so to print all of them, you have to greedily consume all of the things the generator yields first

balmy nova
#

so the index in the loop is set to just a decent amount for readable output?

ashen copper
#

List comprehensions do it implicitly, or you can do it with a for loop, or you can use next() passing in the generator to get each record one at a time

balmy nova
#

otherwise too large or what i'm confused

#

I'll look into it

ashen copper
#

I'm not sure what library you're using or I would give you some examples

ashen copper
balmy nova
#

I watched about 2/3 of the video

#

makes sense

balmy nova
#

I'm using the CLI version atm

ashen copper
#

Ok they're not using generators, this is some custom dark magic lol

#

IP object is not an iterator, yet it is, and yet again it behaves differently in a for loop than a comprehension. This is some wild stuff.

#

Ok so comprehension is showing the repr() of each IP in the /30, whereas str() does not return a nice output but instead raw bytes.

balmy nova
#

holdup imma reread that

#

/30 is CIDR notation right

ashen copper
#

Yep, that's why there are 4 IPs in the object returned when you call IP

balmy nova
#

I need to read up on subnetting one sec

#

again

#

I forget all the time

ashen copper
#

ngl this is a pretty cool library

>>> a = IP(dst="www.slashdot.org/30")
>>> type(a)
<class 'scapy.layers.inet.IP'>
>>> a
<IP  dst=Net("www.slashdot.org/30") |>
>>> type(a[0])
<class 'scapy.layers.inet.IP'>
>>> a[0]
<IP  dst=Net("www.slashdot.org/30") |>
>>> print(a[0]
... )
WARNING: Calling str(pkt) on Python 3 makes no sense!
b'E\x00\x00\x14\x00\x01\x00\x00@\x005/\n\x00\x00\x0e\xccDoh'
>>> a.show()
###[ IP ]###
  version   = 4
  ihl       = None
  tos       = 0x0
  len       = None
  id        = 1
  flags     =
  frag      = 0
  ttl       = 64
  proto     = hopopt
  chksum    = None
  src       = 192.168.123.456
  dst       = Net("www.slashdot.org/30")
  \options   \
cedar forum
#

scapy is neat

#

ipaddress in the stdlib is also cool

ashen copper
#

that's the one I've always used

cedar forum
#

!e ```py
import ipaddress

joes_addrs = ipaddress.IPv6Network("2a0f:85c1:23::/48").num_addresses

print(joes_addrs)

errant bayBOT
#

@cedar forum :white_check_mark: Your eval job has completed with return code 0.

1208925819614629174706176
balmy nova
#

I'm such a noob, is it common for a 16 year old to be learning this

cedar forum
#

you can do this at any age ¯_(ツ)_/¯

#

i'm only 18, I definitely used scapy before I was 16

ashen copper
#

idk but it definitely makes you way cooler than things like vaping

cedar forum
#

lmfao

balmy nova
#

fr

#

I'm gonna keep learning this

#

what is pkt?

cedar forum
#

it's just a generic name

#

what it's telling you is you can just do a[0] to display the packet contents iirc

#

rather than running a print

balmy nova
#

ah

#

the only irc i know is internet relay chat

#

I swear too many phrases

cedar forum
#

ah wait, I know what it's telling you

#

I think it wants you to call bytes instead of str

#
>>> str(a)
WARNING: Calling str(pkt) on Python 3 makes no sense!
WARNING: No route found for IPv6 destination 2a0f:85c1:23:: (no default route?)
"b'`\\x00\\x00\\x00\\x00\\x00;@\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00*\\x0f\\x85\\xc1\\x00#\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'"
>>> bytes(a)
WARNING: No route found for IPv6 destination 2a0f:85c1:23:: (no default route?)
b'`\x00\x00\x00\x00\x00;@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00*\x0f\x85\xc1\x00#\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
cedar forum
#

that reminds me I need to try get ipv6 working on this network again

balmy nova
#

ipv6 is whack

#

too much hex, and 6 octets like what

cedar forum
#

lol

#

ipv6 is honestly brilliant

#

you don't have to write addresses out in full

#

for example, 2a0f:85:: is a valid IPv6 address

balmy nova
#

yeah

cedar forum
#

I used to browse on that IP

#

but IPv6 is great, SLAAC is great and globally routable addresses are great

#

we still don't have ipv6 on uni network, but i didn't at home either

#

so I wireguard tunnelled to a nearby PoP that did have v6

#

and then used that

#

but wireguard doesn't work on uni network 😔

balmy nova
#

nerd talk

#

amazing

ashen copper
cedar forum
#

we've got a /16, so 65k addresses

ashen copper
#

amazing lol

cedar forum
#

but we have rnu out of those

#

lol

ashen copper
#

IPv4 shortage, sure

#

HOW

cedar forum
#

lol

#

i mean

ashen copper
#

how do you run out of 65k public addresses?!

cedar forum
#

we have 65k devices on our network and not everything gets nat'd

#

I think that the halls are now natted, but lab machines actually need unique public IPs

ashen copper
#

they know you can NAT hundreds of devices to 1 IP, right?

#

That's insane

cedar forum
#

yes - but these are machines that need SSH open and similar things

#

we have a huge number of machines that have need for public IPs

ashen copper
#

that sounds terribly unsafe

cedar forum
#

it's all firewalled

ashen copper
#

mhmm

cedar forum
#

NAT is not a security measure

ashen copper
#

true

cedar forum
#

even if the morons at the IRS claim it is

ashen copper
#

but inbound port forward is a security concern

#

I'd be amazed if all of those many SSH endpoints are secure

#

They ought to have a jumpbox instead and use a single IP

cedar forum
#

as far as I'm aware things are solid, it's firewalled so that things can talk between our campuses in uk and also in china & malaysia

#

we are moving to bastions yeah

ember ledge
#

Hey guys, I’m planning on becoming a networking engineer, analyst. Do I need a degree in computer science to become 1?

cedar forum
#

but i think realistically we'll move to v6 in a year or two

covert bridge
#

Hello kind gentlemen, This code isn't working for me. I have tried these alternatives
with open('user.yaml', 'r') / with open('user.yaml', r)

cedar forum
#

we're already moving internally

ashen copper
cedar forum
ember ledge
cedar forum
ashen copper
ember ledge
cedar forum
#

internships/apprenticeships maybe

ashen copper
# ember ledge Really?

I know several people who have gotten into network jobs with just a CCNA and no experience, and a couple of them are now engineers after a couple of years in local businesses

cedar forum
#

yeah CCNA is a good idea as well

#

though I guess that's a qual

ember ledge
#

Also, I’m in grade 11. I’m taking the Cisco CCNA course. Will that be help me in the future?

ashen copper
cedar forum
ashen copper
#

Everyone always needs more networking people

ember ledge
#

Right now I’m taking the ccnav7 intro to networks course

cedar forum
#

and for pydis we just don't use ssh 🤡

ashen copper
#

Also if you get into other CS fields like security, development, or system operations, having a solid network foundation will put you ahead of most people in many ways.

ashen copper
cedar forum
#

hahahaha

ashen copper
#

so jealous

ember ledge
#

Wait so what Cisco qualifications do I need? Do I need to take an exam?

#

I just really love networking

ashen copper
#

Yeah the CCNA exam

cedar forum
#

CCNA is the standard, if you want to be able to put it on your CV you need an exam yes

ember ledge
#

Oh, alr

ashen copper
#

As a student you can usually find free vouchers to take the test

ember ledge
#

Really?

cedar forum
#

yeah, there are a few things out there, make sure you are sure it's legit though

ember ledge
#

Ok

ashen copper
#

ah true there are probably lots of CCNA-related scams, just because there's so much money around it

cedar forum
#

if you do find somewhere to do work exp/internship they might also pay for exam, so that is another avenue, but I have heard of vouchers for free/reduced exams

#

cost without any sort of vouchers is around £250 iirc

#

which is actually quite low for an industry qual, mine cost uhhh

#

£14,000 in total

#

expensed on the taxpayer 😎

ember ledge
#

Wait so can u clarify sum for me? I can get a job as a netowkring engineer, analyst, etc, etc with just a ccna qualification, but if I had a degree in say cs what does that do for me?

ashen copper
#

That will probably depend on the HR department at the place you want to work, unless you want to work for the government in which case there will be explicit requirements for a degree most likely

cedar forum
#

some hiring boards set the minimum bar as a bachelors in cs or a similar subject, so there is more opportunity with that under your belt, not to say there isn't opportunity without, it just gets you through the door

ember ledge
#

Oh, ok

cedar forum
#

and yeah, gov requirements is another one, say you were non-US based and wanted to work in the US for a H1-B you need a bachelors

ember ledge
#

Alr, ty!

#

Wait which ccna exam specifically so I need to do again?

#

Do*

cedar forum
#

the exam is just CCNA, you'll need to find a testing centre nearby you that provides that and pay the fees/find legitimate vouchers

#

in the UK at least Pearson VUE is the testing centre I think CCNA is sat at

ember ledge
#

Ok, ok

cedar forum
#

just make sure you have done practice tests and score well and read CCNA material, it might be worth buying media that's put out for CCNA because if you do have to pay it's a lot of money to not get the qual

ashen copper
#

Where I live, you can get vouchers through the local community college with Pearson Vue

cedar forum
ember ledge
#

I mean I haven’t finished my ccnav7 course yet, but so far I’ve done 1 exam and I got 100 percent on it. We’ve also been doing packet tracer assignment which really enjoy and I’ve been acing on all of em

ember ledge
cedar forum
#

yea packet tracer is cool

ember ledge
#

I’ve also done labs where we configure real switches, routers, etc

cedar forum
#

that sounds very neat yeah, all good things to be doing

#

top thing to get into networking is have some sort of networking lab that you can learn and play with - even if virtual it's neat

ember ledge
#

Ye

ashen copper
#

vyos is a great free alternative to ios with a similar user interface, although Cisco is moving towards doing everything through web interfaces now and other madness like running containers on switches because (I'm pretty sure this is true) that company is run by the Joker

cedar forum
#

lmfao

#

vyos is neat

#

if you want to get into the nitty gritty like I did playing with BGP is cool

ashen copper
#

playing with BGP is cool
Careful, you might trigger any Facebook engineers reading this

cedar forum
#

hahahahah

#

yeah luckily if I mess up the only thing I bring offline is myself

ashen copper
#

I can go toe to toe with my director of network design on nearly everything except BGP. BGP is where I acknowledge that he deserves his salary of double what I make.

cedar forum
#

hahahahaha

ashen copper
cedar forum
#

hopefully I'll be present at a physical exchange at some point

#

can peer with some other real networks, not just virtually

#

that's when I become a bit cooler

ashen copper
ashen copper
# covert bridge Tried both. no luck

Here's a dirty one-liner I like to use:

data = yaml.safe_load(open("file.yml"))

It's dirty because it can raise multiple kinds of exceptions from a single line

#

which means I usually pair it with other dirty patterns like bare exception statements lol

ember ledge
#

Hey guys, when I finish my CCNAv7 intro to networking course will I get a certificate?

ashen copper
#

only if it involves an official test

ember ledge
#

It has official exams made by Cisco

ashen copper
#

Can you ask your instructor?

ember ledge
#

Then it has an official final exam at the end of the course

ember ledge
covert bridge
#

Thanks! I was able to see where I messed up on the first line.

ashen copper
#

It sounds like you'll probably be able to be certified, but the teacher will know for sure

#

What a great opportunity. I loved coding in grade school but my parents always said, "No one is going to pay you to sit at your computer and think all day." I'm glad it's taken more seriously these days.

ember ledge
#

Yeah. Ok so I’ve done a little research. Basically the ccnav7 course gets you prepared for the CCNA exam

#

If you also finish the course with a high score on your first try u get a huge discount on the CCNA exam

ashen copper
#

If you'd told me years ago that one day I'd feel dirty for working in education, I wouldn't have believed it, but wow that sounds like such a grift and so typical of modern "education" facilities.

#

That said, I'm sending you a friend request - no need to accept it now, but if you have trouble rustling up the scratch for that exam when the time comes, hit me up

viscid gorge
#

Hey, I am trying to visualize a network that constantly changes with python, I basically want to show 5-10 elements in an horizontal line and change the arrows from and to each element, example -

twin thicket
#

Hey all in your words how does python interact or is used in networking?

tawny moth
#

Hello everyone! How do I display the image from Google Earth by giving the valid co-ordinates in ".png" help will be appreciated!!

thorny echo
#

What is subnet ?

hasty quest
hasty quest
#

Usually a subnet is in the context of something like a routing table

#

lemme try and draw up a little diagram

#

Here's a small example network with 6 hosts on 2 subnets, 3 hosts on each subnet.

#

These two subnets are connected by a switch, which has 3 cables plugged into it.

#

I meant to name eth3 eth2, so lemme just fix that

#

When you see 172.28.0.0/24, there are two parts to this:
172.28.0.0
/24

#

the /24 is how long the network mask is - the network mask is a measure of how many bits of the address are used to identify the network.

#

The rest of the bits are used to identify the host.

#

So 172.28.0.0/24 is basically a range of IP addresses.

#

The first 24 bits (3 bytes) identify the network - the last 8 bits identify a host on that network.

#

In other words, 172.28.0.0/24 is the network from 172.28.0.0 - 172.28.0.255.

#

172.28.1.0/24 is the network from 172.28.1.0 - 172.28.1.255

#

Both of these subnets are part of the larger 172.28.0.0/12 network, which spans every IP address from 172.28.0.0 - 172.31.255.255

#

Though this network only uses 6 of those possible IPs.

#

When setting up routing tables, firewalls, and that kind of stuff, you can set up different rules based on which subnet a host is on.

#

In the case of our switch here, when the switch receives traffic for one of these subnets, it needs to know which interface that traffic should be sent over.

#

Let's say the switch receives traffic destined for 172.28.0.2. Which interface should that packet be sent over? @thorny echo

#

eth0 of course. And it knows to send it over eth0, because the routing table says to send all traffic on the 172.28.0.0/24 subnet over eth0

#

172.28.0.2 is on the 172.28.0.0/24 subnet, so the switch sends it over eth0.

#

Now let's say 172.28.0.2 sends a reply, and it sends that reply to 172.28.255.4

#

172.28.255.4 isn't on any subnet in the routing table - so the switch sends the response over to the default, which is eth2.

swift dove
#

So after fighting with Wireshark for almost 2 weeks, learning a bit on how to use it and learning the fundamentals of networking, I realised that what I've done is useless and I might need to learn something else to do what I need.

Has anyone here set up a transparent proxy? Can you recommend me what program could I use in Windows or Debian Linux to be able to get the https requests locally from my very own device?

clear bobcat
swift dove
clear bobcat
swift dove
errant bayBOT
clear bobcat
#

I used this few years ago this

thorny echo
#

so all that is Subnet right ?

#

But what is it purpose, and is subnet LAN, MAN or WAN or what ?

soft silo
#

what is the differences between s.send and s.sendall? is there a difference when i do s.recv in client?

ashen copper
zealous flint
#

Is it possible to have async and non async inter process communication? I have a flask webspp running snd would like it to interact with my discord bot, without blocking anything

narrow oak
zealous flint
#

Oh have one thread for the bot and one for the flask?

narrow oak
hasty quest
#

^ You don't need two processes for this, you can just make them the same program

#

default Flask is threaded btw

#

it's done that way so that one request can't block the whole pipeline of inbound requests if the handler is slow.

#

each can get equal scheduling prio

zealous flint
zealous flint
#

On the same program

#

I sssume that makes it easier to communicate

hasty quest
#

If they're the same program, then they wouldn't be an async and a sync program running at once.

#

But yes, you can absolutely run synchronous code and asynchronous code in the same process.

#

You may need and/or want to have a background thread which runs the async event loop

#

But I don't think you actually need that.

zealous flint
#

Ah okay, that’s probably what I’m looking for, I’ll do some more research on it and see what I can do. Thanks for the help!

hasty quest
#

It's probably the easiest thing to do if you don't feel like delving into how the event loop actually works.

zealous flint
#

Yeah I have a pretty decent understanding of how it works already, so I’ll also look into that

#

In case I need it

hasty quest
#
client = discord.Client(stuff)
def run_event_loop():
    client.run(my_token)
evl_thread = threading.Thread(target=run_event_loop)
app = flask.Flask()
evl_thread.start()

This totally works though

#

The event loop will just run in its own thread and chug along happily

#

All the async code related to discord will exec in that thread, but you can still send coroutines to the event loop from flask's threads.

#

There's also an async version flask, so if you wanted you could have a single thread with a single event loop which deals with both flask and discord coros

#

Up to you

zealous flint
#

i see here you only made a new thread for the discord client

#

why not one thread for the bot and one thread for the flask?

zealous flint
hasty quest
#

Flask will spin up additional threads on its own automagically, but it gets ownership over the original thread.

#

So there will be at least two threads. One running the discord event loop, and one running flask.

zealous flint
#

oh i see, i assume discord.py doesn't spin up more threads and so we can safely place it in its own

hasty quest
#

Even if it did, it still needs one thread to take ownership over in this setup.

#

Both threads could spawn as many child threads as they want.

#

But afaik it won't spin up any, it'll just execute within evl_thread.

hollow linden
#

im trying to send JSON over a tcp socket in a while loop, the first time in the loop it works but the second time it tries to send over socket it gives an error

#

sock.connect((HOST, PORT)) OSError: [WinError 10038] An operation was attempted on something that is not a socket

#

hm maybe i shouldn't close the socket until outside the loop

#

hm that didn't work OSError: [WinError 10056] A connect request was made on an already connected socket

#

nice i got it, you need to open and close the socket inside the while loop

#

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) inside the loop

prisma cobalt
#

you shouldnt be creating and destroying a socket in a loop unless its to a different destination @hollow linden, why delete it and recreate it when you can send stuff through it more then once

hollow linden
#

im a noob and this is the first way I got it to work, the destination is a video game listening on TCP port @prisma cobalt

hasty quest
#

make once connection and send a bunch of stuff over it

#

Close that connection when you're done sending stuff

#

best way

hollow linden
#

when i do that, the second time i send somthing it gives an error

#

OSError: [WinError 10038] An operation was attempted on something that is not a socket

hasty quest
#

On what line?

#

The error is telling you the problem. You've tried to use something which isn't a socket as a socket.

#

If I had to guess, I'd say you're probably accidentally overwriting the variable somehow.

hollow linden
#

oh i think i understand now

#

i have sock.connect((HOST, PORT)) in my loop

#

i can put that outside and just call sock.sendall( inside the loop?

hasty quest
#

yup

#

You only need to connect once, so you don't repeat the connect() call.

#

The basic idea of TCP is:
Two sockets connect
The two sockets can send and receive as much data as they want
The two sockets disconnect

hollow linden
#

awesome thanks, that worked. better to learn how to do it the right way

soft silo
meager crag
#

anyone know socketio with python?

clear bobcat
eager mango
#

When someone connects to my socket server, it sends the packets on connecting. But there is a problem. The packet sent to the user is too large, I mean it sends a large packet to the user who connected to it. Is there a way by which I can divide packets into smaller packets and then send them?

runic yoke
eager mango
#

when i send the whole website code to the browser, it wont load, and if i send small html code, then the website works completly fine

#

when client requests to the proxie server, the browser sends the headers to the socket server that the user just requested, and the socket server requests the website and returns source code of the website using requests module, that is just a socket server made with python, its just nearly 30 lines of codes. I want to breake packets into smaller part so that the browser can load it properly

#

or you can just guide me on how to make a proxy server in python completly from scratch.

#

Thanks in advance

hasty quest
#

A proper HTTP impl doesn't care about whether a request or response is broken up into many packets or just one.

#

The end of the request is indicated by consecutive new lines