#networks
1 messages · Page 42 of 1
to fix my problems
i did some digging
and research
and found an api in roblox from 2012 that doesnt ratelimit based on ip address
so
yeah
no need for proxies anymore
so now just simple questions
basically
b'HTTP/1.1 400 Bad request\r\nContent-length: 90\r\nCache-Control: no-cache\r\nConnection: close\r\nContent-Type: text/html'
im getting this
maybe i have this part wrong?
hi, do you know a library to do traversal nat ?
The get part isn’t a path because it gave me a 308 redirect
can someone give me a harder networking project ideea?
I want to create a wifi throttling tool
do you know how to write one in python?
for example, block or limit certain devices on my wifi
can anyone give me some pointers on where to get started on this project
Hey, can anyone explain me how i can make a python file on an extern server and how i can connect to this and use a funcion that is in this file on the extern server?
is there a way to get device names as well as MAC addresses in python
you can use the command shell for that. Just import it and you can write and read in the cmd
as i told you before
GET https://www.example.com/path HTTP/1.1 will not work with regular websites
only with proxies (and as far as i remember some older version of HTTP, might be wrong on that)
No I understand that
@ember ledge
so obv
But when I use the normal path
400 error is returned
It redirects me to that
We went over that before
?
It’s like 308 permanently redirected to
That link
try changing
Host: roblox.com to
Host: www.roblox.com
Ok
@ember ledge left me on read
A news report says that company XYZ’s network was attacked by outsiders, who apparently sent a lot of spoofed ARP requests/responses from remote machines to the company’s network, trying to launch ARP cache poisoning attacks. Please comment on whether this is fake news or not.
Can someone please explain this one?
Whoops
It didn’t work
I’m confused on the parameters
And also
That didn’t work
I didn’t just now try it since I’m not home but that was what I first tried
And it didn’t work
Gave me the redirect
I’ll try when home
all good now?
yes

