#networks

1 messages · Page 35 of 1

prisma cobalt
#

discord custom embed generator

#

it supports images and normal text

#

but i cant show it in action yet

zealous badge
#

I dont even know wht does a discord embed mean, I m kinda new

prisma cobalt
#

go to the #rules, the box thing you see the text in is an embed

#

usually only bots can send them

zealous badge
#

Aaaaa

#

I have a disord bot

prisma cobalt
#

try embeds then lol, they can look pretty cool

zealous badge
#

Lemme see if its still online

prisma cobalt
#

ah there we go, finally got it set up @zealous badge

zealous badge
prisma cobalt
#

lol

zealous badge
#

How much did the domain cost

#

Or free

prisma cobalt
#

free for now 👀 dunno if i want to keep it later on

zealous badge
#

How did you gey free

#

Get

prisma cobalt
#

if you look around quite a few services offer the first year free or something
i used Hostingr which offered it for free

zealous badge
#

Cool thanks

prisma cobalt
zealous badge
#

Btw if u dont mind me asking u from south asia

prisma cobalt
#

im not actually

#

why do you ask?

#

ah you mean india right?

zealous badge
#

Just prediction test

zealous badge
#

U from there

#

?

prisma cobalt
#

no lol

#

sorry

zealous badge
#

Ahh shit wrong prediction, Indians use lot more emojis

prisma cobalt
#

i know where your coming from, its just from my experience quite a large proportion of people on this server have been from there

prisma cobalt
#

nice

#

not nice

#

well i said the wrong thing 😂

zealous badge
#

Lol

prisma cobalt
#

ok*

zealous badge
#

It was nice talking to you bye

#

Later

prisma cobalt
#

cya 👋

cedar forum
#

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'
kind snow
#

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

errant bayBOT
#

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:

https://paste.pythondiscord.com

radiant vortex
#

Are looking into how to set up a Samba file sharing server?

hoary forum
#

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

ember ledge
#

alr it works

ember ledge
#

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?

clear bobcat
ember ledge
#

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

clear bobcat
clear bobcat
rose thorn
#

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.

clear bobcat
livid ore
#

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 pydis_snake

rose thorn
raw pier
#

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

faint vector
#

i always thought it was both since the ports define where communication goes on both ends

faint vector
rose thorn
raw pier
hollow rivet
#

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'

hollow rivet
#

?

coarse matrix
#

can someone recommend me a good tutorial for sockets?

coarse matrix
#

thanks! 🙂

ashen hearth
ember ledge
#

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\

upper cypress
#

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?

humble jungle
# raw pier Hi, my question is related to open ports. When we say say that http traffic goes...

(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.

thorny echo
#

Guys, does Game servers are bought or rent ?

narrow oak
thorny echo
narrow oak
#

Assuming you're talking about vps' or bare metal

thorny echo
narrow oak
thorny echo
#

ok

digital anvil
#

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???
raw pier
#

@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 ?

silver pike
#

@digital anvil have you tried changing the ip address to 127.0.0.1 ?

digital anvil
digital anvil
digital anvil
silver pike
#

you could try: s.bind((socket.gethostname(), 1234))

#

s.bind((socket.gethostname(), 1234))

digital anvil
silver pike
#

Can you show me your whole code?

#

Do you get the error when running the server? Or the client?

ember ledge
#

Anyone know what: Basic, 1, The host is set, but the type cannot be determined. ((like means in real terms?))

surreal sphinx
#

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

digital anvil
silver pike
#

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

digital anvil
silver pike
#

@digital anvil Maybe try and disable the firewall completely and see if that might help?

digital anvil
humble jungle
# raw pier <@431297831224082473> hi thanks alot for the answer. Yes your answer is clear. T...

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.

empty rune
#

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

gloomy root
#

Thats not what horizontal scaling means

empty rune
#

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

bleak stream
#

Hmm ok I have a game I want to make it multiplayer how?

#

Help

nimble flower
#

Using sockets/networking

amber bronze
#

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

trail plover
#

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.

trail plank
#

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

violet gate
#

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

trail plank
#

thanks for explaining the error at least

#

but how is it disconnecting i literally have the server command ran

#

along with the client

tropic dagger
#

U might've placed
connection.close()
Inside ur loop

tropic dagger
#

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
clear bobcat
#

!d socket.socket.settimeout

errant bayBOT
#

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").
tropic dagger
#

Right thanks : )

