#networks
1 messages · Page 35 of 1
I dont even know wht does a discord embed mean, I m kinda new
go to the #rules, the box thing you see the text in is an embed
usually only bots can send them
try embeds then lol, they can look pretty cool
Lemme see if its still online
lol
free for now 👀 dunno if i want to keep it later on
if you look around quite a few services offer the first year free or something
i used Hostingr which offered it for free
Cool thanks
Btw if u dont mind me asking u from south asia
Just prediction test
Ahh shit wrong prediction, Indians use lot more emojis
i know where your coming from, its just from my experience quite a large proportion of people on this server have been from there
I m not from India
Lol
ok*
cya 👋
didn't see if you got an answer but ipaddress (shipped with python) does exactly this
oh wow... that was a way older message than I thought, apologies for the necropost lol
In [1]: import ipaddress
In [2]: net = ipaddress.IPv4Interface("192.168.2.2/28")
In [3]: net.ip
Out[3]: IPv4Address('192.168.2.2')
In [4]: net.network.prefixlen
Out[4]: 28
In [5]: net.netmask
Out[5]: IPv4Address('255.255.255.240')
In [6]: str(net.netmask)
Out[6]: '255.255.255.240'
I have a questions please, if anyone feels kind to answer. I have an old computer set up with harddrives and m.2, my new computer im on now uses linux. I want to set up the old computer as a file sharing server that can be used with a windows machine and linux machine.
I'm currently reading about samba, my networking game is not good. I was going to build a NAS until I realized all I need is a file sharing
Thank you so much!
Hey @prisma cobalt!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
You don’t need to build NAS
Are looking into how to set up a Samba file sharing server?
Hey! For some reason when I run requests.post in a async function it just doesn't run, no error, no request
No idea what's wrong
what the heck
thing is I know it should work
I tried it in a non async scenario
fixed
This site is Currently Under Developement By Kaidos! Please come back soon.
alr it works
I have a scapy question. I noticed the timestamp field of Dot11Beacon returns 403069544007. This date is Sun Oct 10 1982 03:45:44. What am I doing wrong?
Have you seen this? https://stackoverflow.com/a/48754992
Hi Thanks for the help. I will reformulate my question to make it a bit more clearer. When I print timestamp fields for scapy packets, I get different results depending on the layer. For example :
bad_timestamp = originalPacket.getlayer("Dot11Beacon").timestamp
good_timestamp is effectively the current timestamp of the packet (11261963624)
bad_timestamp (the field on Dot11Beacon) however equals 405307085189
I'm new to scapy and am simply printing all the possible properties for all types of packets. I'm trying to understand why (if there is infact an explanation) a sub layer would have a timestamp field but have it innacurate?
According to the scapy documentation, Dot11Beacon has 3 properties (timestamp, beacon_interval and cap). However it appears as though the property timestamp is innacurate (from my noob understanding of the documentation)
and is it just me or are the docs incomplete?
I have much more scapy questions as well, so if anyone can redirect me to a more appropriate channel/place to ask feel free to do so
I never used Dot11Beacon so I don't ever know what is it
It's proper channel to ask about scapy things. If you have questions about Ether, IP, TCP, UDP and other low-level protocols maybe I will help you 
What’s the best way to bridge a socket (TCP) with something else? Specifically a discord bot.
I’ve have thought up of very crude methods such as putting the socket data on a flask app but I don’t think this is the best way.
Describe what you want to do 
I have the problem that my program which requests a website over the ipv6 adress of my server sometimes maybe every tenth request gets the error
gaierror(-9, 'Address family for hostname not supported')) maybe someone has an idea why that could happen. Its strange for me that it works and only sometimes the error comes. Iam running the python script on Debian 10 and I do the server requests with aiohttp 
Thanks for getting back. I have a socket connection that I would like to send things on from my discord bot. I would like to know the best way to execute this. They ways that I have thought of were unsatisfactory.
Hi, my question is related to open ports. When we say say that http traffic goes to port 80 and https goes to port 443. What are we actually talking about, I mean does these port numbers belong to server or these ports numbers are of our router?
What I was assuming till today is that 80 and 443 are are port numbers from server side , and on host side it's just some random number above 10k . But when I cheked for open ports on my router today, both 80 and 443 were open. So i'm little confused about it
are these numbers of server side or host side
i always thought it was both since the ports define where communication goes on both ends
i might be missing something but would the socket library work for this or?
I don't quite get what you mean.
Yeah but numbers are different on both ends
pip3 install urllib3
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (1.26.5)
WARNING: Error parsing requirements for aiosqlite: [Errno 2] No such file or directory: '/usr/lib/python3/dist-packages/aiosqlite-0.16.1.dist-info/METADATA'
?
can someone recommend me a good tutorial for sockets?
realpython have a great one https://realpython.com/python-sockets/
thanks! 🙂
https://www.reddit.com/r/techsupport/comments/pa68ve/video_streaming_working_but_connections_with/ - this is not related to python - but it is related to networking, would appreciate any help (maybe @flint crater could help)
0 votes and 0 comments so far on Reddit
Check ur DNS.
I have a somewhat Scapy question. I'm currently listing AP's looking at Beacon frames. For some reason, some SSID's appear to be blank however using the function len() shows it to be 13... Has anyone ever encountered something similar?
Sorry for taking Internet bandwidth, I found my answer. ssid contained \x00\x00\x00\x00\x00\
When I run GNS3 as user (in admin group) on Ubuntu 21.04, I get this error messsage:
2021-08-24 12:16:54 INFO root:126 Log level: INFO
2021-08-24 12:16:54 INFO main:259 GNS3 GUI version 2.2.23
2021-08-24 12:16:54 INFO main:260 Copyright (c) 2007-2021 GNS3 Technologies Inc.
2021-08-24 12:16:54 INFO main:261 Application started with /usr/bin/gns3
/usr/share/gns3/gns3-gui/bin/python: symbol lookup error: /home/_________/.local/lib/python3.9/site-packages/PyQt5/Qt5/plugins/imageformats/libqsvg.so: undefined symbol: _ZdlPvm, version Qt_5
When I run it as root, works as expected.
Any ideas?
(Even though it's 2 days, I don't see a clear answer):
Server side ports are usually on "well known ports <1024" (or registered ports) or at least must be on ports 'known to the client'. The latter is mostly for testing and sample where you write both the client and server sides.
For Browsers to Web servers the server is almost always on 80 or 443 for SSL/TLS secure communication.
All the browsers presume that the serer will be on 80 for HTTP and 443 for HTTPS unless told otherwise (:8080 at the end of a URL would mean port 8080 which is a common but non-standard number for an 'extra' web service.)
Clients almost always use an "ephemeral" (temporarily assigned) port from the upper ranges. The OS usually choses this on the clients request from anything that is available.
The server needs to be "findable" but the client sends it's return port in the TCP packets so the server can always "just answer" the client at the return address and port it sent.
If the above isn't extremely clear, feel free to ask me to clarify the specific portion.
Guys, does Game servers are bought or rent ?
what do you mean exactly? Most companies usually rent cloud servers through existing providers, usually from aws, gcp or azure, but it depends
Like, can you just buy a game server for one time life ?
Most solutions I've looked at has some kind of hourly based payment for cloud servers.
Assuming you're talking about vps' or bare metal
Just another question, if you rent a game server, does the company’s that provide this server can access into your server and edit it ??? or your the only one with the ability to do so.
once again it would depend on who you're renting from. If it's from some professional providers then they definitely have some terms of service stuff which would explain that. They obviously can, but if they're allowed to or want to is another thing
ok
Im trying to establish a socket server but when i launch it i gives me a WinError 10061, I have tried searching for solutions but no solution have worked,
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(("0.0.0.0", 5050))
sock.listen(5)
while True:
clientsocket, addr = sock.accept()```
anyone got any ideas???
@humble jungle hi thanks alot for the answer. Yes your answer is clear. The reason for my question was that I found both port 80 and 443 open on my home router. This made me think why are these ports open , like you said our os assigns ephemeral ports for connection. Someone told me that these ports are used for connecting to your router (192.168.0.1 , when we sign in into router to make changes). What do you think the reason is for these two (80and 443 ports )to be listening on my home router ?
@digital anvil have you tried changing the ip address to 127.0.0.1 ?
i have tried changing ports and ips
have also read all stack overflows on it and no solution seems to work
someone else suggested letting python thorugh the firewall which i did
you could try: s.bind((socket.gethostname(), 1234))
s.bind((socket.gethostname(), 1234))
well same error WinError 10061
Can you show me your whole code?
Do you get the error when running the server? Or the client?
Anyone know what: Basic, 1, The host is set, but the type cannot be determined. ((like means in real terms?))
Anyone know a way to get headers on an opcode close using the websocket lib?
def on_close(ws, status, msg):
print( ws.sock.frame_buffer.header )
This is what I attempted but it doesn't actually print anything (not even a blank line, which was kinda odd)
Since the library doesn't pass down any of that info after the teardown
running the server, and that was the whole code
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(("0.0.0.0", 5050))
sock.listen(5)
while True:
clientsocket, addr = sock.accept()```
Can't see anything wrong with that code @digital anvil... it works perfectly fine when I try to run it... Must be something in your Windows thats not working correctly
thats what everyone is saying! i have even enabled python to go unrestricted through my firewall and still the same problem?
@digital anvil Maybe try and disable the firewall completely and see if that might help?
did not seem to help? python anyways should have permission?
Yes, your router (almost certainly these days) would have a web interface on at least one of 80/443 and likely both. 80 should just be a convenience and should immediately forward your connection over to 443 (HTTPS).
As you understand, this is so you can connect a browser to your router to view, configure, manage, and update it (you should occasionally update it).
This is almost perfectly fine as long as it's not open on the EXTERNAL addresses (your ISP/Cable etc.) AND as long as your internal network is reasonably secure. You should still have a GOOD password on it (not the default), and use the 443 for actual authentication so an intruder would not see your password and settings.
Also, make sure you remember that darn password as you probably won't use it for months at a time, maybe longer.
Remember if I could visit near your home, gain access to the router, then I could open up incoming ports which could later be reach through the Internet.
I made a flask webserver how do i make it scale horizontally
Because all the help i can find is resources on cloud services but no way to do it on LAN and port fowarding
Thats not what horizontal scaling means
the way i describe vertical and horzontal scaling is as such:
you have computer A
giving computer A more ram is vertical scaling
but buying computer B to work alongside computer A is horizontal scaling
Using sockets/networking
Hi everyone, just wanna ask, what web framework is the easiest easiest to use and setup in Docker?
Just need to add HTTP API to my service
I've seen most people do it with Flask but I have done with it with Django as well. Depends on you really.
btw has anyone worked with AWS? I've got my django project running in port 80 (http://0.0.0.0:80/) in the RDP client but form the public IPv4 address I'm not able to access it.
attempting to make a chatroom using the socket and threading module and i constantly get this error and cant find any solutions? anybody know the problem because im having no clue and i just keep experimenting with code to see if it will work and it never does. hope for someone to look into this problem thanks
this happens if the peer has disconnected
if you try to send to a disconnected socket you get this error
@trail plank
and if you try to recv from a disconnected socket it may sometimes give this error too or it just returns None
thanks for explaining the error at least
but how is it disconnecting i literally have the server command ran
along with the client
U that means either a server closed or u accidentally closed ur client and tried send messages from it
U might've placed
connection.close()
Inside ur loop
How to make a timeout for the server (socket) to receive a message
conn.recv(1024) #Should only be waiting for 5 seconds till disconnect
Try to call conn.settimeout(5) before conn.recv(1024)
!d socket.socket.settimeout
socket.settimeout(value)```
Set a timeout on blocking socket operations. The *value* argument can be a nonnegative floating point number expressing seconds, or `None`. If a non-zero value is given, subsequent socket operations will raise a [`timeout`](https://docs.python.org/3.10/library/socket.html#socket.timeout "socket.timeout") exception if the timeout period *value* has elapsed before the operation has completed. If zero is given, the socket is put in non-blocking mode. If `None` is given, the socket is put in blocking mode.
For further information, please consult the [notes on socket timeouts](https://docs.python.org/3.10/library/socket.html#socket-timeouts).
Changed in version 3.7: The method no longer toggles [`SOCK_NONBLOCK`](https://docs.python.org/3.10/library/socket.html#socket.SOCK_NONBLOCK "socket.SOCK_NONBLOCK") flag on [`socket.type`](https://docs.python.org/3.10/library/socket.html#socket.socket.type "socket.socket.type").
Right thanks : )
You probably need to reset timeout after .recv by passing None as a value 👍
Does timeout raise an error
If a non-zero value is given, subsequent socket operations will raise a
timeoutexception [...]
So yes
conn.recv(None)
or
conn.settimeout(None)
Ah I got what it meant as soon as I sent it
try:
conn.settimeout(5)
conn.recv(1024)
finally:
conn.settimeout(None)
I think that going this way is okay 
So .settimeout needs to reloaded to work again I suppose? Or is reseting only necessary if you want to remove the timeout?
You can preconfigure your timeout when you are creating conn object
conn = ...
conn.settimeout(5)
...
conn.recv(1024)
Is it working?
Let me create a debug code.
🎉
Should
con.send(str(json.loads(jsonhere)))
Be good enough?
I tried
json.loads(json).encode("utf-8")
But Iam guessing this only works for strings
Wait a minute. I should be using json.dumps
Woops
I have completed my TCP based file transfer
It works over the internet, but Iam still doubting how much loss in transmition it might take
can someone, Help me i have this, exe and i wanted to extend it, I wanted to add a log so for when ever, someone open's it it give's me the time and date or there login and i have no clue how to do that
seems like my worries were nothing after all. On my stress test, 0% loss rate with 324mb sent via local -> internet -> VPN -> Client.
I seem to have underestimated tcp : )
But there were some 20mb extra packets sent(prolly loss retransmition)
How do new peers join p2p network without sending a request to a server? Im pretty sure I need to expose some sort of a route so new peers can send request to join the network.
Hey, are there any LibPCAP bindings to Python that function similarly to the C version?
Ur probably looking for a UDP if u mean connectionless
When you say it perfectly fine if it's not open to external addresses, what does that even mean? My understanding till now was that if a port is open, it is open . How can a port be open for internal network but closed for external. I even tried pinging these ports on my public IP using nmap and the result was filtered.
Based on my understanding, network like router seperates local network from the WAN network. Basically that means your localhost devices isnt able to communicate to the WAN without opening a port. Correct me though : / iam interested
@raw pier
No, a router in general has multiple network interfaces, in the case of home routers this will be one on YOUR network with a private IP (192.168.0.1) and one on your ISP/cable network with a public IP.
Otherwise there will be ANOTHER device between your private network and the "router" which is doing that.
Nobody can pass from the outside to the inside (except in ANSWERING a query you initiated) since these routers block that type of access.
You (and your family) can initiated a connection from internal to external and that will work since the response will generally be allowed back in - as long as after the router translates it's destination and it's really destined for the internal IP and port of your computer.
Anyone physically ON your internal network could theoretically connect to your rouer on the internal address, or if they could get authenticated on your wireless it could work even from 'outside' (but nearby) your house.
This is why it is so important to have updated firmware, good passwords, and highest security protocol available on your wireless router/access points.
Almost all such wireless protocols have SOME vulnerability with it getting worse as you go back in time to older firmware or standards.
Access through network connectivity is controlled on an address, port, per interface, and per direction basis. Even on simple cheap routers it's good enough to allow in to out but only responses out to in.
UNLESS you (or your 'gaming' software etc) opens a port for EXTERNAL access. Very dangerous if you don't know what you are doing OR if your internal services are buggy or insecure, but perfectly normal if you understand and carefully control that type of access.
You COULD at least theoretically run a web server (or anything else) internallly and have your router to port and/or address mapping so that conections to port 443 on the OUTSIDE were routed to your internal web server (on the same or different port) but on their internal address.
(There are issues with this such as DNS when using a DHCP assigned address on the external side which is typically but they can be overcome.)
You also could set up an "internal" VPN server to MY "internal" VPN server if we both did this carefully and correctly managed the security issues. At that point we coud have either full access as if we were on a local network TOGETHER, or limited access based on the filters we set.
This latter is way beyond the scope of your question however.
@RenterName no, not if I am understanding you correctly. Or at least that wouldn't be normal.
You would normally (by default) be able to INITIATE connections from inside (local) to outside (WAN),but not the reverse; and the outside (WAN) response would be allowed in to the requester.
Yes thats what I was trying to say. Firewalls are like a one way valve and holes are like ports. You wouldn't want them open unless you're prepared for the risk.
But theoretically I opened port 5000 on my home network, but no programs are listening on port 5000, Would I still receive the packet requests from the outside? Why is it a security issue? And how?
@tropic dagger You wouldn't receive them BUT your router would forward them in to the address you mapped, so you machine would probably see the connection request but since nothing was listening it would either ignore or reject it.
This is huge topic... Basically create peer-to-peer network with transaction protocol which share transaction across all peers
The question is ambiguous: do you mean:
Create another NEW technology LIKE Bitcoin?
Or the more reasonable, USE Bitcoin or one of the competitive technologies to implement… (something??? )
Which and what do you want to implement?
Changing Bitcoin config to create new network is not really hard, we did it (me with my pals) during studies
Also changed proof-of-work algorithm to be more ASIC/FPGA/GPU-resistant lol
Are you saying I'm mean & ugly looking? 😜 Look at messages by @clear bobcat Those are things someone much actually help you do.
What do YOU want to accomplish?
Yeah, be kind @ember ledge 😦
why send 96 kilobytes at once lol
wait are you combining C sockets and python sockets lol
gl
Are they different much?
if the scripts are being ran in the same OS then they are basically the same, as they will be using the same underlying socket api
but that shouldnt really affect anything
96 kilobytes isn't that much
No need to spam
@mellow vortex what do you mean?
variable = input("fuckm") how do we put other variable sum with number?
str((vaariable)
u mean
num1 = int(input('Num1: '))
num2 = int(input('Num2: '))
sum = num1 + num2
?
n pls don't use offensive words
Long shot: Any systemd-networkd gurus here - Is there any option I'm not seeing in the man pages that allow me to change the address of the gateway/default route that RAs advertise - It seems to default to your IPv6 Link Local address - either the auto address or a fe80::X address you assign.
I'd like to change it to use fe80::1 that I have keepalived floating across my primary and backup routers ...
what is networking?
hello guys I have made a game in pygame which is a shooting platformer i have added the player, guns, explosion and stuff and is ready to come out as a multiplayer can someone tell me how do i do it
Does anyone know to to get Ethernet on a ipad
Im assuming you cant unless apple have some some janky lighting port stuff to Ethernet cable
I have done it before
You need a lightning to Ethernet adaptor, and a regular ethernet cable (depending on what cables you use)
once you connect them, settings will automatically show an ethernet option
i need to forward port 27015
theres a guide in channel pins, but also look up if your ISP provides a guide for your specific router
lol DCHP isnt a thing, i assume you mean DHCP which means dynamic host configuration protocol?
Any suggestions for projects on networking for newbies?
Chat application?
very helpful right?
just informing them on the correct name, nothing wrong with that. as for their question, i dont know the answer so 
well they could try the guide in pins but im not sure what exactly they are trying to do
What is the question lol
ethereum has some networing components
didn't get you
anything else?
IPIP/SIT tunneling
anyone able to help me with netmiko?
I am using Netmiko to connect to a 2960 S series Cisco switch
This works fine
out1 = connection.send_command("show ip interface brief")
print(out1)
But for this one, The Cisco switch returns "invalid input detected at marker", even though the command is valid
out = connection.send_command("show run") #also tried "show running-config"
print(out) ```
never mind
turns out I just needed to put py connection.enable()
I've done that so many times
anyone got a video i can watch to learn network scripting
What do u want to learn ?
- name: Allow connections on multiple ports
ansible.builtin.iptables:
chain: INPUT
protocol: tcp
destination_ports:
- "80"
- "22"
- "443"
jump: ACCEPT
rule_num: 1
- name: conntrack allow RELATED and ESTABLISHED
ansible.builtin.iptables:
chain: INPUT
ctstate: ESTABLISHED,RELATED
jump: ACCEPT
rule_num: 2
- name: Block all the rest
ansible.builtin.iptables:
chain: INPUT
policy: DROP
anyone knows why those iptables rules block apt update, or loading images from docker.io during container building?
but if I change /etc/resolv.conf from
nameserver 127.0.0.53
options edns0 trust-ad
to
nameserver 127.0.0.53
nameserver 8.8.8.8
nameserver 4.4.4.4
options edns0 trust-ad
it starts working
fuck yeah!
I allowed 53 port as INPUT, it is needed for DNS. And then it started working without nameserver tinkering, udp is required being allowed too
can anyone help pls
share complete code
network port and IP scanner? same like https://pypi.org/project/python-nmap/
for beginner, no need to implement the full features only specific parts.
it have to go and it have to back
hey i have been trying to learn websockets but cant see where im going wrong
import websocket
SOCKET = "wss://stream.binance.com:9443/ws/ethusdt@kline_1m"
def on_open(ws):
print('websocket open')
def on_close(ws):
print('websocket close')
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
ws = websocket.WebSocketApp(SOCKET, on_message=on_message, on_open=on_open, on_close=on_close, on_error=on_error)
ws.run_forever()
if someone could shed some light it will be nice
what goes wrong
it says its open but wont reply the message
error also work but dont tell me there is any
i should get a stream back thou on message
sudo tor
import requests
proxies = {
"socks5":"127.0.0.1:9050"
}
res = requests.get("https://api.ipify.org", proxies=proxies)
print(res.content)
gives me my public ip address, but when i do curl --proxy socks5://localhost:9050 ifconfig.me/ip it gives me my tor exit node? im confused.
I'm using the great Requests library in my Python script:
import requests
r = requests.get("some-site.com")
print r.text
I would like to use socks proxy. But Requests only supports HTTP proxy now...
Setup http via socks5://...
@hardy elk As #voice-verification says, please don't spam to bump your message count, you'll not gain access to voice chat this way.
is there a indepth resource on everything about LANs and how an internet connection works?
RFCs?
For example https://datatracker.ietf.org/doc/html/rfc791
Internet Protocol (RFC )
I highly recommend the book "Computer Networking: A Top-Down Approach", by Kurose and Ross.
Especially if you are a beginner. RFCs can be overwhelming.
this applies, thank you 🙂
How can I send multiple things concurrently with (tcp) sockets?
You can open multiple connections, if the server supports that.
Oh just like that? It's that simple? No strings attached?
Yeah, RFCs can be overwhelming but I am guessing that the deeper source doesn't exist lol
I will check that book in free time 👍 Thanks for recommendation
It really depends on what you want to do 😅
You're welcome! I strongly recommend it.
I'm making a discord clone and i want to be able to send messages while a large file is sending.
If that clears thing up
And how would you handle sending and receiving files?
Are you using any web framework, such as flask or fastapi?
Just the plain old socket library
why the "switch" in "packet switch" why not simply "packet forwarder"?
switch mean something is flipped or not, kinda confused by the term, that's all
like a lightswitch
Most web services such as discord use HTTP for sending and receiving messages
The term "switching" goes all the way back to physical telephone lines.
When an operator had to physically attach (or switch) your line until you reach the person you wanted to talk to.
ah where you had to manually connect cables to establish a connection?
You could open a new port on your server just for files, or you can create some standard for messages. For example, a chat message could be:
MSG hello world
While a file transfer could be:
FILE test.txt followed by the bytes of that file.
You can accomplish that in so many ways 😆
It's up to you.
Yes I have already put in a place a similar system what i'm worried about is some underlying obscure socket behavior screwing me over, like bandwith management, priority etc.. which i'm not familar with
Which is why I would use a framework such as django, flask, sanic or fastapi
They take care of that stuff for ya
Yeah I believe I should look up some examples, what framework would you recommend?
I've been thinking of getting into them but they seem scary
I miss IRC times 😄
Personally, my preference is FastAPI
Django is way too complex for a beginner.
Flask is great for beginners, because there's a lot of tutorials for it. But AFAIK it doesn't support asyncio, and it's pretty slow compared to sanic or fastapi.
Ouch no asyncio support? I don't know if i want to commit to learning it then
I'm not entirely sure though. You can probably find out by reading flask's documentation.
It seems to support async/await syntax
But:
"Flask’s async support is less performant than async-first frameworks due to the way it is implemented"
flask is a great framework with lots of resources. It just is pretty old now.
Compared to the others I mentioned, at least.
Alright thank you.
You're welcome ;)
Ah so RFC is not one, but THE standard about IP?
RFC stands for Request For Comments. They are documents that contain technical and organizational notes about the Internet
One of them is the RFC that defines the IP protocol version 4
There are RFCs for TCP, IPv6, HTTP...
Almost every protocol there is.
With the exception of proprietary protocols, such as Microsoft's SMB.
So IPv4 will stick around for some while? Because some devices can't upgrade their version?
Otherwise those devices can't communicate with a device using exclusively IPv6
Well, nowadays IPv6 is used a lot.
It's usually not about the device not being able to upgrade, but rather that the IPv6 adoption is pretty slow.
Google has an interesting graph about that: https://www.google.com/intl/en/ipv6/statistics.html
From where comes the term ethernet? I know ethereal oils for example and "ether" in pokémon.
Bob Metcalfe talks about how he and David Boggs invented Ethernet. Produced by www.NetEvents.tv.
Follow-up interview with Bob includes how he sold Ethernet - https://youtu.be/Ber1zDOAEBE.
mmh, do I need to remember twisted pair, coaxial, optical?
it's just the medium right and in future maybe there will be something better?
Is bit the better unit to measure anything networkrelated, instead of byte? (or their k/m/g respectives)
You will see both very frequently.
In some places, you will see the word octet used instead of byte
Mmh, ISPs use bit, like always. I guess because higher numbers sell 😄 (in my country)
I would agree 100% with you on that one 😆
But IPv4 adresses, for example, consist of 32 bits. However, we represent them in 4 octets (or 4 bytes) separated by dots.
Mmh, so packetswitching is better assuming there are users on the link, that are idling alot of times, since the probability that there are many users requesting data from the internet at the same time is low. Instead of circuitswitching where you can only have up to N connections at all times and the users can't ever have more speed.
in packetswitching as I understand the speed will be divided by the active users
Circuit switching is faster and more reliable.
But it would be too costly to have the entire internet circuit switched.
it is used for telecommunication like mobile phones right?
Packet switching, however, is highly flexible. That's why it's the choice.
Well, it used to be like that. Now, most operators use VoIP, which is packet switched.
Ah, ok. So in the future it can be that if alot of users phone right now. Then the quality of each call goes down?
or some get simply "net overloaded"
Well, mobility is a complicated subject.
Although it's packet switched, it usually isn't transmitted over the internet.
But for example, Google Meet, MS Teams, Zoom...
Their traffic is packet switched, best effort, goes over the internet...
I bet you have experienced issues with some of them before 😅
Anyways I like the book 🙂
I only use Discord at the moment, can't remember my skype time
so, if all discord users where in an active calling session at the same time, some would have bad quality?
like it was the case with some app Elon Musk said was cool
maybe telegram don't know
because suddenly the servers where full 😄
Yeah, that's exactly it.
I observed that alot of telecommunication providers are just daughtercompanies of bigger ones
reason?
Post offices follow a similar reasoning
The smaller offices serve smaller communities
Where demand is lower
And they just send the package to a bigger office
Here in my country there are hundreds, if not thousands, of smaller providers.
Is it possible for a small buisness to be their own ISP?
Well, no. If you want access to the Internet, you will need a link to somewhere.
And usually you can only get that link from an ISP.
So you the only alternative would be to setup an alternate internet?
(but that is not doable for small buiseness haha)
Lmao
The best a small organization can have is an Intranet.
Which is the internal network of the organization.
But it still needs at least one WAN link that serves as gateway to the internet.
But a university can act as an ISP? (according to the book)
without having a contract with the "normal" ISPs
Well, my university has links from 2 ISPs. One is state-owned, and the other is a private company.
For redundancy and performance, they got an additional WAN link.
So Tier-1 ISPs are some of the biggest companies in the world? (ISPs for ISPs)
Yeah
Verizon, for example, has a huge infra:
https://www.verizon.com/business/content/dam/business-markets/img/why-verizon/global_networks_map_en_xg.pdf
Including submarine cables
Is every searchmachine a contentprovider? What else can be a contentprovider? Is a library a contentprovider in that it provides books?
Don't you mean search engine?
Like Google, Yandex, Baidu...
And yeah, kind of. Wikipedia is another good example.
News sites, you name it.
Ah yes, sorry it's literally machine in my language
Lol it's ok
Mmh, what I don't understand is this: the "out" I get, but how the router in a LAN decides which endsystem gets what packets? Have the packets from some website a header which specifies that?
That's what routing protocols are used for.
ah ok, then I just continue reading
It usually works by looking up a routing table
so there stands "endystem A requested data from website X, now send packets from website X to A"?
or more general in adresses
yes, are they covered in the book?
I think so.
But the tables look somewhat like this:
They know roughly where each network is
This is of course a very simple example though.
Chapters 4.5 and 4.6 cover the routing algorithms and protocols
But you will probably need some knowledge on IP addressing and subnetting first.
Three are tools/apps that serve like emulator of building a network of computers, routers. They are cool to play with
We used them in uni, to pass network related tasks
So, does the Transport Layer actually transport, as like the name suggests? https://stackoverflow.com/questions/13333794/networking-difference-between-transport-layer-and-networking-layer
IMO it's misnamed 😦
Well, there is a chapter on that book explaining the Transport Layer.
I think it's named like that because it is the layer directly below the application layer. So it is responsible for transporting the segments/datagrams with the application's data directly.
Yeah I currently have read the layer(s). Still it is very abstract for me. Is the TCP of the source, necessarily the same TCP at the destination?
(if sent over the internet)
Are the transport layer and networking layer just additional envelopes for the packet created in the application layer?
with 2 different "zip codes" on it, so the router knows where to send it
No. Usually, the client's transport layer port number is different than the server's.
The HTTP default port is 80. A web server receives connection from multiple hosts simultaneously, correct?
The web server knows where each client is based on the client's port.
So if client A accesses http://amazon.com on port 80 at the same time as client B, they will use different TCP client ports for that (even though they are both connecting to the server's port 80)
This "enveloping" is called encapsulation. And very frequently yes, the transport and networking layers are used to encapsulate the data coming from the app layer. However, the ping command for example sends ICMP packets, which are encapsulated inside the IP packets.
(image source: https://www.networxsecurity.de/glossary-d1/i-d1/icmp-d1/)
@ember ledge I also highly recommend Ben Eater's videos about networking:
https://youtube.com/playlist?list=PLowKtXNTBypH19whXTVoG3oKSuOcw_XeW
Hey thanks 🙂
So the ping command bypasses the TCP encapsuling and goes straight to IP?
It's not that it "bypasses" TCP. It just does not use it.
ping sends ICMP messages, which are directly encapsulated by the IP packets.
The networking stack is very flexible, as you don't need to use all layers every time.
The ARP protocol, for example, is encapsulated over Ethernet frames.
There are few other protocols built on top of the IP one
There are few others built on top of the TCP / UDP (like DNS)
You can also pack an IP packet inside another IP packet to make IPIP tunnel
whats the difference between socket.AF_UNIX and socket.AF_INET
AF_UNIX defines a UNIX socket. This is a specialised internal socket that usually is backed on the file system rather than the general network, this generally means they are much faster in general but come with the limitation that they can only communicate between processes on the same machine. As part of what makes it fast is the optimisations / assumptions the OS can make by limiting it to just the local machine.
AF_INET is the general address family that general sockets use (Ipv4)
If the goal is to send information (such as text) from one computer to another that aren't connected to the same network, how is that accomplished.
Realistically speaking you are connected to a network
/ you have to be
the difference is generally you're going from LAN to WAN
which is done via INET sockets
Why is WiFi usually limited to tens of meters?
Would it change with a better/bigger hardware?
Well generally its because of signal interferance
the further away you are the weaker the signal, the more interference
generally this is more of an issue with 5g rather than 2.4g for the distance part because they're simply higher frequency waves that travel a shorter distance becase they're more likely to collide and interfere with other atoms / particles
2.4g tends to be more subject to interference because it travels further, this is generally much more prominent in cities and towns where there are lots of houses with their own routers in close proximity.
Ultimately this is a physics problem rather than a hardware thing.
we have the tech to do wifi over kilometres of distance, but the longer the distance the lesser the speed because generally you need lower frequency waves to travel further.
Its the same idea for why we use Low feq EM waves over X-Rays for broadcasting data wireless to radios.
There is WiFi that can got much further now. But dependant on path attenuation, and power at the Base.
Inverse Cube Power law if you Wana read up.
Hi is this correct?
Suppose users share a 2 Mbps link. Also suppose each user transmits continu-
ously at 1 Mbps when transmitting, but each user transmits only 20 percent of
the time. (See the discussion of statistical multiplexing in Section 1.3.)
a. When circuit switching is used, how many users can be supported?
b. For the remainder of this problem, suppose packet switching is used. Why
will there be essentially no queuing delay before the link if two or fewer
users transmit at the same time? Why will there be a queuing delay if
three users transmit at the sa
a) Only 2, because circuit-switching makes guarantees.
b) La/R(average packetsize/transmitrate) will be exactly 1 with 2 users and above 1 with 3 or more users.
A queuing delay is only when La/R is above 1. This is because the link can only handle 2 mb/s.me time?
I'm building a server for IoT devices that communicate via a TCP connection and was wondering which python library is the best for it. I've used twistd before but that was years ago and I'm just wondering whats the go to async tcp server these days
as in HTTP stuff
or just TCP in general
asyncio is pretty much the inbuilt go to for async networking
TCP, the IoT devices can only communicate on TCP. So I cant use HTTP requests 😩
How come? HTTP is simply a protocol, and it uses TCP.
The server can be a normal HTTP server, and the clients can just build the packets from scratch using the HTTP protocol.
It's an IoT device that uses very low level code to save battery
But HTTP messages are just TCP data with a standardized format
Anyways, if you want to use sockets from scratch, there is always the websockets package.
I didn't write the firmware for it. But its not uncommon for IoT stuff to use pure TCP or MQTT. They squeeze the hell out of these devices to get every once of battery life out of them
I just meant that you can send HTTP messages to a HTTP web server using only a TCP socket client.
Like netcat, for example.
But that also applies to low level code
But it really depends on what you want to use the TCP connection for
Btw, FastAPI supports websocket endpoints
If that's any help.
FastAPI framework, high performance, easy to learn, fast to code, ready for production
I just learned Germany is a developing land in terms of internet access/infastructure. Sad, as I live in it 😦
And Telekom has the right to throttle Fiber to Building when it conflicts with their wires.
how we built a python program to know the length of the password
unless the hashing algorithm used to "store" the password is horrible there is no way, other than guessing the password. At this point the length is rather uninteresting?
unless you mean py someString='some password' print(len(someString))
So I think I m planning to connect computers together though wireless network and let them train nn model together, do u think there is anyway to do so?
The realpython tutorial is a bit overwhelming, is there an easier socket tutorial and possibly explaining what everything means?
sockets are fun, communicating with another computer can lead to so much more
although tbh my first intercomputer comunication was in discord and using a discord bot in a private server to recivie and parse the text commands i was sending
They are so confusing though, is there a place to learn the logic behind them first
the RP tutorial made me feel overwhelmed tbh
imagine sockets as a tunnel of which you can send and receive data
any data works, as long as its in binary form
hmm
Hello,
Can anyone tell me how to hack a phone by sending an sms???
Nope, not here I'm afraid.
Anyone able to help me with Netmiko's textFSM?
I'm getting the following error but I don't know what it means
TextFSMError: State Error raised. Rule Line: 64. Input Line: ^
The command I am attempting to send and textfms works fine in my test document, but in my main code it gives that error
this is the command I am getting the error with
out = connection.send_command("show ip int vlan " + (VlanID), use_textfsm=True)
Does this work? out = connection.send_command("show ip int vlan " + VlanID, use_textfsm=True)
Sorry I forgot to say
I figured out the issue
That command on a Cisco switch, it only works for interfaces. So the vlan in question would have to have an IP address
Otherwise the output is “invalid command detected by marker^” and TextFSM can’t do its thing
So I used a try and except
hi can i found this example(https://gist.github.com/Evorage0/74f00d12231d08722b47b8b5531e5dac) here pinned and it has some problem it should be connection.recv(1024).decode() not s.recv(1024).decode()
Why it happens and is it possible to prevent it?
please,ping when you answer. Either,I will not able to see it
Thanks in advance
Hey guys I get an error from cloudflare when i try to make a call
Error 1020 anyone knows how to fix it
Or how to prevent it from popping?
if socket.recv() is a blocking call, then how do examples work like this
data = ""
while True:
temp = socket.recv(1024).decode()
if temp = "": break
data += temp
since the recv blocks until it gets data, it can never be "", it just blocks?
there must be a special rule or something
recv() can return ""
and when it does it means the opposite peer sent all the data it had for you
what if i dont have access
yeah, since .recv() is a blocking call, it will wait for data to arrive from the opposite side, and the program will not progress until so happens
once all the data from the sender has been received, the .recv() just returns whatever data it just got, it could be anything, since the sender could send anything
the way I've been handling the closing procedure of breaking loops and closing sockets is looking for certain keywords like if received data from .recv() is "close" break the loop and close all the sockets, in the same way, someone could have the string "" (or probably None type too) as their keyword, .recv() won't return anything on its own, just what it received
so im making a chat thing using asyncio streams, however the problem is that the input() blocks the program from receiving msgs from the server, how do I fix tht?
1 solution I can think of is to mke 2 client programs, 1 for just sending messages, and 1 for displaying them
You can use threads
Is it possible that the content of some internetsite is displayed slightly (like one char) different than it is meant to be?
due to an error transmitting the data to my browser
Hey @mortal tide!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
import socket
import threading
from queue import Queue
import os
import sys
import time
os.system("cls")
target = input("[38;2;255;255;255mEnter The Host To Find Open-Ports -> [38;2;33;255;66m")
queue = Queue()
open_ports = []
def portscan(port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target, port))
return True
except:
return False
def fill_queue(port_list):
for port in port_list:
queue.put(port)
def worker():
while not queue.empty():
port = queue.get()
if portscan(port):
print("[38;2;255;255;255m[[38;2;33;255;66m{}[38;2;255;255;255m] Open Port For -> [[38;2;33;255;66m{}[38;2;255;255;255m]".format(target, port))
open_ports.append(port)
port_list = range(1, 444)
fill_queue(port_list)
thread_list = []
for t in range(1500):
thread = threading.Thread(target=worker)
thread_list.append(thread)
for thread in thread_list:
thread.start()
for thread in thread_list:
thread.join()
print("\n[38;2;255;255;255mopen ports are: [38;2;33;255;66m", open_ports)
print("[38;2;255;255;255mport scanning [38;2;33;255;66mdone")
time.sleep(300)
**Fast Port Scanner ⬆️ **
what is the question?
you could get it on github, some subchannel of discord I don't think is reaching alot of people 🙂
That would be very rare.
because of crc?
There are many error verifications
yup
so practically it is rather impossible?
And TCP has error control too
However UDP doesn't
That's why audio and video can cut, fail, skip frames and lose quality
And that's treated as web content too
In protocols that use TCP, yeah
But if you got some time, watch this video: https://www.youtube.com/watch?v=AaZ_RSt0KP8
are they layermodels of OSI or the book you recommended worth remembering?
Well, OSI isn't really used in the real world.
If you are taking a test such as CCNA, you have to remember them, yes.
I have them remembered bc they are mentioned quite a lot
And I took many tests too
i get only 4 of them right: physical, application, network, transport (tho the order...)
but I know there are 7 in OSI and 5 in the book
With some more practice you will remember it :)
The book shows both OSI and TCP/IP
And a comparison of both
the encapsulating of packets is done in multiple layers right?
namely transport and network
and dependant on the app, in the application layer too
The application data in encapsulated in a transport layer segment/datagram, which is then encapsulated inside an IP packet.
The IP packet is also encapsulated, in the Layer 2 Frame.
are there real applications that don't make an app-header?
That really depends on the protocol
You can create a websocket that just sends a stream of data
FTP, for example, uses 2 ports. One for management and the other for transmitting data.
If I'm not mistaken, the port that transmits data doesn't use any headers
Not sure though, it's been a long time since I've studied FTP
@grand kayak I like veritasium, but this video escaped from my view. Interesting!
That is one damn good video :)
So to avoid cosmic radiation, you have to send data redundantly?
Well, I don't know if it's worth the trouble 😆
With the exception of mission critical scenarios
Or if you're on space
well with voting I see it mission critical IMO
I don't know much more about those single effect cosmic ray stuff, but there could be other ways of preventing it
I really don't know tbh 😅
On a large scale, interplanetary Internets are impossible(fast) because of the speed of light?
like connecting Mars to Earth
intersolar(star to star) systems would have to create a new technolgy like wormholes, but then I think transmissionrate would suffer alot
Well...
There are quantum networks.
If you want to dive into that, there's NetSquid for Python
That's the only one I'm familiarized with
Well you could implement error checking/correction. Even a simple algorithm should do the trick based on the low chance of a cosmic bit flip
A few parity bits should do the trick and not take up much space as well
Has anyone worked with Firewalls with python, primarly the netmiko library?
I am using asyncio streams which is concurrent
I think tht video is kinda exaggerated on how much error has/can occurred/occur due to tht, like the plane one, where he says cosmic radiation cud have been the cuz, but according to the researchers, it was as improbable as the other hypothesis
magnets would be a much more probable reason for a computer to crash thn cosmic rays
best web browswr?
For me? It's the Brave Browser by Brendan Eich, founder of Firefox and creator of JavaScript
It's true Brave is really the new Firefox
Also Brave will launch its privacy-centric search engine soon:
What are you waiting for?
how are you sending a request to the website protected with that cloudflare?
I use graphQL, I get error 1020, but the weird thing is that if I make a call from postman, I get a response
are you using graphql python library
but the weird thing is that if I make a call from postman, I get a response - most likely the request is just different when its made within postman
even if you access the same path on the website
the headers may differ
how are you sending the graphql request
How is your stance on allowing other chracters than acii as "addresses"? Like emoticons or, more sinister: an "e" characters that looks by all means the same, but isn't
addresses?
ohhh you mean like domains
god no
well, most browsers actually filter out domains like that which use similar-but-not-the-same-characters to prevent phishing
as for other than ASCII, it's great
Im pretty sure you just straight up cant do unicode domains
yeah you can
okay well, thats fucking painful
firefox renders it for me
oh could be my system lol
well actually nvm
but the thing is
this only works because they are ccTLDs
because they were around before ICANN was really structured and had regulations their contracts are basically "do whatever the fuck you want"
gTLDs and non-ccTLDs like .com, .org, .dev, etc. are all banned by ICANN from doing this
it's the same reason that http://ai./ works, because they are a ccTLD and they just... decided to put A records at the TLD level
gTLDs aren't allowed to do thta
good time with the web
Does django channels work pretty much like TCP sockets? Like from the client side, will a pure tcp connection from the client side get routed and hold it open like a tcp connection?
no
well
sorta
it gives you the ability to do websocket communication
which is bi-directional streaming
yeah, i think thats what I need. I just need a client to connect, send some byte data up to the server then decode into HEX then decode the HEX msg structure. Based on the message structure then send back a string of HEX chars to get converted back to bytes
and then drop then connection
is this client inside a web browser?
no its an iot device
if you're doing python client & python server you're better just doing something like ZMQ or MQTT imo, django channels is optimised for use as a web app component
that I can set its upload ip address and it will continually send byte data up via tcp to it
https://mqtt.org/ is pretty much the go-to for IoT communication
A lightweight messaging protocol for small sensors and mobile devices, optimized for high-latency or unreliable networks, enabling a Connected World and the Internet of Things
the device side is a third party device so I can't change it to MQTT
django channels isn't raw TCP yea
it's websockets, which is just an extension to HTTP
oh, that wont work then
it initiates with a HTTP request and then the server upgrades the connection to websockets for bi-directional comms
you'll probably just need raw TCP with sockets, gevent or asyncio
I was looking into twistd but I'm much more familar with django. I was trying to see if there was any way I could use django for this but I think django might not be able to handle this. I can still use asyncio or twisted as the device-to-server and use a django for the HTTP restframe work for user-to-server. Then have them share a database that could relay information down into the iot devices.
and also upload the device to data and place into the databases for users to querey
yeah django won't be able to do raw TCP sadly, you can have a django API that a middle-man socket server talks to though
when I use django I use a reverse proxy like nginx or caddy. Can I use those to sit between my tcp server and incoming traffic?
not really - nginx can proxy tcp connections but only to a tcp server
django channels is just not compatible with that, it's way more than raw TCP
What is the difference between "transporting x" and "moving x"?
in what context?
could you link somewhere you are reading that? neither of those is truly standardised
there is a "transport layer" which is L4 of the OSI model
examples include TCP and UDP
yeah, but as I see it (and I WANT to be corrected) only the physical link is transporting
as in moving stuff from A to B
each layer in the model adds features to the transmission of data as a whole
so think, physical layer is the actual comms as you say
data link has some error correction for the physical layer
it's for frames on the same network
then you've got the network layer, which is generally IP
in a local network, devices communicate with mac addresses, on the internet they need public, unique addresses, hence IP adds that
but then what if you want multiple connections between the same two hosts / IP addresses?
well, the transport layer, TCP & UDP, add port numbers
so you can open a load and allocate a unique port number to them
then each layer above that moves more into application space so things vary more
but the words "transport" nor "moving" have a standardised definitiion
imo the OSI model has some odd naming for layers
the DoD model makes it a tad clearer
hi
I would like to create an http client/server and socket, how can I start or should I start?
with almost the same headers as the postman
Except the native default postman ones
I send the same body and the only difference is in headers
How do DNS servers know which domain name corresponds to which IP address?
it's a distributed system, so it trickles down
if you are trying to resolve a domain like for example, foo.pythondiscord.com
first you go to what are known as the DNS roots, they're the servers which know where to find the other servers for each Top-Level Domain (TLD, like com, org, dev, etc.)
you ask the roots "hey! which servers know how to answer for .com?"
and then the roots will give you back a list of servers for .com
then you go to .com and go "hey! which servers know how to answer pythondiscord.com?"
and the .com nameservers will return the nameservers configured by you, now the ball is in your ground
then finally it'll come to your nameservers and go "hey! do you have a record for foo.pythondiscord.com?" to which the DNS server for pythondiscord.com can either say yes (and give you an IP as an A record or something), no and give you an NXDOMAIN error, or point you to another more specialised DNS server
hope that makes sense a bit @cursive jacinth, let me know if any sections are unclear
there is a tool which will actually show you this process step by step from asking the roots to asking the TLD nameservers and so on, so I invite you to give that a try and throw in some domains https://dns-lookup.jvns.ca/trace.html#pythondiscord.com
question.
when I'm using asyncio streams; if I put a asyncio.sleep() before a data = reader.read().
asyncio.sleep(100)
data=reader.read(100)
it is still able to assign the reader data to the variable, and it does not miss it, does tht mean my computer is storing all the data being sent to it? waiting for some program to read and empty it?
lol unless you save the link somewhere theres no way your getting back to that website without a lot of effort, how do yuo type in those characters lol
Well it should translate to punycode if you type in accented characters
can you post those headers
both within python and postman
you can exclude all the sensitive information
first of all you are forgetting await before asyncio.sleep(100)
and what this sleep call would do is basically just freeze the execution in this context for 100 seconds (whether you are in a function or outside of it)
only after 100 seconds have passed your .read() call will be executed and the data will be read into the data variable
yeah, i have tht in my code
but its not a good practice to just "stall" at an ongoing connection like that
the opposing party may just close the connection
read from where? where is tht file stored on my computer? im using linux, so is tht stored in some file?
read from where?
from the connection
reader, writer = asyncio.open_connection are used to open a connection with some other machine
in theory it could be a file as well if you are on linux but its definitely not your case
so the bytes are sent from to a port in my computer, its not directly being a sent to the py program, rather comp is receiving them, doing something with, then my py prog can pick it up from somewhere
what is the hostname
you use
as the first parameter to open_connection
if its localhost or some local IP address
reader, writer = await asyncio.open_connection(
'127.0.0.1', 8888)
yes
so yes in this case think of it as establishing a connection with some other program
running on your computer
the one that "listens" on port "8888"
even when await asyncio.sleep(100)?
asyncio.sleep is not related to networking
at all
actually
it's just an asynchronous version of time.sleep()
so it really doesn't relate to reader, writer objects
as i said the only thing asyncio.sleep does it make your code sleep for the provided time
no I mean, even when it is sleeping, how is it storing the data, after it exits the sleep is able to assign to read tht data?
after it exits the sleep is able to assign to read tht data?
yes if the other party didnt decide to drop the connection while your code was sleeping at asyncio.sleep()
due to reasons like "hmm I sent my information to the other client but it didn't acknowledge it for 100 seconds, i should just close the connection"
this could happen
await asyncio.sleep(100)
data = await reader.read(10)
now some data has been sent to it when the program is sleeping,
now after the program continues.
await reader.read() is able to read the data that was sent to the computer while the program was sleeping.
so my question is that, the computer is storing the data that was sent to the open port, waiting for something to read and delete that data?
oh right
i think you are misunderstanding something
you probably don't need await asyncio.sleep(100) at all
btw there is background code, but im not including it.
what is your reason for using it?
client is sending data to the server, server processes that data, and sends processed data.
now if there is a fast client which is able to send me data, lots of times per second, it will take up resources of a slower client, which is bad, so I want something like a timeout, like 50 milliseconds, so the server is serving clients equally.
is this server side or client side
server side
side question
data = await reader.read(100)
does this wait for 100 bytes? so if client sends 10 bytes, my program will keep on waiting untill 100 bytes are accumulated?
does this wait for 100 bytes?
this waits for at most 100 bytes
from the client
but say a client is only sending 10 bytes like this:
conn.send("0123456789".encode())
then data = await reader.read(100) will still successfully return
and save only 10 bytes to the data variable
and so no
is the answer to the last question
i did, didnt work
what
no i meant
when you send those headers here
for us to see
you should exclude sensitive info
@limpid bay i dont even know if your active on this server anymore but i remembered this conversation about how my example wasnt working and it clicked and ive fixed it now i think 😂 sorry for the inconvenience
Oh nice, only 4 months late lol
I gave up on sockets that very day and been happily using RabbitMQ for everything since then
oops sorry about that, dont give up on sockets, i dont know what rabbitMQ is but sockets are cool lol
I just created a server and sent a message and a client. amazing lol
uh
It's great and Erlang!
vco hated me for saying it but imma do it anyways
rabbitmq is worse that redis in speed and worse that kafka in regards to persistency

