#networks
1 messages · Page 1 of 1 (latest)
if it wasn't using TCP headers it wouldn't be a TCP connection and it's the OS that is managing the TCP connection, the application doesn't need to concern it self with all those details
yeah, otherwise we would call it something else like a SCTP connection or UDP "connection" (even though it's probably technically wrong to call it a connection when talking about UDP, but people still do in practice because it's easier and we are pretty often not that correct or formal in informal conversations)
Yepp thanks for this haha
What happens if without a TCP connection being established, a client sends a server TCP packets? Since TCP is just a protocol, if a server is running TCP, it should be able to understand the TCP packet and perform the same operations as without a TCP connection being established right?
after this chat
Haha I feel like im having a hard time wrapping my head around these basic topics that I feel should be straightforward and its frustrating
if the packet doesn't belong to a connection that the other side recognizes and have the correct state for it will reject the packet, typically with a RST packet or if it's a SYN packet to a port that isn't listening it will typically respond with a ICMP error response
Perfect
And actually, whats the function of a TCP connection haha.
Like why wasnt it made so that when a client sends a TCP packet to a server, the server can just perform normal operations. What does a TCP connection bring to the table
TCP brings reliable delivery which UDP and ICMP doesn't
yeah but how does the actual TCP connection do that
TCP ensures the packet is received by resending it if necessary which can only be done because of the TCP connection
since the receiver can send an ACK [or not] back through the "connection"
UDP doesnt allow this
To my understanding, this resending is only done if the sender doesnt detect the ACK
yes
yes
how does the tcp connection come into play
if the sender is the one that detects the ack
i get its done ‘through’ the tcp connection, but why does it have to be ‘through’ the tcp connection
in the three-way handshake both parties establish the sequence numbers and together with acks they can know if there is any missing packets and resend them
a "connection" is a concept, not an actual thing which is where i think your getting caught up on
everything is packets, its just TCP has some infomation in the header that allows a persistant "connection"
so the three way handshake establishes the sequence number of the packets, ill take that as an answer
So whats the point of establishing a tcp connection
no, the sequence number of the packets is decided when the packets are sent, not during the 3 way handshake
correct me if im wrong here @cloud spruce
it might help to stop calling it a connection, just that the sender and receiver have registered each other on their machines so they can recognise the other when they send a packet
Why doesnt TCP just send these packets that create a ‘connection’, without actually establishing a ‘TCP connection’
Sorry, you’re saying the information within the TCP headers is what creates this ‘connection’. Yes.
Now if the ‘connection’ can be created by simply a sender sending a TCP packet and the receiver sending back an ACK.
Then why, in the actual TCP process, do you need a 3 way handshake to establish this connection
I can understand this and will take this as an answer, you’re saying that the 3 way handshake ensures both machines are registered to each other.
thanks haha sorry if my reasoning is a bit unclear
before i answer that, before when i said that:
the sequence number of the packets is decided when the packets are sent, not during the 3 way handshake
i was talking about the "relative" sequence number
let me explain the handshake
client initiates connection by sending a SYN packet to the server, this contains a 32 bit random sequence number
server responds with a SYN-ACK packet, this contains the servers 32 bit random sequence number and tells the client that the server acknowledges the first SYN packet
the client then sends an ACK to the server and this is the "connection" (both machines now have each other listed locally so they can recognise each other)
the sequence number is initally random for both sides and then is incremented with every packet sent, this is so when one side ACKs the other, they can say exactly which packet they ACKed
Yepp that seems consistent with what Ive read
the sequence number represents the amount of data sent between each "device" and gets updated with every piece of data recved
yepp, thanks
at the beginning of the three-way handshake each peer chooses a more or less random number within the possibilities of a 32 bit unsigned integer as the initial sequence for the packets that side is going to send, during the three-way handshake that number is incremented with 1 and after that it's incremented with the number of octets (bytes) that it has sent
it's like you don't start talking with a stranger end begin the conversation in the middle of a sentence without any context
haha, now i've read the whole conversation so far, and yes, correct
Yess, so the 3 way handshake
- Registers both machines to each other
- Establishes the sequence number for when the packets are sent.
Actually, here when you say ‘registered each other’ are you referring to the fact that because the unique sequence numbers have been established, that both parties can identify the packet and ACK, and that this is the ‘registering’?
Yes, that both parties devices can now recognise the others packets by the sequence number, origin etc
Ahh ok thanks
yes, so that other people should not easily be able to inject packets between two parties by sending packets to one of the parties and spoofing the other party
Yepp makes sense thanks
i updated my Raspberry pi 3 with the latest os
i set up my antenna wireless wifi adapter
except i cant tell if my raspberry is using it or the inbuilt antenna because the the raspberry still shows the wifi signal in the taskbar
even if this is network related i think it might be more linux specific and you'll probably find better help with this in #unix
Referring back to this question, with HTTP1/2, how does the os know it needs to create a TCP connection? Does HTTP tell the os that it needs to open a TCP connection? e.g. if im using http3 instead, who is the one that tells the os to use quic instead of a tcp connection.
http and quic isn't implemented on an OS level, the OS will only handle the TCP and UDP parts
http and for http/3 also quic is implemented in the application (typically using a library) and it's up to the application to tie it all together by requesting a TCP socket from the os to then run http 1, 1.1 or 2 over or a UDP socket to run quic and http/3 over
the OS doesn't concern itself with the higher level protocols
Ahh, so the application is the one that ties it together
HTTP is completely independent from tcp/quic
tcp and udp are independent from http and quic
but http 1, 1.1 and 2 all depend on tcp, it's a one-way dependence
quic is only applicable to http/3 and runs over udp
the lower level protocols are always independent of the higher level protocols
higher level protocols can be dependent on one or one of several or even several lower level protocols to function over a network an the set of lower level protocols that higher level protocols can run over can be extended in time by additional standards
but yes, it's all down to the application code in the end as the OS will not involve itself with such details
Yeah I think I get what youre saying actually, let me rephrase.
The HTTP is independent from the creation of the tcp connection, but http does rely on tcp still for the tcp connection (sending a request getting an ack, sending a response getting an ack).
The application is the one responsible for creating the tcp connection by requesting it from the os. Afterwards, the application then employs the http1.1/2 protocol to send the http packets with that tcp connection
hello people i hab question
i tried hosting a server locally and use it as DNS server for all my devices on LAN
while all devices can ping the local DNS servers correctly and get packets back, as well as browsing the internet fine
some apps just says no internet
if i change DNS on other devices to automatic which uses my router again it works
please ping me when you reply thank you
almost, but the application doesn't know anything about the packets it only writes and reads a data stream to and from the socket that the os provides to the application, the os is in charge of chopping that data stream into chunks as it sees fit to be able to fit the pieces to the constraints of the path mtu, so just like the os doesn't concern it self with the higher level protocols the application doesn't need to concern it self with the details of the lower level protocols other then selecting witch protocols it requests a socket for from the os
separation of concerns is very important for a good architecture and api
ping won't tell if the dns server works correctly
internet probing on devices are done by doing specific dns lookups and usually also connecting to that destination periodically to see if it's reachable
if your dns server fails to resolve that domain name or even filter it out on purpose you will get that effect
but when i ping specific url which has rules to redirect them i can see that the packets are using my local dns server with its address specified
is that not indicative of whether the device is using the DNS server? i am very noob to networking lol
also i can see there are packets coming to the DNS server if i use fiddler
is there a way to know what url the app is trying to access and why its not working perhaps?
or maybe what would be the standard pipeline to debug this behavior? i dont really konw the term for network debugging lol
look at different layers.
/etc/resolv.conf can tell you about the domain resolution
curl command can give you details about how it goes about hitting a url
route can tell you where packets are routed on your box
(assuming a GNU/Linux environment)
sounds right, that wasn't clear from your initial statement, but if you ping a hostname that your own dns resolver will override the official response for with something else (like a sinkhole ip address) and that address is getting the traffic instead that is definitely an indication that the device is using your resolver
so im trying to launch an app on iOS 15 and iPadOS 15, and after i manually choose my home server(a linux laptop) as their DNS(so like 192.168.x.x), they can browser internet fine
but some apps dont work
they just say no internet
sorry, I can't help with ios
also beware of how windows does dns lookups to all its dns servers in parallel and uses the first response
but i can still use route on the linux laptop to check packets i think
so on iOS i would delete all other DNS in the wifi settings and leave only 1 DNS which is my home server(192.168.x.x)
and in the terminal app on the iOS I use ping in, the terminal app tells me which DNS server its using
and the terminal app gives me back the DNS server address to be the custom home server one instead of the automatic router DNS
is this enough of an indicator that the DNS server is working and the problem is on the app itself?
i also tried copying a linux virtual machine(as the DNS server) which works on other peoples LAN and their machines with those apps but not on my LAN and my machines after modifying the ip and making sure the VM can connect to internet
at least at that moment, if you are still using dhcp a dhcp renewal might override your settings depending on how you did that configuration change and how ios works
wait the dhcp on iOS? my server has static ip in router settings
it could be that your dns server is filtering (or rewriting) something that the application is dependent on
hum
i see
but what about the VM situation tho
in theory if the VM can function as the DNS server that those apps need on other LANs it should also function on my LAN with correct VM ip address and VM DNS server right?
and also i think i tried ping some of the specific URL needed for one of the apps
yeah the ios device might get the default dns servers back when renewing the dncp lease depending on how you override the dns server settings on the device, but if you are doing it in the ip settings of the device it shouldn't be an issue
and the local DNS server i have gave back packets after the ping
there is a tab in wifi settings on iOS device called configure DNS and you can choose manual or automatic i changed it there
that is the right way to do it, then those settings should remain in place
i dont entirely understand the situation but some of the assets are stored locally on the DNS server itself so i think maybe its trying to redirect those apps onto its locally stored assets?
and that could be the problem somehow?
maybe i need to learn apache2 idk lol
but if the application says "no internet" when using your dns server you are probably filtering and redirecting traffic that the application needs to function correctly and the application probably isn't getting the response back from the endpoint that it expects
i see
if it's assets served over https you will have a hard time redirecting them without complaints from the application
that would require a lot more work and installation of a custom root ca on the client device as well as the application not using any form of certificate pinning or certificate transparency checks to validate the certificate in use
if it's plain http you will have a much easier time
im gonna look into that
thank you man
🙂
wait
so in the scenario where i put the local dns server in a VM
will there be any complications than just running in a native linux machine?
vm or standalone physical computer should matter much as long as all the networking for a vm is setup correctly
what im thinking is that we now have router firewall, linux machine host firewall and the VM firewall?
idk if thats the case or if theres anything else
you just have to see to it that the vm is not behind a nat or being firewalled
so what does behind a nat mean?
i googled NAT a few hours ago and my understanding is that the router translates 192.168 ip into public ip?
as in sharing the ip address with the host machine as far as the rest of the network is concerned
so is sharing the ip with host meaning behind a NAT or not behind a NAT?
that is correct for a home router
yes im just using a home asus router lol
if outgoing connections from the vm looks like they are coming from the host machine you will probably run into issues when trying to run server software on the vm and have it reachable from other machines on the network
so i should not physically replicate the host network?
and let the VM have its own 192.168 ip?
if the host machine is doing nat for an internal vm network the host would have to be setup to forward traffic for certain ports to the correct vm
ohhh i think i get it now
so i should not let the host NAT the VM but instead let the VM physically replicate the Host network, so that both of them gets NAT from the router?
but if the vm gets it's own ip on the same network as the host and the other machine ls on the network it's much easier to run server software on it that will be reachable from other machines on the network
just talking about LAN IP now
i see
that is enough to make it reachable from the lan
which should be all you need if you don't need people out on the internet to be able to reach it as well, then you would have to setup port forwarding on your home router the same way as if it was a physical machine
just done share the ip between the vm host and the vm guest
ok ill try look into that too
one more question
so recently i changed my microsoft account to be passwordless which sends notification to my phone's microsoft authenticator when i try to log in, but i dont know how i can setup windows folder sharing now since there is no password to login through SMB
see to it that the vm guests gets its own ip on the same lan as the vm host and the other physical machines/devices on the lan
i log into my pc using a locally stored pin
i see ill try to check this and tweak it
i'm on linux full time since many years so don't really know how that would work in the windows world, when i do have to use a windows computer it's always with a normal local or AD account using username and password not their passwordless solution, so can't help you there unfortunately
i see thank you so much man!
I have some servers at home. Is there any way I can use different external ips for them?
that depends on if your ISP will hand out more than on IP to you (mine does)
in the case of that they do, you can run your servers on different public ip addresses without a problem, but you probably would need a switch to connect to your internet connection and then connect your home router and your servers directly to that switch
I'm a bit confused by the concept of a carraige-return line-feed here. Does this mean that a http response must consist of at least one line for the version and response code, and another blank line? Is it txt HTTP/1.1 200 OK or simply ```txt
HTTP/1.1 200 OK
Like if I was implementing a http server I would need to return this right?
in the pre 1.0 version of the protocol it was only GET /path with just one CRLF after it (without any protocol name or version after the path) and the response was just the content (no status line or blank line)
all later versions has the request line optional HTTP header lines and then a blank line to mark the end of the headers and the optional content for the request
for the response there is a status line and then the optional HTTP header lines and then a blank line to again mark the end of the headers and the response content body
correct, or HTTP/1.0 if that is the maximum version that your server would be compliant with and the status for that particular request
Ah ok for the response, if no header or body is required, we can just use the one line with protocol version and status code?
well, you do need to include the blank line as well to flag that you are done sending data
Can you do ```txt
HTTP/1.1 200 OK
<body here>
is this also valid to indicate no headers and just a body?txt
HTTP/1.1 200 OK\r\n\n<body here>
yes, that would be valid, but after you have sent the full content you would need to close the tcp connection if you don't give a content length in the headers or use chunk encoding
Ah using connection:close ?
use of \r\n\r\n is preferred but \n\n works to is not preferred if you can avoid it, what ever you do, don't mix the two in the same response, that can trigger bugs in the clients
Gotcha
Thank you
Connection: close is the default if the Connection HTTP header is not sent
if you want to reuse the connection you would have to first check that the request contains a Connection: keep-alive HTTP header and then send the same back in your response as well as a Content-Length: x HTTP header with x being the number of bytes the client should expect the content to contain or use chunked encoding instead of the Content-Length HTTP header if you don't know the amount of data when you start responding (for example in dynamic responses that is built during the response) and each chunk will have it's own length indication, this is if you still want the option to reuse the connection even when the content length is unknown when you start sending the response from your server
I'll have to look more into chunked encoding! I am familiar with sending content length as I've worked with socket connection before (HTTP uses sockets right?)
yeah, HTTP uses stream (TCP) sockets
Server sends HTTP -> socket -> TCP -> socket -> client receives HTTP (?)
I know there are some more steps after TCP, but is this basically it?
very simplified, yes
ignoring the IP and Ethernet protocols, ARP, mac addresses and all that
Most of that is handled by the ISP though correct?
but it's details you can dig into later if you are interested in how computer communications and networks work
no, it's handled by the operating system on both the client and the server as well as all network devices in-between
or well, layer 2 devices (switches, hubs, bridges and such) doesn't have to deal with the IP layer, just everything under that layer
while layer 3 devices (for example routers) needs to understand IP and all the layers under that
just like layer 4 devices (firewalls and load balancers to name the most common ones) needs to handle protocols such as TCP and UDP and the lower layers
the operating system of a server or client can be seen as a layer 4 device and then the application takes care of the above layers
Watching this now, explaining the different layers involved https://www.youtube.com/watch?v=OTwp3xtd4dg
NEW DISCORD SERVER: https://certbros.com/discord
--------------------------------------------------------------------------------------------------------------- --~--
MY FULL CCNA COURSE
📹 Register your interest - https://www.certbros.com/Course-Interest
HOW TO PASS THE CCNA
📚 Get a great book - https://amzn.to/3f16QA5
📹 Take a video course - ...
Bit of an unrelated question, but if HTTP already uses sockets, and sockets support bi-directional communication using the same connection (e.g using keep-alive) then what is the use of websockets? Is it simply a different application layer protocol?
And the change in application layer logic reduces latency?
Wait... The server cannot send a request to the client in HTTP? Then it is only client -> server -> response -> client. But never server -> client -> response -> server
the TCP/IP model is one thing and consists of 5 layers while the traditional OSI model has 7 layers, but the OSI model is much more theoretical and the TCP/IP model is more like things work in practice
TCP/IP is more like an implementation built upon the ideas of OSI from what I gather
websockets can send traffic in either direction at any point and can be in almost what ever format, while http 1.0 and 1.1 needs to have the request response structure and can't just send data when ever it wants to but needs to wait for the other side to finish
That makes sense, sort of like normal HTTP is a one way street but websockets have 2 lanes for flow of data.
correct, unless you run http/2 with push and such, but it shouldn't be abused for such things and you should use websockets for that instead
Ohh yeah the http server is coming together now ```txt
PS C:\Users\Jarrod\Desktop\http_server> & C:/Users/Jarrod/AppData/Local/Programs/Python/Python310/python.exe c:/Users/Jarrod/Desktop/http_server/server.py
b'GET / HTTP/1.1\r\nHost: localhost:5000\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate, br\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nSec-Fetch-Dest: document\r\nSec-Fetch-Mode: navigate\r\nSec-Fetch-Site: none\r\nSec-Fetch-User: ?1\r\n\r\n'
that's a request, what did you send back as a response from your server?
I simply printed the request to make sure the connection was working haha. The browser hung because no response it sent back
yeah, that's what happens in that situation until it times out
Should I have a default read length for when the header doesn't include a size? Right now I can get the header by reading until crlf,crlf but I can't tell when the request body has ended
what library are you using for sockets, request and response handling?
i would suggest you go with an async library of some sort if you insist on implementing the protocol yourself even when there are ready made stuff to use, but it's a good learning experience
I'm using asyncio Stream
Just reused some code from a chat app I was working on, trying to recycle it to handle http
good choice to go with async from the start, it will make things much easier for you later on
From what I understand, the normal sockets library can handle multiple clients, bit it needs to cycle through each clients and see which has data to read, using asyncio Streams avoids this
And ofc you can only handle one connection at a time
exactly, it's a lot more work if you would do it that way and not as performant either
well, that is kind of the same, even asyncio just takes care of one thing at a time, but it multiplexes between tasks as soon as it hits a await
with normal sockets you can use select and just read as much data as there is and then go on to the next socket with data available and you can use non-blocking io as well if you want to, but async still beats it hands down
Define "cycle through each client".
Because the socket api doesn't constrain you in how you want to multitask, it just hands you the tools and off you go.
You can use an fd monitor alongside it and you'd be good to go.
In non blocking mode, you've essentially recreated an async event loop minus all the syntactic sugar and native support by the language.
Well that would be the most basic implementation, is cycling through each client and checking for data. But you're right, even asyncio Stream uses sockets just building upon the basic tools to build something with better performance
Is the select module an fd monitor? I'm not familiar with the abbrreviation.
Yes, but it's quite bad, especially on windows.
The fd stands for file descriptor.
Oh haha well that's unfortunate
Yeah, and what's more unfortunate's that the only good alternative for windows is IOCP.
But for some reason asyncio is the only one with a wrapper for it for some reason. (Under the proactor loop)
They just didn't bother updating selectors.
yes, it's very unfortunate that they didn't update the selectors library to use IOCP on windows
back to your original question, read the request until the empty line
and then check the headers for a Content-Length: or Transfer-Encoding: HTTP request header (which are all case insensitive)
if none of them are exists the request was done with the empty line
if one of them exists you must continue reading
for Content-Length it's simple, it's just the number of octets/bytes expressed in the header after the empty line that must be read
but for Transfer-Encoding it will be a bit more tricky (chunked encoding again)
can anyone plz help i want to make a twitter bot that runs 24/7 but i don't want to keep computer on all the time any (free) solutions
Alright, all of the other classes are just stubs, but the class that handles the connection is coming along, how does this look? ```py
class HTTPConnection:
def init(self, reader, writer):
self.reader: asyncio.StreamReader = reader
self.writer: asyncio.StreamWriter = writer
asyncio.create_task(self._handle_connection())
async def _handle_connection(self):
try:
while True:
request = await self._read_request()
# get response here
await self._write_response(response)
if request['connection'] != 'keep-alive':
break
finally:
await self._close_connection()
async def _read_request(self) -> Request:
header_data: bytes = await self.reader.readuntil(b'\r\n\r\n')
header: RequestHeader = RequestHeader.from_bytes(header_data)
body_data: bytes = await self.reader.readexactly(header['content-length'])
return Request(header, body_data)
async def _write_response(self, response: Response):
self.writer.write(bytes(response))
await self.writer.drain()
async def _close_connection(self):
self.writer.close()
await self.writer.wait_closed()
async def main():
server = await asyncio.start_server(
client_connected_cb=HTTPConnection, host=IP, port=PORT)
async with server:
await server.serve_forever()
if name == 'main':
asyncio.run(main())
so why cant i select SAE as my encryption method for WPA3 in my asus router?
i read a little online and sites been telling me how amazing SAE is compared to PSK but i only get AES?
SAE is not the encryption method, it's a authentication method and key exchange protocol, it can still use AES for the bulk encryption
you got support for SAE if it's really WPA3 standards compliant
ohhhh i see
so should i choose wpa3 personal or wpa2 enterprise for home router?
im thinking wpa3 right? since all my devices support it
enterprise is if you want to setup authentication using RADIUS, LDAP or other more advanced authentication service
sometimes the wifi system has a built-in such server to not require the infrastructure and complexities that enterprises usually have for central credentials and authentication
if you just want a passphrase you should pick personal, if you want separate usernames and passwords for different users or certificate based authentication you and should use enterprise (in the standard there is such a thing even for WPA3, but your router/ap might not support it)
just know that there is a lot of devices that can only do "personal" and are not compatible with "enterprise" authentication (google chromecast, game consoles and such devices are just a few examples of things that are generally not compatible with enterprise authentication)
ohhh isee
one more question
so the asus router offers something called "instant guard" which enables remote connection from WAN to my home router and use my home router as a VPN server
so that i could connect my phone to my home router VPN server when im on public wifi
but what kind of new attack surface would this enable by enabling this so called "remote connection" thingy?
because i do share folders in my LAN which is just stuff connected to my home router
so im a little worried lol
that depends on what technology instant guard is built on, i would have to research it a bit to know more about it
if it's based on openvpn, wireguard or the like, the router would start a local VPN daemon and open the firewall on the router for one or more ports used by the VPN daemon so that clients can connect to it to establish the tunnel, just keep your router firmware updated and use secure passphrases (if it's even based on such things or if they tie it to an asus account you need to have a strong passphrase there) for the vpn access
i see i ll look into that thank you!
found it lol
strongSwan is an Open Source IPsec-based VPN solution for Linux and other UNIX based operating systems implementing both the IKEv1 and IKEv2 key exchange protocols.
looks like opensource stuff on github
i remember using IKEv2 in like 2015
and that its not very secure
there's nothing wrong with the security of IKEv2 if setup correctly and paired with the right algorithms
i see
cuz i was using V2Ray couple years back
and it seems that was the new hot thing lol
the setup process was painful tho lol
i read something written 1,5 years ago that said that instant guard uses IPsec with AES256 (which is good) and HMAC-SHA1 (which is old and isn't very good for security by today standards)
i can only hope that Asus has upgraded to SHA2 or SHA3 for instant guard by now, but without more research i wouldn't know
using IPsec can sometimes be problematic in some network environments, so it's good if it has fallback to UDP and then as a absolutely worst case TLS over TCP if everything else is blocked
i see that is interesting
im not expert in encrption either lol
let me google a bit
if they had used wireguard they would run over udp instead, which often works better then IPsec in restrictive (or quite common with badly configured) network environments
and if it had been based on openvpn (which i think is also supported on asus routers/firewalls with a bit more manual setup and know-how required to get it right and properly secure) it would try to use UDP first and if it failed it would try to switch to TCP to get through even more restrictive network environments
if i understand it right the instant guard thing is kind of auto-setup if you just start the app and click the big icon to let it do the initial setup when connected to the home wifi
yeah i wonder if i could just host vpn servers on the router using other protocols or if that would be too much load on the router hardware
yes its auto setup
i think asus comes with an openvpn server out of the box
unsure if they require any additional licenses and payment to use it (at least beyond the first 1 or 2 or so devices that they might have included with the purchase of the device as a teaser)
Hey
Can someone help me
I got a script from GitHub
I’m trying to run it but I can’t figure out how to
Your talk on separation of concerns inspired me to think about this in terms of the TCP/IP model.
Below, I will try explain my mental model of how a client encapsulates an http1.1/2 request for it to be sent a server. Please feel free to correct me at any stage
-
(I'm still a bit confused here. How does the application know to request a TCP connection instead of say, a made-up connection called the ABC connection? but anyways)
-
The application (e.g. web browser) requests that the OS creates a TCP connection.
-
We're now in the application layer. The application, with the HTTP protocol, creates an HTTP request e.g.
GET /mypage.html. This is the raw data. -
The application sends the HTTP request to the os
-
We're now in the transport layer. The OS then segments up that HTTP request into multiple HTTP request data pieces (and because of the layering, or 'separation of concerns', the OS doesn't know that it's specifically an HTTP request it is segmenting, just that it's a data stream),
-
Now, with the TCP protocol, the OS creates a TCP header for each 'HTTP request data piece', and puts them in the 'data' portion of each TCP header. These are TCP segments.
-
The network and network interface layers (I think the OS is also responsible for the network layer, unsure about the network interface) encapsulates further and the network interface layer also sends out the frame to the next device (router).
In this sense, the application does not need to know about lower-level protocols (TCP), since it just sends the HTTP request to the os and lets the os do its thing. And the os doesn't need to know about higher-level protocols (HTTP), since it just performs segmentation arbitrarily.
Could you help answer step 1, and also let me know if I've got it or am completely off track haha. Thanks
so i m having a small problem with my code. i am trying to retrieve the price of a named stock at a site. running the program normally results in the price being printed. but i want to run the program without having the browser open. so i add options.add_argument("headless") but this time the price is not printed. i am thinking this happens due to the price element not leading without the browser opening. Here is the code
def getPrice(stockName, driver):
price = ''
try:
driver.get('https://www.lankabd.com')
searchText = driver.find_element(By.ID, "searchText")
searchText.send_keys(stockName)
price = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[1]/stocklatesttradestatistics/div/div/div[1]/div/div[1]/span"))
).text
except:
return -1
finally:
return price
ChromeOptions = Options()
ChromeOptions.add_argument("--ingnore-certificate-errors")
ChromeOptions.add_argument("--ignore-ssl-errors")
#ChromeOptions.add_argument("headless")
Chrome = webdriver.Chrome(executable_path = 'chromedriver.exe', options=ChromeOptions)
while 1==1:
stockName = "ACMELAB"
os.system('cls')
print(getPrice(stockName, Chrome))
time.sleep(10)
@cloud spruce Thanks for the help yesterday, just got route decorators working on my http server py @route('/hello') def index(request): items = '' for k, v in request.headers.items(): items += f"<li>{k}: {v}</li>" return f"<html><ul>{items}</ul></html>" ```txt
#localhost:5000/hello
Host: localhost:5000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Got the most important status codes working already ```py
STATUS_NAMES = {
200: 'OK',
404: 'NOT FOUND',
418: 'I'm a Teapot!',
}
flawless 🍵 ```py
@app.route('/teapot')
def teapot(request):
resp = Response(
status_code=418,
body="I'm a little teapot, short and stout, tip me over and pour me out!"
)
return resp
anyone have any experience with gunicorn, aws sqs and flask? I'm trying to poll for messages while a flask server is running.
i think you'll find better help with this in #web-development
yeah, it's mostly right
and as to how the application knows to request specifically a TCP socket from the OS, that's all down to the application code that the application programmer/developer has written
to get a TCP socket over IPv4 from the OS towards a destination in python you would so something similar to:
import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect(("www.google.com", 80))
```where `socket.AF_INET` means IPv4 and `socket.SOCK_STREAM` means TCP, for UDP one would use `socket.SOCK_DGRAM` instead
then you have a socket you can write to and read from
nice going 👍
yeah, that last one is really important 😆
but i would use "" instead of '' for all those strings and remove the \ in the last string
Im designing a queuing app that end users use, and an associated queuing management system for the businesses to handle the queues
1.When a user performs a queue operation (e.g. joins a queue), the server gets updated and notifies both the management system and the app. e.g. management system gets its queue updated with a new user, and the app shows the user in the queue
2.Similarly, when the management system performs a queue operation (e.g. kicks someone out a queue), both the app and management system should be notified, e.g. management system gets its queue updated with the user removed and on the app the user is out of the queue
I'm thinking of either using a hybrid of request-response and websockets or exclusively using websockets to do the 'notifying'
-
Hybrid: When a user joins a queue, it sends a request to the server, and the server responds with the queue details. Then, the server opens a websocket connection with the management system to send it the updated queue. A similar workflow would then occur if the management system performs a queue operation (e.g. kicks someone out), request-response to update the management system, Then opens a websocket connection with the app telling the app the user's been removed from the queue
-
Exclusively websockets: When a user joins a queue, it opens a websocket connection with the server, and tells the server it's joined the queue. The server then sends the app the queue details through the websocket, and also opens a websocket connection w the management system, and sends the management system the updated queue. A similar workflow would happen when the management system performs a queue operation.
Im definitely leaning towards exclusively using websockets since I imagine it'll kinda allow me to set up an event manager in the server that notifies both the app and management system easily since they'll both be using some similar socket.send() interface.
Any thoughts?
Why not use a database to manage its state? It sounds like it could help simplify your system and eliminate the need for websockets (or rather they become an implementation details if one wants real time updates/notifications)
Yes databases will be used.
Say user joins a queue, theyll send data to the server and the server will modify it and store that in the database. The server will then have to send back the modified info to the user. Should this process be a request-response or a websocket
I would use a http request/response
If they need real time updates on their move in the queue, then a websocket would make sense to receive updates. But doing so would decouple their presence in the queue from receiving updates and helping resolve issues like disconnections
The only reason im considering websockets instead of http for when a user joins a queue is because the server will then have to send modified info to the management system through sockets, and by making everything use sockets i imagine my event manager will have an easier time doing some socket.send() to send data both to the user and to the management system instead of handling a request-response for the app/user, and a socket connection for the management system
What's the difference between your management system and your queueing system?
Do you control both?
there are two applications.
-
queuing management system/queuing system/management system all the same thing,
-
the actual app for users to join a queue
yea ill control both
so why do you need such strict separation between the queue system and management system?
by queue system you mean the mobile app?
The thing that receives the requests from the mobile app
A user joins a queue in the app, sends that data to the backend/server. Backend has to give it modified info back (queue details), Backend also has to update the management system that a user has joined the queue
Separation between app and management system is because the app is for actual users to join a queue. Management system is for businesses to monitor the queue
so are you saying the management system is a html frontend?
Ye
got it.
Then yeah, using websockets to receive updates on the management frontend would make sense, with the caveat they only need one connection, not one per user
Yepp
Now my question still is, would it make sense to also make the app -> server, server <- app process use websockets instead of http requests, so that everything just uses websockets.
I'm afraid that by using request-response, it makes the project difficult to scale if I have more frontends that need to be 'notified' by the backend.
that's the opposite. request/response is easy to scale
The general pattern is:
- request/response to get the (latest) state
- websockets to get the updates
For example, when the management system kicks a user out, if I'm using http request-response, then I'll instead have to create a socket connection between the backend and app, and use http between the management system and backend.
So then I'd have two systems.
- if the app sends the update, use http for the app and sockets for the management system.
- if the management system sends the update use http for the management system and sockets for the app.
With more frontends the increasing permutations seems a bit much
Conversely, if everything uses websockets...everything uses websockets
Alright sounds good, thanks
and as you mentioned a mobile app for the user app, you should look into push notifications
forget about connecting from the backend server to the app or the management system for that matter if it's web-based both needs to be the ones that connects to the backend server
I'm not sure if it's been done before but does anyone know of any implementation of RDP protocol in pure python?
check out: https://github.com/citronneur/rdpy
but it has not been updated in two years time
Okay thank you!
Hey beautiful people I have a question
Today I've been seeing a couple of videos on burp suite...perhaps I don't really understand it much or I haven't just seen a video for exactly what I need..so here's what I'm trying to do.. The data coming through a website's websocket is what I need and I want to know if I'd be able to use burpsuite in any way to reverse engineer it
Im not quite sure I understand what youre trying to say.
Both the app and management system will be ‘connected’ to the backend. My question however was whether this ‘connection’ should use both http and websockets or excludively websockets
either works, and there is even the option of using request/response without websockets and still get really close to real-time updates if you use a notification system
but what i was answering was that in your description of the flow you were saying that the backend server should in specific situations connect to the app or the management system (which are both different kind of clients, right?) to give it an update of an event, and i'm just saying that you shouldn't count on being able to connect to any of the two from the backend server, it is the app and the management system that needs to initiate the connection to the backend server every time, not the other way around, then the backend server can talk to either client through that connection
sure, you should be able to, unless the app has been built with countermeasures to defend against such attempts to reverse engineer it
Ohh I see, yeah you’re right, either way the clients are the ones that initiate the connection. Thanks for the pointer
Okay but can you give me tips or something on how
Hi everyone.
I have this home assignment that I need to submit.
I'm need to run an Nginx load balancer for a simple flask app.
The flask app should print the IP address of its container OR local IP.
The requirement is to scale to 3 instances and use docker compose to run everything.
What I'm trying to achieve is to browse to localhost:9090 and on each page refresh, have the loadbalancer cycle the IP address of each flask app instance.
The problem is that I'm only getting the IP address of nginx server instead of the flask apps.
that's my docker-compose:
version: '3.7'
services:
# Build the app services
app1:
container_name: app1
# The my_var is for validation purposes
#environment:
#my_var: app1
build: app
ports:
- 5001:5000
app2:
container_name: app2
#environment:
#my_var: app2
build: app
ports:
- 5002:5000
app3:
container_name: app3
#environment:
#my_var: app3
build: app
ports:
- 5003:5000
nginx:
container_name: nginx
build: nginx
# Bind the port 80 of container to machine port 9090
ports:
- 9090:80
# Make app as nginx dependency service
depends_on:
- app 1
- app 2
- app 3
that's my nginx.conf:
# nginx will handle the connection requests
events {}
http {
# Define the group of servers available
upstream backend {
server app1:5000;
server app2:5000;
server app3:5000;
keepalive 20;
}
server {
# Server group will respond to port 80
listen 80;
location / {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
}```
that's my app.py:
from flask import Flask, request, jsonify
#import os
app = Flask(__name__)
@app.route("/", methods=["GET"])
def get_my_ip():
ip_addr = {{ request.environ['SERVER_ADDR'] }}
return ip_addr
#return ip_addr
#return jsonify({'IP ': request.remote_addr}), 200
# return os.environ["my_var"]
app.run(host="0.0.0.0", port=5000, debug=True)
i could add here that by default his docker-compose configures Bridge network, and somehow connects his host/app1/app2/app3/nginx in this equation.
And within app1/app2/app3/nginx is present autoconfigured internal DNS resolver allowing to communicate from nginx to app1 by hostname app1? 🤔
No idea about details. I am newbie to networking.
from host, it is possible to request app1/app2/app3/nginx only through localhost hostname
from nginx/app1/app2/app3/nginx it is possible to address nginx/app1/app2/app3/nginx only through named hostnames like app1, but not possible through localhost
This did the trick:
app = Flask(__name__)
@app.route("/", methods=["GET"])
def get_my_ip():
return socket.gethostbyname(socket.gethostname())
app.run(host="0.0.0.0", port=5000, debug=True)
👍
thank you for helping!
can someone please help explain to me, what on earth the password for this ssh connection is supposed to be? im beyond lost, and have yet to find an aswer for this...please
for clarification, im setting up an SSH tunnel from Host VM #1 (on the left), to Host VM#2 (on the right).
The only password that it should be, is my VM2's root password, which its denying.
you are trying to login as the user test not root, also note that the root account might be disabled for logins over ssh
ohhh i see
yeah its giving me a permission denied, so i really want to know how to bypass that or grant permissions to this host
because its not saying the password is incorrect
it's hard to troubleshoot this issue like this and with this little information
sorry, i don't really do DMs or calls on discord, but if you want to try to go into more details here in the open channel i can try to continue helping you here
so, if we start from the beginning, what are you trying to do?
which host is trying to connect to which host and what are their ip addresses that they can reach each other on?
@cloud spruce So theres 2 Virtual Machines running Ubuntu Linux - ip of VM#1 = 192.168.100.5 . ip of VM #2 is 192.168.100.6. Im able to succesfully chat the two via a netcat session, by running nc -lp 1234 on VM1, and connect the VM2 to it by doing nc 192.168.100.5 1234 . This far im good and understand, but netcat is unencrypted so I wanted to create an ssh tunnel over which I can run these same commands and chat.
However where im stuck now, is in finding my answer of how to do this (https://askubuntu.com/questions/476594/secure-chat-tunnel), and running the ssh 192.168.100.5 -L 1234:localhost:1234 command on VM2, is giving me this major pain in the ass problem ->
I have no idea whats causing this, and have tried editing my sshd_configs file with all the google suggestions, but god knows what this password is, or permissions issue is coming from....please assist if you can
the password should just be the password you use when logging into the test account
before you try to get the tunnel working, first just try to get a normal ssh session up and running between the two VMs
it's just the account password
right?...unfortunately that doesnt work
how would i do that again? apologies my brain is fried atm
from .6 can you SSH regularly into .5? ssh test@192.168.100.5
just remove the -L and everything after
ok let me check
also add -v afterwards if you want some debug logging to see what's going on
what username are use using when you login locally to the VM (not over ssh)?
yeah nope
well when i open the vm, its virtualbox, so it just asks for my password
is the account username on 192.168.100.5 also test
nope
well that's why you can't login
SSH takes the remote host and the remote user
you need to ssh saad-linux@192.168.100.5
if there is no test account on 196.168.100.5 then what are you logging into?
i see, that actually makes alot of sense
let me try this
wow, yeah so that ssh works
neato
@cedar forum thanks for clearing that up, now to actually see why my netcat wont connect to the listening port on the host
im starting to question if (https://askubuntu.com/questions/476594/secure-chat-tunnel) this solution is even correct? can someone verify im doing this right?
can you show all commands you've run, including the SSH one
you need to leave the SSH command running somewhere
this is on VM2 (the 0.6 one)
uhhh
and this is all i should need to do on the VM1 (0.5 one), is just listen for a connection
you're logging the VM into itself
you're on 192.168.100.5 and are opening a new SSH connection to 192.168.100.5
yeah i realized that after reading the name...but you guys said it was correct
right, my goal should be to open an ssh connection to the opposing vm right?
oh wait
im confusing what an ssh tunnel does, my bad
okay, what you need is 3 terminal windows, one on 192.168.100.5 and two on 192.168.100.6, something like this:
192.168.100.5:
nc -l 127.0.0.1 1234
192.168.100.6:
ssh saad-linux@192.168.100.5 -L 1234:localhost:1234(leave this running, open a new one for the next command)nc localhost 1234
explaining what each of those does:
- on
.5:nc -l 127.0.0.1 1234opens a new netcat session listening on127.0.0.1:1234 - on
.6:ssh saad-linux@... -L ...creates a new SSH tunnel, it'll proxy any traffic going tolocalhost:124on.6to the port1234on.5, over the secure shell session - on
.6:nc localhost 1234open a session with netcat to the local end of the SSH tunnel, that'll proxy it to the remote end and eventually to the other nc session
should i clear the session? how do i exit the ssh'd instance of my 0.6 host?
or should i just continue on another terminal
just type exit until the window closes
ok
you've probably got shell sessions inside shell sessions so you might need to type it a couple of times
but for the ssh tunnel to work the ssh session must be left open, that's why you need two sessions on that machine
ok so i did that last command, on the second terminal nc localhost 1234
and it did seem to connect to the listening port on VM1 (0.5), which is just running
I sent a message, but it immediately ended the session
and it shows this on the ssh terminal tab
sorry one second
@cedar forum @cloud spruce so it seems im having a connection refused
for clarity, 0.5 is on the left, 0.6 two terminals machine is on the right ofcourse
hmmmmm
looks like the SSH tunnel can't get to the local nc url
okay try change that SSH command out to uhhh
ssh saad-linux@192.168.100.5 -L 127.0.0.1:1234:localhost:1234
oh hold on wait
might be the wrong way around
hm no, its doing the same
i didnt see how it would make a difference anyhow, since localhost should be the same on both machines, they're both running on my host network ofcourse
thanks alot for your in depth help man, first person to do this much
ahhhhh
also add -v to all the commands (both nc commands and the ssh command
i've got it
the nc on the other host needs nc -l 127.0.0.1 -p 1234
it's missing the port flag
dude, i swear to god that was my first hunch
since on the regular netcat connection, i needed to do -p otherwise no connection was made..
SUCCESS! @cedar forum @cloud spruce thanks a ton guys
👍
one last question though for my understanding of this tunnel
when i exit the connection from the 'host (VM1)' side
it closes only its connection
and not the connection of the client (VM2), which remains open
however, the other way around is not the same, closing the client connection ends both connections
again, if you add -v to each of those commands you will get more information about what is really happening under the covers
apologies, i will do that now
no problem, and sorry if I sounded harsh, that was not my intention
not at all lol, your help was appreciated all throughout
im just rushing as id been stuck here for days now
to be fair, @cedar forum did most of the work, i myself is just typing away on my phone right now
if you know the reason to the question i made above actually, feel free to share
i somewhat understand it
if i remember things right nc -l will just handle one connection, if you want it to stay alive you need to add the -k option to that side to keep it alive for more connections
but why does the client side connection stay open even after the host listener closes?
but nc will still just be able to handle one connection at a time
it probably just don't know that the other side has disconnected yet for some reason, i would just blame it on the implementation of nc 🤷
I feel like sharing something kinda cool I made with sockets that's in its early stages
https://github.com/kronifer/cosmo I wrote a web server
Hey Everyone
Today I've been seeing a couple of videos on burp suite...perhaps I don't really understand it much or I haven't just seen a video for exactly what I need..so here's what I'm trying to do.. The data coming through a website's websocket is what I need and I want to know if I'd be able to use burpsuite in any way to reverse engineer it
@ember ledge Pretty sure burpsuite acts as a proxy, so it sits between your device and the server,
device —- burp suite —- server.
when the server sends a websocket msg itll go through burp suite then to your device. you should be able to configure burp suite to receive the messages and see it in the burp suite app. not sure on specific configurations tho
it's pretty straightforward
u enable it in firefox
you can enable intercept in burpsuite
then the http requests n stuff will pop up when you do anything thru firefox
you can then modify and forward them
not sure what you mean by reverse engineer it in this case tho
what kind of device and application is the websocket coming from in your end?
is it even a web browser or is it some kind of other app on a mobile device?
From the web browser
The messages are coming from the website's server on google chrome.. what I'm trying to actually do is get a hold of the messages everytime they come in and direct them to a website I'm making...
then you shouldn't even need the burp suite to see the data, that should be available directly in the network tab of the developer console in chrome
Yes I can see the messages in devtools.. the main point of even considering burpsuite is because I'm trying to constantly forward the live messages somewhere else
why not just build something that access the websocket directly?
I tried that.. it always kept closing
I sent the code here a few weeks back
oh, so this is for the same thing?
Yes bruv I'm just looking for an alternative
Good night people
I'm studying about backdoor and I sent my backdoor to my friend
But we saw that I need to be on the same network and I wanted to know how I can circumvent this
If anyone knows, please let me know!
We won't help you with that here
I understand
Why do we need MAC addresses when you have local IP addresses
they work at different levels of the network stack. mac is used for point-to-point while ip will be used for end to end
Hi Guys, I am using python to build up a virtual network. For instance, I got a graph(topology), and I need to stick configurations to each node(device) and edge(connections), which is troublesome. Because, you need to handcraft everything, making sure that each connection is valid (for example, two-end nodes should have ip addresses in the same subnet. Another one, one node has DHCP running should not connect to WAN directly.)
I want to know if there is any library serving the similar purpose as I described. For example, generating random but legit network configurations.
how can ı upload file to ftp server with python script
take a look at ftplib: https://docs.python.org/3/library/ftplib.html
does anyone have examples of using flask as a HTTP POST endpoint?
how could I intercept, modify, and then forward HTTP requests to a server
because when I use the requests library and get the headers it doesnt include things like user-agent or the values I put into the search bar
I used urllib for parsing headers for one of my projects, not sure if that would be of any use to you
yea it's just Im not getting the HTTP request I want to when I use the requests library
it's just that I want to get back traffick that looks like this:
GET /search?q=heyowhatsup HTTP/2 Host: stackoverflow.com Cookie: prov=ba71d634-73d0-baaa-51b6-98f176c9c1e4; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Jul+26+2022+22%3A15%3A03+GMT%2B0100+(British+Summer+Time)&version=6.37.0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0003%3A1%2CC0004%3A1%2CC0002%3A1%2CC0001%3A1; OptanonAlertBoxClosed=2022-07-26T21:15:03.563Z; _ga=GA1.2.1711668389.1658870195; _gid=GA1.2.1682325424.1659038292 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://stackoverflow.com/search?q=heyo Upgrade-Insecure-Requests: 1 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: same-origin Sec-Fetch-User: ?1 Te: trailers
actually containing the search input
but im jusdt getting this
{'Connection': 'keep-alive', 'cache-control': 'no-cache', 'pragma': 'no-cache', 'content-type': 'text/html; charset=utf-8', 'content-encoding': 'gzip', 'strict-transport-security': 'max-age=15552000', 'x-frame-options': 'SAMEORIGIN', 'x-request-guid': '4f78de5b-cd4d-4b37-b0fc-8ec34a3113c8', 'feature-policy': "microphone 'none'; speaker 'none'", 'content-security-policy': "upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com", 'Accept-Ranges': 'bytes', 'Date': 'Thu, 28 Jul 2022 20:41:05 GMT', 'Via': '1.1 varnish', 'X-Served-By': 'cache-ams21066-AMS', 'X-Cache': 'MISS', 'X-Cache-Hits': '0', 'X-Timer': 'S1659040865.319320,VS0,VE187', 'Vary': 'Accept-Encoding,Fastly-SSL', 'X-DNS-Prefetch-Control': 'off', 'Set-Cookie': 'prov=07af97fd-3330-8209-91d2-142e80334ec2; domain=.stackoverflow.com; expires=Fri, 01-Jan-2055 00:00:00 GMT; path=/; HttpOnly', 'transfer-encoding': 'chunked'}
whats the question?
could be helpful yea thanks
this is a different module again but urllib.requests has a method for adding headers https://docs.python.org/3/library/urllib.request.html#module-urllib.request
aah yea I saw that but I just realised
.get gets the received data not the one being sent
which is what I want
Takes a key Val pair
I need to do .post with some empty data maybe
ohh I see
thanks anyway!
no problem, I think that might help me with my next project too
any good general networking discord servers?
this feels really dodgy and i would advise anyone and everyone to not download and execute binaries from random people or sites online, it could be very dangerous
\ In Linux, many environment variables are ignored by the dynamic linker if the program to be executed is a Set-UID program. Two such examples are LD PRELOAD and LD LIBRARY PATH. Please explain for what reasons would the following environment variables be considered a security risk if they are not ignored:
• LD AUDIT
• LD DEBUG OUTPUT
Hi Guys, I am using python to build up a virtual network. For instance, I got a graph(topology), and I need to stick configurations to each node(device) and edge(connections), which is troublesome. Because, you need to handcraft everything, making sure that each connection is valid (for example, two-end nodes should have ip addresses in the same subnet. Another one, one node has DHCP running should not connect to WAN directly.)
I want to know if there is any library serving the similar purpose as I described. For example, generating random but legit network configurations.
So w the tcp/ip model, an http request gets segmented into multiple segments and has a tcp header added to each segment. all the segments then get turned into packets and then frames
You send the frames to a server. Does the server send an ack back for every frame or does it rebuild a request from the frames and then send a single ack for the request?
I tried checking the networking custom invite but it was a bust 😔
the vanity invite? yeah i checked it as well😔
the receiving side does not need to acknowledge every packet, it is very common that the tcp stack will acknowledge every other packet or even less often if the data rate is high enough (packets are received in quick succession)
the acknowledgement number tells the our peer which sequence number that we are expecting next and that we have received all octets/bytes prior to that sequence number
we're really acknowledging the number of octets/bytes we have received so far in the data stream rather then packets or segments as such, even though it will always align with a segment boundary
the sender needs to receive an acknowledgement before it has sent as many octets/bytes as the size of its window since the last acknowledgement it received, or else that peer must pause its transmission of data when it has exhausted its transmission window until it has received an acknowledgement, or in the event of not receiving an acknowledgement before its retransmission timeout it will need to send that unacknowledged data again
you might try asking your network related question in here, unless it's mainly about web development and belongs in #web-development
oh no no i have no issues, i just want a cool networking community to talk to :DD
so, we are not cool enough? 🤪 😉 😆
Its not you, its me😅 😔
that phrase usually means the opportunity 😁
(while trying not to hurt the other persons feelings)
you could try sockets!
that would allow you to get that exact text
idk I realised that my proram needs to be able to detect input fields like the searchbar and try to actually perform a search from it
to get that data
because otherwise if I just input the link with the search in the url there's no search info that needs to be sent so it wont be in the request
you can send all the header fields and even content body in case of a post that a browser would send, you just have to add that too
I dont want to add it
I want to receive the data
but like I said nvm I figured it out alrdy
oh, i see, i must have misunderstood you completely then
Is there anyway to drop repetitive packets/payloads from a host? I've been looking around articles and such but I haven't found anything useful.
what kind of traffic are you talking about when you say repetitive, like DoS/DDoS, scans/probes or just crap traffic like broadcasts on the network?
Mainly DoS/DDoS.
if you know the source ip addresses you can always block the host(s) it with a firewall rule
if it's http/https requests a WAF might be able to help you to a certain extent
or if all you want to serve is https traffic and you're okay with hiding your host behind cloudflare and letting them get access to all the traffic, then that might be an option
otherwise we are probably talking about either very complex open source solutions (using things like snort, sagan, zeek, suricata and prelude to stitch something together by yourself) or some expensive commercial DoS/DDoS solutions
I'm mainly trying to block L4 traffic, most DoS/DDoS attacks consist of sending a single payload repetitively being sent to overwhelm servers or whatever they're targeting. I'm just trying to find a simple solution to that. Thank you for naming a few programs that I can possibly create this firewall with!
you can always change your devices ip but it really wouldnt change the fact that the ip is getting flooded with request and wont respond accordingly when assigned to a new device, right?
Ooh I see, so theres a window of how many packets you can send, until you receive a single ack back that acknowledged those packets. and if you send as many packets as that window size and dont receive an ack back then you cant continue sending packets and you retransmit
if you have a [dynamic] dns entry for a site/service that you're hosting and they know the dns name of that entry it won't change much at all
your probably much better off trying to automatically identify the source ip addresses of those that are abusing the service through patterns in your web logs and automatically temporary block them for x number of hours or even a few days at a time
ah if were talking about dns name thats something i didnt knew lol
thanks btw
How do i make sockets communicate globally instead of locally?
websocket packets use HTTP to format messages right?
What is best practice? To create the public and private key on the client and send the public key to the ssh server, or, create the public and private key on the ssh server and send the private key to the client?
almost, but during the three-way handshake each party tells the other how big its receive buffer (window) is in number of octets/bytes, not packets
and that is how much data each party can send to the other until they have to get an acknowledgement to be able continue sending data
that doesnt answer his question and why would you do that anyway 😂
if, by locally, you mean on your LAN and by globally, you mean "on the internet". the server will have to configure port forwarding
this can usually be found in your routers settings
basically it allows incoming connections (from the internet) past your router and allows your server to handle them itself
no, only the handshake that switches the communication from HTTP to websocket is HTTP, after that request-response that starts the websocket it's just a bidirectional binary socket
it's best practice to only ever have the private key on the system that is going to use it and transfer the public part to the other party
Thank you!
as @prisma cobalt was saying, the system that is receiving the connection needs to have a public ip address out on the internet to be "globally" reachable or have some other system that has a public ip address forward the communication (for example using port forwarding or DNAT)
i was wondering if anyone knows how to make a sneaker bot
im new to python completly and was wondering if someone can point me in a direction or make it for me for a pay
isn't asking for paid work a rule violation? Like rule 9?
how do i get what networks my flask app is running on?
like in a variable
and not printed
Can anyone describe what netmiko is and connection handler in it im new to python
!rule 5 because i'm quite sure that using a sneaker bot is against ToS of the site that it's used on and probably malicious and certainly inappropriate
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
!rule 9 is quite self explanatory in this case
what do you mean exactly?
you mean the ip address of the server that it's running on or the public ip address that it's running behind? (for the last one, you can't really)
for the last one, you'd have to rely on another service such as https://www.my-ip.io/api
just that there is no guaranties that the ip address used for outgoing connections is the same as the one used for incoming connections, that's why i left such a suggestion out, it very much depend on the environment that it runs in
can scapy be used on windows?
both
ok so basically it can already do that i just depends on your router?
I'm not sure if there's a better place to ask this, but can someone make a simple script in Python or C# (unity) that uses networking to log into either backpack: (https://unsmbp.uns.nova.edu/SeniorApps/facelets/registration/loginCenter.xhtml), or Canvas: (https://uschool.instructure.com/login/ldap),
I know this is kind of a big ask, but I've tried it myself and I simply don't know enough to do what I want to do. For now, after logging in, I just want to print the HTML of the page you're sent to after logging in. Thanks.
i just mean that if you are hosting something and use a dns name that you update with your new ip address and they know the dns name you are at the same time giving them your new ip address
but if you are hosting something you will need to update the dns entry or else the site/service won't be accessible to anyone
yeah, we aren't code bots that generate code upon requests
what we do try to help with to the best of our abilities and to the extent that we have time for is to guide or help people fix their code when they provide the code they have come up with so far
and I don't really see the point of using unity if you are going with c# (which is pretty much off-topic for this channel and mostly for this server as well)
Like I said, Python is fine too, I'm just more new to Python than C#
would mocking a request like this be a simple post request with json={...} or data={...}? Getting 520 status, usually when sending json data it didn't say form data as title at top
At 14:10 https://youtu.be/r5oT_2ndjms, the speaker says hpack works over the tcp connection not over streams.
To my understanding, a ‘stream’ is just a logical connection, where any h2 packet sent with a stream id is in a ‘stream’. similarly, a tcp connection is just an environment when a tcp packet is sent where it receives an ack back.
Im a bit confused on where hpack is located and how it can be ‘stored’ as a single instance within a tcp connection,
like is it stored within the application and decompresses the header frame(but then this would be part of the application layer and not over tcp like the speaker says),
or does the os store the hpack instance (but then it shouldnt know about the http header frame).
Please help clarify this, thanks
HTTP/2 is coming. Actually, it’s here. Right now. It impacts not only your user’s experience but also the way you need to think about your website and webapps. Let’s see how HTTP/2 came to be and how it makes development easier.
Surma is an engineer working with the Chrome team. He likes to cut himself on the bleeding edge, goes full-stack ever...
dot11b = Dot11(type=0, subtype=12, addr1=client, addr2=AP, addr3=AP)
why is it often that addr2=addr3 in these type of packets?
How can I pass some data from django to js script preferably without using this in template (I prefer storing scripts as separate files)
<script>
let data = JSON.parse("{{ data }}");
</script>```
Idk if this is a valid channel to ask but I already asked in [#web-development](/guild/267624335836053506/channel/366673702533988363/) and got sent to here
If possible ping me on reply pls
what would be a very bare bones multi connection server?
what is ip data plane ?
Hi. when doing socket.getaddrinfo(host, port ...), port could be string like "http", "https", ... , or int like 80; 443. Where could be seen a reference for this mapping : "svc": N ? thx
# bot.py
import os
import discord
from discord.ext import commands
#client = discord.Client()
client = discord.Client(intents=discord.Intents.default(),proxy="http://myproxy.com:8080")
bot = commands.Bot(intents=discord.Intents.default(),proxy="https://myproxy.com:8080",command_prefix='!')
os.environ['HTTP_PROXY'] = 'http://myproxy.com:8080'
os.environ['HTTPS_PROXY'] = 'https://myproxy.com:8080'
@client.event
async def on_ready():
print(f'{client.user} has connected!')
@bot.command()
async def dosomething(ctx):
await ctx.send('I did something')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
client.run('TOKEN')
can anyone help how to run discord bot using proxy ?
this script is working only make bot online but when type no working.
I already try using export HTTPS_PROXY= and export HTTP_PROXY=
I ask in discord topic also they don't know
so, i got a docker file up and running, it starts up server.py (my server) on http://127.0.0.1:80 (i'm using fastapi and uvicorn), this has only one websocket endpoint, the root (/). however, when i connect to it i get a ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection.
Yes i have done EXPOSE 80. Any ideas?
Did you map the docker port to server port
Ok
def main():
srvr = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
srvr.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
srvr.bind((ip, port))
srvr.listen(5)
print(f'[*] Listeining on {ip}:{port}')
while True:
cli, addr = srvr.accept()
print(f'[*] Accepted connection from {addr[0]}:{addr[1]}')
cli_hndlr = threading.Thread(target=handle_cli,
args=(cli,))
cli_hndlr.start()
def handle_cli(cli_sock:socket):
with cli_sock as sock:
req = sock.recv(1024)
print(f'[*] RECV: {req.decode("utf-8")}')
sock.send(b'ACK')
if __name__ == '__main__':
main()
First recv and send is ok, but after that there is always a broken pipe error, what am I missing guys?
can someone tell me why when i send a request using python to a site it returns {"status":"error"} but when i do it in the browser with the same headers and payload it works
also the response code is 200
So i want to make a get request with a proxy that looks like this
ip.blabal.com:12323:user:pass
how do I do that?
oh
nvm
got it
proxy using http or https ?
http like this, but https i look for the answer also
Hi I wanted to learn backend development (create endpoints and such). I was wondering wheres the best place to start?
hey guys, i am building an app for small python code challenges, basically you can download it and solve small coding challenges. the beta version will be available soon on testflight. leave your email addresses and i will add you in beta if interested.
Fast api docs
#discord-bots and skill issue
You are making a client and bot instance
Which is a bad idea
Use only the bot instance
And add await bot.process_commands(message) at the end of the on_message event
And you might gotten the port/endpoint wrong
Check your proxy docs
hello peeps i managed to setup a ubuntu vm in vmware with static ip(bridged) that has the same 192.168.50.xxx as its host, i also setup static ip in the router for the host machine
the vm and host have different ip and can both access the internet but i cannot ping my vm no matter what
i tried a number of devices with dns server set to the VM's ip(192.168.50.xxx) but i just cant get the ping through
firewall on the VM and host are both disabled
the host is win11, vm is ubuntu18.04
i ve been trying to get this working for weeks lol
@cloud spruce?
code is working without proxy.
Bros not even a mod
Get off my d### WORD like why u on my d### you not even a mod or admin
using pycurl.Curl(), how can i get the json response, the text and response_code? this syntax is weird, and im not entirely sure if im doing it correctly
Tf is ur problem?

Anyone have any experience using the EasySNMP library? From reading the documentation (https://easysnmp.readthedocs.io/en/latest/session_api.html) it looks like there's no way to create a session where you can specify a separate read and write community strings. It looks like it attempts to use whatever is passed to "community" for both read and write. Does anyone know if there's a way to create a session instance with a separate read and write community string?
This seems kind of silly because most SNMP devices don't use the same community string for both read and write. I know I can just create a new session using the write string for write operations, but ideally I'd like to use the same session instance for both.
What is the difference between tcp flow control and http2 flow control.
More specifically, with window_update frames that work on the whole connection vs tcp window size.
To my understanding, window_update frames that work on the whole connection, works by a sender being allowed to send as many octets as agreed upon by the initial window size in the settings frame, the receiver then sends a window update frame to tell the sender their buffer is free and the sender can again send octets equal to the initial window size determined by the settings frame.
with tcp flow control, each ACK by a receiver contains a window size field that tells the sender how many remaining octets the sender can send.
This seems redundant to me. With TCP you’re telling the sender the updated window size after every packet gets received and with http2 you wait until all of the octets are received before sending a window_update frame saying your buffer is free and to send octets equal to that initial window size again.
Why the need for these two flow controls? Why couldnt http2 just rely on tcp’s flow control?
isn't it because you can have multiple http2 streams in single tcp connection? just guessing, don't know real answer
Yeah im specifically referring to window_update as a mechanism to flow control the connection since that’s also a feature of window_update
I get the use of window update for flow controlling individual streams
oh yea just found that: both endpoints maintain stream level and connection level windows. hmm that indeed looks redundant
how do i connect to other computers from who are on same wifi as me
using python
without reverse shell
like this
both computers connected to same network
me
connecting to other computer just using ip, port and same network
i know there is a way
There isn't a way without having an application running on the remote host.
my friend told me that is possible :/
They are wrong
oh
If you want to connect to a host, there must be something listening on a port. Which means there must be an application opening up a socket to listen, which means there must be an application running there.
That would be more like a normal remote shell, ex: ssh
the target computer needs to run a server script and your computer needs to run a client script (if your the one wanting to connect to them)
i know
once the server is listening on an address like recursive_error said, its easy as pi
So, I wrote some code today and ended up using socket conns as dictionary keys. While writing I was thinking "this feels like a stupid way to do this and it probably won't work". And then it worked. Anyway I felt like telling someone who might care
A short explanation is the tcpip.server can have multiple simultaneous clients (likely up to 60+ eventually) and they send data that gets passed via queues to a gRPC client/server and I needed a way to associate responses back to the proper client
I just dreamed up a better way... Key it by socket.r_port. that will be equivalent and not a dumb key
Im trying to get IPv6 of the matchine running the program.
I tried gethostbyname which is states in document but it gives local ip.
I now trying a aproach of doing with os.system("cmd /c ' ipconfig' ")
it gives the whole ipconfig I want to get just IPv6 part
how can I do it
parse it
are you looking for the public IP?
you're not going to get that from ipconfig
you need to use a service on the web
make a request to https://icanhazip.com/ for v4/v6 or https://ipv6.icanhazip.com for just ipv6 if you want to find the current address
What?
No, my thing is a local socket connection. I definitely should use the remote port
right, but then you just said it gives the local ip
You're mixing up two conversations I think

oh they left anyway lol
hahaha i don't have much great insight to add
other than it makes sense that things work as dictionary key given how computers represent network conns
it'll give back a file descriptor which is a monotonically increasing integer which makes it very suitable for hashing
Yeah. It was an interesting problem though
Because I had to encode my command reference into the reference that went out via gRPC and then translate the reference back to figure out which connection I needed to queue the response to
Pushing multiplexed messages through a singleplexed pipe
ahhh
Hey guys! I have a question. I am going into college-level network security classes, and I've never worked with network security or networks in general. Any videos I could watch to help me get a leading edge?
So does a router send a packet or a frame? I always thought a router decapsulates a frame, read the L3 data, then re-encapsulates the frame to send it to the next router, and the process repeats.
https://networkengineering.stackexchange.com/a/56644/84919 This first paragraph of this answer explicitly says it sends a packet. The router decapsulates the frame, reads the L3 data, then sends off a packet to the next router. Then the next hop router rebuilds a frame for the packet so that it can strip it off again? I'm not sure about that last part about the next hop router.
In any case, in the last paragraph, the answer suggests that routers do send frames, but the layer 2 protocol is just different e.g. PPP.
Could someone clarify this for me? Thanks
so we were assigned minor project for semester 5 ....and since my specialization in course is cyber security I have decided to work on network analyzer and visualizer(graphs and plots)...and I have recently got to know about networkx library in python..and I want to make everything with python so if anyone has ever worked with analyzing and visualizing computer networks then I would like them to guide me a bit
Do you have a typo in the above?
Is there some variant of Happy Eyeballs but with a different timeout for each option? Is it even a good idea?
I it is a good idea, in what order should I try the connections? Smallest timeout to biggest, or vice versa? Or maybe it's irrelevant without failure rate information?
Whats netowrking?
in networking, how would you call some information exchange between the server and client. I'm basically looking for the term I should use to name one of my base classes. I already have a packet, which can be contain some data and be sent or received, but I'm not sure how to name a class that performs some longer communication that should still be groupped, such as for example the initial handshake, where some data/packets are sent, but also received, I'm thinking of names like 'transaction' or 'interaction', but I'd like to use some conventional term if there is one
How’s “connection “
I'm not sure that's really what I'd want, since there can be multiple transactions like these done during a connection
<@&831776746206265384> this link is a scam
so many redirects to finally see "youve been infected with a virus" which is a shame because i was actually looking forward to learning about networking in docker
"transaction" is more used for database stuff. in one of my projects, we had a ConnectionManager and ClientHandler function if thats of any use to you
client: connects to server
server: accepts the connection
-- Handshake transaction
client: sends their username to the server
client: sends their public key to the server
server: receives the username and public key
server: sends it's public key to the client
client: receives the public key
-- Some other transaction
...
Hi, I'm trying to develop a websocket client that connects to WilliamHill server and reads realtime data. But it sends me only binary data. Is there a way/practice to handle this data?
URL:
wss://scoreboards-push.williamhill.com/diffusion?ty=WB&v=16&ca=8&r=300000&sp=%7B%22src%22%3A%22traf_sb_football%22%7D
Data returned on connect:
b'#\x10d\x1f\xbe\xd4\x1dMe\x92C\x00\x00\x00\x02\x00#0-fSe40w+NZgS9cc78a0xdYZ2S\x00\x00\x00\x00\x00\x01_\x90'
This image represents what the browser sent after connected.
Payload?
how do you do this curl command in python?
curl
--cert $CERT_FOLDER/client-cert.pem
--key $CERT_FOLDER/client-key.pem
--cacert $CERT_FOLDER/truststore/ca-cert
https://localhost:8080/echo -X POST
-d '{"a":"test"}'
Depends on the library you're using, but it should look mostly the same in all of the same
I'm assuming the part you're having issue with is the certs
The requests docs go over specifying your cert, and your ca here
https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification
and https://requests.readthedocs.io/en/latest/user/advanced/#ca-certificates
Though CA is just certifi
what is the difference between udp and tcp and which is better
Good evening team!
I have an important question. I was wondering what everyone thinks of Mimo Dev. Should I apply for the course they offer?
how to make a proxy server using python
there isn't one that is "better"
they solve different tasks
TCP is intended for communication which is fast, but can handle network congestion and will resend any packets that get lost along the way
It ensures that all packets at the receiving end will be collected in the exact order of sending
UDP is intended for fast realtime communications, if UDP packets get dropped, they are not resent, if they are received out of order nothing is done, it's better for things like video calling or multiplayer games where it doesn't matter if a single frame or something was dropped, you just want to get a good enough amount of data transfer in a non-specified order
anyone here worked with networkx package?
UDP is more of a broadcast type thing… if there are too many devices on a network, it can slow things down
UDP is not broadcast
^, vast majority of UDP/TCP is unicast, going from one host to another host
it's just that if you do want to do broadcast/multicast/anycast, UDP is much more optimised for that because it doesn't have a handshake, meaning that multiple devices can receive the same packet and be satisfied with it
what is a UDP socket then, sockets as a concept define 2 communicating endpoints but UDP doesnt require a connection or anything, you can just release a packet into the wild
to an extent yes, but there are still two endpoints that are communicating
you can just release a packet into the wild, but it's still directed from somewhere and to somewhere
which in my books, are two endpoints 😄
@cedar forum A really basic question that I can’t seem to wrap my head around if you dont mind helping out.
It forwards packets encapsulated in frames
The router receives a frame destined for it, but that frame alone can't tell it where it is to go next, so it decapsulates the frame, gets the L3 data including next IP, then it looks up that IP in it's ARP/NDP table, creates a new L2 frame and forwards that on to the next router in the chain
the confusion arises because the packet remains the same across the whole transmission, but at every router the old L2 frame is discarded and a new one created
Thanks for the direct answer haha appreciate it
👍
Sorry I’m a bit lost with the channels where can I go to get advice as what to do as a a beginner?
So what’s the point of framing the packets then if routers don’t even read it?
I’ve seen so many posts talking about how routers don’t care about L2 data and only read the L3 data and forward packets based on IP. So what’s the point in repeatedly framing them?
they do need L2 data, because switches route based on L2
In a non ethernet network
and local networks are routed based on L2
Me sending packets to a google server in another country. why should my router repeatedly frame the packet? My router shouldnt be physically connected to the next hop router that gets it closer to google (and thus they shouldnt have a switxh between them)
they absolutely will have a switch between them
Oh
you might have say
10 or 11 hops between your laptop and google
the only bit of that which isn't ethernet/switched is in your home
it gets to your router, your router connects to your ISPs routers/switches, and then it's just a path of routers and switches until you reach the destination server
it's true that L2 is only used for communication on adjacent networks, but that's not a minor job, bear in mind there will be layer2 networks with hundreds of nodes
This cleared up so much confusion. I thought switches were only physcial
on the network i'm currently on, my laptop is connected directly to the switch
if i was to connect to my wifi AP right now, it'd just be adding a hop to get to the wifi router, which then goes physical to the switch
and L2 is still used on wifi networks
Wait so are you saying that switches are all physical?
any IEEE 802 layer will use MAC addresses https://en.wikipedia.org/wiki/IEEE_802
IEEE 802 is a family of Institute of Electrical and Electronics Engineers (IEEE) standards for local area networks (LAN), personal area network (PAN), and metropolitan area networks (MAN). The IEEE 802 LAN/MAN Standards Committee (LMSC) maintains these standards. The IEEE 802 family of standards has twelve members, numbered 802.1 through 802.12,...
yes
or well, i've yet to see a switch which isn't physical lol
But how does your wifi router have a physical switch connecting it with a router from another network?
as in the two routers arent connected via ethernet but rather via wifi
the wifi AP has an Ethernet running into the switch
youre saying every router in the world is connected via ethernet?
every router has an Ethernet port in the back, probably going to a modem, which goes to your ISP
oh wtf haha thats so neat
the wifi AP there goes into the switch you see in the cabinet which in turn goes uhhh
The world is connected by wires
there
And then the sharks eat the cables
Oh damnnn okok yeah that makes sense
wrong reply but my point still stabds
How does my phone/device connected to wifi send packets then?
the smaller of our switches but the smaller Cisco catalyst is a real nifty little switch
It sends them destined to the routers MAC with the destination IP
But theres no switch connecting it to the router
your phone connects to the router over wifi, that is the physical link, the router then connects to your ISP
and that connection to the ISP will probably be to your ISPs switch, it will probably not be a LAN protocol but it will be L2 (like PPP)
I found this non-smart switch earlier, amusing stuff, maxes out at 100M, making it completely useless to us hahaha
nearly found it's way into my coffee table but it's already full
Switches are all physical. I don't see a switch on my phone. So my phone doesn't actually need a switch to forward its frames to the ISP switch, since it can use wifi. Thus, MAC addresses are not actually necessary for packet transfer. Thus, using wifi, L2 can essentially be omitted. Does that mean that if the world connected all the routers via wifi instead, you could remove L2 altogether?
Wireless routers are an addition to the network stack in order to allow phones and whatnot to connect
Switches are absolutely necessary for transfer, remember how switches work, instead of copying packets onto every interface they direct packets based on L2, and they often have considerably more ports than a router, even a professional one, switches are just as powerful as routers and neither are things that are "unnecessary"
My main confusion is I don't see a switch on my phone
You do need L2 routing, even on wifi you need L2 because remember that if you try contact an adjacent device the lookup uses L2 and is routed on L2
Yes, because you're not connected to the switch
Your router is connected to your ISPs switch
That's not in your house, that's probably at your local internet exchange
Critically, you keep saying things along the lines of "if we route on IPs we don't need L2", remember that there are other L3 protocols which don't even have the concepts of IP addresses
Ahh I see
Ahhh so do you mean to say that over wifi there's an alternate data link protocol that isn't mac addresses and doesn't use ethernet, that doesn't need a physical switch that can let my phone send packets to the ISP switch?
My router is connected to the ISP switch and that is how my router can send packets to all the other routers in the world through L2, mac addresses, arp and all that, that part makes sense to me.
I am still confused tho on what L2 protocol allows my phone which is on wifi and not connected to any ethernet, to send packets to my router/ISP switch, if L2 works on an ethernet basis
L2 doesn't work just on an Ethernet basis
Ethernet frames are one form of L2 transmission
IEEE 802.11 is part of the IEEE 802 set of local area network (LAN) technical standards, and specifies the set of media access control (MAC) and physical layer (PHY) protocols for implementing wireless local area network (WLAN) computer communication. The standard and amendments provide the basis for wireless network products using the Wi-Fi bra...
There's a whole set of protocols in the 802 family https://en.wikipedia.org/wiki/IEEE_802 if you expand Working Groups
IEEE 802 is a family of Institute of Electrical and Electronics Engineers (IEEE) standards for local area networks (LAN), personal area network (PAN), and metropolitan area networks (MAN). The IEEE 802 LAN/MAN Standards Committee (LMSC) maintains these standards. The IEEE 802 family of standards has twelve members, numbered 802.1 through 802.12,...
Ethernet is 802.3, WiFi is 802.11
They're the most common two
That wiki article looks promising as an answer, I'll read up on that article and this topic some more since I'm clearly missing something. Thanks for being willing to discuss always a great help!
thx
also can run a python server on WLAN
???
You're going to have to explain that one a bit
Your laptop is connected to your WLAN network, you can run Python on your laptop which binds to that WLAN connection if that's what you mean, but if you want it publicly accessible you'll need to set up port forwarding
Christmas came early
who's joe
@ocean bay MAC addresses are used for communication between computers physically connected by wires
IP addresses are more "routeable" which means that they can be used for computers that arent connected to each other
for example, A wants to send data to C, since its not physically connected, it cant just send data over a wire, instead it has to rely on intermediaries (B)
A surrounds its data with more data that says its destination is C (ip address)
A cant send the packet directly to C but it knows that B could try
A surrounds the data with more data that says its immediate destination is B (MAC address)
B receives this data but when it unwraps it, it sees that the data wasn't intended for it (MAC address)
B see's that the intended destination is C so it wraps the data with some more data that specifies the hop between B and C (MAC address)
C receives the data and sees that its the intended recipient, it also see's that it was A's ip address that originally sent it
an Ethernet frame contains the MAC address
the ethernet frame encapsulates the IP header which specifies the destination IP address
thats a nice image to describe the different layers
Just to clarify as well, the internet is made up of wires. The wireless stuff happens only at the very very beginning when your device is talking to a WAP. The data is then converted to work on wires as shown above
God I love networking
if a computer has a damaged LAN card, will that prevent an ethernet cable from working?
or are they completely separate?
an Ethernet cable is a cable, unless physically damaged, it cant go wrong in the traditional sense>
if the LAN card is damaged in a way that it sent strange data, all that would happen is that the receiving computers would be very confused and ignore the message. the cable would still transfer the data unconditionally
so to answer your question, they are seperate
thanks, thats a relief to hear 
google wasn't giving me any straight answers on if the cable would keep going even if the card stopped working, and i've been having some really annoying issues with it uninstalling its own drivers at random?
so that gives me some peace of mind, thanks 
ah, well if the card is damaged, it might break its functionality and uninstall its driver 🤔 this could break some software but rest assured, the cable should be fine
Yesss the WAP is exactly the term ive been looking for.
wireless access point lol, certainly nothing else 👀
ayo haha
daily reminder Cisco has tiktok
One more big text wall quesition if you guys don’t mind
Thank you joe
lmao
what the heck, cisco has a tiktok?!? the last cat😭
For applications that require diverse clients intercommunicating like for example a video feed or a udp based game client, how from the application side is the destination IP determined or configured? I am a traditional network guy and I understand that on the network/server side you can use multicast groups to deliver that content, but I cant figure out how the application itself knows who to reach out to.
Anyone know/have any experience with this?
Anyone hazard a guess to why (on a newly registered domain & new web app) would traffic be successfully routed to the app on mobile devices (ipad, iphone) but when attempting to hit in a browser on Mac / PC, gets the landing page for FastHost as though it's not hitting anything? 😄
am I understanding this routing table crrectly?
@tranquil trellis
seem correct, but it looks like either there is a layer 2 switch or subinterfaces between 172.16.1.2 and 1.3
Or just a bad way of diagraming a lan segment given the number of devices
I have no idea how to configure this in packet tracer
I"m currenly having DNS_PROBE_POSSIBLE error while trying to access my website. I saw that my domain got expired which i've paid the renewal fee. But i'm still getting the DNS_PROBE_POSSIBLE error on my browser. My nameservers configurations are all good as i didn't update that from it's previous working state.
What should I do to resolve this ?
I'm fairly new to IPTABLES, I understand that NAT is before INPUT in the process of handling packets.
I am currently trying to use my VPS to proxy my main server for learning and security purposes.
I have blocked all https://check-host.net/ servers WHICH works, I can't connect to my SSH port but my proxy port is allowing https://check-host.net/ servers to connect to my proxy port which means my DDoS protection IPTABLES are not taking effect on my proxy port. How should I go about fixing this issue?
Check server: website monitoring with useful tools, Check IP, Check website
I should add that my proxy tables are in NAT and my DDoS tables are in INPUT and OUTPUT.
Hello guys, anyone can help me ? I soft brick a ap wireless, surfing in the network I find one exploit to unbrick but is in python and I don't know nothin about it, can help me please ?
if anyone here at any point has played with liveoverflows mc proxy please help me i need a sanity check
I'm trying to find a ballpark figure of what bandwidth costs at the transit level, e.g. from the people running the undersea fibers etc.
CloudFlare has some blog posts comparing costs between regions but was careful not to include any real dollar amount. Does anyone has a ballpark figure?
yeah moooost of that stuff is under NDAs, cogent & HE are cheapest, and even then you're looking at something like $1,500/mo for a 10Gbps
if you get a blended connection provided by someone else you can sometimes get it around that/cheaper
however, the nature of transit is that costs are going to differ based on your location, your datacenter and at times even the location within the datacenter, so it's hard to say without getting a quote what a definitive baseline figure is
if you go for a tier 2 that price sooooars down, then you're only paying colo fees which you're looking at anything from $45 to $300 per U per month
depending on what the colo provider is offering, the quality of the DC, etc.
Can somebody explain why there are four ipv4 addresses
you're asking for www.slashdot.org, which will resolve to presumably 66.35.250.148, but then you're asking for a /30 subnet, which contains 4 IP addresses
ah ok
does anyone have good articles on P2P(peer to peer Network)?
have a look at pnp
anyone free to help me out with my packet tracer assignment?
what is that
Peer Network Program
or Plug n play
its a way to use Peer to Peer without the middle man(servers)
p2p already doesn't need servers
it auto port forwards
oh
but if you do p2p when ever one is connected to router do you still need port fowarding
@wise jungle do you thinks it better to use a lib for this or write my own code
Hey there i am transmitting 2 numbers from the client to the server in the same message (using sockets).
How can i find those 2 numbers and make them into separate variables?
Message from client:
99 85
Current code:
data = str(data)
data_x = data[0:1]
data_y = data[1:2]
print(f"X: {data_x}, Y: {data_y}")
Current output:
X: 9, Y: 8
Problem: It is printing only the first digit of the 2 digit number that can change to 1 digit number.
What i want:
data_x = 99
data_y = 85
Ping me if you have a solution.
Hi looking to speak, want to hear about more experience in the industry
do you know what
[0:1]
``` is doing?
we will not just give you the solution as its pretty clear what the issue is
It is looking at the string and it is grabbing the letters from the 0 index to the 1 index. (I think)
Maybe for you. I am new to python overall.
So don’t expect everyone to have the same amount of knowledge that you have.
Because I wouldn’t ask if I would know what is wrong.
jumping into sockets then as a beginner is a huge leep
you should learn more python before jumping into sockets
I have never worked with strings in this way. That is what I ment by beginner
ok so there is this function called split
And this refers to python strings btw
and you can split strings by however you want
Ok. I will look for some more detailed explanations
yea you can find some good explanations in stackoverflow
Most python apps don’t need sockets. HTTP or websocket works fine.
How does a receiving device know what protocol is being used in each layer. e.g when a dns server sends my computer back a packet, how can my computer know that the packet’s L3 is the ip protocol, its L4 is udp and the application layer is dns?
Receiving device can look it up but it rarely cares
Can you define ‘look it up’, and how can it ‘rarely care’ if it needs to be on the same protocol to read the data at each layer?
They can try and figure it out. Apps don’t care about anything past Layer 7.
Sorry if I was unclear, let’s just use one example then. When receiving a dns datagram back from a dns server, how does the web browser (working on the application layer), know that the application layer data it received uses the dns protocol instead of some other protocol.
A little unrelated, does anyone know how to disguise my computer when I connect to my wifi, I want to show up as an android phone or etc.. when I am using windows
Interesting question, as a kid i used to play with a nintendo 2ds and there was a feature where you could connect to a other one wirelessly without wifi, near by like Bluetooth, does any one know what protocols they used to transfer data very quickly for games like nintendo super smash bros, i tried to search on google but the answers werent really exactly what i wanted and were quite foggy in terms to answering the question i have.
The Nintendo DS also features the ability for multiple DS consoles to directly interact with each other over Wi-Fi within a short range without the need to connect to an existing wireless network.
https://en.wikipedia.org/wiki/Nintendo_DS
ah i see, thank you!
Is there any way to write a program that handles accepting socket connections instead of windows doing it?
No
Anyone in Georgia? I have no friends that code😭
I dont even have friends
I have a backend for an iOS app I did with Flask. It’s been running fine for a year now. It’s pretty simple with only maybe 70-80 API calls for CRUD for various more or less complex data types. I now started to slowly port stuff to FastAPI. I was somewhat surprised to see that for the absolutely trivial stuff that I’ve ported so far that Flask is faster. I had hoped to see the opposite as my backend is already glacially slow.
FastAPI is so much nicer to work with though, so users will just have to wait some hundreds of ms longer per API call.
FastAPI is running via uvicorn (all defaults) and Flask via uwsgi (minor settings tweaked). Both on the same server against the same Postgres db.
I hope there’s some magical options that can be tweaked to at least halve the response time.
The endpoint I’m now looking at is one that doesn’t even do any authentication or data validation, which seems extremely slow in FastAPI, but it’s simply a “ping” type call that I call from Pingdom. As the call is executed every minute or so I have some statistical data to look at, so it’s not just a few curl calls and quick conclusions.
Interesting that there is no dedicated channel to backend cruft, I guess this channel is more about bytes, sockets and Nagle than REST.
Ok, it seems to be a common problem that FastAPI is slower API than Flask. You have to be an expert at tuning the whatever thingiemagick is running it in order to get comparable performance to a default Flask.
I had hoped a tool meant for API:s would be massively faster than a tool meant for serving web pages.
Try running FastAPI with gunicorn that has uvicorn workers
It should make optional usage of resources in fastapi, equal to resources used by flask
Then u could see if fastapi has better performance
Although may be uvicorn can run in multiprocess too 🤔
The irony of FastAPI running slower than its alternative gave me bit of a chuckle.
Could be that the name refers to how quickly a developer can create an API. In that regard it’s certainly true.
Hadn't considered that angle. How fast would you say it is compared to say, Flask-Restful or RestX?
I've found Flask API frameworks to be quite easy to setup, a few minutes of work give or take, can't imagine how you could streamline the process even more
its not splitting, its slicing. they are not interchangeable!
also:
as its pretty clear what the issue is
if someone asks a question and they are trying to understand... this isnt particularly useful
maybe to you the problem is obvious but it can be frustrating to hear someone tell you that
to help, you could answer their question or at least point them in the right direction, even if that is just saying "it might be better to open a help channel"
also this isnt true. there are workarounds to port forwarding. p2p does not port forward for you.
i guess you could say the effect is similar to port forwarding but they arent the same
It was the easiest way to explain
Realistically most applications are all the same speed, the framework will make essentially do difference. Because you application is only as fast as the slowest thing, which is normally the DB.
The advantage of FastAPI over flask is the fact it uses asyncio, which means you gain the ability to handle multiple concurrent connections on the same thread, so while one request is waiting on the DB for example (via an async driver) other requests can be processed. However, this does have a limit because again, normally the database will have a limit and if your app has a bunch of queries with JOINs if you're in the SQL world, you'll likely top out at about the same as Flask + Threading.
If you're just 1:1 pasting flask code to fastapi and expecting it to magically be faster, you'll have a hard time, because the only way you'll get any performance improvements is if the server can do multiple things per thread, so database connections need to be async, things need to not block the event loop, etc...
But it’s wrong xD
FastAPI isn't going to give massive performance boost. Either fix parts of your code taking too long or switch languages.
Hi is there anyway i can get this to not return 127.0.0.1?
import socket
HostName = socket.gethostname()
IP = socket.gethostbyname(HostName)
print(IP)
what would you like it to return?
192.168.x.x?
riiiiight
so
you can kind of hack that a little bit with socket
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
print(s.getsockname()[0])
s.close()
it assumes you've got internet and works by opening a connection and seeing which IP was used to open that connection
Oh ok thx
How do I parse incoming GET request? Looking for specific header key:value to respond to to verify a webhook address
I feel like ive been reading information wrong. For example I print request.url and its my webhook address, which I would think would be the host_url
Hey how do I implement dependency injection in a python socketio event listener .
The socketio instance is hooked to fastapi
Any help would be appreciated!
🤝
any with relevant experience/knowledge, please @me
ISM (Rockwell)
Trainee Responsibilities:
Participate in training in: VMware vSphere, Cisco CCNA, Microsoft Servers
Self-study related to networks and virtual machines
SOME START-UP
Analysis and identification of errors reported by platform users,Direct and remote support for users of software (first line of support),
Resolving system requests (including granting privileges, password resets, answering functional questions).
What they offer
Development in the environment of new technologies (internal and external training, conferences, training budget),Creating and supporting SaaS projects,
Startup atmosphere with a partnership approach,
About them
Just remember, in NAME you are not only a programmer. You are the next brick (there are already 50 of us) who is invited to work with us on a long-term basis. With us, you will contribute to the startup ecosystem by becoming either a mentor, an IT project leader or even an investor (as it is described above). You can also switch your career path and turn into an entrepreneur with NAME venture building – our acceleration program for the early-stage startups.
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
anyone have a webscraper? i want to find every url in the site that has a specific string
I have some basic doubts related to networking
the layers
is there anyone available?
how do i check whether the port on which im trying to run my react project is free or not? If its not free, how do i change it?
Hey, can someone show me how to properly do dependency injection on a python-socketio event-listener's callback function?
I need dependency injection to check the priviledges of a user and then return the user.
I need it not to happen in the func's body.
Thanks in advance
Easiest way is that it won't run if the port is already taken, multiple applications shouldn't be able to listen on the same port
The default should be 3000
Though usually tools like vite will tell you which URL it's running on
Hi everyone, can someone help me with a few questions I have about GCP
I'm currently doing a quiz but somehow i cannot manage to achive more than 67%
@ember ledge @wise jungle please discontinue this conversation here and DM @small mango if any further issues.
and just fyi for all, all users are welcome to inform one another of our rules, not just mods and admins
i think i pinged the wrong person
@sour forge for you ^
Hello, could someone explain p2p to me? I seem quite confused and I'm not that good at networking either...
Not an expert but have some knowledge. P2P is fundamentally different from your client vs server model which is the most common. It eliminates the server entirely (in some cases of P2P there will be an index server), but the server’s job is distributed to the users, so there’s no need for dedicated computing power, it’s instead distributed over the client machines. P2P applications will usually have a “daemon” or a background process running that’s handling part of the server’s job, for other users.
That’s sort of a basic level explanation. There’s a lot more into it but that’s out of my expertise
if you didn't already, check out scrapy
say you've got two clients, one wants to send a file to another, in a typical client-server model, the client sends the file to the server, and then the recipient downloads it from that server
so it's client-server-client
that means there is one transmission of the file from sender to server and then server to recipient
p2p cuts that out, there is a direct connection from the sender to the recipient without the transfer going through the server, or being sent twice
often there is a server involved to help coordinate the transfer, because it's very difficult when two clients are behind firewalls to effectively ensure that they can communicate directly without a server
that's called NAT traversal or holepunching
Oh wow that makes a lot of sense
p2p used to be a whoooole lot easier, so a lot of older multiplayer games and software for sharing files (sometimes not so legally hahahaha) worked around p2p
now that we're running short of IPv4 addresses, people are using stricter firewalls, etc. it's a lot harder to implement p2p, but still very much possible and a lot of applications use it (for example, a lot of smart VPN software uses it)
an example tool I'm using a lot of at the moment for work is Tailscale: https://tailscale.com/blog/how-tailscale-works/
they use a p2p network for any device you connect, very smart stuff, they have another blog post on how they manage to get around firewalls and traverse NATs which is frankly genius
Yeah this all sounds WAY too complicated for me to comprehend, probably because I'm lacking networking skills but I still somewhat understand
yeah it's one of those things where the idea is simple, but implementation is difficult
but if you're just looking to understand p2p, it's just a way of two computers, like yours and mine, communicating directly without going through a server (e.g. discord)
so, there used to be a few good reasons to use p2p over client-server, main one was that since you don't have the "server" bit you don't need to pay for a server
Okayyy that actually makes a ton of sense
is it also faster or is performance still the same?
there is the other less "legal" benefit that it's harder to legislate and cease&decist a p2p network, because there is no central server you can shut down
uhhh performance can vary
depends on how good your internet is, how good the other peers internet is, how many peers you're connected to
if you imagine a large p2p network you could have hundreds of clients sending and receiving data from your computer, which as it grows is going to be less performant than having a server
ahhaaaa
but p2p is still everywhere and used everywhere, on the network I operate we've just enabled a thing so that windows machines can download Windows updates from each other instead of going to the central Microsoft download server
it is -- if you're on a local network (i.e. your home router) and not going across the network, it's very much feasible to set up a p2p network and play around with it
Does p2p have any vulnerabilities though? Would the other peer be exposed to some sort of vulnerability
that is a risk -- yeah -- if the p2p software has a bug then you are exposed -- and your IP is also leaked to other peers on the p2p network
discord is client-server and as a result when you join a discord voice call your IP does not go to the other person
conversely, from what I recall, Skype is p2p, and so when you're in a Skype call, your IP is leaked to all those in the call with you
Ahhaa I see
Well I really appreciate your time and thank you so much for explaining p2p further
I was honestly confused at the very beginning but now I understand the idea of it
All the vulnerabilities that comes with having a direct connection to someone else, yes
Trace the connection, change the packets, whatever really
Who hosts the server that initially connects the clients together?
Clients connect to each other, there's no central server. Some applications will an index server to do this, but other than that it's purely client-client
I guess you could get around that with hole punching but you’d have to previously agree on a certain time to start together
🤔 actually not sure about that. don't quote me on it
I meant the index server
Like, if the service doesn’t have a main server backing it, is the index server just one that people using the network volunteer to host?
But that raises the problem of who knows where to initially connect to the index server
You need a recognised entity to host it for decentralisation to work right?
Well, if you're using something like Tailscale, they run that server, common ones are TURN, ICE or STUN servers for things like this, all do a slightly different thing
I looked at the tail scale resource you sent, very interesting and in depth
Does anyone here think they can create a forex copier software? One that can charge both monthly and performance fees? Message me if you do
Hello does anyone know what browser is faster brave or vivaldi by performance??
Hey, quick question regarding Cloudflare
I just set up my site to use Cloudflare and now its blocking requests from my Python script
What settings should I change through Cloudflare to avoid blocking the requests?
I accidentally tinkered with a few settings and now it doesn't work. It was working with Cloudflare earlier
they say POST requests are about submitting data to create something in a server. but I was just doing something with curl -X POST ... (mostly tokens as the data) and there definitely is a json response back. so I dont think I understand the distinction between GET and POST anymore if POST gives back a response too
@ember ledge often you want to create something and then get back some info like its ID or an error message about why it failed
you first need to understand what requests you're actually sending and then look at the analytics/firewall
it is going to say what is being blocked
If anyone is able to help me get networking working again on my ubuntu machine after an upgrade to 22.04.1, I'd be very grateful:
https://askubuntu.com/questions/1424269/network-problems-after-upgrading-to-22-04-1
Hello, I’m creating a python script with socket so I have clients and my server when a client logs in for the first time it gets a generated ID that will be transmitted to the client and will be stored in the server as a.json file and I would like to know how do so that when I type "show_connections" it displays in a rich.table table the list of connected clients by writing in the table their public ID and IP. Thank you
Sorry I can’t post on the forum - I had a similar issue on Ubuntu. Windows’s fast boot was using up my NIC or something similar, I wasn’t able to ping or anything. I doubt that’s the problem but a starting point?
Was that with WSL? Mine is pure Ubuntu. But I wonder if something is doing the same...
No, dual booting, which is strange because windows should in no way be able to affect another OS when it’s not even being used?
That is indeed odd as is my situation.
Is it difficult to setup my own machine so that i can access it for example with putty from another machine?
PuTTY is a SSH client, yes? If so it just install sshd given it's a linux machine, and access it from another one
And set up port forwarding on your router at home, if it is meant to be accessed from the Internet to your machine.
Note that if you make it available on the Internet, I would strongly recommend you to at least:
- Disable password authentication and use pub/private key authentication
- Setup fail2ban and enable the ssh module
How can I understand if a proxy is residential or datacenter with py?
hi lets do zoom meeting
hi
hi
have you created this?
no
indian?