clear bobcat
clear bobcat
#

If a non-zero value is given, subsequent socket operations will raise a timeout exception [...]

#

So yes

tropic dagger
#

Ah I got what it meant as soon as I sent it

clear bobcat
#

I think that going this way is okay this

tropic dagger
#

So .settimeout needs to reloaded to work again I suppose? Or is reseting only necessary if you want to remove the timeout?

clear bobcat
#
conn = ...
conn.settimeout(5)

...

conn.recv(1024)
tropic dagger
clear bobcat
tropic dagger
#

Let me create a debug code.

tropic dagger
#

Thanks

clear bobcat
#

🎉

tropic dagger
#

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

clear bobcat
#

Hah, yeah

#

json.dumps to dump data in JSON style

tropic dagger
#

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

muted niche
#

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

tropic dagger
#

But there were some 20mb extra packets sent(prolly loss retransmition)

ember ledge
#

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.

thorn cypress
#

Hey, are there any LibPCAP bindings to Python that function similarly to the C version?

tropic dagger
raw pier
tropic dagger
#

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

humble jungle
# raw pier When you say it perfectly fine if it's not open to external addresses, what does...

@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.

humble jungle
tropic dagger
#

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?

humble jungle
#

@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.

clear bobcat
#

This is huge topic... Basically create peer-to-peer network with transaction protocol which share transaction across all peers

humble jungle
#

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?

clear bobcat
#

Also changed proof-of-work algorithm to be more ASIC/FPGA/GPU-resistant lol

humble jungle
#

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?

clear bobcat
#

Yeah, be kind @ember ledge 😦

delicate pond
#

POV: you try to send 96,000 bytes....

#

Yeah it froze....

#

Yup it's dead

prisma cobalt
#

wait are you combining C sockets and python sockets lol

#

gl

delicate pond
#

Are they different much?

narrow oak
#

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

lofty bough
#

96 kilobytes isn't that much

mellow vortex
#

how do we put a variable?

#

how do we put a variable?

#

how do we put a variable?

simple cedar
#

No need to spam

lofty bough
#

@mellow vortex what do you mean?

mellow vortex
#

variable = input("fuckm") how do we put other variable sum with number?

#