and all three have completely different use cases, lol
redis pub/sub is basically rabbitmq
Whenever I need a request, should I create a connection?
sure at the expense of a lot of speed
what library are we talking?
asyncio
id try to keep a client around as long as its needed
otherwise you're just wasting processing setting up and deleting the client
not really, rabbitmq is considerably better in terms of consistent latency for larger messages
¯_(ツ)_/¯
I'm using
loop.create_connection
but it seems that to send a message I must open a connection.
specifically

thing is i havent played around much with messaging and am mostly repeating the experiences of friends
so im open to learn
I'm interested what benchmarks you are going off with the claims, but in all situations I've worked with MQs RMQ or Kafka are the go to choices, Redis is fast in some situations but when you have large messages it gets slow fast
sounds reasonable
since the ppl ive talked to so far use redis for thousands of really small messages
yeah we scaled RabbitMQ to around 30,000 events/s
and bandwidth wise around 120mb/s iirc
redis wasn't effective at that scale
redis pubsub doesn't really scale at all because it broadcasts all messages to all members if you're clustering
yeah
i've only really used kafka so far
which was amazing btw but has a different usecase
Kafka is nice
is it possible to keep an open connection using the low level of asyncio?
Anyone use the Netmiko Library?
i mean you can host socket servers with asyncio
ive just been looking into this coincidently, it turns out asyncio completely does its own thing and i dont even need to manually import the socket module
ignore the Config bit
i hate it ngl, i have my own pure raw socket implementation which i much prefer
custom event loop time it is i guess
I was also able to connect
this is the proper stuff right here
indeed! under the hood it uses socket!
Lib/asyncio/base_events.py line 1385
async def create_server(```
that's where the magic happens
@cedar forum can I make http requests with the socket?
import socket
import ssl
context = ssl.create_default_context()
MSG = b"""GET /humans.txt HTTP/1.1\r
Host: pythondiscord.com\r
User-Agent: Joe's script\r
\r\n"""
with socket.create_connection(('pythondiscord.com', 443)) as sock:
with context.wrap_socket(sock, server_hostname='pythondiscord.com') as socket_ssl:
socket_ssl.sendall(MSG)
resp = socket_ssl.recv(4096)
resp2 = socket_ssl.recv(4096)
print(resp.decode() + resp2.decode())
this is a HTTP request through the sockets module
you have to do all the HTTP yourself, which is why I advise highly against it, but this is a proof of concept that you can do it
if you run that you'll see the full HTTP transaction as a response, headers and content
I had to do two receives because it was too much for one buffer
Yes very difficult
so, urllib if you want something that ships with python already, alternatively httpx or requests
wait you can skip the whole api challenge if you add a user agent arg of Joe's script? 😂
that's a differeent thing
you are tihnking of https://challenge.pythondiscord.com/
this is juts humans.txt
says i'm a robot
where do robots go
I never asked myself that question
correct, you need to think like a robot
When I make a request to python.org it tells me that it is forbidden by administrative rules.
Finally someone understand me lol
I get nothing but shit for using RabbitMQ for everything including queueing my booty wipes
hahahhahaaha
I have 6 free redis servers
That's nuts though, is that with clustering too or just a single node?
clustering, but not a tonne of nodes tbqh
With load balancing in the cluster or just failover?
load balancing
Sounds sweet, I haven't gotten that deep yet, I'm barely peaking 10/s but good to hear that it can scale
yeah there were some wild people in the dept that managed rabbitmq
came in and just said "already i want a 10% increase by the time I go home" and they just went and did it
I don't really have any high-throughput tasks yet but I do use rabbit in some "unique" ways (or maybe not unique but no one recommended me to handle it with a MQ when I asked around) - for example I just made a bunch of queues for my distributed functions that need to run 24/7 but never more than one instance at a time, so I created a queue and put in a single empty message, consume the queue with ~10 servers and nack the message every time. Whenever a customer gets the message (using higher customer priority for the beefy server) it runs the function and repeat
Does that sound legit™️ or not really production proof?
Working like a charm so far but what do I know, certainly not anything about production stuff
(I've been trying to figure out what's the most bulletproof approach to running a function non-stop in a distributed way but always only on one server at a time)
@cedar forum I've already made my own requests, I'm excited.
if it's going to break, in my experience rabbit makes that evident early
anyone has experience with websockets (async)
When I make the request, many messages are received but never all in one, how can I solve this?
At least if it returned Content-Length
please don't ghost ping me
the solution is not rolling your own requests usually, or just reading until there is no more content to read
well
If Content-Length is provided, is it supposed to be multipart, then would all browsers expect the same?
its supposed to be multipart when Content-Type request header indicates so
can you show us how the request looks on the back-end side
Thanks, it explains a general idea.
how do u guys usually get the access_token in Oauth2?
hey does anyone have a Nexus switch with port-channels in their core going toward the edge or towards a hypervisor? I have added functionality for this to an IP tracing script I have published to Github, but I unfortunately don't have a means to test it at the moment
Traceback (most recent call last): File "C:\Users\-----------\Desktop\Python\Dr.Sploitberg\tests\test_ddos.py", line 54, in test_ddos_stop_method_twice ddos = hacking.tools.attack.DDoS(targetPort=self.sock.getsockname()[1], isTesting=True) OSError: [WinError 10022] An invalid argument was supplied could someone help me?
I am using the example of joe and loop.open_connection
you want help... in a script named test_ddos.py... with a line of code that reads hacking.tools.attack.DDoS(targetPort=...
its not illegal
unless you do it on your own devices
...right
google it then
no i know you can test your own systems
but
we dont help with that here since it can be used illegally very easily
this was a waste of time then, ill go find someone who can be arsed
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
exactly, sorry mate
also you do realise the hacking.tools.attack.DDoS is an unknown function where we don't know the required args to help with (since thats whats causing the error) @bright nest...

thanks for the help (telling me where the issue is coming from)
and also, you make a good point about not knowing the args

where would i go to get help on this topic?
!warn 858340220353249311 Please do not use our server to advertise your personal YouTube channel.
:incoming_envelope: :ok_hand: applied warning to @boreal plover.
With DDoS software? Nowhere afaik
you will find a lot of help for protecting against ddos attacks but not for the attacks themselves, not to mention that any libraries and code that claims to do this, will most likely target you as well, leaving you extremely vulnerable to attacks
lol
works though
also is how most root certs work
they are all offline and the secondary keys are manually signed iirc
That's it afaik
afaik lol
Hello, I have a question on VPNs & proxies. Is anyone online ?
Yup
It's about p2p.
I think my ISP is blocking uploading/seeding.
How do I go about changing this ?
I'll be buying a VPN next month, but till then, I need to seed.
probably not a whole load of options without VPN
they are probably blocking ports or even protocol
alternatively, check port forwarding
but I'm not going to lie to you - they are blocking it for good reason
Yo, anyone know specifically to terminate a process using a timer, it's used to end the connection for a user which is connected to the server if they are idle for 5 mins lets say and dont type anything/are idle, in other words it terminates if it doesnt detect a user input in that specific time
so
you can either spawn a task that waits 5 minutes and then kills the connection, and then every time the user types kill that task and spawn a new one counting down
you can do that with asyncio pretty easily if you are using async
Hmm ok
the other idea would be to have a loop that runs once a minute and checks the last typed time on all the connections, if it finds one older than 5 minutes it will kill it
that means you don't need to spawn a new task every time the user types
I think this one would be easier but less optimized
I will implement both, and see which one works smoother
Thank you, and have a good one
well, bear in mind that with that approach you don't have to kill & spawn tasks on every input, which might end up being fairly neutral in terms of optimisation
np, you too
Is anyone willing to help me tackle how to get this browser MU* hosted to my domain?
Anybody know how to link a django site to a physical robot on the same network using either sockets or http or something else. If you could help that would be great
Can someone suggest a way to connect to an ftp using ftp_tls, where I can use a custom port? I'm able to connect via filezilla, but when I use python, it will time out after using .connect().
Is there something I need to do in order to accept their certificate? I can't find anything in the documentation, nor much online.
Code examples (via phone)
with ftplib.FTP_TLS(host, port) as ftp:
ftp.login(user, pwd)
Or
client = ftplib.FTP_TLS()
client.connect(host, port)
client.login(user, pwd)
I literally just need to transmit a string through a view
right
what capabilities does the robot have
is it on a microcontroller so socket only, or is it an education kit so websocket might be better
Before I go ahead and learn SSH, let me make sure the use case I have in mind will be satisfied by it. Can I use an SSH server to run scripts on my connected, remote linux desktop?
SSH and remote desktop are different things
with RDP/remote desktop, you put in an address and get back a tunnel to the GUI of the end machine
with SSH you connect to the IP, login as a user and get a terminal shell, no GUI
you can indeed use that to run commands remotely
Oh that makes sense
ssh really isn't hard to learn, you only need a command or two and you're good to go
it's basically just ssh user@123.45.3.2
Can I still log in into a machine by SSH as a user that's already logged in through other means?
yep, they are completely different things
👍
Hey Joe, I am applying for Computer Science next Year, can you please let me know what are the Main Topics are in this Stream.
stream?
heyyy How can i parse XML from url? Or just how to downlad the xml file?
(url: http://www.strava.cz/foxisapi/foxisapi.dll/istravne.istravne.process?xmljidelnickyA&zarizeni=3148 )
idk what to do, cuz the url dont end with .xml
Hi
I have a question
I hope you can help
How can i download a HTML page using python?
requests or httpx are things to look into
A next-generation HTTP client for Python.
Hey what’s up guys! My name is Tony. I’m working an NFT project right now, but am new to coding. It’s a going to be a similar project to crypto punks/bored apes. It uses generative art. Would anyone be interested in collabing on this project?😎
Hello, anyone can help me about download files trough sftp?
I have a simple script, and all is perfect with files less than 10mb, but when i needd to download files morr than 100 mb, is soooooo slow the download
I use pysftp
import math, pysftp, sys
myHostname = "192.168.1.1"
myUsername = "usuario"
myPassword = "password"
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(host=myHostname, username=myUsername, password=myPassword, cnopts=cnopts) as sftp:
remoteFilePath = '/path/demo.wmv'
localFilePath = '/home/demo/demo.wmv'
sftp.get(remoteFilePath, localFilePath)
:incoming_envelope: :ok_hand: applied mute to @umbral charm until <t:1631760180:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
Hi, I'm Adrian, 19 years old looking for a python partner to learn with. I'm just starting (just finished Kaggle's python course). Happy to meet you guys!
guys i'm trying to collect data from a online game, so i was thinking about how i can do a reverse engineering with python to collect data from a online game, someone know where i can start to learn about that?
how's this possible?
it is pending and fullfilled
and got a value
then how's this pending
what will happen if you send a unicode only character thru http, which uses utf8?
nvm im dumb as hell
Ayo so I need help port forwarding, I just got a new ISP and it directly passes the ip to my router rather than going through a modem. I port forwarded and it says the port is closed. I heard I need a static ip, but I have a eth0 connection
Static IP is used to connect directly with your computer when you are away of home, port forwarding is different topic (like opening and closing connection on certain port)
I have a question: are there effective solutions to the halting problem involving heuristics only, not algorithms?
or are huristics just another kind of algorithm?
oops sorry wrong channel
hey can someone pls help me out
i want to know if there is a way that i can preview data that is going to be uploaded on a website
automatically on a specific date and time?
Yeah, quite wrong - more #algos-and-data-structs. However the algorithms cannot exist afaik
Hmm, are you asking about a tool like WireShark?
You could decrypt the tls connection with tcpdump and run -w to create wireshark-compatible pcaps, but like the previous speaker (class 💩 ), I don't really have any idea what you're talking about.
I'm using nginx to proxy HTTPS requests to an HTTP app exposed to localhost. However, my app responds with 307 Redirects which contain an http location. How can i intercept these redirects and rewrite them to redirect to https instead?
what is the app using under the hood?
Starlette running in a docker container