how can i invoke something when a websocket send anything using aiohttp
hey
have you looked into the websockets with aiohttp?
like some sample code?
i found the answer
@ember ledge i was wrong there is still something wrong
i cant seem to send my parameters through a get request in socket
"Content-Type: text/html\r\n"
# "X-CSRF-TOKEN: {}\r\n"
# "cookie: {}\r\n"
"content-length: 45\r\n"
"\r\n"
"assetTypeId=8&itemsPerPage=10&userId=31797661\r\n"
"\r\n"```
i cut out the top line
alright
well
again
im dumb as shit
theres no need to put 9in the body
i just put it in the headers
nono
i mean
in the path
naughty
?
Wait, what ru doing with Roblox?
making a price checking bot
oh, alr
Heya, so I have 2 4gs wireless network hubs, from 2 diffrent network supplier
What would happen if I plug them both into a network switch?
Anyone know?
It'd work. "Hubs" (what I am assuming are wireless routers) need to be configured each manually though. I would really recommend not using two different vendors as it can be difficult to manage authentication. Its usually much better to have a single hub (or even better: a router that uses APs instead of integrated for wireless) that connects to multiple APs if you want to expand your range.
Generally you want Router > Switch > APs
I do have routers and aps actually In here
it goes 4G modem > Switch > ap
but here is the thing, i have 2 4g modems
that i wanna connect to the switch
and later in the future, i wanna connect a fibermodem into the switch aswell
(we dont have fiber yet in this old house from the 1960)
here is what my network is looking like atm
here is what i wanna do
@kindred flame
(if you are wondering why i have two routers conected in a series, i needed to isolate a projector in a meetingroom along with a printer so noone conecting from the AP's would be able to use the printer or projector for meseciues stuff, this was the only way i knew how without doing some weird stuff with the switch)
hi, i have a problem, when i download the package miniupnpc, i never get the files .py
Hi @Марвил#2376
G'day everyone! I'm starting a networking company, specialising DDoS protection and web-filtering for educational services, (Schools for example).
I'm currently looking for someone to aid in the development of some backend softwares. There are no prerequisites, as this is a learning experience for whoever wants to join. Although there are no requirements, a history in networking and web development are desirable. To discuss this further, including payments, please message me privately.
Here are the current services we are developing:
Minecraft DDoS Protection:
- Global network of distributed proxies, spreading the network of players across pools based on geolocation
- We already have the knowledge and resources to make a fully functional API and web panel.
Content Filtering:
- In the near future, we are looking at creating an educational tool, used to block certain websites that meet
certain filters. We have an idea on how this would work, we just need to put it into code and do some testing. On
top of this, the system will allow data allocation to specific accounts, have a live feed of tx/rx traffic, and
indicating whether is has been dropped or not.
HTTP/1/1.1/2 DDoS protection:
- Similarly to the Minecraft DDoS protection, we are looking at supplying protection to web-applications, such as
websites, APIs and countless other web resources
Hope to hear from you soon!
Mitch
i may sound like the you got any games on your phone? when i say this but.
How does a public server work and how is it possible to make my home laptop a server?
Better not to open ports on your personal machine freely.
You want to use the modems as routers? Do they even have that capability? If not, why do you need more then 1 modem? Of course adding more routers would work... but why?
A server pretty much is just a PC running 24/7 that has very little running on it except whats required. Laptops don't make great servers because of their thermals (and usually low specs.) Have you looked into a Raspberry Pi instead?
Actually looking into one. I want to know how it would be public to the world
If you only open the port to whatever you are doing, you need to setup authentication on that. It'd be about as open as your PC.
in networking, a client will always connect to the server first. never the other way round (it wouldnt make sense for the server to preemptively connect to a client right).
for a client to connect to your server you need 2 things
- an application listening on that port, like a server script
- the expected port needs to be open to incoming traffic
people usually get stuck on the second thing lol
I don't want to use the modems as routers
I just want better 4g cover in the house
It's a pretty big place
The only modem is a shotty 4g modem
I mean no you can't just hook up modems and have them act as access points, since the only way thats possible is if it was a modem/router combo. A modem connects you to the internet, you have to have a router to route through a modem.
I don't want to use them as wireless hubs! x3
fixed that
yes I am aware. I don't know if you understand all the terminology. AP = wireless access point, aka transmits 4g/5g, router = routes between devices, modem = connects from your coax or fibre to your home network.
I don't have fibre yet
thats fine
I have a 4g mobile phone modem
So
4gmobile phone modem is the only internet sauce
It connects to a switch
That to a few diffrent routers in the house
Okay why do you need 2 modems for 4g again?
Okay I was confused I thought you were talking about 4g wireless and not connecting to a cellular 4g connection
so with that cleared up: If the two devices are the same brand, odds are they have a way to pair the devices so they can have better coverage. Two different brands and you will most likely have to manually configure the devices.
No problems
My question is :what will the switch/routers do? Will they use both of og the modems, one. Both but switch between em?
So thats where the configuration comes in, if they are the same brand and you configure it correctly it will just swap when it needs to, using the best connection or when the other one goes out.
And when I connect a fibre modem in the future, what will happen
It depends is it the same internet provider?
Nooe
Then whats going to happen is that you'll be using two different IP addresses when the router routes your stuff out.
This can be bad if you are hosting stuff or certain brands that rely on having a singular IP might be not great. (Though assumably you won't need the other modems anymore if you are using fibre)
Oh yeah
That's the problem im having with this 4g modem atm
It keeps changing the antenn it's connecting to. And changing the ip
I csnt have a static ip
I mean the provider should be giving you a static IP
Oh thats right, the sim card has to be a special kind that actually has a static IP on it
Most sim cards just use whatever is available first
They are called static sim cards or fixed IP sim cards
I phones them about it. They said it's imposible since It changes thr antena depending on the connection
If thats what they told you then thats probably true
So there is no way to ssh my raspbery pi :(
You could python code something to send out to your other PC the current IP regularly 🙂
unfortunately whenever it disconnects its gonna change IP though probably lol
Its not great, but thats what happens when you don't have a ethernet/fibre connection
@ember ledge no more errors?
Some weird rate limiting on my aws
But
Nothing I can’t fix
Yeah everything is working
interesting... i'm actually reading an article on sockets from realpython. the problem is i don't think it's possible for me to upload scripts to the camera - is that what you meant with "the other side"?
What would be the best way to send some text between a nodejs app and a python app?
I am thinking about sockets
basically the nodejs app would send some data and the python app would parse and do some stuff with it then return some other data which would then be used in the nodejs app
Are sockets the best method for this?
or like some http rest api like thingy with flask on localhost
that sounds overly complicated
requests.post("http://127.0.0.1:5000/api/message", data="lmafo")
How do i print the data in a flask server?
How I can get the connection strength to the network I am connected to?
Afaik as long as you make some checks to make sure each party knows when to stop receiving, sure.
can someone give me a socket-networking project in python pls?
Something like skribbl.
Did you already do anything?
rat?
This is the exact usecase for DDNS
Yeah technically they could use zerotier, now that I think about it
remote administration tool
Can someone plsss tell me how to do step 4?
where do I put the cname
In the DNS server. Then with DHCP, you put the DNS server IP in the field
hello
I have a problem
in python code
print(gateway)```
this code return :
``` Default Gateway . . . . . . . . . : 192.168.0.1
0```
I want to delete
``` Default Gateway . . . . . . . . . : ```
and return
``` 192.168.0.1 ```
please help me
if you want to get ip there's a better way
Source code: Lib/socket.py
This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms.
Note
Some behavior may be platform dependent, since calls are made to the operating system socket APIs.
stdlib no need for install
NO I want default gateway ip address
hang on
socket.gethostbyname(socket.gethostname() + ".local")
it works on my linux
idk windows
but worth a try
my system is windows
yes
but it return my laptop ip
I want default gateway ip
awww packet tracer, i remember those days :3
I don't know of a good Python module for looking at your local routing table in a way I'd be "happy" with, so I think you are down to parsing system commands, which I'd always avoid if I could.
This Powershell command should return exactly what you want. The IPv4 default gateway. There normally only will be one, but in theory, there could be multiples.
Get-NetRoute -DestinationPrefix "0.0.0.0/0" | Select-Object -ExpandProperty "NextHop"
So something like
import subprocess
import ipaddress
response = subprocess.run(
[
"powershell",
"-Command",
"Get-NetRoute -DestinationPrefix '0.0.0.0/0' | Select-Object -ExpandProperty 'NextHop'"
],
capture_output=True,
)
# WARNING: This assumes there is ONE and EXACTLY ONE default gateway.
# Broken networks may have zero, and this will crash.
# Some more complex network scenarios, including those with redundancy
# and those with VPN's may have more than one default gateway. This should
# also be handled.
gateway = ipaddress.ip_address(response.stdout.decode("utf-8").strip())
print(gateway)
Not sure if this the right channel to ask this, but basically I have these 2 services (Camera service: reads frames, processes data, notifies PLC service about events, sends data) and Programmable Logical Controller service (PLC service for short: reads data from PLC, notifies camera service about events) and I need bidirectional communication between these two services. My current implementation uses simple threads / queues for inter-thread-communication - however my code is starting to get messy and it seems I need to seperate these two services. I keep reading but can't understand which of the three I should be using: rabbitMQ, Kafka or Redis for such task ?
Any suggestions appreciated
Hi, I am using netmiko to connect to real cisco switches/routers.
I am currently using time.sleep(0.1), ** Can I send commands to cisco devices instantly, or do I need the time.sleep?** if so, what amount should I wait in between each command?
Hi,
Does anyone know of a maintained/decent library to you for interfacing with Cisco Nexus switches?
Does cisco have its own python library?
is netmiko maintained?
I am trying to write a small monitor for my PTP status which I want to send to Zabbix - i was wondering if anyone has any recommendations on how best to do this? I have many switches on different subnets
Generally, after using send_command() Paramiko will wait until it sees the prompt again before sending the next command, so you shouldn't need a delay.
You can do send_command(expect_string="SOMEREGEX") if you want to see something other than the prompt as the thing to wait for.
I've found prompt detection mostly "just works", but if you go into router contexts with unusual prompts and the like, you can find it breaks.
hello, how do i fix a 403 forbidden when trying to access a docker running on a server port
I am so new to socket programming, i am making a chat application
Ques: if i am hosting on local network then to connect with others i need to have one port dedicated to all the person or i have to have one port for each person
You have to port forward, program your router to redirect incoming packets from a specific port to a specific ip:port in your LAN
Get the IP address of the computer you are using and make sure that packets coming to your router are redirected to the address of your computer and the port you open.
when i say your router i mean your WAN IP
you know the difference between WAN and LAN?
😅 lan for local area network and wan for wolrd area network?
Is there any vidoe u will suggest me to watch ? I have just seens some tuts ob python socket, and i am working on local onkine chat app with the tech with tim code as the basic understanding
U learnt from ..?
There was a guy here on the server, I don't know his name anymore
But i also took some networking courses
He teached me how to do it
they are not devices
LAN is a defining term
Define all devices connected to the same router in your home
WAN refers to all routers that are connected to the global Internet
😂 i am mobile network user, 😅 and i have nothing connected to wifi
It seems like i must clear my basics 😅
Anyways thanks, seems like a next level thing for me to work on
someone help, I made a code to check if the version of the program is the most up-to-date, in the case the code has a variable with its version and on the site it has the most up-to-date version, so my if is not working the way it was supposed to work even if the version that is in the var and the one on the site is the same it prints (version wrong) and if it is wrong it prints the same thing someone help pls
In vs code:
Versão_atual = "v1.2"
def teste333():
Url = "https://Teste.pontoio.repl.co"
conexao = urllib3.PoolManager()
retorno = conexao.request('GET',Url)
pagina = BeautifulSoup(retorno.data, 'html.parser')
print(pagina.prettify())
global versao
versao = pagina.prettify()
teste333()
print(versao)
print(Versão_atual)
if versao == Versão_atual:
print("version certain")
if versao != Versão_atual:
print("version wrong")
In replit:
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "v1.2" #versao atual da insim mais atualizada possivel
def run():
app.run(host='0.0.0.0', port=8080)
def note():
t = Thread(target=run)
t.start()
note()```
what python modules should i learn for networking after sockets
why are you using beautifulsoup and prettify
returno.data is exactly what you want
but you're parsing it as html then displaying it as html again
.
Thanks!
Cisco has a Mekarki API, I think they might have a Nexus API too.
But Netmiko works great. It seems to be maintained
not 100% sure though
is there any way where we can do reverse dns look up with multiple ip address?
In many yt tutorials i see that on server side they do an infinite loop and then after work is done they just closes that program
Python handles all this at its side but how can i close the server while closing the program
When i see the tcp connection i see that thise connection (server and client) are still established, i tried to end the process throught powershell commad but it seems like they dont closes but their PID number changes
@coarse leaf
So reclarifying the question so I know I'm thinking about the correct thing.
- You have a client program, and a server program.
- You fire them up and they communicate successfully using TCP.
- You terminate the server program (how exactly ?).
- You say the connection is "still established". I'm guessing this is by running something like "netstat -an" and seeing "ESTABLISHED", but I'm not sure.
"I tried to send the process throught powershell commad but it seems like they dont closes but their PID number changes"
That sounds like whatever program you are running restarts on getting the terminate signal from Powershell, rather than actually terminating, but I'd need to know more about the server you are running to know that for sure - as well as exactly what you are doing with powershell.
I dont have any idea that what i am saying is how much correct, it has nothing to do with powershell, i was just asking that in lots of tuts we see that we have server running in infinite loop waiting to accept connection, and when we are done we close the program which it still seeking for someone to connect, python might be handling all these on exit or killing th program, but i thought thay anyway i can close tgat while loop before program ends
.
Currently im very new to socket peogramming, so i am just implementing what i have learned and by methid of trial and errors refining the knowledge and understanding 😅
Aah too long
Idk i should merge client and server things or not cuz i making chatt app and idl how to have connection for duel or multi person chat
That is a lot of code and I'm, still not sure exactly what you are doing. Might be better to put it up on github or something if you want people to be able to read the whole thing.
@short raven Not sure if this is the question or not, but if you want to have some Python code that sweeps an address range for reverse lookups, you might want something like this :-
import ipaddress
import pprint
import socket
# Nonexistant DNS servers cause timeouts.
# If I was doing this at scale, I'd want async code.
socket.setdefaulttimeout(1)
def reverse_lookup_range_v4(iprange: ipaddress.IPv4Network) -> dict[ipaddress.IPv4Address, str]:
resp = {}
for ipaddr in iprange:
try:
resp[ipaddr] = socket.gethostbyaddr(str(ipaddr))[0]
except socket.herror:
resp[ipaddr] = False
return resp
def main():
lookups = reverse_lookup_range_v4(ipaddress.IPv4Network("195.66.226.80/29"))
pprint.pprint(lookups)
if __name__ == '__main__':
main()
This returns the following, which might be what you want ?
{IPv4Address('195.66.226.80'): 'lx.borwood.net',
IPv4Address('195.66.226.81'): False,
IPv4Address('195.66.226.82'): 'linx.vqbn.com',
IPv4Address('195.66.226.83'): 'ge-02-tfm140-q05-bor01.tfm140.synety.net',
IPv4Address('195.66.226.84'): False,
IPv4Address('195.66.226.85'): False,
IPv4Address('195.66.226.86'): 'lan.probe-edge5-thn-lon1.linx.net',
IPv4Address('195.66.226.87'): False}
can anyone tell me what threading module is in python?
threading is a module which lets ur program do multiple things at once, without the threading module u can imagine ur code as a single car moving from left to right, but when using threading u can imagine it as somewhat like, multiple cars moving from left to right, another example, without threading u can only have a single while loop running in ur code at a time, with threading u can have multiple while loops running at the same time
hope i did a somewhat reasonable explanation of what it is
so threading word means like doing multiple things running at once?
yep
also
when I am learning new modules should I write functions of such as SOCKET
there can be really big list of them
And some will be good for revision or reference?
Written NOTES I meant
sorry im not so sure what u mean, im somewhat of a beginner, i just happened to know what threading is 💀
apologies
ah well
u can if u want, it can be useful bc sometimes u may happen to forget smth, its a lot of information so forgetting things isnt that uncommon
im also writing notes sometimes i recommend it a lot tbh , can be hella useful
was just wondering people say its not efficient but written notes look good
i would say its not efficient if u write too many notes, bc u know u cant rlly memorize everything, so writing every single thing u learn is a sort of a waste, maybe write the things which are more complicated/hard for u to understand so u can try to understand them from reading ur notes again and again
just simple two liners will be good for me
for example
yea that for example
yeya something liek that, quick notes yk
yea
I am not buying books for that
xdd
nah but books can be hella useful too
especially for specific things like networking/automation shit like that, theres some specific books which are perfect imo
for learning specific things
ofc, see ya
now imma write down my question
Using the SMTP library, is there any way for me to check if an email ive sent has been sent successfully, for example when using the requests library u can do things like
``import requests
x = link
response = requests.request("GET", x)
print(respnse)
Response [200]``
can i get something similar with the SMTP library ? when i send an email can i check if everything was received/sent without problems ?
thanks in advance

@zealous flint yo ;-;
is it a problem if i ask u for this ?

Yes?
umm this
any suggestions ?
apologies if its a dumb question
I haven’t worked with the smtp library before, so unfortunately no
Though it’s worth seeing if there are APIs to do this that way what you did with the requests library might be possible by observing the HTTP response code
hey I am making a project in which I need what ports are open on a website but it takes 3 min for me to check the ports, is there a fast to check ports in python currently I am using socket module
does anyone know why this payload is encoded? and how to decode? its surely not in base64
Zlib compressed packets can look like that
.decode("utf8")
Is this community about networking with people, or web stuff
I think the word you're looking for is channel and not community? Community would refer to the whole server and maybe even its associated projects. Only this channel of the Python Discord server is designated for discussion on "Discussion on network protocols, technologies, hardware with relation to Python"
web stuff (HTML, CSS, JS, etc.) goes specifically in #web-development
this is more for TCP, UDP, IP packets, DHCP and that kind stuff
and no, it's not a channel for meeting and making connections with new people, you can certainly do that in the server in general, but there's no dedicated place for it since well.. I think just participating and discussing on topic stuff is good enough at forming connections
Woow I'm speechless dude, I didn't even expect this elaborate answer, I bet you are a dude who answers questions in stackoverflow and other forums. Much respect dude. It made me feel better 😊
Btw do you by any chance want to be friends or acuatence
I don't really answer questions on SO but I've done support work for programming communities (mostly as a maintainer of the black autoformatter) before so it comes somewhat naturally nowadays.
Dope, but if you asked me I'm starting to step in this programming world, and they suggest to learn python as the first language so I'm in. Currently on day 10 out of 100
Any way to decode?
And encode back again
Use the zlib
Its actually been sent to server as payload content, so copying and pasting to decode will work?
Sockets
Hi, I'm trying to use socket library to send RAW packets with their own headers. I trying to establish a three-way handshake with it. I already have sent the SYN packet but the server doesn't respond. In Wireshark I saw that packet arrived at the server, but it still doesn't want to establish the connection. Is there someone who knows how to help me?
I was wondering if it is because I use the wrong calculation of checksum, but I'm not sure about it.
Inserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socket.SOCK_STREAM means sending data via TCP, right?
Yes, basically.
The question with woth context to python socket where server is listening forever i want that it should turn on or off as per my wish, like usih tkitner button to turn it on or off
You'll have to delegate that to a different thread or process, and figure out how to forecefully kill it, altough who knows what complications if any may arise.
A much better option is to make the server async, and simply remove the server's socket from the monitoring list when you don't want to accept any more connections. But that'll require you restructure the whole thing from the ground up.
A simple yet reliable option will be to make the server socket nonblocking, and add the required exception handeling and flag checks.
😓 well it seems like some adjustments has to be made, i wonder how the real life examples works or they might be too complex
What python modules do I learn for networking besides sockets
Hi i'm trying to do this but everytime i receive
Hi @fringe aurora , i hope to explain you correctly and please anyone correct me if i wrong. SMTP is a protocol for sending email to a mail transfer agent (MTA), that could be your local email server, o a 3rd party service like Sendgrid i.e. So the only result you can get is that the next MTA received the email you sent, but if it reaches the destination or not should be checked on email server
thanks for the reponse!
im not quite sure what to make of this message tbh, somewhat confused
i understand what u are saying, hope theres a way to see if the email was sent correctly or not
if it threw an error each time the email couldnt be sent i could Just use try, except but as far as im concerned it doesnt throw any error
so im left guessing if the email was sent or not
i need to check if it was sent by going on Gmail.com and actually checking there
I'm assuming you mean you have some sort of a home network and you want to expose your service listening on a port inside that network to the internet. In that case, the only IP address exposed to the internet is going to be your router. In order to get traffic to a service running on your computer inside the network, you need to configure port forwarding. Lots of routers have this available from their admin interface. So, you would configure say, port 8080 on your router to forward traffic to port 8080 to your internal network IP of your computer (say like 192.168.1.xxx). So out on the internet, a client would just connect to your router's IP at that port and all traffic would go to your computer.
still thanks tho
hope i get a response

I think i got the sol6 not very much direct but still useful
socket.settimeout() fn it raises error after the given amount of time inside that servee.accept() of no connection connected
.
The nect question my mind raised that is this oky for program to do try excpet thingy inside an infinite loop?
Why would it not be?
it is but bear in mind it may lead to design patterns that are prone to just getting stuck if things break
e.g. say you try to perform an operation inside a try block and it's erroring in a way that will never fix, if you just except and handle the error every time it will keep going forever
Dont have any answers to that but seems like i alaso dont have other choice
Let's say I have a server that receives data from clients in a separate thread. I want to send data from server to all clients at the same time, do I have to create another thread or it's not necessary?
What ucan do is to store connection s and then use a for loop to send to all clients
What if I use another thread to send data to the specified address, every time the server has to send something, is it better or not?
i had no clue where to put this
so whenever i make a google account i need a required id
i disabled cookies and also checked through the html and... idk it's nowhere to be found
i guess it's server side? here's some screenshots to help visualize
everytime a digit is appended to the front whenevr u run a request to googles api
anyone know how to find this number, or at least what it is so I can do more research because i can't find anything lmao
You can't really send to all of them at the literally the exact same time, you're at the whim of your platform's kernel, and all the underlying OSI layers.
But it should never be a problem
Anyone have example code for Nat punch through for p2p that works? I can only find an MIT whitepaper and non-working examples on github
Idk but if i were u i try to ise threads less
Untill there isnt any other option
If AWS load balancer have 503 Service Temporarily Unavailable, can I redirect it to 3rd party url like github pages?
is the 503 coming from the load balancer itself
or the server it protects ?
The server it protects
Anyone interested in developing an advanced Restaurant POS using Tkinter?
Hi, does anyone fancy helping me make the backend of this website https://www.subnet-calculator.com/subnet.php?net_class=A
Networking knowledge will be very beneficial. Would rather work on something in a duo // team rather than alone. Once we have backend setup we can make frontend if that is something someone is interested in (Either tkinter or Flask)
DM me if you are interested. I have some of the basics setup already.
OOP knowledge is required.
I was thinking that using sockets required also using threads
Aah if u lnow what th reason behind usong threads then u will understand the reason to ise thread
which type of load balancer do you use
Elastic Load Balancing supports the following types of load balancers: Application Load Balancers, Network Load Balancers, and Classic Load Balancers. Amazon ECS services can use these types of load balancer. Application Load Balancers are used to route HTTP/HTTPS (or Layer 7) traffic. Network Load Balancers and Classic Load Balancers are used t...
Points to a ec2, so application?
What is socket programming?
Hi guys.
I'd like to translate text in different languages, but want to keep the network traffic anonymous/ offline. Any ideas how to do that? For example push that trough tor etc.?
The act of using sockets in your program.
Anybody an iptables wiz here? I have an application where I need all outgoing traffic on a certain port to be routed to a different NIC
"A socket is a communications connection point (endpoint) that you can name and address in a network. Socket programming shows how to use socket APIs to establish communication links between remote and local processes." - Google
This is a basic introduction to the Internet protocols and how to use them in programs using sockets.
This is the first of two introduction videos on the Internet Protocol and its family of associated protocols (UDP, TCP, etc.) as well as Sockets, a pseudo-standard interface made for programmers to write programs which use these protocols.
The...
Are those losten and accept are connected in some way woth each other?
Can i close that listen cmd
If yes then will that affect accept method?
does anyone have a list of us based proxies
What's a good project for Python networking?
Where I can find python for network security community?
Where can I learn everything i need about the networking. I know some because i keep testing but still don't understand
It depends on what kind of networking you want to learn, if you want to learn general networking, cisco netacad is a good place to start. If you wish to learn python networking, start looking into libraries such as sockets
Thank you,
Does IoT falls under Networking ?
I will take a look in both of them!!
In my opinion it depends on how you want to set your network up but IoT mostly comes with some kind of networking that you have to do, right?
Couldn't you use an offline python module? Then there is no traffic?
any ideas which I could use?
I saw one on GitHub a min ago lemme find it quick
Here
I haven't personally used it yet, but I've got a good feeling it's pretty good considering its got 2k stars and its own GitHub account.
thx :pepusclapo:
Hi guys, someone already installed owncloud in NAS Synology here ?
Hey @ember ledge!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
import math
import time
import turtle
#variables
name = input("whats your name")
age = int(input("whats your age"))
height = float(input("whats your height"))
weight = float(input("whats your weight"))
birthday = input("when is your birthday")
print("processing data...")
time.sleep(5)
print("Welcome"+name)
print("Your "+str(age)+" years old")
print("your "+str(height)+"ft")
print("your "+str(weight)+"lbs")
print("your birthday is on"+str(birthday))
#if statements
if age <= 18:
print("Note: your young")
elif age >= 18:
print("Note: your a adult")
if height <= 5.6:
print("Note: your short")
elif height >= 5.6:
print("Note: you are built for basketball")
if weight > 130:
print("Note: your god")
elif weight < 130:
print("Note: your a baby")
first project
hey
i think my ISP blocking me from connecting to a proxy
dose someone have a solution
You're*
funny
Hi, i'm getting errors with Netmiko
the first one is
socket.timeout
and the second one is
netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.
Could anyone please help me understand what they mean and how I can avoid them?
is this for a cisco switch? if so do you normally type in the enable password
I found out what’s causing the issue
But I have no way to fix it
So the command I was sending, was “interface range” and then it would use a list of all the ports
hi guys
But, my switch has 1 x FastEthernet and 28 x GigabitEthernet
So because they are different types, the switch gives an error straight away
The only other option I saw was to go through the list and send 28 commands “int g1/0/1” “shutdown”
The names of all the ports are obtained through the switch/router, I wouldn’t know what they are before hand
My program is Graphical user interface for Cisco IOS
So it has to be dynamic
if you can save the results to a csv file and then you can then use that file to select ports that have a Gi on the interface name. there’s a module called TextFSM that can store results of show commands in a yaml format. you can save this result and then load it and select only interfaces with Gi in the name
Oh yeah I use text fsm
that’s what i’m thinking, i have not had the chance to use it other than youtube guides and blogs
Thanks for the suggestion, but if the device connected to only had FastEhternet interfaces it wouldn’t work 😦
This part all has to be automatic too 😦
well what i was thinking is a CSV file with the switch/router name or ip in one column. then the interface in the next column. then it’s possible to load the values and if the value matches Gi then use the int Gi command. if it has Fa then use the int Fa command.
i do something similar with a CSV with pandas. though it is for Meraki devices. if my meraki device name on the CSV file has AP in it. then i loop through all the rows with AP and configure them as i have to. if the name has SW for switch then that has its own set of commands
i haven’t tried something like this with netmiko so i’ll try it out on my spare time
123
hello guys, i want to learn some networking stuff, i only find the socket module too hard.... is there another easier module with about the same possibilities???
You could always try aiohttp or requests to mess with rest apis
yeah
greetings, any idea how to find my router config website on Windows? when I type IP of default gateway, router config website does not show and address is not recognized. I tried nslookup by IP but didnt work (yes it works for domain name).
So how can I check domain name of 192.168.1.1 for example?
please ping / reply once someone got some clue, thank you
i have a list of url to test if they are 404
how can i do that
just checking the response, but not fetching any resources of the webpage
I think you can do it with cURL
thank you
How do i send a string over a socket?
i already have a connection using socket.connect_ex() (and socket.bind() on my server) and it first does a speedtest and then it tries to send a string with socket.send(stuff.encode()) but then when i do py data2 = conn.recv(1024).decode() print(data2)
it just returns a blank line for some reason?
'stuff' is just literally a string
okay after a little 'investigation' it seems like the bytes are not being sent at all for some reason?
i have no idea why
for some reason it sticks it to the end of the previous send message even though it is in its own parameter, is there a way to tell the server to end the message and start the next one?
all google tells me is how to handle multiple clients 🙃
fixed the previous issue, it was stuck in a loop untill data ran out. Now the problem is that i have to break out the loop in another way than just py if not data: break
but i tried just doingpy #Client: s.send(b'e') #Server if data == b'e': breakBut if i do this e != e according to how the code runs? I tried decoding it before checking it as well but that also doesnt work
Is it uncommon to get "too many open files" errors when using aiohttp on linux? Would this vary by distro? I'm reading it's related to the number of available file descriptors, but I don't know what that # would have to be to support 100 semaphores
I ask about distro because I never had this issue on ubuntu but just got buried in errors in Debian
does socket.send combine packets or something? Because for some reason when i do multiple sends it arrives as one
Basically yes, Nagle's algorithm is a contributing factor, however even if you disable that the issue won't really be gone.
While yes Nagle's algorithm does buffer outgoing data if the last batch wasn't acked yet,
the problem is that you're reading an arbitrary amount of data with each recv call.
I can't stress enough how bad of an idea that is.
You can easily end up reading more than you actually want to, and you still have to deal with premature returns.
You can send a million bytes indivisually, then read them all at once.
There is no notion of packets on the level of the program TCP is serving (No ,tcp segments is another story)
Eitherway you can't guarantee when the data arrives and how fast your os and the actual recipient program will react to and handle it,
there are a lot of tiny factors you can't really control.
You're simply not supposed to use sockets like that without any real application protocol to circumvent these issues.
Anyway to fix the issue you can use headers of your own or go down the more painful path of termination characters and even more buffering.
With that said, I highly recommend these, for they will demistify the magical aspects.
https://www.youtube.com/watch?v=C7CpfL1p6y0
https://www.youtube.com/watch?v=kCuyS7ihr_E
https://beej.us/guide/bgnet/
And if you're intrested in what the hell it is that TCP is actually doing, you can't go wrong with the wikipedia page.
https://en.wikipedia.org/wiki/Transmission_Control_Protocol
can i make a proxy server with python?
So I'm making a tcp chat server and im in the design phase at the moment for the protocol Im going to use. I want the server to only accept 1024 bytes and check message length, but the 1 issue Im having is packet fragmentation. Im not really sure how to handle this and what protocol to use to prevent errors from 3rd party streams etc
Im using asyncio so i cant just see if the the message is still sending aswell since Im awaiting on it. Im not sure what to do at this point as Ive tried many things
yes
Can someone help me with try except please? I am trying to catch a TCP connection error using except ConnectionRefusedError: my understand is this way I can display custom message to the user, but instead I am getting a track back :
except ConnectionRefusedError:
print(f"\n{Fore.YELLOW}CODE HERE\n")
continue
Traceback (most recent call last):
File "C:\Users\cischology\AppData\Roaming\Python\Python39\site-packages\netmiko\base_conn
ection.py", line 1021, in establish_connection
self.remote_conn_pre.connect(**ssh_connect_params)```
Whats the difference between an ethernet address and an ip address?
Does anyone know of a good way to check the traffic of one single python script?
Ethernet is local, IP can be local or the internet, assigned by your ISP or router.
Wdym by local?
Your local network. Like your WiFi network
Is it like a Mac address?
No MAC is assigned by the manufacturer of the hardware but ethernet does send data using the MAC address
So if ethernet uses MAC addresses to send data whats the point of ethernet addresses?
MAC addresses are something entirely different than ethernet addresses.
What layer of the internet uses ethernet addresses?
Hey @ember ledge!
It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
Here read this: https://ufile.io/f/g2csw
Two good books for you
Thanks!
you probably want a try except block that covers all the code
or maybe override the sys.excepthook (don't, do that as your last resort)
/shrug
Can you please elaborate more?
who use sockets?
Netmiko does 😀
I have a specific question that has to do with php SQL Server and python
Im want to setup a sql server in an enterprise server and not have to pay a service to do so. Do i need a service to send sql data through php to that server or do I not need to? And in addition to having the sql, im going to install the sql python connector. Would I need to use sockets to connect to the sql server or no?
I think u can do it with a raspberry pi
If it’s a small project
Technically it's a small project but I have access to an enterprise server and want it to start growing
It's a school project
I just want to send data through ip address using php and don't know if I need a service to do so or if I don't
U don’t just to use php
Im sending data through html forms to the ip address for the sql server
Tbh I don’t rly know but I do know u don’t need to pay for php on ur own server
can someone help me with socket programing. Im making this chatroom and im trying to get the clients to communicate using defined functions instead of input
hi, can anyone suggest me an library for audio transmitting over network other then portaudio based?
You say that as if input isn't a defined function, what do you mean?
what i meant by that is, the clients dont take input to communicate over the socket but instead they call a fuction to generate a suggestion and response
no input from the commandline, i run a client by providing three parameteres. IP, port and name . Dending on the name, for example if it is a host it suggest an activity and if it is a participant with a name then it would respond to the suggested activity
Hi, I wanted to know how I can build a tool to download incoming video and audio streams using as few libraries as possible
is there any apis for tts
Is there a command like
journalctl | grep -Ei 'dhcp'
But to see ipv6 dhcp leases?
Using a for loop to list through a list of data to Post to a website using s = session.requests(), but I've noticed that it seems to cache the data and somehow keeps sending the same exact data instead of the next one in the list. What can I do
Can I see raw data packets through my OpenVPN
If so, how can I disable that
raw as in decrypted
What’s the best way to mitigate a ddos attack on a 1gps home network? And I’m saying small ddos attack around 10gbps. Like what would I need to install/setup to prevent issues like these?
why would you be getting DDoSed
can someone help me im doing an auto update bootstrapper for my application, but how could i handle this if the files name are changed and but it will still find the files and replaces them?
(idk where to ask this question lol)
What if you just override the s variable with a new fresh session
That's what I do, the for loop starts with s = requests.Session()
ah could idea, I'll try that.
i'm trying to make a socket server work with also the webserver, i have the socket server on another thread, but when i try to push it to heroku doesn't seem to work as i expected
just curious but i figured out. You cant mitigate a DDOS attack at home, you basically need to have alot of bandwidth to withstand a DDOS attack
you mitigate it by never leaking your home ip to others, you can use something like cloudflare to proxy everything through their servers
We're making a chat app that works using http requests and mongodb (Server and Client)
Anyone would like to help
guys i wanna change my ip address every minute in opera gx, we can do it in Tor browser but can someone guide me step by step, i'd be reallly happy and it would make my day, please
do you have a repo I could look at?
would you like to help?
any good hosts for FastAPI webservers?
Guys
I Wana ask something
Python modules like scapu
What do I do to understand completely how they work
And how theyre coded
Where do I see the code?
How does the third and second layer of the internet interact?
could anything other than ufw be blocking connections? ( canocal ubuntu)
What would make a linux VPS start burying me in "Too many open files" errors after about 1000 requests with aiohttp when I'm not actually writing the responses to disk?
Would this be different on Debian vs. Ubuntu for any reason?
I worked very hard on this script and now it suddenly started erroring out
Hey everyone my name is Tony! I am a sophomore in college and am currently working on a social media/ NFT app. I am looking for potential programmers who might be interested in joining this project. This is a very ambitious project! DM me if you are interested.
Code:
@app.post("/register", dependencies=[Depends(_check_admin)])
@limiter.limit("5/minute")
async def register_user(
request: Request, username: str, password: str, license_key: str
) -> dict:
"""
[Admin]: Register a user with a license key.
"""
# Find Profile
exists = await user_db.find_one({"username": username})
# Return Error if Exists
if exists:
return {"status": encrypt.text("This username already exists.")}
# Check License
license_key = license_key.upper()
license_exists = await license_db.find_one({"license": license_key})
# Return Error if License Invalid
if not license_exists:
return {"status": encrypt.text("Invalid license.")}
# Proceed if all checkpoints are valid
await license_db.delete_one({"license": license_key})
await user_db.insert_one(
{
"username": username,
"password": password,
"hardware_id": None,
"hwid_resets": 0,
"note": None,
"datecreated": date.today().strftime("%m/%d/%Y"),
}
)
return {"status": encrypt.success()}```
Error:
response = await func(*args, **kwargs) # type: ignore
File "/home/ubuntu/ascend-api/main.py", line 284, in register_user
exists = await user_db.find_one({"username": username})
RuntimeError: Task <Task pending name='starlette.middleware.base.BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.coro' coro=<BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.coro() running at /home/ubuntu/ascend-api/env/lib/python3.8/site-packages/starlette/middleware/base.py:34> cb=[TaskGroup._spawn.<locals>.task_done() at /home/ubuntu/ascend-api/env/lib/python3.8/site-packages/anyio/_backends/_asyncio.py:629]> got Future <Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.8/asyncio/futures.py:360]> attached to a different loop```
Any idea as to what could be causing this?
😭
Hi guys
I have a very bad issue with my program ( I created it into an exe, that's when I got issues)
I am using Netmiko & TextFSM
I tried importing ntc-templates but it didn't help
**How do I set the environ variable and what do I set it to? Could someone please help me? **
any help is greatly appreciated
Update: I think it fixed it... I sent an evrion variable and the new exe I made works fine 🙂
#help-cherries <-- little bit of networking troubleshooting
u should be able to do that
Hello there 🙂
Not sure this is the perfect place for that, but I need a little help on a request problem from a django app to fitbit API --> #help-rice
Hi, I'm a student looking for a Software Developer internship. I have experience in MERN, Flask and a bit of ML and automation with python. I'm looking for an internship in a product based company. My colleagues and friends are based in a service based company so I'm looking to cold email for referrals. I need some guidance to find people that are based in those companies and Is there a way to write eye catching emails including the subject that I can send to them?
Hello
I'm looking for help with getting free proxies with python api wrappers
Reply if you can help
Disclaimer: this is not for fishy purposes this is just because I am building a website and I want to test traffic management and how I can filter out bots using ML
do routers act as a wireless acsess point for devices?
eehhh if u dont plug in some ethernet wire in it
ah okay
A home router is normally also a wifi access point. On a business network the two are normally seperate
Can anyone suggest some books for networking
It really depends on your goal... if you're starting from zero and just want a survey of practical concepts, any study guide for the CompTIA Network+ exam could be worth reading
ohh ok thanks
The one by Mike Myers is pretty good
Oh ok
Hello, I wrote a snake game in python and I want to move it to the web with html, how can I do it?
You can either go with Django or flask
Python frameworks
Oh
Nvm
I read it wrong
I want to host a simple flask api from my pc for short term. Tried to port forward and quickly realised that I am behind a NAT connection! So then I got to know about uPnP and was trying it out to expose my api through that but it doesn't seem to be working. I am on windows 10 and using UPnP Wizard to set-up port mapping. Have any knowledge about this then please help 😄
I am trying to connect to my api by requesting http://my_pub_ip(found on google search):port/
Hey @inner latch!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
anyone want to help me with a project I'm working on for my 10th grade computer science class? its not too hard I just don't quite understand it yet. dm for .py file
ok
Hello, Guys Good day..
This is Kirankumar from India. Having 6+ years exp. in Networking.
I have started learning Python recently.. I wanted to know the Python for networking and python for data science or developers is different..
appreciate anyones guidance
Thank You in advance
Google dorking is your friend
Isnt that a crawler thing
It’s a way to find things easier
Suppose i wanted to find HTTP(s) proxies without spending hours of research I can just make a google dork like the following:
“Proxy” “8080”
please help me, how do I forward port 10010 from the locale to the global Internet?
Router Settings
Where?
Ask your VPS provider or possibly use a vpn with port forwarding capabilities
Oh yeah i didnt think of that
Thanks a lot
anyone?
@cold charm ngrok?
I know about it, but i wanna learn and make UPnP work
hello
thank you
hey guys! I'm trying to solve a CTF problem that requires me to send server ('localhost', 10000) GET_KEY to retrieve key and then to reverse the key and send it back to server to get a flag
Here is my code
import socket
def reverse(string):
return string[::-1]
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('localhost', 10000))
client_socket.send('GET_KEY'.encode())
data = client_socket.recv(1024)
send = reverse(data)
client_socket.send(send)
but im not getting the flag, so my code is wrong somehow. Does anyone have a clue why?
can you connect a router to a router, without access to a router?
example: i’m going to a hotel which provides internet (via wifi), it doesn’t provide ethernet sockets
i want to take my own router and connect it to the hotel wifi, so that i can setup my smart home products like philips hue, etc
Guys on cidr/17 do we got here only 1 subnets? as all the ip addresses begin with the same 17 bits.
what is better? sockets or websockets?
they are different things :) websockets use sockets, they are based on http
Code:
i work for a financial org in the network security team but we have certain apps locked down, i can't install c++ build tools, but I want to use pytricia to ingest all our firewall/router routing tables, but i can't, is there a pure python version of pytricia?
hi'
i am new '
somebody sent me a link of this server he told me you can learn coding is it true
hello new, im aeternus 😺
yes
atleast, we can help u with ur problems
programming problems ofc
Hey,
As I found, many requests could be done by proxy, have you any experience ? Is this generally considered a safe ?
I mean for scraping eg.
Wow
hi guys
i am trying to join discord servers from invite using discord tokens
it was working yesterday but now I can't access my main accounts since discord thought it was suspicious
and on this new account it's not working anymore
any fixes?
import string
import requests
def join(token, server_invite):
header = {"authorization": token}
r = requests.post("https://discord.com/api/v8/invites/{}".format(server_invite), headers=header)
discord token list
with open("discordTokens.txt", "r") as tf:
tokenIDs = tf.read().splitlines()
words = input("Invite: ")
words = words.translate(str.maketrans(string.punctuation, ' ' * len(string.punctuation))).replace(' ' * 4, ' ').replace(' ' * 3, ' ').replace(' ' * 2, ' ').strip().split()
print(words)
for word in list(words):
if 6 <= len(word) <= 8:
for i in range(len(tokenIDs)):
join(tokenIDs[i], word)
print("Attempting to join", word, "with discord token #", i + 1)
how do i join a discord server with python requests without discord blocking me / asking for captcha (even though I have a verified number + email +2fa set up)? thanks
x
add .decode() to data, reverse(data.decode())
@humble granite then you might need to receive the response again ||| print(client_socket.recv(1024).decode())
How would i make a server for a multiplayer video game using sockets? I have already tried this and i keep having a problem where the client decides to stop sending data to the server
hi
that worked! Thank you
Np
pretty sure u need to decode then reverse then encode
hello! 🌻
Hello,
s.sendall(b"" + mainList[1] + '/' + mainList[2])
How to better write it?
f"{mainList[1]}/{mainList[2]}".encode()```
or if those are already strings py "/".join(mainList).encode()
So basically
I'm trying to host a websocket database on linux
using python
but every time i try to connect
it
shows timeout error
Are the database server and python application running on the same network segment ?
You need to handle deconnection, on the client side. One way it can be done, between others is using a heartbeat signal.
Hi all, happy to have found this d-server. Since I am really stuck on a new school project I am working on. I am pretty new to programming, started my journey with Java 2020, and now since 2021 I code mainly with Python. Anyway, I am not sure if this is the correct channel for my question, but here goes...
I am trying to write a http/https proxy server to filter my web browsing. I have tried to find a good tutorial on Google and Youtube, do you guys have any experience with coding proxy servers and can help me or do you know any good way for me to start?
hey, does anyone here know if its possible to connect to a server on multiple ports on a pc ?
like can i have 3 different programs all connected to a server on port 443 for example
Hey @ember ledge!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
No, you can only bind one process to one port at a time, unless you bind them to different addresses or one to * (asterisk/wildcard/all/any, sometimes denoted as 0.0.0.0), but if there is a binding for the specific address that is receiving the traffic it will have precedence and the wildcard binding will never get those packets.
If you want to do something like that you need a server process that can act as a reverse proxy and route (or rather proxy or forward) the traffic to the right destination or other process in some way according to rules that you give it.
I haven't looked at your code yet, but I can tell you right of the bat that you will have trouble deciphering the https traffic to different degrees depending on your ultimate goal with this project is and how you want to filter (on what type of conditions you want to filter on) and if you want the proxy to be transparent or not.
transparent HTTP proxies don't work for TLS/HTTPS - so you have to be content with proxying in the clear or not creating a transparent proxy (or proxy at the TCP layer)
Do you think this piece of code could be "implemented"?
import SimpleHTTPSServer
import urllib
PORT = 9012
class JustAProxy(SimpleHTTPSServer.SimpleWebSocketServer):
def do_GET(self):
url=self.path[1:]
self.send_response(200)
self.end_headers()
self.copyfile(urllib.urlopen(url), self.wfile)
httpd = SimpleWebSocketServer.SimpleWebSocketServer('localhost',PORT,JustAProxy)
print ("Proxy Srever at" , str(PORT))
httpd.serveforever()```
@ember ledge what is your ultimate end goal here, is it to learning how proxies work or for doing the filtering you first mentioned?
i'm asking since there are lots of software that can already do sort of what you are asking for depending on the situation and exact requirements you have
My first intention was to create a app to block websites through redirect in etc/hosts. But my teacher thought that was to easy so I needed to create a proxy server for http and https filtering through proxy. Then is the goal to block and unblock websites through proxy
aha, so it's kind of an assignment
and it doesn't need to be a transparent proxy?
no exactly, just need to be able to browse http and https and block websites. This is just what I found online searching for info
if it's just a http/https proxy that is configured in the browser, the browser will use the "connect" method when trying to connect to https web sites
you will not be able to see or filter the content (as it's encrypted), but you will get the hostname and port that the browser is trying to connect to and you can filter on that then then allow or deny the request based on that
@ember ledge instead of just handling normal http "get", "push" and friends, your proxy also need to handle the "connect" method for the https requests
Hello. I am trying my first time to edit a twitter spider script. There is a hidden.py that gives the user types his keys there. I need to input consumer_key, consumer_secret, token_key and token_secret but in twitter developer webpage i can just find 3
@ember ledge the relevant RFC standard documentation: https://httpwg.org/specs/rfc7231.html#CONNECT
Do I have enough information to complete this dictionary? Thank you
Thank you so much! That is great, now I have a lot more to go on and perhaps be able to get this done
Not sure if this is the right channel but if it isn't please feel free to redirect me.
I'm trying to use the aiocometd module to subscribe to a cometd websocket. But I'm getting frequent connection drops with 402::session_unknown.
I suspect it's not sending the connect packet in time but I can't seem to find the segment of the code that allows me to send the connect packet ~3 seconds earlier. Would appreciate another set of eyes.
@ember ledge i had not looked at your code until now
a few things stand out to me
max_conn doesn't have to be that large (especially if you implement the next change i'm suggesting below) as it's just the connection queue for connections on the listening socket that has not been handled with .accept() yet
you probably want to move your first call of conn.recv() from the main() function as it executes in the main thread and it's a blocking io call, if you instead move that code into conn_string you don't need to pass it data and you'll also do the blocking io call to conn.recv() in the separate thread that is serving that connection, so that the main loop can concentrate on just accepting new connections and firing off new threads for the new connections
listen_port and max_conn doesn't have to be global and buffer_size probably shouldn't need to be as it can either be defined in your conn_string function or be passed in to it as an argument (maybe even with a default value so that it doesn't have to be passed in unless you want something else than the default) and then again to the proxy_server function in a similar manner
you could also read the port number that the server listen to using argparse and have a default value for that as well instead of interactively prompting the user for the port number when starting the proxy
i have only dissected your main() function you posted on that url, haven't really looked too closely at the logic in the other two functions
@ember ledge as you are probably using Python 3.6 or newer (or you really should be as anything prior to 3.7 is out of support and is not being patched for security vulnerabilities anymore) you could use formatted string literals https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals also called f-strings https://docs.python.org/3/reference/lexical_analysis.html#f-strings in your code to make it even easier to read
you could try looking into ssl/tsl
also @cloud spruce's changes make sense, use that
Wow, that is some Great inputs, I will try what you suggest first thing. I'll let you know how it goes! As I will probably mess things up and come back looking for answers😅
Thanks for your suggestion! @trim moth
@ember ledge your url/uri handling in conn_string could be improved and more robust by using urllib.parse https://docs.python.org/3/library/urllib.parse.html as well as the code would become shorter and easier to read
you also need to transform the data that you send() to the web server in proxy_server as the request from the browser to a proxy has the full url while a web server only expects the full path, without the protocol (http/https part), hostname and the optional port, just the first / and everything after it
there is really a lot to take in to consideration when implementing a http proxy, probably more than you want to take on, but even implementing a basic one that is not even near standards compliant is still a great learning experience
implementing the "connect" http method support for proxying TLS/SSL is really simple in comparison to proxying the rest of the http protocol that is not encrypted
if you are sill keen on implementing a http proxy your self, instead of just installing one (privoxy, tinyproxy, squid proxy, burp suite community edition or charles proxy to just name a few) and configuring it to do the filtering for you, you can check out https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol and the list of rfc standards, out of which i would recommend the now obsoleted RFC 2616 https://datatracker.ietf.org/doc/html/rfc2616 which stood the test of time for about 15 years (between 1999 and 2014) as a starting point and where the most relevant bits are contained in a single document and current browsers will still be compatible with it
can anyone help with beautifulsoup in #help-cookie
or is this #web-development
something for them
nevermind im all good
Is there an easier way to restart app server process on python without having to do a
sudo lsof -i :<port> and kill -9 <pid> every time?
i'm using django
hey all, looking for a pure python version of pytricia, has anyone looked into this?
Aaah alright, so perhaps just change that to urllib.parse and then the protocol for the data beeing sent? It is truely a Great (a bit hard) learning experience for me. It is very new for me, I have worked mostly with APIs and databases. Thanks, will check the links as well!
OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
Does "normally permitted" mean I can allow more sockets to be used? I couldn't find anything about it online
it means a socket is already running on that port on that specific address
are you trying to bind to a port and wait for inbound connections or are you doing outbound connections but specifying a specific source port?
Hey everyone, I am Rohan. I want to enhance my data analysis skills. Have knowledge of SQL, Excel, Tableau, Power BI and basics of python.
I am a 4th year undergrad, will be starting with python.
Anyone who is on the same level and want to move further in the field of data analysis and consulting, dm me.
trying to monitor UDP traffic of a process
aha, then the answer is no, you can't do it that way
you need to sniff the packets, that you can do using standard python libraries but it's easier with something like scapy
I found out u can see some traffic if you set packet type to RAW but I have to parse the packets my self
yes, that is what it does when you sniff the patckets, you need the raw socket for that and the privileges on the machine to do so
and yes, that is the way to do it using only python standard libraries, then you also have to parse the packets your self
using scapy or any other such library will abstract much of that away for you and do the heavy lifting when it comes to parsing
there are other ways to sniff the traffic like using a driver or firewalling in the OS to send copies of the packets to another process or even using another device between the two computers that is talking to each other, but that is probably beyond the scope of this
low level stuff always interesting 😜
haha, i totally agree, but it's not for everyone, it all depends on what your end goal is and what restrictions are imposed upon the work that you are doing
and also about where you are on the scale between doing the project to learn or if you just need to get a task done
what kind of machine can intercept internet traffic?
I mean are eletromagnetic waves going through air
router have the exact specifications to do that
any device on a wifi network can intercept communications
open wifi network more so
any device along the path to the destination can also intercept
of course, HTTPS and encryption makes this harder
not at eletromagnetic waves level
no. im wrong
anything that can intercept 2.4GHz radio can intercept wifi, it needs a bit more than that to be able to do anything useful with it
like decoding 802.11
@cedar forum has already mentioned routers, but there is a lot of other network equipment that the traffic may pass such as switches, firewalls and load balancers just to name a few, and then there is all the purpose built equipment like ethernet taps (for "copper" cabels) and optical spliters (for fiber cables) and packet brokers to just name a few in that category as well
I'm reading about lpwan (Low-power wide-area network) that's why I'm building an application "bluetooth based" https://datatracker.ietf.org/doc/draft-ietf-lpwan-architecture/
LPWAN Static Context Header Compression (SCHC) Architecture (Internet-Draft, 2021)
a bit like LoRa for use by IoT, sensors and the like?
I don't know yet I have to read more about
anyone know how virtual machines all share a single physical network adapter (im thinking in terms of mac addresses and ip's)
everything i looked up resulted in a tutorial for some software lol
Have someone implemented UDP hole punching before?
why we need to learn socket programming in python?
what's the application of those knowledge? thank you
for network communication other then using libraries that abstract everything away from you
when you need/want fine grain control
or just to learn how things actually work under the hood
a greater understanding of networks, protocols and all the mechanisms will make you a better developer when it comes to anything that has to do with data transfers over the network stack
that reminds me, can computers monitor traffic from other frequencies? and how
why XML and JSON are considered as "format" of web data?
we have pdf, image, plain text, csv.... etc.
When we surf the internet. All of the transmitted are bytes? or XML? or JSON?
Why people would say JSON / XML are the protocol of web data communication? thank you.
you should probably be more clear/specific about what you mean, but I'll take a guess and I think this might be relevant
with the right hardware they can, it all depend on what hardware you have and what frequencies you want to listen to, if it's not normal wifi or bluetooth traffic you probably want to take a look at hooking up a SDR (software defined radio) to your computer
some wifi chips can even function like a SDR to a limited degree with the right drivers, but severely constrained to which part of the spectrum it can access, as the chip and antennas are made for the wifi bands
I tried to do that with wireshark (locked on channel 2.4GHz, well never tried with monitor mode
they (everything you listed) are all just data formats not protocols, they can be stored in files just as they can also be transmitted as a data stream
mostly would like to see things like IoT traffic
still a bit wide as it can mean normal network traffic (over network cables or wifi) or internet/WAN connection through the mobil phone networks (3G/4G/5G/LTE) or more esoteric networks like LoRa
but my best guess is that you are probably after the zigbee, z-wave and x10 frequencies and maybe even bluetooth
most of which will be encrypted today, with x10 being the exception
yeah, nothing specific in mind, just would be nice to know how to mess with IoT devices if I wanted to 😄
how does in pycharm this configurations work when creating new project?
am new in python and in pycharm
like I jumped from vs2022 to pycharm only bcs of the tutorials
sounds like you're looking for the #editors-ides channel 🙂
hey guys why does ```python
urllib.request.urlopen(some404website).getcode()
how can I get the desired output?
ok I'll check
thanks it worked, I had already tried it before but maybe I was not handling the error properly
I am having some trouble with hosting a socket server. I am using a socket stream on port 9999. However the server can only be accessed locally. Any idea how to solve this?
They are cross platform and cross application text data formats.
They mostly communicate configurations and settings and stuff like that.
the ip of the server that is hosting the socket server needs to be accessible from the client that tries to access the socket server
also check that this server where you are hosting the socket server doesn't have a local firewall that blocks access to the port that the socket server is running on
you need to port forward to have to accessible to devices outside the network on top of that make sure ur hosting on 0.0.0.0 ip and not 127.0.0.1
I was wondering if there is a way that I can create and host a server and host
a python program to simply text my friend?
on internet not on LAN btw
yes, it's doable, and what @wise jungle just wrote applies directly to you as well then
you probably want some free DDNS service too, so that they can reach the service that you'll be hosting without having to know your IP address
your IP address will probably changing from time to time, so you need to have something running in the background to periodically check if the IP address has changed and if the DDNS record needs updating
also, if you don't want anyone else to be able to listen in to that traffic with relative ease you probably want a ssl/tls certificate as well, https://letsencrypt.org/ is good for that but they have a pretty short lifetime, so you'll need something that auto-renews the certificate periodically as well before they expire
yes ofcourse there is a way
there are some tutorials on youtube that you can follow along
make sure you have a static ip
and not a shared ip like most isps do these days
there were mostly of socket module which far I know mostly demonstrated for local area network
lol
i use them on a regular bases for everything
outside of LAN
make sure your isp doesnt provide you with a CGNat IP address so that your able to port forward
can I add you friend to ask on this matter sometimes?
no just ping me here
ok np
if you are behind a CGNAT you unfortunately need to find hosting for your service elsewhere 😞
Hey, has anyone a good video recommendation to implement a programm in a client script to check for an update of the server and THEN to update the client script/exe itself...? - Thx in advance :)
Hope the question is somewhat understandable
the way i do it is just have a version variable in the server script and client
Yeah... That's what I was thinking... But how can a Script/Programm/Exe Update itself is much more interesting 👍
read a python file and copy the data into a new file
i dont suggest copying it into the same file until u get the code down
Oh... Okey I think I get the idea... Tbh I thought of that specific option but assumed it would be much more complex in nature
Of course thx for your quick help :)
np
hey, i have to make a program for my school that needs to run at 1 computer/server and needs to access all the computers in a range of some ip's and give me some info, i have the part where he gets the info of the local machine and also the part where he loops all the ip's that are given but i don't know how to acces the other computers, i use python for everything
can we do python as a Websocket Server
but for the Server-Side Web Server, I will use Node.js, PHP, Java, Go, or other non-python?
Yes, Node.js has popular Socket.IO module, but thats not what I am trying to do, I just want to understand the WebSocket
Is there something out there thats a non connectionless UDP framework
requests.post(localhost, files={‘file’: open(fpath, “rb”)})
Not sending the binary file
Flask says the request is filename and none type for data of file
I’m trying to send a binary based file (binary data numpy arrays file .npy) 20MB+ to a flask server ( currently localhost) and save the exact file (.npy)
so you have a numpy array?
@unreal wren
you should use msgpack if its a numpy array your trying to send
(I'm reposting my question here from a help channel)
Hello, I have a scapy question.
When I create a packet using fuzz, the fields get set to a random value. However, the fields only take on a certain value when building it to a bytes representation. Can I "fix" these fields before converting it to a bytes representation?
Below some code in interactive scapy to show what I mean:
>>> p = fuzz(IP())
>>> p.show()
###[ IP ]###
version = <RandNum>
ihl = None
tos = <RandByte>
len = None
id = <RandShort>
flags = 4
frag = <RandNum>
ttl = <RandByte>
proto = <RandByte>
chksum = None
src = 127.0.0.1
dst = 127.0.0.1
\options \
>>> p_fixed = IP(bytes(p))
>>> p_fixed.show()
###[ IP ]###
version = 2
ihl = 5
tos = 0x59
len = 20
id = 19047
flags = MF+evil
frag = 7482
ttl = 127
proto = smp
chksum = 0x5574
src = 127.0.0.1
dst = 127.0.0.1
\options \
I'd like a better way to convert from p to p_fixed. The problem with doing it this way, is that the information about the packet type is lost. I'd like to retain that information and just "fix" the fields in the internal representation. I've looked through the source of scapy but can't seem to find a way to do this easily. I also can't seem to find the right keywords to google. If someone knows how, it would help greatly!
Thank you in advance.
found out the traffic is encrypted through a TCP connection before it goes to UDP so I have to decrypt the TCP traffic first, but it's using TLS... Anything I can do or is it impossible? I don't understand why I couldn't decrypt the traffic if all the encryption data is given in the handshake
read about someone using a self signed certificate for this but ehh
what, TCP connection and then UDP???
yes it contacts main service through TCP first and then establishes UDP connection between client
i should point out that UDP is connectionless here
i think your mismatching some terms
I know
UDP connection
i dont understand
by that I mean it starts using UDP
got you
that's the howl idea with TLS, everything needed to decrypt isn't exchanged in the handshake, otherwise it would not be secure and debugging encrypted traffic can be a real pain even if you have all the keys that is needed for decryption
generally speaking the TLS handshake uses asymmetric cryptography to securely exchange/agree upon symmetric keys for use with symmetric ciphers that is used for the bulk encryption of the data that one wants to transfer securely
you can decrypt traffic that doesn't use forward secrecy (FS/PFS) if you get hold of the private key that is associated with the certificate used, unless the connection also use a client certificate (mTLS), then you need to get hold of that private key as well
for traffic that is encrypted with algorithms that provides forward secrecy those private keys will get you nowhere, then you instead have to get hold of the session keys or session secrets from either the server or the client applications: https://support.f5.com/csp/article/K50557518
i recently replied to another question about signing that you could read for a short introduction to some of the underlying cryptography used in the TLS handshake
this is a link to that question and my replies that might interest you is the two replies that follows just after the question: #cybersecurity message
^^
sorry for my long form answers 😆
np, nice to have well put answers, will likely learn more 😄
your on the right track with a few methods of attack here btw, its just TLS sniffing isnt one of them lol
when we are on the subject of self signed certificates, they don't provide weaker cryptography, only non-existent trust in that it comes from whom they say it come from and can thous be swapped out by someone else that can intercept and terminate the TLS connection like a transparent proxy and generates certificates on the fly to act as a server towards the client and as a client towards the server
but if the two parties has already exchanged the self signed certificate out of band using a trusted secure channel and the client has installed the certificate as a trusted certificate for that server address they will still be able to trust the self signed certificate even if it's not best practice to do it this way (one would typically use a private/custom root CA for that)
to slightly continue this. web browsers come with trusted certificates pre-installed which is why most HTTPS websites can be seen as secured. most browsers also allow you to import your own certificates for use. for instance:
the server actually allows a connection without tsl but the client uses tsl, I guess I could try to stop the tsl packets and swap them for normal ones but that would require lower level stuff ig
not sure how I'd use one in this case, since I'm not 100% sure how they even work and how they're related to tsl
the client would notice this. if the client has established a tls connection then any response they dont recognise will alert them
ig yeah
since your swapping out the packets, the client wont receive their expected trusted message
whats your end goal?
decrypt the packets between client and server to sniff the packets
i assume we are talking HTTP here?
one can stop the redirects from http to https from happening if it starts with http communication and you are in a MITM position, but that is being countered more and more these days with for example HSTS and things like "HTTPS Everywhere" that now is more or less built in to the browsers
yes, I'm assuming the https traffic will have a key to decrypt the UDP traffic that comes after
i'm guessing the udp traffic is a vpn tunnel of some kind?
basically there's a system application that has a HTTPS connection to their servers and a client that uses the system application to authenticate and establish a connection UDP connection to the client
sounds very much like a vpn tunnel setup to me
actually the UDP traffic might go through the system application as well
if I were to make a self signed certificate, how exactly would I decrypt the traffic? I know tools like fiddler have this implemented but I doubt it will magically make the packets readable
Also can I make scapy parse the packets I receive from a socket? or does it only know how to parse with sniff() and pcaps
do torrenters mainly download copyrighted content?
depends on who you ask, the average windows or mac person would probably tell you yes, some linux people will probably tell you no, since quite a bit of larger open source software such as distribution install images are available as torrents as well as normal downloads
server {
listen 80;
root /var/www/website.com;
index index.html;
server_name website.com;
location / {
# Help Here
if ($request_uri ~ ^/(.*)\.html) {
return 302 /$1;
}
try_files $uri $uri.html $uri/ =404;
}
}```
When I use this config, visiting website.com automatically redirects to website.com/index
Any idea how to fix?
what is the goal of this partial nginx configuration?
when i test it out locally it looks to be working as intended
It removes the .html from page names
So users do not have to visit domain.com/page.html, they should be able to go to domain.com/page
Yet it causes domain.com to redirect to domain.com/index - I do not want this to happen
i do understand what it does, but i was asking about what your goal with it was (which you now have provided in the replies just below the one i'm replying to now)
just using your try_files line will already make it so that it first tries to find a file under /var/www/website.com that matches exactly the url path sent from the browser
if that fails it will then try to find a file with the same path again but with a .htmlextension (which is what you say that you are looking for)
if that also fails it will try see if there is a directory with the same path as before (by appending the path with a /
finally if everything before this has failed it will return a 404 "page not found" error response
it shouldn't be showing /index unless you type /index.html at the end of the url when you test this out in a browser
what your if statement is doing is redirecting any typed url with a .html extension to the same url but without the .html extension
if all you want to do is show the content of the file /var/www/website.com/about.html if someone visits http://website.com/about the try_files line already does that without the if statement
without the if statement one would also be able to visit http://website.com/about.html and see the same page without being redirected, all the if statement would do here is to stop this from working and instead redirect such a request to http://website.com/about and then show the page, which is an extra request/step
Has anyone encountered a situation where random CSS/JS files fail to be loaded from a Flask server? It seems to only happen on Chromium browsers. So far, I have found basically no documentation regarding this error, so I have no idea exactly what is causing this. FYI, this all started happening from 30/3 onwards, and reverting my code to earlier commits did not fix the issue.
hey guys i made a simple voice chat client/server using python
https://github.com/e1pupper/VoiceChat
currently its not encrypted but you can easily do it
Hmm, the server clearly receives the request and declares it with a 304 unmodified code and since the web browser errors it might be a caching issue 🤔 what happens if you clear your page cache and try to rerequest each resource?
Not sure if this is relevant but check this out: https://bugs.chromium.org/p/chromium/issues/detail?id=927364
this is pretty cool actually
Thanks brother
for some reason when a third person connects the shit starts lagging
i think i cameup with a solution of just threading the data sent instead of looping through
how would i get ips of all of the devices on my network
I've tried clearing the cache before and it didn't help. Also, I've asked others to try accessing the site and they are encountering the same issue, so it's unlikely to be something on my end.
Hey all
is this channel friendly towards Questions? etc
Attempting to write a an ssl client using socket -- but whilst i am attempting to connect using socat i get this
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
@twin thicket please use one of the above methods to post your code to the channel again instead of a screen shot
Does ssh work across separate networks
yes, it will work as long as you can establish a connection without being filtered on the port you are using
try rewriting both your client and server to use non blocking io sockets and select() for picking up which sockets has data ready for reading or has a new error state to be handled
It might also be good to change the read buffer size to at least 1472 bytes or something like that to be sure you can read the content of a howl packet off the wire at a time
How do use non blocking io sockets?
instead of using threads, you can check the state of each socket in a loop to see which ones have data ready to be read. this stops a recv call from blocking the main thread and removes the overhead of switching threads which the current method uses
Im usind udp with tcp i can do it easily
and you will only be reading from the sockets that has something on them, select takes care of finding out which those are
udp or tcp doesn't matter
non blocking io is a very important subject that is good to get familiarized with
even if you use threads you might get problems with blocking io if you are handling more then just one reading from one socket in that thread
as the blocking will make just make the howl thread wait for data to arrive from that socket before it can do anything else
that means that you would need a separate thread for reading the audio data from your local microphone and transmit that data if you're not using blocking in your voice chat client
The only thing i can think of doing is creating multiple sub servers that handle data from each client
But that would take up the ports but at this point i dont think is a problem
Ill go home and try and wrote a solution
i would definitely suggest either a non-blocking io based server using sock.setblocking(False) and select
otherwise you can spawn a new thread for each data stream you want to read from (in the client that would be one thread for the socket connected to the server and another thread for reading from the microphone and send the that data in that same thread to the same socket that you are reading from in the other thread)
In tcp i can do cliet, addr = sock.accept()
Then thread the connection so that each client is handled
i have no admin rights on the receiving computer, and i would create a stream somehow
I have done both before and still same problem
youve used the select module?
Yes but i might not have used it correctly as i was clueless
I know this would work amazingly
But i rather not want to take up a lot of ports
you don't need admin privileges on the receiving machine as long as there is already a ssh server running there and they are not running any firewall (not even on the host) that is blocking the listening port
select will not use more ports
Ill write m solution and show you ut
Give me likr 20 min
actually
the more i think about it
the more i feel like it might be a client side issue
ima try sumthing
what you do is mark add the server socket that you have issued bind() and listen() on to the list of sockets that you check with select to see if there is anything to read from them
select will (amongst other things) return a list of all sockets that has something to read from
then loop through that list and you use an if statement to check if it's the same as the server listening socket, in that case you have logic to accept() the connection and add it to the list of client connections that you will also run select() on later on, and if it isn't that socket it's one of the clients sockets that you need to handle as such
no
im not using tcp !?
im using UDP
i easily handle tcp connections i have no problem with tcp
im struggling with UDP
i'm trying to tell you that it doesn't matter much if it's tcp or udp
you cant listen() or accept() in UDP
cause if you can then i wouldnt have had this issue
can i have an example
right, that's true 😆
assuming your sending data to multiple clients as well as recving
you would want the select module to check the UDP server socket with a timeout so if theres no data you can focus on sending other data to other clients rather then blocking with the recvfrom call
you just have to bind() (without listen()) and recvfrom() instead
what the hell
have you guys read my code
at all
ive made these changes
def handleConnection(self):
while True:
try:
d, a = self.udp_server.recvfrom(4096)
self.mainServer.clients[a] = time.time()
if a != self.addr:
self.udp_server.close()
break
serverHandler(self.mainServer, d, a)
except Exception as e:
print(e)
def timeoutHandler(self):
timeout = 1
while True:
connectionHandler(self, timeout)
def acceptConnection(self):
timeout = 1
while True:
try:
d, a = self.udp_server.recvfrom(4096)
self.clients[a] = time.time()
if a not in self.connections:
if d == b"connection":
self.udp_server.sendto(d,a)
self.connections.append(a)
self.port += 1
Server(self.port, True, self, a)
print("Get connecting from ", a)
else:
print(f"{a} trying to connect!?")
#for c in self.connections:
# if a != c:
# self.udp_server.sendto(d, c)
#self.udp_server.timeout(0.050)
except Exception as ex:
pass
#server class
def __init__(self, port, isSubServer=False, mainServer=None, a=None):
threading.Thread.__init__(self)
self.port = port
self.mainServer = mainServer
self.addr = a
server_config = (self.host, self.port)
self.udp_server.bind(server_config)
self.udp_server.setblocking(0)
self.clients = dict()
if not isSubServer:
self.acceptConnectionT = threading.Thread(target=self.acceptConnection, daemon=True)
self.acceptConnectionT.start()
self.timeoutHandlerT = threading.Thread(target=self.timeoutHandler, daemon=True)
self.timeoutHandlerT.start()
else:
self.handleConnectionT = threading.Thread(target=self.handleConnection,daemon=True)
self.handleConnectionT.start()
i think this would work
what do you guys think @cloud spruce @prisma cobalt
why would you close your server if the connection isnt self.addr?
its dedicates server for 1 client
maybe thats OD
ima just do pass or something
or ill just do if a == self.addr
wait does this use multiple ports?
yes
how is the client supposed to know which port to connect to?
thsi was the solution i was thinking of
ok so they intiialy connect
to the main hub
so you see in the acceptconnection
if a not in self.connections:
if d == b"connection":
self.udp_server.sendto(d,a)
self.connections.append(a)
self.port += 1
Server(self.port, True, self, a)
print("Get connecting from ", a)
in self.udp_server.sendto(d,a) ill change d for a port
this isnt a production ready server
what if you run out of ports
in reality this is done differently
and have it be the same ip
yea i know
but i think overall it wont be that bad
😭
i mean someone could probably open like 10000 ports
and then have 9999 people connect to a main server
per ip
so technically you can have multiple machines hosting upto 10000 ports
but ive done 25 port range
ima test it
i doubt it will work
yup dis shit did not work x)
nvm wait
i forgot to encode
why do every client need it's own port?
is it so that a client can change source ip and/or source port and you'll still know it's the same client?
but then anyone can impersonate that client by just sending traffic to that clients port on the server
thats what i added if a == self.addr
that way you cant just send packets
and gonna have to connect through the main server
[WinError 10035] A non-blocking socket operation could not be completed immediately
[WinError 10035] A non-blocking socket operation could not be completed immediately
: ?
we do a little bit of trolling
why am i getting this error now
i wasnt getting this earlier
@cloud spruce @prisma cobalt
my laptop blue screened LOL
In this video series we will cover Python 3. In this video we will demonstrate look at the differences between blocking and non blocking sockets using select.
Python 3 youtube videos by Bryan Cairns
Web: http://www.voidrealms.com
Github: https://github.com/voidrealms/python3
Facebook: https://www.facebook.com/groups/1400884323467285
Udemy: ht...
so if you do not support clients to change neither source ip or source port during a session you can identify the client on those two
im hella stuck
im actually clueless on what to do
i know there is a way to do it all on 1 port but i really dont know how
(on the note about select on windows) that sucks... 😞
i'm a full time linux user (since like forever), so i wouldn't really know about those problems
i'll see if i can try something out over here
appreciate you
if u get somewhere ping me @cloud spruce ty
i'm looking through your code at https://github.com/e1pupper/VoiceChat/blob/main/server.py
one way to get a non-blocking udp socket (and this doesn't even require a separate call) is: udp_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM | socket.SOCK_NONBLOCK)
you can change the code and make a lot simpler when using udp, like not using threads right now (at least until you have lots of clients to send the same piece of data to)
especially: don't create a new thread for every non-blocking .recvfrom()
Whole point is i want to send to a lot of client