str((vaariable)

urban coral
#

u mean

num1 = int(input('Num1: '))
num2 = int(input('Num2: '))
sum = num1 + num2

?

#

n pls don't use offensive words

ember ledge
#

does anyone know ursina networking ?

#

pleas help

glad steppe
#

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 ...

ember ledge
#

what is networking?

bleak stream
#

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

real pike
#

Does anyone know to to get Ethernet on a ipad

gloomy root
#

Im assuming you cant unless apple have some some janky lighting port stuff to Ethernet cable

radiant vortex
#

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

atomic helm
#

Hey my friend needs help with port forwarding

grizzled haven
#

i need to forward port 27015

prisma cobalt
prisma cobalt
# atomic helm

lol DCHP isnt a thing, i assume you mean DHCP which means dynamic host configuration protocol?

livid yarrow
#

Any suggestions for projects on networking for newbies?

clear bobcat
prisma cobalt
#

well they could try the guide in pins but im not sure what exactly they are trying to do

storm saffron
eager urchin
livid yarrow
livid yarrow
clear bobcat
radiant vortex
#

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()

mystic nymph
somber lily
#

anyone got a video i can watch to learn network scripting

fierce pivot
last ore
#
      - 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

lapis oasis
#

can anyone help pls

light zealot
north rock
#

for beginner, no need to implement the full features only specific parts.

pulsar vigil
#

it have to go and it have to back

agile robin
#

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

storm saffron
#

what goes wrong

agile robin
#

it says its open but wont reply the message

#

error also work but dont tell me there is any

storm saffron
#

reply to what

#

you don't send a message

agile robin
#

i should get a stream back thou on message

ember ledge
#

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.

clear bobcat
#

Setup http via socks5://...

lofty bough
#

@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.

ember ledge
#

is there a indepth resource on everything about LANs and how an internet connection works?

grand kayak
#

Especially if you are a beginner. RFCs can be overwhelming.

ember ledge
earnest blaze
#

How can I send multiple things concurrently with (tcp) sockets?

grand kayak
#

You can open multiple connections, if the server supports that.

earnest blaze
#

Oh just like that? It's that simple? No strings attached?

clear bobcat
grand kayak
grand kayak
earnest blaze
#

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

grand kayak
#

I see. You could use threads for that.

#

One thread for each connection.

earnest blaze
#

And how would you handle sending and receiving files?

grand kayak
#

Are you using any web framework, such as flask or fastapi?

earnest blaze
#

Just the plain old socket library

ember ledge
#

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

grand kayak
grand kayak
#

When an operator had to physically attach (or switch) your line until you reach the person you wanted to talk to.

ember ledge
#

ah where you had to manually connect cables to establish a connection?

grand kayak
#

Exactly!

#

Just like a lightswitch, as you mentioned.

#

Creating a physical circuit

clear bobcat
#

Really old times

grand kayak
#

You can accomplish that in so many ways 😆

#

It's up to you.

earnest blaze
#

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

grand kayak
#

Which is why I would use a framework such as django, flask, sanic or fastapi

#

They take care of that stuff for ya

earnest blaze
#

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

ember ledge
#

I miss IRC times 😄

grand kayak
#

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.

earnest blaze
#

Ouch no asyncio support? I don't know if i want to commit to learning it then

grand kayak
#

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.

earnest blaze
#

Alright thank you.

grand kayak
#

You're welcome ;)

ember ledge
#

Ah so RFC is not one, but THE standard about IP?

grand kayak
#

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.

ember ledge
#

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

grand kayak
#

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.

ember ledge
#

From where comes the term ethernet? I know ethereal oils for example and "ether" in pokémon.

grand kayak
ember ledge
#

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?

grand kayak
#

Yep.

#

Maybe something using quantum mechanics.

#

We never know.

#

😆

ember ledge
#

Is bit the better unit to measure anything networkrelated, instead of byte? (or their k/m/g respectives)

grand kayak
#

You will see both very frequently.

#

In some places, you will see the word octet used instead of byte

ember ledge
#

Mmh, ISPs use bit, like always. I guess because higher numbers sell 😄 (in my country)

grand kayak
#

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.

ember ledge
#

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

grand kayak
#

Circuit switching is faster and more reliable.

#

But it would be too costly to have the entire internet circuit switched.

ember ledge
#

it is used for telecommunication like mobile phones right?

grand kayak
#

Packet switching, however, is highly flexible. That's why it's the choice.

ember ledge
#

since they only require a fixed bandwith

#

(to achieve good quality of speech)

grand kayak
#

Well, it used to be like that. Now, most operators use VoIP, which is packet switched.

ember ledge
#

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"

grand kayak
#

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 😅

ember ledge
#

Anyways I like the book 🙂

#

I only use Discord at the moment, can't remember my skype time

grand kayak
#

Discord can have issues, too

#

For the same reasons*

ember ledge
#

so, if all discord users where in an active calling session at the same time, some would have bad quality?

grand kayak
#

Yeah, and it could be for many reasons.

#

The discord servers could be overloaded.

ember ledge
#

like it was the case with some app Elon Musk said was cool

#

maybe telegram don't know

#

because suddenly the servers where full 😄

grand kayak
#

Yeah, that's exactly it.

ember ledge
#

I observed that alot of telecommunication providers are just daughtercompanies of bigger ones

#

reason?

grand kayak
#

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.

ember ledge
#

Is it possible for a small buisness to be their own ISP?

grand kayak
#

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.

ember ledge
#

So you the only alternative would be to setup an alternate internet?

#

(but that is not doable for small buiseness haha)

grand kayak
#

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.

ember ledge
#

But a university can act as an ISP? (according to the book)

#

without having a contract with the "normal" ISPs

grand kayak
#

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.

ember ledge
#

So Tier-1 ISPs are some of the biggest companies in the world? (ISPs for ISPs)

grand kayak
#

Yeah

#

Including submarine cables

ember ledge
#

Is every searchmachine a contentprovider? What else can be a contentprovider? Is a library a contentprovider in that it provides books?

grand kayak
#

Don't you mean search engine?

#

Like Google, Yandex, Baidu...

#

And yeah, kind of. Wikipedia is another good example.

#

News sites, you name it.

ember ledge
#

Ah yes, sorry it's literally machine in my language

grand kayak
#

Lol it's ok

ember ledge
#

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?

grand kayak
#

That's what routing protocols are used for.

ember ledge
#

ah ok, then I just continue reading

grand kayak
#

It usually works by looking up a routing table

ember ledge
#

so there stands "endystem A requested data from website X, now send packets from website X to A"?

#

or more general in adresses

grand kayak
#

What do you mean?

#

Are you asking about the routing protocols?

ember ledge
#

yes, are they covered in the book?

grand kayak
#

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.

last ore
#

We used them in uni, to pass network related tasks

grand kayak
#

Yup.

#

Probably Cisco Packet Tracer 😆

ember ledge
#

IMO it's misnamed 😦

grand kayak
#

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.

ember ledge
#

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

grand kayak
#

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)

grand kayak
grand kayak
ember ledge
#

Hey thanks 🙂

grand kayak
#

You're welcome

#

:)

ember ledge
#

So the ping command bypasses the TCP encapsuling and goes straight to IP?

grand kayak
#

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.

clear bobcat
#

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

wooden magnet
quiet pine
#

whats the difference between socket.AF_UNIX and socket.AF_INET

gloomy root
# quiet pine 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)

quiet pine
#

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.

gloomy root
#

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

ember ledge
#

Why is WiFi usually limited to tens of meters?

#

Would it change with a better/bigger hardware?

gloomy root
#

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.

indigo panther
ember ledge
#

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?

onyx mica
#

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

gloomy root
#

as in HTTP stuff

#

or just TCP in general

#

asyncio is pretty much the inbuilt go to for async networking

onyx mica
#

TCP, the IoT devices can only communicate on TCP. So I cant use HTTP requests 😩

grand kayak
#

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.

onyx mica
#

It's an IoT device that uses very low level code to save battery

grand kayak
#

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.

onyx mica
#

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

grand kayak
#

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.

ember ledge
#

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.

hollow rivet
#

how we built a python program to know the length of the password

ember ledge
#

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?

ember ledge
worn elm
#

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?

empty jungle
#

The realpython tutorial is a bit overwhelming, is there an easier socket tutorial and possibly explaining what everything means?

empty jungle
#

Ty

#

I might just not do sockets though tbh

#

but I don't know what to learn

prisma cobalt
#

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

empty jungle
#

They are so confusing though, is there a place to learn the logic behind them first

#

the RP tutorial made me feel overwhelmed tbh

prisma cobalt
#

imagine sockets as a tunnel of which you can send and receive data

#

any data works, as long as its in binary form

empty jungle
#

hmm

wraith condor
#

Hello,
Can anyone tell me how to hack a phone by sending an sms???

cedar forum
#

Nope, not here I'm afraid.

radiant vortex
#

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)

limpid wagon
radiant vortex
#

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

queen hinge
polar moth
#

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

vernal jackal
#

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?

ember ledge
#

check the firewall rules

#

if you have access to the cloudflare firewall

prisma cobalt
#

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

ember ledge
#

recv() can return ""

#

and when it does it means the opposite peer sent all the data it had for you

vernal jackal
trim moth
# prisma cobalt if `socket.recv()` is a blocking call, then how do examples work like this ```py...

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

split goblet
#

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

mortal tide
ember ledge
#

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

errant bayBOT
mortal tide
#
import socket
import threading
from queue import Queue
import os
import sys
import time
os.system("cls")
target = input("Enter The Host To Find Open-Ports -> ")
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("[{}] Open Port For -> [{}]".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("\nopen ports are: ", open_ports)
print("port scanning done")
time.sleep(300)
#

**Fast Port Scanner ⬆️ **

mortal tide
#

its not

#

just for people that wants a script of a portscanner

ember ledge
#

you could get it on github, some subchannel of discord I don't think is reaching alot of people 🙂

ember ledge
#

because of crc?

grand kayak
#

There are many error verifications

grand kayak
ember ledge
#

so practically it is rather impossible?

grand kayak
#

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

grand kayak
ember ledge
#

are they layermodels of OSI or the book you recommended worth remembering?

grand kayak
#

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

ember ledge
#

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

grand kayak
#

With some more practice you will remember it :)

grand kayak
#

And a comparison of both

ember ledge
#

the encapsulating of packets is done in multiple layers right?

#

namely transport and network

#

and dependant on the app, in the application layer too

grand kayak
#

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.

ember ledge
#

are there real applications that don't make an app-header?

grand kayak
#

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

ember ledge
#

@grand kayak I like veritasium, but this video escaped from my view. Interesting!

grand kayak
#

That is one damn good video :)

ember ledge
#

So to avoid cosmic radiation, you have to send data redundantly?

grand kayak
#

Well, I don't know if it's worth the trouble 😆

#

With the exception of mission critical scenarios

#

Or if you're on space

ember ledge
#

well with voting I see it mission critical IMO

grand kayak
#

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 😅

ember ledge
#

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

grand kayak
#

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

prisma cobalt
#

A few parity bits should do the trick and not take up much space as well

rustic knoll
#

Has anyone worked with Firewalls with python, primarly the netmiko library?

split goblet
split goblet
#

magnets would be a much more probable reason for a computer to crash thn cosmic rays

hasty charm
#

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:

https://search.brave.com/

What are you waiting for?

ember ledge
vernal jackal
ember ledge
#

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

ember ledge
#

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

cedar forum
#

ohhh you mean like domains

gloomy root
#

god no

cedar forum
#

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

gloomy root
#

Im pretty sure you just straight up cant do unicode domains

cedar forum
#

yeah you can

gloomy root
#

well the protocol could allow it

#

but browsers and most webservers will reject it

cedar forum
gloomy root
#

okay well, thats fucking painful

cedar forum
#

lol

#

not a lot of browsers render it though iirc

#

firefox doesn't

gloomy root
#

firefox renders it for me

cedar forum
#

oh could be my system lol

gloomy root
#

well actually nvm

cedar forum
#

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

gloomy root
#

good time with the web

onyx mica
#

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?

gloomy root
#

no

#

well

#

sorta

#

it gives you the ability to do websocket communication

#

which is bi-directional streaming

onyx mica
#

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

cedar forum
#

is this client inside a web browser?

onyx mica
#

no its an iot device

cedar forum
#

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

onyx mica
#

that I can set its upload ip address and it will continually send byte data up via tcp to it

cedar forum
#

https://mqtt.org/ is pretty much the go-to for IoT communication

onyx mica
#

the device side is a third party device so I can't change it to MQTT

cedar forum
#

ahhhh gotcha

#

but it supports websockets?

onyx mica
#

i wasnt sure if it would work

#

its just base tcp i think

cedar forum
#

django channels isn't raw TCP yea

#

it's websockets, which is just an extension to HTTP

onyx mica
#

oh, that wont work then

cedar forum
#

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

onyx mica
#

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

cedar forum
#

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

onyx mica
#

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?

cedar forum
#

django channels is just not compatible with that, it's way more than raw TCP

ember ledge
#

What is the difference between "transporting x" and "moving x"?

cedar forum
ember ledge
#

internet layers

#

like application, transport, network, link, physical link

cedar forum
#

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

ember ledge
#

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

cedar forum
#

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

ember ledge
#

hi

#

I would like to create an http client/server and socket, how can I start or should I start?

vernal jackal
#

Except the native default postman ones

#

I send the same body and the only difference is in headers

cursive jacinth
#

How do DNS servers know which domain name corresponds to which IP address?

cedar forum
#

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

#

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

split goblet
#

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?

prisma cobalt
storm saffron
#

Well it should translate to punycode if you type in accented characters

ember ledge
#

both within python and postman

#

you can exclude all the sensitive information

ember ledge
#

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

split goblet
ember ledge
#

but its not a good practice to just "stall" at an ongoing connection like that

#

the opposing party may just close the connection

split goblet
ember ledge
#

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

split goblet
# ember ledge from the connection

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

ember ledge
#

what is the hostname

#

you use

#

as the first parameter to open_connection

#

if its localhost or some local IP address

split goblet
#

reader, writer = await asyncio.open_connection(
'127.0.0.1', 8888)

ember ledge
#

okay 127.0.0.1 indicates localhost

#

which is your own machine

split goblet
#

yes

ember ledge
#

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"

split goblet
ember ledge
#

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

split goblet
#

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?

ember ledge
#

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

split goblet
# ember ledge `after it exits the sleep is able to assign to read tht data?`
        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?

ember ledge
#

oh right

#

i think you are misunderstanding something

#

you probably don't need await asyncio.sleep(100) at all

split goblet
ember ledge
#

what is your reason for using it?

split goblet
#

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.

ember ledge
split goblet
#

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?

ember ledge
#

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

ember ledge
#

is the answer to the last question

vernal jackal
ember ledge
#

what

#

no i meant

#

when you send those headers here

#

for us to see

#

you should exclude sensitive info

prisma cobalt
#

@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

limpid bay
#

I gave up on sockets that very day and been happily using RabbitMQ for everything since then

prisma cobalt
#

oops sorry about that, dont give up on sockets, i dont know what rabbitMQ is but sockets are cool lol

cedar forum
#

RabbitMQ is so cool!!!!!

#

one of the best things in the world

ember ledge
#

I just created a server and sent a message and a client. amazing lol

steep juniper
cedar forum
#

It's great and Erlang!

steep juniper
#

vco hated me for saying it but imma do it anyways ReeCat rabbitmq is worse that redis in speed and worse that kafka in regards to persistency

cedar forum
#

and all three have completely different use cases, lol

steep juniper
#

redis pub/sub is basically rabbitmq

cedar forum
#

no it isn't

#

rabbitmq is considerably more featureful than redis

ember ledge
#

Whenever I need a request, should I create a connection?

steep juniper
#

sure at the expense of a lot of speed

steep juniper
ember ledge
#

asyncio

steep juniper
#

id try to keep a client around as long as its needed

#

otherwise you're just wasting processing setting up and deleting the client

cedar forum
steep juniper
#

¯_(ツ)_/¯

ember ledge
#

I'm using

loop.create_connection

but it seems that to send a message I must open a connection.

cedar forum
#

specifically

steep juniper
#

thing is i havent played around much with messaging and am mostly repeating the experiences of friends

#

so im open to learn

cedar forum
#

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

steep juniper
#

sounds reasonable

#

since the ppl ive talked to so far use redis for thousands of really small messages

cedar forum
#

yeah we scaled RabbitMQ to around 30,000 events/s

#

and bandwidth wise around 120mb/s iirc

#

redis wasn't effective at that scale

toxic mural
#

redis pubsub doesn't really scale at all because it broadcasts all messages to all members if you're clustering

cedar forum
#

yeah

steep juniper
#

i've only really used kafka so far

#

which was amazing btw but has a different usecase

cedar forum
#

Kafka is nice

ember ledge
#

is it possible to keep an open connection using the low level of asyncio?

rustic knoll
#

Anyone use the Netmiko Library?

prisma cobalt
#

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

ember ledge
prisma cobalt
#

this is the proper stuff right here

errant bayBOT
#

Lib/asyncio/base_events.py line 1385

async def create_server(```
cedar forum
#

that's where the magic happens

prisma cobalt
#

god the asyncio source code is complex lol

#

this is what i was trying to avoid

ember ledge
#

@cedar forum can I make http requests with the socket?

cedar forum
#

you can, yep

#

let me try setup a demo

ember ledge
#

well

#

So the requests are made through sockets?

cedar forum
# ember ledge <@165023948638126080> 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

cedar forum
#

so, urllib if you want something that ships with python already, alternatively httpx or requests

prisma cobalt
cedar forum
#

that's a differeent thing

#

this is juts humans.txt

prisma cobalt
#

oh right, the body response is the same

#

nice teapot reference btw

ember ledge
prisma cobalt
#

where do robots go

ember ledge
cedar forum
ember ledge
#

When I make a request to python.org it tells me that it is forbidden by administrative rules.

limpid bay
#

I get nothing but shit for using RabbitMQ for everything including queueing my booty wipes

cedar forum
#

hahahhahaaha

ember ledge
#

I have 6 free redis servers

limpid bay
cedar forum
#

clustering, but not a tonne of nodes tbqh

limpid bay
#

With load balancing in the cluster or just failover?

cedar forum
#

load balancing

limpid bay
#

Sounds sweet, I haven't gotten that deep yet, I'm barely peaking 10/s but good to hear that it can scale

cedar forum
#

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

limpid bay
#

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)

ember ledge
#

@cedar forum I've already made my own requests, I'm excited.

cedar forum
ember ledge
#

anyone has experience with websockets (async)

ember ledge
#

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

cedar forum
#

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

ember ledge
#

well

#

If Content-Length is provided, is it supposed to be multipart, then would all browsers expect the same?

ember ledge
ember ledge
cursive jacinth
quaint lodge
#

how do u guys usually get the access_token in Oauth2?

hoary drum
#

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

bright nest
#

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?

ember ledge
prisma cobalt
bright nest
#

its not illegal

prisma cobalt
#

...yes it is

#

ddosing is illegal

bright nest
#

unless you do it on your own devices

prisma cobalt
#

...right

bright nest
#

google it then

prisma cobalt
#

no i know you can test your own systems

#

but

#

we dont help with that here since it can be used illegally very easily

bright nest
#

this was a waste of time then, ill go find someone who can be arsed

clear bobcat
errant bayBOT
#

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

prisma cobalt
#

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...

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

prisma cobalt
bright nest
#

where would i go to get help on this topic?

tough plume
#

!warn 858340220353249311 Please do not use our server to advertise your personal YouTube channel.

errant bayBOT
#

:incoming_envelope: :ok_hand: applied warning to @boreal plover.

clear bobcat
steep juniper
#

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

steep juniper
#

lol

#

works though

#

also is how most root certs work

#

they are all offline and the secondary keys are manually signed iirc

steep juniper
#

afaik lol

dusky solstice
#

Hello, I have a question on VPNs & proxies. Is anyone online ?

ember ledge
#

Yup

dusky solstice
#

It's about p2p.

dusky solstice
# ember ledge Yup

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.

cedar forum
#

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

plush raft
#

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

cedar forum
#

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

plush raft
#

Hmm ok

cedar forum
#

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

plush raft
#

I will implement both, and see which one works smoother

#

Thank you, and have a good one

cedar forum
cedar forum
ember ledge
#

Is anyone willing to help me tackle how to get this browser MU* hosted to my domain?

dark trench
#

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

storm saffron
#

well

#

what capabilities does the robot have

tame grove
#

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)
dark trench
storm saffron
#

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

ember ledge
#

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?

cedar forum
#

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

ember ledge
#

Oh that makes sense

cedar forum
#

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

ember ledge
cedar forum
ember ledge
#

Oh that was easy

#

Thank you

cedar forum
#

👍

analog fulcrum
# cedar forum 👍

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.

ember ledge
#

idk what to do, cuz the url dont end with .xml

wicked vessel
#

Hi

#

I have a question

#

I hope you can help

#

How can i download a HTML page using python?

cedar forum
hushed cave
#

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?😎

hearty zinc
#

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)
errant bayBOT
#

: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).

umbral charm
#

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!

red geode
#

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?

deft phoenix
#

how's this possible?

#

it is pending and fullfilled

#

and got a value

#

then how's this pending

ember ledge
#

what will happen if you send a unicode only character thru http, which uses utf8?

ember ledge
#

nvm im dumb as hell

median prism
#

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

clear bobcat
median prism
#

ok

#

so it wont connect

#

through WAN

median prism
#

well found the issue

#

somehow my eth cord disconnected

hardy elk
#

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

neat spade
#

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?

clear bobcat
clear bobcat
stiff mirage
lofty bough
#

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?

cedar forum
lofty bough
#

Starlette running in a docker container