#networks

1 messages · Page 44 of 1

ember ledge
#

Unfortunately I'm not in front of my computer right now. Can I get back to you with some code that I'm using and the full traceback?

#

On Monday I will resume so I would say that the issue will persist😅

bronze anchor
#

sure, np. someone will be around

ember ledge
#

Cool

bronze anchor
ember ledge
#

Alright thank you so much for your time, I really appreciate it

final meteor
#

How do I use scapy? I can't find a tutorial thats updated. The only ones I find use old versions that doesn't seem to work with the latest version. And the docs are so confusing and doesn't work

ember ledge
final meteor
final meteor
#

How can I use windows cmd to see all the available wireless networks in the area?
Like when I choose a wifi through the gui and I see all the different wifis and the connection strength

ember ledge
#

Idk know how it’s works there but in Linux terminal just run sudo scapy3

ember ledge
# final meteor How can I use windows cmd to see all the available wireless networks in the area...

https://www.thepythoncode.com/article/building-wifi-scanner-in-python-scapy
This website will help you.But idk how ur going to do this in windows because u have to use ur wireless adapter

Building a Wi-Fi scanner in Python using Scapy that finds and displays available nearby wireless networks and their MAC address, dBm signal, channel and encryption type.

final meteor
#

Im watching a tutorial that uses scapy.arping() but .arping does not seem to exist for me

final meteor
ember ledge
#

u can do use scapy in windows I saw some YouTubers

#

But not sure

#

if u can do everything

ember ledge
#

Eventually I decided to prepare the code I'm using and the traceback for today. With the intention of starting fresh next week 😅. I feel like there is sensitive information within the Traceback. Can I send it to you privately alongside the code I'm using to call the api?
Thank you so much in advance

fervent apex
#

Hey guys

#

I need help

#

How can I communicate with my su 200 plc over Ethernet with python

pure wyvern
#

Anyone using Jinja for Cisco config templating

#

Yes, for simple show commands across Cisco devices.

sick violet
#

I need help with some IP address calculations.... essentially I need to convert IP networks, ip/mask, into one or more wild card DNS records that would match them.... so for 1.2.3.4/32 I need to return: 4.3.2.1.sub.domain.org .... for 1.2.3.0/24, *.3.2.1.sub.domain.org.... etc.

I wrote a function that seems to work fine, but it uses a naive logic.... iterates on every possible IP in the given cidr, and then figures out the octetes that go from 0 to 255, then replaces them with wildcard *.... not cool 🙂 I would appreciate hints on how improve this function.

sick violet
#

I guess my question is just how to find all /24 subnets in a given network/mask .... because those are what I need to replace with a wildcard... others would need to be listed one per IP.

fossil wing
#

Can someone try and help me in #help-chili if you can, it's about web browsers and stuff like that in python.

sick violet
bronze anchor
cloud spruce
ember ledge
#

I replicated the environment in my local computer executed the same code and it works, but in that server it doesn't🤷

bronze anchor
#

yeah, this works for me

>>> requests.get('https://www.afedegi.com')
<Response [200]>
>>> requests.__version__
'2.25.0'
#

what version of requests do you have on that one?

bronze anchor
#

ok. on that machine, what happens if you just curl -I https://www.afedegi.com?

ember ledge
bronze anchor
#

ah, so you don't have the CA for LE... interesting

ember ledge
bronze anchor
#

yeah. what did that output?

ember ledge
bronze anchor
#

wat

#

that seems unlikely

ember ledge
#

It seems like it doesn't terminate

bronze anchor
#

that sounds more plausible

#

maybe the server doesn't like your IP :D

ember ledge
#

Now it does

#

I added https://

ember ledge
# bronze anchor yeah. what did that output?

140329658971712:error:2008F002:BIO routines:BIO_lookup_ex:system lib:crypto/bio/b_addr.c:730:Servname not supported for ai_socktype
connect:errno=0
unable to load certificate
139929155102272:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE

bronze anchor
#

yeah, you don't want https

ember ledge
#

Pretty weird not gonna lie

ember ledge
bronze anchor
#

oh, is the intermediate cert missing?

#

that doesn't explain why s_client hangs

ember ledge
fossil fiber
#

Hey there, I'm back. I've looked into sending data over sockets with struct, but can't seem to figure out how to apply it to my game engine. Since each game object needs to send different data, how could I use a struct to do so? Since encoding/decoding with the struct library depends on a specific format (one that does not accept strings, only a set of numbers such as ints, floats, ect) I cant find a practical use for my engine. I apologize for my naivety, but I'm basically starting from square 1 when it comes to networking.

cloud spruce
fossil fiber
#

Right, but some objects only need to send maybe a position, but others may need a scale, rotation, animation state, ect.

#

using struct seems like the best option but im having trouble understanding how to send that data, especially when decoding that data requires a pre-determined format

cloud spruce
fossil fiber
#

You are correct, that is how I would handle that too, my issue is packing the game object data on the server using structs. Since structs require both a set format in packing and unpacking, I dont see how a client could decrypt object data without that special format, considering the format is different on an object by object bases

#

The simple answer to this would be to store the decryption format on the client too, but then how does the client know what data corresponds to each object?

#

I guess I'm having a hard time with the specifics of this lol

cloud spruce
#

and i'm guessing you mean decode and decoded rather then decrypt and decrypted, just so that we are talking about the same thing here

fossil fiber
#

I would imagine lol, sorry not exactly caught up on the vocabulary yet either

#

To be the most specific i mean struct.pack and struct.unpack

cloud spruce
#

you probably want some transport security in the form of encryption as well, for example TLS, but it's not relevant to this discussion right now

fossil fiber
#

well any information helps, Ill look into it once i get actual data sent from server to client

#

I can send basic text already, but ive heard sending actual game data should be done with structs

mortal summit
#

if i have a server and a client using socket and ssl should i pack the ssl certificate into a variable to use it when its executed on a machine or should the client request the certificate? And if you think its the second how does the server detect that the client doesnt wants to further communicate and only get the certificate to connect with it again? should the server just try to send a test message and if a exception is raised it will understand that the client disconnected?

cloud spruce
cloud spruce
fossil fiber
cloud spruce
cloud spruce
unreal path
#

Can anyone help with this?

fossil wing
#

Can anyone tell me how to implement the built in plugin supports for PyQtWebEngine, with the Pepper Plugin API, how would you make a plugin, how would you add them to your PyQt Web Browser and how would you make an extensions GUI button for removing and disabling plugins? I found some documentation, I how this can help some of you guys to at least make it a bit easier to help me: https://doc.qt.io/qt-5/qtwebengine-features.html#pepper-plugin-api

cloud spruce
#

!rule 8

errant bayBOT
#

8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.

cloud spruce
cedar marsh
#

I am trying to use proxies to perform a request, often its not actually using the proxy but my own public ip... How can i prevent that from happening?

ember ledge
cedar marsh
cloud spruce
wary kayak
#

where i can host a socket server over the internet?

prisma cobalt
wary kayak
prisma cobalt
wary kayak
cloud spruce
cloud spruce
wary kayak
#

i see

#

i think i'm gonna try with the repl just to test it out lol

prisma cobalt
#

repl automatically stops its process after a certain amount of inactivity, this means to keep your server running you need to GENERATE your own activity which another process

wary kayak
#

i was researching about it but it says replit actually doesn't handle sockets

prisma cobalt
#

you can sign up to an external service to do this for you i think

wary kayak
#

so basically i have two programs one that is a python program that records audio live and send it to the server that it serves to the website, but sockets doesn't seem to work that good on heroku neither repl, do you think there's a way to convert it into websockets?

#

the two programs are like the python program for recording audio live and sending it, and the website who manages it and makes it playable, by just entering the page in any device

unreal path
#

is there any issue here?

cloud spruce
# unreal path

looks okay to me if that is the ip address range you are working with and the number of required users are right and you don't need much more room to grow

unreal path
#

I only have two subnets

#

do you think it is correct?

cloud spruce
#

the subnet calculations and all is right as far as i can see

unreal path
#

when I put it on packet tracer it doesn't work properly

#

as all devices are connected but the message is not delivered from one side to the other

cloud spruce
#

what ip addresses and routing have you assigned to the two hosts and the router?

unreal path
#

so the pc's the last host of the subnet

cloud spruce
#

would that be pc-b?

unreal path
#

same

cloud spruce
#

no, i see now, it's pc-a

#

but what does the ip addressing and routing look like on pc-a and pc-b?

unreal path
cloud spruce
#

you also need to do show run int gi0/0/0 and show run int gi0/0/1 so that i can see the rest of the interface configuration

unreal path
#

ok one sec

#

invalid inputs

cloud spruce
#

ans just a show run then?

unreal path
cloud spruce
#

in config mode, run: ip routing

#

to enable routing between L3 interfaces in the default vrf

unreal path
#

yeah

cloud spruce
unreal path
#

it doesn't say anything

#

do I need to say no shutdown

cloud spruce
#

no

#

it's just a command to enable routing in the default vrf

unreal path
#

oh ok

#

how do i check if it's working

cloud spruce
#

you can check it with show run again to see if you can see that new line in the configuration

#

then you can try pinging again from pc-a to pc-b

unreal path
#

it didn't add any new lines mate

#

still requested time out

cloud spruce
#

okay, then it looks like it's enabled by default on that platform

#

or well, the platform they are emulating

unreal path
#

yeah but the issue is still there

cloud spruce
#

from R1, can you ping pc-a and pc-b?

unreal path
#

btw, do you know the table I sent, can you tell me the gateway, because i'm not sure if it is this for PC-A (for example): 192.168.103.64

cloud spruce
#

the gateway for each network segment is the ip address of the router interface on that network segment

unreal path
#

so the one I sent you?

cloud spruce
#

yeah, so computers on the 192.168.103.0/26 segment would have 192.168.103.1 as their default gateway for example

unreal path
cloud spruce
#

that 0 should be a 1

unreal path
#

these are the details of the pc

#

pcs

cloud spruce
#

the error is with the pc-b default gateway, it's right now pointing to the .0 network address instead of the routers interface .1

#

the network address is just another broadcast address of sorts

#

so, that's no good for use as the default gateway

unreal path
#

what about pc-a then?

cloud spruce
#

and then it's the same on pc-a as well

unreal path
#

so 65?

cloud spruce
#

.64 is the network address, you should use the routers interface ip address as the default gateway for the computers on that segment

#

yeah

unreal path
#

ok done that

cloud spruce
#

now try pinging between the computers

unreal path
#

my guy

#

lemmi try anpther one

#

the other one

cloud spruce
#

you understand why this works too now?

unreal path
#

as the default gate was wrong

#

gateway

#

so the router doesnn't where to send the message?

cloud spruce
#

yeah, so if you should reach anything outside of your own network segment you need a route to that network through some gateway (most often a router of some kind)

#

it's the computer that didn't know where to send the message to reach outside of the network segment

#

it was trying to lookup the mac address of a host on the same network segment with the .64 ip address, but it couldn't find one

unreal path
#

right

#

so that is good, thanks for the help, I might some in bit anyway

cloud spruce
#

now it can find the mac address of the routers interface and send the ip packet to that mac address to have it routed to the next network segment

unreal path
#

why the switch deliver the message then?

#

don't

unreal path
#

i don't it matters

cloud spruce
unreal path
#

can we ping a switch and a router?

cloud spruce
#

this switch is probably just a L2 device, that means it doesn't have any ip address, at least not on this network segment

#

it just switches packets based on mac address using mac learning

unreal path
#

yeah becuase how am I meant to give an answer here?

cloud spruce
#

it will learn which of the switches network interfaces which mac address belongs to

unreal path
#

ok. so I don't need to put anything here?

#

no I mean

cloud spruce
#

as the switch isn't participating in anything that has to do with Layer 3 as it's working on the below layer, Layer 2

unreal path
#

but it's still part of subnet A

#

so it does have a gateway

cloud spruce
#

it's just switching packets back and forth, not routing them, it doesn't care about ip addresses or the ip protocol at all, just ethernet and arp

#

no, that switch neither has an ip address or a gateway, it doesn't concern it self with ip at all

unreal path
#

but the teacher said to give the gateway as part of gateway

#

Imma put that anyway

#

but It doesn't have any ip address or mask

#

as they are not meant to be routing anyway

cloud spruce
#

if the switch supports management you could set an ip address and a default gateway on the switch as well if you would like to

unreal path
#

how to do that?

#

will that not ruin the work, right?

cloud spruce
#

no, it shouldn't it will just add another L3 device on that network segment on that side of the router

#

see if you can bring up a console on the switch just like you could with the router or if you can configure an ip address and gateway on it similar as you could do with the simulated pcs

#

it you can't, then that simulated switch is just a dumb, non-management switch and it has no idea about the ip protocol at all

#

in that case you shouldn't put anything other than N/A on all the columns for the S1 device

unreal path
#

I cannot add another device

#

I'll just put N/A

cloud spruce
#

and even if it's a managed switch, the way it was configured when we ran the lab just now it's still N/A for all those columns for the S1 device

unreal path
cloud spruce
#

as you have not given it an ip address, ip mask or a default gateway

unreal path
#

how long do you think this can take up to?

cloud spruce
#

oh, you have a bit of ways to go

unreal path
unreal path
cloud spruce
#

but it looks like you should configure all the intermediary devices, i would interpret that as meaning the switch as well

unreal path
#

yeah

cloud spruce
#

see if you can configure that in almost the same way as when you were to configure the router

#

can you bring up the console on that one as well?

unreal path
#

so I'll start that in a bit, I need to finish the other bit

cloud spruce
#

but that would change what you put in that table

unreal path
#

that is the second bit, something different from the begging no?

cloud spruce
#

if you can configure it you can put the ip address, mask and gateway in for S1 in that table as well

unreal path
#

wait so let's do it now

#

one sec

#

don't I need to implement the ipv6?

#

first

cloud spruce
#

yeah, still here, multitasking a bit

#

see if you at least can get a console for the switch S1 so that you can configure it

#

it looks to be a cisco switch which supports management, in that case it should be very similar to the cisco router R1

unreal path
#

ok

#

let's start from the begging

cloud spruce
# unreal path hello?

my time is running out and i really need to be going
how is that console access to S1 coming along?

unreal path
#

I have set the two routers has hostnames

cloud spruce
unreal path
#

yeah

#

telling me to set an ecrypted password

cloud spruce
#

then set a password according to the rules explained in the text you got

unreal path
#

doing it now

#

I'm not really good with this

#

so bear with me

cloud spruce
#

it should be ccnaconpass

unreal path
#

yeah

#

when it says all EXEC I have given router a password

#

and now I have to do that to the PCs and switch too?

#

What is the difference

cloud spruce
#

you can't configure the pcs like that

unreal path
#

I might have messed up

cloud spruce
#

but the router and probably the switch as well

#

it's only the router and switch that count as intermediaries the pcs are considered end stations

unreal path
#

did I mess up?

cloud spruce
#

check your work with show run

#

you have set an enable password

unreal path
#

yeah but their meant to be two different password, no?

cloud spruce
#

the other one is for the console, you set it in another way

unreal path
#

what is the correct way?

cloud spruce
#

it should be at the end of the configuration that you see when you run show run

unreal path
#

so how can I fix it?

cloud spruce
#
conf t
line con 0
password ccnaconpass
login

if i remember it right

unreal path
cloud spruce
#

see if you can use secret instead of password

#

at least for enable

unreal path
#

enable secret and then password

#

which is the EXEC one given

#

right

#

?

cloud spruce
#

enable secret and then the exec password

unreal path
cloud spruce
#

i think you will have to remove the enable password first with no enable password as you can only have one of them

#

oh, some cisco systems just support having one of them not both at the same time

unreal path
#

yeah

cloud spruce
#

but you should remove it anyways

unreal path
#

yeaj

#

one sec

#

just checking now

cloud spruce
#

you also want to have service password-encryption so that your console password is encrypted

unreal path
#

that works fine

cloud spruce
#

if you now exit all the way?

cloud spruce
#

you should have a new password prompt

unreal path
cloud spruce
#

yeah, there it is, the console password

unreal path
#

wait

#

it doesn't workl

#

the password don't work

cloud spruce
#
conf t
service password-encryption
end

didn't work on your simulated cisco device?

unreal path
#

yes

cloud spruce
#

that should be ccnaconpass

unreal path
#

yes

#

why tho

cloud spruce
#

why what?

unreal path
#

never mid

#

mind

#

my bad

#

shall i do the same with switch?

cloud spruce
#

yeah

unreal path
#

so password just normal

#

and secret exec one

#

wait

#

I still need to ecrypt

cloud spruce
#

on the switch you also want to set an ip on int vlan 1

unreal path
#

it's already there

#

give me one sec

cloud spruce
#

yeah that's what the service password-encryption in configuration mode does

unreal path
#

i need to excrypt

#

so that is done, right?

#

that is the vlan ip I set up

cloud spruce
#

yeah, and then you check it with show run and you should not see any clear text passwords anymore

#

you'll also want to add a default route to the switch pointing to the interface of the router

unreal path
unreal path
#

because it is needed

cloud spruce
#

ip default-gateway 192.168.103.65 because the switch is not a routing device and doesn't have ip routing enabled

#

ip default-gateway is only used by the switch it self, not for the traffic flowing through the switch

#

after that pc-b should be able to ping the switch and the switch should be able to ping the ip address of pc-b as well

#

they should now be able to reach each other over R1

unreal path
#

I'm trying to fix that goddam password for S1

cloud spruce
# unreal path because it is needed

you know you can google most of this stuff right, like cisco ios default gateway
because i really need to get going, should have left for quite some time ago

unreal path
#

well ok, but it gets complicated after with adding admin and passwrods

#

that's all

#

you can go, will you come back?

cloud spruce
unreal path
#

I'll be here

#

for 11 hours

#

I hope you come back to see some imporovement

cloud spruce
unreal path
#

see ya soon

unreal path
#

why isn't it telling me that something has changed, instead it just adds the ipv6 into the g0/0/0

cloud spruce
#

don't forget to add logging synchronous to your line con 0 section for both the switch and the router

unreal path
#

One sec

#

Lemmi go on my pc

#

done that

#

so I'm assigning Ipv6 now

#

basically the last bit

#

but I don't know what is link local address

#

I don't know the gateway on the PCs

cloud spruce
# unreal path ?

as far as i remember you shouldn't need to set any default gateway with ipv6 since it should be mostly self configuring in that regard
but then, ipv6 isn't something i work with a lot

unreal path
#

Don't worry now

#

I've done what I could

#

Thanks for the help anyway

cloud spruce
unreal path
#

No, don't worry

#

What's done is done

cloud spruce
cloud spruce
# unreal path What's done is done

and have you checked that you didn't miss any items on the work sheet, like setting the password policy, motd or disabled dns lookups?

unreal path
#

Yeah done all of that

#

Didn't do the last part

#

I was up all night

#

I hope they understand and pass me off

#

Cuz, I cba rn

fossil fiber
#

Hey there, back again. I know I keep returning for a similar question, but every time I feel i've figured it all out, something else comes up. So I've figured out how structs work finally, how I would package all the object data up and send it from the server to the client. However, I'm having difficulty figuring out how the client will determine what object to propagate that data to. The server has a master list of all objects in the world, and so does the client. Since each object sends different data to the client, the format for struct packing is different. The simple answer is to store the format per object in the client, but since the object id is still in the encoded data, we cant get the object, therefore we cant get the format, and we cant decode the data in the first place, so its a loop. Even if we did know what the class of the game object is (ie weapon or player or bullet ect) how could the client know which specific object in the world to use that data for?

hollow urchin
#

is someone able to explain to me exactly how I can change my router to connect to the receiver in a different place than before?

bronze anchor
#

@fossil fiber make each object have a common header that includes its ID (and probably type). the client decodes the header first, determines the type, and then decodes the rest of the object

#

(this is the same way e.g. HTTP works; you look at the Content-Type header and decide if you're rendering html or text or an image)

fossil fiber
bronze anchor
#

the header is of a fixed length, so you first grab the first n bytes and unpack that, then deserialize the remaining len-n bytes

fossil fiber
bronze anchor
#

it's just some stuff at the beginning of a packet that describes the rest of the packet

fossil fiber
#

I see, that's actually really cool, thanks! That's exactly what I was looking for

#

Side note, if we're only reading the first byte, how many different objects can I differentiate? Or would I do it so maybe the first byte tells us it's it's weapon, and the second byte tells us what specific type if weapon the object is, for example..

bronze anchor
#

every byte can encode 2^8 = 256 values. in 2022, I wouldn't bother using less than 4 bytes for any number @fossil fiber

fossil fiber
#

Wow, I really need to read up on what a byte actually is lol. I will attempt to implement this, ill share the results later, thanks again!

bronze anchor
bronze anchor
#

@fossil fiber ^

fossil fiber
#

Oh, sorry didnt see that

prisma cobalt
bronze anchor
#

fair, but we probably don't want to deal with variable-length headers

fossil fiber
#

i sincerely dont lmao

prisma cobalt
#

lol

cloud spruce
# fossil fiber i sincerely dont lmao

the point is that you can make the fixed length header any number of bytes you want/need to describe the rest of the variable length data that follows the header, this is essentially how a lot of the network protocols work that you use every day without thinking about it

#

the ethernet protocol header does almost this for example

umbral cargo
#

one questio

#

is there a way to get a specific (web browser) cookie to python

cloud spruce
umbral cargo
cloud spruce
cloud spruce
umbral cargo
cloud spruce
umbral cargo
#

👉 👈

cloud spruce
cloud spruce
#

after you got your self a help channel you just write which one in here

umbral cargo
#

:(

cloud spruce
#

aha, lets try again and when you have one i'll join it and we can continue in there

cloud spruce
teal furnace
#

How to I get my flask app onto my public ip?

thorn stratus
#

you need to port forward on your router

teal furnace
#

what are some examples

grand salmon
#

I think some ISPs won't allow that for normal users anyway

cloud spruce
keen jewel
#

I moved into a new house and don't have wifi yet. I have unlimited data on my phone and use it as hotspot on my laptop. I would like to share the laptop connection to my PC through an ethernet cable.

I enabled network sharing on my laptop wifi adapter. Setup IPV4 on laptop ethernet adapter to IP: 192.168.0.1 Subnet: 255.255.255.0
on my PC I set ethernet adapter IPV4 settings to: IP: 192.168.0.2 Subnet 255.255.255.0 Default gateway 192.168.0.1 DNS 192.168.0.1

This worked for a day but then my PC connection got real slow while my laptops connection was still fast. Today I didn't have an internet connection on PC. Media state says enabled and it's sending/receiving bytes but it just has no internet acces.I tried uninstalling adapter/drivers, resetting network settings, /flushdns, /registerdns, /release, /renew, disabling ipv6 and some other fixes. Nothing works. Is there someone that can help me. I need internet acces on my PC desperately for school/work.

balmy crystal
#

Is this related to python?

keen jewel
#

No

fossil fiber
cunning void
#

can any one pls tell me where to start

supple quest
fossil fiber
supple quest
cloud spruce
tired elbow
#

Hi. Suppose that I, as a server, have a trio.SSLStream object. How would I fetch the client certificate, or otherwise validate that the incoming connection's client certificate is signed by a CA to the domain they claim to be from? The documentation of Trio doesn't make it clear and doesn't seem to provide such an option which is critical in my program (federated server-to-server protocols).
I'm using Trio, the structured async library's socket streams.

frozen drum
#

if you want to use custom CA certs (such as self-signed certs) you can add them to the default CA cert folder on your system or add them to a custom context you create yourself

bronze anchor
errant bayBOT
#

trio/_ssl.py line 369

"getpeercert",```
tired elbow
#

Ah, thanks 😄

zenith sinew
#

Hi, I am not sure if this is the right channel but I try.
I currently develop a flask API.
I want to deploy the flask API a a docker Container.
Now I search a way to create something like a load balancer.
So, my main app should access the API via the IP but behind the IP there should be different instances of the flask API for load balancing (the Endpoints of the API did much heavy work to I want to have multiple instances for load balancing)

What should I google?
I can not find the right way

zenith sinew
#

Ok thanks guys I will have a look

azure crypt
cloud spruce
azure crypt
cloud spruce
warped hazel
#

Can anyone help me with a Scapy question?

cloud spruce
cloud spruce
warped hazel
#

What's the best way to check if a sniffed packet is outgoing or incoming?

azure crypt
#

Aws ec2 Ubuntu

#

@cloud spruce

cloud spruce
warped hazel
#

How do I get rid of the b' '?

#

It's a print line I wrote

cloud spruce
warped hazel
#

.decode() does trouble and str() also doesn't work

ember ledge
#

Or it’s in a dictionary

warped hazel
#

that's how I wrote it for now

#

What's your question exactly

ember ledge
#

Don’t use str in scapy

warped hazel
#

What's the alternative then

azure crypt
ember ledge
warped hazel
#

Could you explain please if its not too much trouble

ember ledge
#

make a variable where it’s a byte So when u get a byte u add to the variable so now we have full line of bytes. Then convert it into str by decoding

#

#packet[DNSRR].rrname = b"google.com"

#line = b"Domain: "+packet[DNSRR].rrname
#print(line.decode())

warped hazel
#

ahhh

#

@ember ledge but sometimes the value comes as a str and sometimes in bytes

ember ledge
#

use replace("b","")

warped hazel
#

meaning some packets I can't concatenate

ember ledge
#

before u have to make it a str

warped hazel
#

Both values?

ember ledge
#

yes

#

l = b"Domain:"+b"google"

l = str(l)
l
"b'Domain:google'"
l.replace("b","")
"'Domain:google'"

#

or before u return the domain u can check if its a byte just decode there before printing it

warped hazel
ember ledge
#

wait u said sometime it returns bytes and str?

warped hazel
#

that's the problem basically

ember ledge
#

try:
return data.decode()
except (UnicodeDecodeError, AttributeError):
return data

ember ledge
ember ledge
warped hazel
#

It works!

#

I just filter out the non str responses

#

which are no use to me

#

you are amazing for helping some random guy online

#

thank u

ember ledge
#

welcome ;)

tranquil current
#

It's probably easier to just use subdomains though.

cloud spruce
cloud spruce
# azure crypt Thanks for linking the first result on google search but its not for specfic set...

it may be the first hit on google depending on what you google
it's a very long tutorial but at least it tries to secure phpmyadmin which is more then i can say about a lot of the other much shorter tutorials which i was hopping that you didn't follow
we are trying to help people here without knowing what knowledge they have or what they have tried already, so that attitude is unnecessary

ember ledge
#

How can I convert my Nginx website from port 80 to 443?

#

By convert I mean do I have to do anything in terms of Cloudflare settings, Domain, etc.?

#

When I tried switching it in the server block, I started getting Error 521s

cloud spruce
ember ledge
#

I just installed a SSL certificate from CloudFlare on my server

cloud spruce
ember ledge
#

I wanna transition to Full SSL Encryption (CloudFlare setting)

#

Next?

cloud spruce
ember ledge
#

Ah ok

#

Whenever I set my Nginx port to 443

#

Website stops working

cloud spruce
#

cloudflare needs to know where to reverse proxy the traffic

ember ledge
#

How do I set the new port then?

cloud spruce
#

as i haven't used cloudflare my self i don't know exactly how or where, but it has to be somewhere on in the settings at cloudflare

ember ledge
#

I don't see a port option

#

Could it be in the DNS possibly?

cloud spruce
cloud spruce
# ember ledge I don't see a port option

it might just automatically assume port 443 on the remote server when you change the ssl/tls setting on cloudflare to "Full" (start with this one first) or "Full (strict)" (if you get the first one working you can move on to this one)

cloud spruce
ember ledge
#

Sadly still displaying a 521

vagrant hamlet
#

Any websocket pros around?

spare vessel
#

i don't see any questions about it so i don't see why there would be any

vagrant hamlet
#

Ha that's fair

#

Just struggling with a websockets issue and didn't get any bites in my help channel

spare vessel
#

i mean i've implemented the websocket protocol, so i know a bit about the internals, but i don't know your question

vagrant hamlet
#

Sorry

#

I'm trying to send data to several websocket clients at once, but I'm running into concurrency issues with asynchio

#

How do you start a server and keep it alive while also doing other tasks?

#

I think I need to have two tasks running, one that handles the new WS clients, and one that runs a while loop over sending data to all of them.

spare vessel
#

which server library are you using for the websockets? i could take a look to see if there's a nice way to do it

vagrant hamlet
#

Just the regular 'ol "websockets" library

spare vessel
#

handler handles WS client connections, and you can broadcast data to each client concurrently

vagrant hamlet
#

I'll try that, I've been hesitant to use it though, because eventually I will want to send different data to all clients

spare vessel
#

there's a lot of potentially relevant discourse later on in the documentation there which you could repurpose pretty easily, or at least fit into what you want

vagrant hamlet
#

Yes, you're right, I have prematurely written off this page, there is indeed a lot of good info here

#

Thank you for the help

spare vessel
amber bobcat
#
import websockets
import socket

any difference between them?

#

?

fair kindle
amber bobcat
#

okay

fair kindle
#

websockets are a specific protocol i think

amber bobcat
fair kindle
#

i'd start with socket

#

also i think websockets is async?

fair kindle
# amber bobcat which one am i supposed to learn first

From https://stackoverflow.com/a/4973689:

Even though they achieve (in general) similar things, yes, they are really different. WebSockets typically run from browsers connecting to Application Server over a protocol similar to HTTP that runs over TCP/IP. So they are primarily for Web Applications that require a permanent connection to its server. On the other hand, plain sockets are more powerful and generic. They run over TCP/IP but they are not restricted to browsers or HTTP protocol. They could be used to implement any kind of communication.

fair kindle
#

yeah

amber bobcat
# fair kindle yeah
import socket

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.bind((HOST, PORT))
    s.listen()
    conn, addr = s.accept()
#

what does conn and addr do

#
import socket

HOST = "127.0.0.1"  # The server's hostname or IP address
PORT = 13583  # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    s.sendall(b"Hello, world")
    data = s.recv(1024)

print(f"Received {data!r}")
#
s.connect((HOST, PORT))
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
#

??

ember ledge
#

Host and port are the same în both files?

cloud spruce
cloud spruce
#

oh, windows... check your windows firewall settings

amber bobcat
cloud spruce
amber bobcat
#

okay it's fine

tired elbow
#

DO NOT use WebSockets when not specifically developing something for Web browsers

#

(I don't make and generally don't use Web applications or most of the modern Web for other reasons, but anyhow I vastly prefer native programs)

grand salmon
#

Do torrents create a true PvP connection between seed and leech?

#

if so how? does it all just boil down to the tracker giving the leech the seeder's IP and then the leech opening a socket pointed at that IP?

cunning garden
tired elbow
#

recursive_error: Simpler technology (i.e. not basing application protocols session protocols on top of application protocols) has much less overhead
It is understandable to have WebSockets for Web applications because after all that's all Web applications could use

Also this question has been bugging me: Why would you use programs in browsers, usually hundreds of megabytes big, when a program of a few kilobytes (in case of programs I use) or a few tens of megabytes (in case of the casual user) would suffice?

carmine gulch
#

hello there

#

i wanted to ask, how can we block a hostname from joining or even able to send packets to our server?

cloud spruce
cunning garden
# tired elbow recursive_error: Simpler technology (i.e. not basing application protocols sessi...

Not sure if you are referring to the hundreds of megabytes big for the browsers themselves of the javascript/html/etc.
But regardless, the benefits are that it comes down to making the deployment and updates so much easier and manageable, in addition to keeping the users captive. It also enables the consolidation of the backend (and thus mutualize some of the costs) and to deal with a level of complexity that cannot be contained to a single machine.
From a user's perspective, it provides me with a working environment, with my data, from anywhere at any time.

In the context of websockets, we could take coinbase as an example. They provide a websocket feed of the market updates.
On their side, scalability and reliability is solved with traditional tooling.
On the user side, users can use that in their frontend, or even write their own program, including python scripts, to connect and get their data. Since it's websocket, there are tons of libraries around.

cloud spruce
# tired elbow recursive_error: Simpler technology (i.e. not basing application protocols sessi...

and i'll add to what @cunning garden said by mentioning that it will most likely be less of a hassle to get the traffic through firewalls and proxies and one can easily reap the benefits of protected communications with the help of TLS which will be well implemented and supported by many different web servers and much easier to setup that way

and as to why someone would opt to use a "program" in a browser, because it doesn't require the user to install additional software on their computer, just go to a website and start using the service without much downloading, installing and setup

tawny belfry
#

Hi guys, I don't even know if this is considered a "networking question" but I want to be able to run my python project on the cloud so I dont have to run it on my computer

#

its a super small script with a few 3rd party libraries

#

I looked at azure but dont even understand where to start... every tutorial I've seen seems like its answering different questions, and is way above my head at the moment

zealous flint
#

Once you kind of understand how it works, it becomes much easier

barren flower
#

If anyone has done this plz let me know. I have a multiplayer game using sockets and it works but only if both clients are on the same local network i would like to set it up where i can give this game to anyone and they can join a party but the only way i found out is enabling (Port Forwarding) which mean everyone has to enable it which is not what i want.

cloud spruce
dull lynx
#

You'll have to maintain a record of all parties and players, as well as making sure that the server is up and running.

earnest blaze
past spindle
#

Hi, I am writing a client side driver to test and interface with a device. The device requires me to start the communication service, and after the start request, it will start sending UDP datagrams every 30ms. The device can send a few types of UDP datagrams, and they are variable length with different fields. They should be parsed according to their OP Code and length encoded into the header of the message. The problem is that the offset, or location, of those header fields is not consistent between messages. Frame of Type A will have the OP code at 0x08 offset from the start, where as a frame of Type B will have the OP Code at 0x04 from that start. How should I handle this?

ember ledge
#

anyone know how to use sockets to monitor the changes to a website

cloud spruce
# earnest blaze > (Port Forwarding) which mean everyone has to enable it which is not what i wan...

i think @barren flower is using a peer-to-peer network where each client need to connect to every other client
i don't think there is any server software created for this game yet other then the client it self
that's why i suggested creating a server that everyone that should join the same game connects to
then only the person running the server needs to port forward if it's not running directly on a public ip address already

cloud spruce
halcyon robin
#

Might anyone have an idea to why a text-to-voice script I wrote isn't outputting any sound to the speakers when running the script over SSH on a host computer?

#

I am guessing it has something to do with how when you SSH to a host, you are created a child session, and for some reason this child session does not have access to the main host computer's speakers.

white basalt
#

Hello anyone here i can talk to talk about servers?

#

Im making a game that requires data transfer and request from a server and my team is complaining about how this things work

tired elbow
cloud spruce
# fair kindle people do this,any idea why?

i would say that is @tired elbow opinion and is using "strong language" with the upper case text

i do partially agree that one would probably not be best served by using websockets outside of a browser environment in many cases and should opt for tcp or in some cases even udp sockets, unless you have specific requirements and have weighed your options carefully

reasons for using websockets outside of browser environments can be due to for example the server environment that has been chosen to develop the software on the server side

cloud spruce
cloud spruce
tired elbow
white basalt
#

i prefer to pm

cloud spruce
# white basalt i prefer to pm

i won't be able to dedicate my time like that as i'm doing other things as well
if you put it in the channel or in a help channel others can join in and help you with the problem

white basalt
#

ok

cloud spruce
# tired elbow That's called BCP 14 language, but yeah I personally prefer SCTP

sure, but as you might know it is many times interpreted as raising ones voice or even screaming then chatting, especially if it's not an abbreviation of some kind
and even in BCP 14 context it's meant to strongly or even forcefully convey ones intention/meaning and remove any ambiguity

SCTP is a nice protocol 👍
but can sometimes be hard to traverse firewalls with in more hostile network environments or if one needs to go through a proxy which might only allow proper http on port 80 and the connect method and proper TLS on port 443
on the other hand it can in other environments be easier to bypass the firewall with since the person configuring the firewall might have "forgotten" about the fact that there are other protocols on-top of IP then just TCP, UDP and ICMP 🤦 😄

tired elbow
#

Yeah, those are sad, but they are also uncommon
Also, there's SCTP-over-TCP

#

The main problem with SCTP isn't with routers; rather it's with NATs

tired elbow
#

s/TCP/UDP/

muted cobalt
#

anyone here?

#

what should we do when we have slow internet?

cloud spruce
fluid basin
#

Should I be running NGINX inside or outside of a docker container?

ember ledge
#

it will help a little, about speed and also saving data

zealous flint
frank hull
#

I'm trying to establish a connection between 2 programs of mine who act as a client and a server.
However, the connection shortly ends after being established. Any help?
**Code is in #help-peanut **

grim sonnet
#

pls help

zealous flint
#

Is there an E) all of the above pithink

cloud spruce
# grim sonnet

i wouldn't exactly say that d) is correct as it's not "the internet" as such that does the exchanging, it's clients and servers that does that, the internet just facilities the transfer of information between those, but now i'm being picky

cloud spruce
# grim sonnet

the other three are true but due to confirmation bias in both search engines and social media platform I would say even if c) is true in theory, in practice it's mostly the other way around, you go deeper and deeper in to the same rabbit hole as what you usually search for and click on

latent drum
#

hi guys. i'm writing a user guide for a company. the company i chose is smal and sell energi drinks or juice. so the question is, what kind of computers should they use. pc, mac or something else. anyone has some advice? 🙂

cloud spruce
# latent drum hi guys. i'm writing a user guide for a company. the company i chose is smal and...

i don't think the #networks channel on this Python server probably isn't the right place for this question
but I would say it depends on budget (mac is expensive) and what proficiency the employees of the company has with the different operating systems
also, if the computers will be in a customer environment there might exist a consideration about what image the company project towards customers, depending on the demographic the company is targeting with its products

latent drum
undone sky
#

Is that original or fake?

latent drum
#

the company is small. i have no idea how it works at the company . i haven't been there before.lol. but my teacher said that the company would open as new, and the workers do not know much about tech. cuz there was a question about how to install app programs

cloud spruce
cloud spruce
latent drum
cloud spruce
cloud spruce
latent drum
#

i guess i don't need to think of the cost. cuz it is not real, but we need to write something about the network suggested for them. this is the question from the teacher(
What network will you set up for them - which one is ideal
)

latent drum
cloud spruce
# latent drum store i guess

if it's a store there might not be a lot of computers and maybe not even laptops if there is fixed positions for the computers, then cable might make more sense

undone sky
cloud spruce
latent drum
undone sky
prisma cobalt
#

🤔 all for "educational" or pen-testing purposes ofc?

ember ledge
#

Hello, does the socket library creates a server from scratch or does it just binds to server like a WSGI?

cloud spruce
# undone sky Packet injection, monitor mode

aha, that explains the choice of older tech such as 802.11g hardware
it's hard to find cutting edge or even current gen hardware that has drivers that can do that
some "alfa" stuff is good for that, depending on the chipset used
but that is as far as i will go on this subject because of:

#

!rule 5

errant bayBOT
#

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

cloud spruce
fading trellis
#

Hi everyone,

Currently I'm trying to install a Cloudflare SSL certificate on my server. I am following the DigitalOcean guide on how to do so, but once I successfully install the certificate as per Digital Ocean's instructions, my website stops working.

#

This is the output of sudo systemctl status nginx:

#

This is my Nginx configuration:```nginx
server {
listen 80;
listen [::]:80;
server_name api.website.com;
return 302 https://$server_name$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;

ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/certs/key.pem;

server_name api.website.com;

location / {
    proxy_pass http://localhost:8000;
}

}```
I am using a proxy_pass because I have a FastAPI API running locally on the machine.
Any ideas why my setup is not working? When I switch back to non-SSL and using port 80, it works fine.

fading trellis
#

Please @ me if you respond.

frosty idol
#

I’m attempting to send data collected by a python script to a chrome browser on another computer (both on same network) via WebSockets but when trying to establish a connection on the browser via JavaScript I get “WebSocket connection to x failed”

#

Scoured the Internet for a solution but no dice, was looking at other alternatives to WebSockets but again having trouble finding

cloud spruce
ember ledge
#

Hello, about https and ssl certificates, does someone know where the certificate is located in the response? In the header? In the payload?
Like how does the client actually know this is https, instead of just http?

cloud spruce
# ember ledge Hello, about https and ssl certificates, does someone know where the certificate...

TLS/SSL does not live on-top of or inside the http protocol, the http protocol is running on-top of the TLS (what used to be named SSL back in the days) protocol (check out the OSI model)
the certificate is exchanged in a handshake that happens when the client connects to the server right after the TCP handshake has completed
after the client and server has completed first the TCP handshake and then TLS handshake the client can start issuing HTTP requests

fading trellis
#

I apologize, as this is not inherently a Python question. I just thought I'd ask here because of how good the help is here.

Currently I'm trying to install a Cloudflare SSL certificate on my Ubuntu server that uses Nginx. I am following a guide on how to do so, but once I successfully install the certificate as per the instructions, my host seems to stop working and Cloudflare shows an Error 522 when visiting my domain.

My Nginx Configuration: ```nginx
ubuntu:/etc/nginx/sites-available$ cat ascend.so
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;

server_name  ascend.so;
root   /var/www/html/ascend.so;
index  index.html;

ssl_certificate /etc/ssl/certs/cloudflare_ascend.so.pem;
ssl_certificate_key /etc/ssl/private/cloudflare_key_ascend.so.pem;
ssl_client_certificate /etc/ssl/certs/origin-pull-ca.pem;
ssl_verify_client on;

client_max_body_size 100M;

autoindex off;

location / {
    try_files $uri $uri/ =404;
}

}```

#

$ cat /var/log/nginx shows this:

2022/05/20 13:30:49 [error] 9267#9267: *113 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 45.9.135.234, server: ascend.so, request: "GET /phpMyAdmin-5/index.php?lang=en HTTP/1.1", host: "3.15.150.145"
2022/05/20 13:30:49 [error] 9267#9267: *114 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 45.9.135.234, server: ascend.so, request: "GET /phpmyadmin2017/index.php?lang=en HTTP/1.1", host: "3.15.150.145"
2022/05/20 13:30:49 [error] 9267#9267: *115 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 45.9.135.234, server: ascend.so, request: "GET /phpMyAdmin-5.1.1/index.php?lang=en HTTP/1.1", host: "3.15.150.145"
2022/05/20 13:30:49 [error] 9267#9267: *116 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 45.9.135.234, server: ascend.so, request: "GET /phpMyAdmin-5.1.0/index.php?lang=en HTTP/1.1", host: "3.15.150.145"
2022/05/20 13:30:50 [error] 9267#9267: *117 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 45.9.135.234, server: ascend.so, request: "GET /phppma/index.php?lang=en HTTP/1.1", host: "3.15.150.145"
2022/05/20 13:30:50 [error] 9267#9267: *118 rewrite or internal redirection cycle while internally redirecting to "/index.php", client: 45.9.135.234, server: ascend.so, request: "GET /phpMyAdmin-4.9.7/index.php?lang=en HTTP/1.1", host: "3.15.150.145"

That's very weird since I'm not even using PHP.

ember ledge
cloud spruce
fading trellis
#

As for the other issues, do you have an idea?

cloud spruce
# ember ledge I see, so tsl/ssl is a protocal of the presentation layer in OSI model. So shoul...

kind of, TLS stands for Transport Layer Security but really has a bad fit within the OSI model
my point was more that it's HTTP which lives on the application layer is wrapped inside TLS which in turn is wrapped in TCP and so on
and the certificate exchange will happen before any HTTP stuff and the HTTP stack don't even have to know or bother with if it's wrapped directly in TCP or has TLS sitting in-between it self and TCP, for the HTTP traffic it will be all the same
if it was a path it would probably look something like Ethernet/IP/TCP/TLS/HTTP

ember ledge
cloud spruce
cloud spruce
ember ledge
cloud spruce
ember ledge
frosty idol
cloud spruce
frosty idol
#

Copied this example

#

Python side didn’t have any errors

fading trellis
#

Does anyone have any experience with an AWS Lightsail instance not connecting?

#

I can no longer SSH into it. I have a feeling it might be ufw?

rain cipher
#

Hey, I am trying to scrape from a site which requires "validation_id". I have this id, but im stuck at how I need to post that in my header? any help very much welcome ( sorry if wrong channel)

scenic vortex
#

Why does a short TTL help DNS load balancing? I thought it would just mean that the entries update faster but how does that affect the load?

#

would it not be the same quantity just with more up to date IP addresses (more or less)

#

it seems obvious/logical but theres a step missing in my head

cloud spruce
cloud spruce
scenic vortex
#

(sorry for the terrible drawing art is certainly not a strong poinr XD)

#

The old entries are updated faster that makes sense but if its the same number of entries (green stars), which are being "replaced" with the updated entries (blue stars) then how does this affect load balancing - i kinda am reasoning it as the same number overall

#

I think I have missed a logical step or have not got a correct understanding of DNS load balancing

cloud spruce
scenic vortex
#

i hope so but if you have time to go over it then please do, then I can check my understanding

#

I understand how DNS resolves domains to IPs if thats what you mean, if not then no

#

and i assume load balancing is just the same as general server load balancing

cloud spruce
cloud spruce
#

a client want to look up a name, lets say a client wants to look up www.google.com
the client will typically use the stub DNS resolver built in to the OS to request that information
the OS has the IP address configured to one or more DNS resolvers that it will send such requests to, it doesn't do the heavy lifting it self

scenic vortex
#

yep

cloud spruce
#

the DNS resolver will look in it's cache to see if it can find an A or CNAME record for that name, if not, it needs to look it up
to look it up it will start to see if it has a cache entry for one or more NS records for an authoritative name server for the domain google.com to ask for such a record

scenic vortex
#

yep

cloud spruce
#

if not, it needs too look that up first, and it will check for a NS record for com to ask
if it doesn't have such a record it will look in it's root hints file to find the root domain servers to ask them about an NS record for com

scenic vortex
#

i learnt as like browser -> root dns -> TLD -> domain nameserver -> ip adress sent back to broswer

#

(theoretically all the above may not be necessary)

cloud spruce
#

once it gets an answer it will cache it for the number of seconds that the TTL says it can cache such an entry

scenic vortex
#

okay does that vary by server or by entry

scenic vortex
#

;-; okay ty

#

your above explanation makes sense

cloud spruce
#

every resolving DNS server has something called "root hints" which is a list of hostnames and ip addresses for the global root servers
each entry is typically an ip address that is not for a server but instead an anycast address that will be load balanced between many servers spread over a big area and many different data centers and ISP:s to create high availability of these servers

#

anycast is a whole subject by it self and is a very powerful tool to spread load from clients around the world and achieve high availability for the service, but for right now i'll leave it at that

scenic vortex
#

thats okay, thank you

cloud spruce
scenic vortex
#

(I will make a note of it and look into it)

#

i use several machines they run windows & linux

#

traceroute dns?

cloud spruce
#

any unix/linux like environment where you have the dig command will do if you want to follow along with commands

scenic vortex
#

okay

#

yes please

cloud spruce
#

lets say you where a DNS resolver that a client has configured as it's DNS server, you would have a list stored on the server, the content of that list would look something like what you get if you run
dig +noall +additional @a.root-servers.net . NS

scenic vortex
#

that is very cool thank you

cloud spruce
#

the DNS resolver server would use one of the IP address from that list and ask it for the a NS record (the DNS servers) for the .com domain, you would such a list if you issue the command
dig @a.root-servers.net com NS

scenic vortex
#

oh okay yes!

#

btw what does the 2nd column denote

#

the 6 digit numbers

cloud spruce
#

using that list it would pick one of those entries that contains the authoritative DNS servers for the .com domain to find out about the authoritative DNS servers for the google.com domain
dig @a.gtld-servers.net google.com NS

scenic vortex
#

okay I see

cloud spruce
#

the second column is the TTL, the maximum number of seconds that the DNS resolver may cache the entry for

scenic vortex
#

oh okay and they are consistent (in the list) since they are the same zone?

cloud spruce
#

that is how it usually looks but they can be different, but typically they will be the same within one zone

#

dig is a tool from the bind DNS server software package
the output of dig almost the same as the zone configuration file could look for bind (and many other DNS servers as well)

#

the resolver server would do this walk all the way until it either has NS entry that matches the domain it is trying to look up or until it gets a negative answer

#

so we'll do dig @ns1.google.com www.google.com NS

#

and we have our negative answer, because there is no DNS server for www.google.com, but there could be

scenic vortex
#

yes

#

it is clearer with the examples, thank you

cloud spruce
#

now that we know that www.google.com doesn't have it's own authoritative DNS we will query the last authoritative DNS that we got about an A or CNAME record for www.google.com

#

dig @ns1.google.com www.google.com CNAME will be negative
but dig @ns1.google.com www.google.com A will give you a positive answer

#

you'll also see that they have decided to give this A record a lifetime of only 5 minutes (300 seconds)

#

now the DNS resolver server can reply back to the DNS stub resolver of the OS that was forwarding its DNS request to the resolver server

#

and the resolver server will typically be caching all those answers to reuse all or parts of that information the next time it needs to do lookups until each entry expires

#

the OS will let the browser know which IP address to connect to to reach the web server for www.google.com

#

the whole DNS infrastructure and the domains can be seen as a tree structure

scenic vortex
#

all in a few seconds as well that's pretty cool

#

further down tree = more precision?

#

i will google an image

cloud spruce
#

probably within one digit or low two digit number of milliseconds even

scenic vortex
#

wow

#

that's incredible

cloud spruce
#

not more precision, at the root you are as far from your final destination as you can and then you come closer and closer to your destination

scenic vortex
#

i put the root at the top my bad

#

family-tree style

cloud spruce
#

that's fine, you can see it as an upside down tree too, that doesn't matter much but you work your way from the trunk out further and further out the branches

scenic vortex
#

yes getting bit by bit to the actual place you want

cloud spruce
#

i need to go afk for about 30 minutes, then i'll be back

scenic vortex
#

that's okay I am much happier with this now

#

thank you very much!

cloud spruce
scenic vortex
#

the walkthrough with commands helped a lot it's much better to see something real rather than theoretical speculation

#

thank you

cloud spruce
#

@scenic vortex now i'm back again

scenic vortex
#

hello

cloud spruce
#

as you could see when running the dig command the hostname or ip address after @ sign is the server you ask and then you specify the DNS name that you are going to ask about and then you may also include the record type that you want to ask about

#

and as you saw you got multiple answers for some queries and single records for others

#

when you get more then one record it's typicly refereed to as a RRset (a set of multiple Resource Records) and you can pick any one (or even several) of them for your next operation
the responding server usually will shuffle the order of the records around when sending them just in case it is sending it to a dumb receiver that always picks the first or last record to spread the load, but the receiver should pick any and not just the first or last one, so it's just a precaution

#

here you have the first example of load balancing in DNS, to spread the load among DNS servers for NS records and between other servers for other types of DNS records

#

but this way the DNS server doesn't really have any control as to which record will be used

#

an authoritative DNS server that is handing out the leaf node records such as A records and CNAME records can decide to give out different answers to different requests

#

this still isn't very granular as the requester is probably a DNS resolve server that is serving many clients and will cache the answer and then just serve that same answer to all it's clients for the duration of the TTL without asking the authoritative DNS server again until the record expires

#

@scenic vortex remember that i'm skimming through this here, the resolver server is actually doing even more steps when walking the tree that those dig commands hiding

scenic vortex
#

okay

#

this is cool for now

cloud spruce
#

remember when we asked the root servers that we already know about from the "hints" file?

scenic vortex
#

yes

cloud spruce
#

the request and answer would rather look more like this the following dig +noall +auth @a.root-servers.net com NS

scenic vortex
#

(btw just realised will have to go in 10 mins wasnt keeping track of time ;-;)

cloud spruce
#

you notice that you are not getting any ip addresses for the DNS servers for those requests?
it will have have to look them up too in the same manner before it can proceed unless it receives something called "glue records" (bonus answers that it didn't ask for but that are related) in the additional section of the answer

#

okay, anyways we have just started to touch upon the load balancing part of the story

#

but this is basically what is happening every time a browser, your python script or other program want to look up a hostname to get the ip address of where it should connect

scenic vortex
#

thats awesome

cloud spruce
#

i think you can also begin to see how using DNS for load balancing servers is a pretty coarse and blunt tool, but it's still useful if you use it in the right way

#

typically you use it on a high level and then you use other types of load balancing where you have more control closer to the servers

scenic vortex
#

yes

cloud spruce
#

so you might use DNS to load balance traffic between IP addresses that is handled by other types of load balancers to spread the load between them

#

like a load balancing for the load balancers or to direct traffic from one part of the network or the world towards what the DNS load balancer believes to be the closest server farm to the requester, which will typically not be the client it self but instead the DNS resolver server that the client is using

#

if you don't have any load balancer you can use DNS as a poor mans load balancer by just sending out multiple records so that the clients will spread the load amongst all of those servers that the records are pointing at, but without much control over the process

scenic vortex
#

I am afraid I g2g, thank you very much for all your guidance and teaching @cloud spruce it was brilliant

#

(i will be able to read anything when I log back onto discord tomorrow if there is anything you recommend I should look up)

cloud spruce
scenic vortex
#

thank you for your time it has been extremely helpful

cloud spruce
pastel oriole
#

Hi anyone have experiance using Flask-user library?

cloud spruce
pastel oriole
novel junco
#

Does anyone have a good list of proxies?

wispy jackal
#

Hey network peeps,

I just released a new library, CIDR-Bottle: https://pypi.org/project/cidr-bottle/
CIDR-Bottle is yet another implementation of a Patricia Trie for handling network routing information (such as ROAs & Routing Tables) for reconciliation.
However, unlike other implementations it supports both sub-tree checking and longest-prefix matching.

I know there are others out there, but they were either missing features, or just weren't pythonic, so I wrote my own.
I would love some feedback (hopefully either positive, or at least constructive).

sweet karma
#

hey, i am kinda stuck lemon_angrysad
how do i use rcon to send and request commands, i am getting timeouted always

cloud spruce
errant bayBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

cloud spruce
frozen drum
cloud spruce
frozen drum
#

that seems plausible 🙂

sweet karma
#
from rcon.source import Client


def main():
    with Client('127.0.0.1', 25575, passwd='test123') as client:
        response = client.run('listplayers')
        print(response)


if __name__ == "__main__":
    main()
#

error:

rcon.exceptions.SessionTimeout```
#

i try to send the rcon command to my local gameserver

cloud spruce
sweet karma
cloud spruce
# sweet karma windows 10

have you changed the port for your server?

By default, SRCDS listens for RCON connections on TCP port 27015.
can you run the following in powershell and make the window a bit wider before running the command to show that something is really running on that port?

Get-NetTCPConnection -State Listen -LocalPort 25575

can you paste the output of that command in here?

sweet karma
#

@cloud spruce

cloud spruce
# sweet karma doesnt work says check request arguments

oh, theirs your problem then, nothing is listening to that port, so that's not what your game server is listening on or it's not currently running
if you instead run the same command but without -LocalPort 25575 you will get a list of all the ports that has something listening on them

#

the error messages are really crappy though, it should instead say what is actually wrong or give an empty list as output, but no not microsoft...

sweet karma
#

@cloud spruce
port now open

#

still error: rcon.exceptions.SessionTimeout

cloud spruce
sweet karma
#

yes is running

#

or need restart?

#

i restart to be sure

#

still error sir

cloud spruce
# sweet karma or need restart?

don't think so, it's running now according to the output in powershell
now it's probably your windows firewall that is in the way

sweet karma
#

i opend port for incoming and outcoming on my windows firewall

#

for udp and tcp

cloud spruce
sweet karma
#

server and python file are local

cloud spruce
sweet karma
cloud spruce
sweet karma
#

@cloud spruce i check logs now it sends to console hello, but it gives timeout error

#

and cant request data to print user list etc

#

rcon.exceptions.SessionTimeout

meager nebula
#

If I have a API request that requires a machine learning model to run (1.5 minutes), should I respond with 200, store the job in a database and then process the request after that? And in the frontend, I just query ID to see the job status in the DB?

cloud spruce
sweet karma
#

gives error

#

ah wait

#

@cloud spruce what now sir?

cloud spruce
sweet karma
#

yes thats the server

cloud spruce
# sweet karma gives error

yes, the numbers has changed since you restarted the server process
but looks like you figured that one out already 🙂

sweet karma
#

yes

cloud spruce
# sweet karma yes

hold on, i'm looking up things as i'm not used to windows, i'm on linux since more or less forever

cloud spruce
cloud spruce
cloud spruce
# sweet karma

i also updated the command above to say 127.0.0.1 instead of localhost so that it does the same thing as your program and doesn't try IPv6 (the ::1 that you see in the output)

cloud spruce
cloud spruce
sweet karma
#

same

#

rcon.exceptions.SessionTimeout

#

@cloud spruce

#

server sees the rcon request btw

cloud spruce
# sweet karma server sees the rcon request btw

that is defensively a step in the right direction 👍
does it say the same in the log if you change the password in your code to something that you know is wrong or does it say something else or nothing then?

sweet karma
#

in code

#

@cloud spruce

cloud spruce
sweet karma
#

yeah it is

#

@cloud spruce

cloud spruce
# sweet karma still same

strange, because you get some warning in the server log
at least we know the server now gets the connection and the command
so that much is at least working now

sweet karma
cloud spruce
past spindle
#

Hi I have a very basic networking question. I have a server that is sending me UDP packets from address 10.0.0.10, port 2000, to my machine at 10.0.0.101, port 54874. I am trying to receive those packets using a python script. Do I create a socket and bind to the remote machines address and port? Or do I bind to the local machines ip and port?

#

I have tried both, and am still failing to receive the appropriate packets. As its UDP, do I need to set my receive buffer to the exact length of the message?

sweet karma
#
    try:
        with Client('127.0.0.1', 5000, timeout=1.5) as client:
            with Client('138.201.62.108', 27216, passwd='prastacruc') as client:
                response = client.run('listplayers')
                print(response)
    except socket.timeout as timeout:
        print(' >> timeout')```
#

i did this

#

and got timeout

#

@cloud spruce ideas?

cloud spruce
# sweet karma ```py try: with Client('127.0.0.1', 5000, timeout=1.5) as client: ...

this doesn't look like it makes any sense

        with Client('127.0.0.1', 5000, timeout=1.5) as client:
            with Client('138.201.62.108', 27216, passwd='prastacruc') as client:

your trying to connect to two different servers
one on you localhost 127.0.0.1 and TCP port 5000 where you don't have a game server running and without any password, this will of course fail with a timeout
if it had not failed you would have connected to the remote system with ip address 138.201.62.108 and TCP port 27216 with a password and overwriting the variable client that was set previously, but that will not happen since the previous connection attempt fails and the code never reaches this point
i think you're looking for something like this:

    try:
        with Client('138.201.62.108', 27216, passwd='prastacruc', timeout=1.5) as client:
            response = client.run('listplayers')
            print(response)
    except socket.timeout as timeout:
        print(' >> timeout')

if that is the right ip address, tcp port and password
then you probably want to change your password as well

sweet karma
#

@cloud spruce hey bud i use mcrcon as module now that works instantly without errors

#

rcon is kinda bugged ig

cloud spruce
sweet karma
#

@cloud spruce thanks for helping tho!

umbral yacht
#

i'm trying to use asyncio's network sockets to implement an already-documented protocol, i have about 80% of the initial handshake (identify as client and authenticate) working, but for some reason after a certain stage my socket Reader starts reading data that doesn't show up anywhere in Wireshark (searched for the bytes Python's receiving, no matches), where would I even start with trying to debug this?
(code that gets me to this point below)

        auth_result = await self.reader.read(11)
        logging.debug("Abandoning authentication attempt, you are on your own")
        logging.debug(auth_result)

(self.reader is the reader for the connection to the server)

#

i'm currently trying to use asyncio's sockets to implement a client for a well-documented protocol (so i'm not just blindly fishing in the dark, i know what to expect) but at a certain point in the code i start receiving bytes that show up nowhere in my Wireshark capture (i'm logging network traffic between my client and the server for debugging) - any ideas on where to even start with debugging that?

#
        auth_result = await self.reader.read(11)
        logging.debug("Abandoning authentication attempt, you are on your own")
        logging.debug(auth_result)

(Reader is, well, the reader for the network socket communication happens on)

#

the bytes 0B 00 00 00 and 09 00 00 00 do show up at various points in the capture, but never next to each other

umbral yacht
#

…for now, disregard what I’ve sent so far, I think I have some serious misunderstandings about how socket I/O works which has lead to mistakes in my code… if I’m still having this issue when I’ve fixed those I’ll come back

umbral yacht
#

I might as well close this out for the curious… it was my fault. it was a hack I implemented coming back to bite me. I’d neglected to read data from the buffer, and it was just being Left There for the next time I read from the buffer, hence the confusion. the reason why it wasn’t showing up in wireshark? I’d made a typo in the find box facepalm

#

went back, did what I was originally trying to do “properly” instead of taking shortcuts, code now works as intended

#

i feel like there’s an idiom for this that I’m forgetting

ember ledge
#

amm
this is port forwarding
so

what whould i add in external ip
my public ip?

cloud spruce
boreal berry
#

is there a http requests library which has all the headers of say chrome etc.

thorn sleet
#

Do anyone know how to do path base routing in haproxy

trim sonnet
#

Anyone got much experience with snmp? I'm trying to control a pdu via pysnmp, get commands work super quickly, but when I'm setting I can be waiting 10+s for a response, which is awfully slow, especially when I need to turn on 18 sockets in a certain order

#

Is this normal? Is there a preferred way for sending multiple set commands?

boreal berry
cloud spruce
boreal berry
lofty mango
#

Does anyone know why this error occurs when i attempt to install metric-server helm chart to my minikube cluster “Kubernetes cluster unreachable: Get “https://127.0.0.1:65437/version”: x509: “minikube” certificate is not standards compliant”

lyric wigeon
#

hello

#

I saw a recent post about microsoft giving cloud computing: data fundamentals training + Certificate for free

eternal glade
#

Oh hey there's a networking channel

Anyone know their way around Paramiko here?

cloud spruce
eternal glade
#

Yeah sure

I'm trying to configure a handler for keyboard interactive authorization, and the way I'm seeing in the documentation is throwing a "list object is not callable" error.

Here's what I'm trying to do, can anyone tell me if it's wrong?


def handler(title, instructions, fields):
    if len(fields) > 1:
        raise SSHException("Expecting one field only.")
    return ['MyPassword123']

transport = paramiko.Transport(('myServer',22),
    default_max_packet_size=10000, default_window_size=10000)
transport.connect()
transport.auth_interactive('myAccount', handler('title','instructions',[('Password:', False)]))
channel = transport.open_channel('session',dest_addr=None,src_addr=None,window_size=None,max_packet_size=None,timeout=None)```
cloud spruce
# eternal glade Yeah sure I'm trying to configure a handler for keyboard interactive authorizat...

had to install paramiko in to a venv and read up a bit on it as i have never used it before

change the line:

transport.auth_interactive('myAccount', handler('title','instructions',[('Password:', False)]))

to:

transport.auth_interactive('myAccount', handler)

you only give the function name as a callable (not string) parameter and auth_interactive calls it with parameters
to better understand what's happening also import logging and add the following line above the line where you call paramiko.Transport:

paramiko.util.log_to_file('paramiko.log', logging.DEBUG)

you will get a log file named paramiko.log in the current directory as you execute the script from which will give you detailed of what going on

eternal glade
#

Oh my gosh thank you so much @cloud spruce, going to give that a shot

#

Okay I've gotten farther now @cloud spruce, hopefully just one more

It's giving me an auth failed even though I know I've supplied a good password in the return of the handler

Logging showed me the following (starting with end of the kex handshake):

DEB [20220524-19:06:51.760] thr=1   paramiko.transport: kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEB [20220524-19:06:51.760] thr=1   paramiko.transport: Switch to new keys ...
DEB [20220524-19:06:51.761] thr=1   paramiko.transport: Got EXT_INFO: {'server-sig-algs': b'rsa-sha2-256,rsa-sha2-512'}
DEB [20220524-19:06:51.831] thr=1   paramiko.transport: userauth is OK
DEB [20220524-19:06:51.934] thr=1   paramiko.transport: EOF in transport thread```
light zealot
#

how do you send a list of socket objects(a peer list), to all the clients?

#

I tried pickle.dumps and json.dumps but it results in the error socket object in not serializable

#

how would I go about doing this then?

cloud spruce
cloud spruce
light zealot
#

got any idea to solve this?

steady horizon
#

Why do you need to do that

#

The whole point of the server is to broadcast this kind of messages if it's appropriate

#

What are the clients who receive the message supposed to do?

light zealot
light zealot
#

and I've got no idea about how would I go on doing this

#

I've worked with the client-server model in the past

cloud spruce
steady horizon
#

Yeah and each client will need to know the ports and IP address of every other client

cloud spruce
cloud spruce
cloud spruce
# light zealot I've worked with the client-server model in the past

otherwise you would need to be sharing the ip address of each client with each client which wouldn't be very anonymous (as ip addresses can somewhat be mapped to location) and also run the risk of one bad actor in the network could try to hack, DDoS or otherwise directly attack other members of the network unless they use a vpn to hide their true ip addresses

cloud spruce
light zealot
#

thanks for the links!

cloud spruce
# light zealot the thing is I want to create a p2p network

some other p2p-networks tries to solve the problem with NAT for both parties by making some of the clients into "super nodes" if they are detected to not be behind NAT or strict firewalls so that others can connect directly to them
these super nodes would route messages between two parties that want to talk with each other, here end-to-end encryption helps so that the super nodes just gets partial meta data about the communication and one can even use something very similar to onion routing with super nodes to try to alleviate that problem somewhat

cloud spruce
# light zealot thanks for the links!

either way you go, you still can't share socket objects, you would instead need to get the ip addresses of the peers and distribute those ip addresses among the peers, and you would need ports that they register as well, some of this is what the three protocols above is about

light zealot
#

I see

cloud spruce
ember ledge
#

well I can not find any help with my code

#

I am trying to make a IRC bot

#

and evertime it works and connects intill it makes everything a massive blank screen

dapper pulsar
ember ledge
#

socket

split wasp
#

IRC bots are fun ^_^

#

ugh it was 4 hours ago 😦 i never look at the timestamps

wind oriole
#

Can anyone help me understand, what is more like the multiple connections a browser makes to a webpage... multithreaded requests or asynchronous (a-la aiohttp)?

cloud spruce
wind oriole
#

I think you're right, was reading about HTTP1.1 protocols and the request pipelining does sound more like async. Just want to make sure I'm not pissing off site owners when I crawl.

cloud spruce
wind oriole
#

Yeah I go with 6 semaphores, and I honor robots.txt and usually check for an XML sitemap first, plus I only hit any domain once every 8 seconds minimum

#

New browsers are well past 6 now though, even though they're technically not supposed to

#

the new Edge does 12 I think

final meteor
#

How does routers know where to send the package? Ik they use routing tables and such but what if the destination is not in the table? What does it do then

cloud spruce
sacred isle
#

Hello! I have a very basic routing question

cloud spruce
sacred isle
#

Can anyone help me understand this?

#

It's the routing table

cloud spruce
# sacred isle

the image is a bit cut of, what does it say to the right, eth.... ?

sacred isle
#

eth0

cloud spruce
sacred isle
#

Completing the blanks, this is the solution of an exercise and I don't really understand it : (

cloud spruce
sacred isle
#

For instance, when the exit port of R01 (router) is eth1 it makes sense that the network where it goes is 192.268.2.0/27 but then for eth0 the mask goes from 24 to 27

sacred isle
sacred isle
#

Sorry, I meant 24

cloud spruce
# sacred isle Sorry, I meant 24

larger prefix (such as the /24 in this case) can contain many smaller prefix, here it's at least one /27 and a /26
in this instance it's 192.168.2.0/24 (192.168.2.0 - 192.168.2.255) which is just a prefix and not a actual network
it contains the network (or prefix if you will) 192.168.2.0/27 (192.168.2.0 - 192.168.2.31) which is directly connected to R01 on eth1
and 192.168.2.192/26 (192.168.2.192 - 192.168.2.255) and called network (cloud) A which is directly connected to R01 on eth2

cloud spruce
# sacred isle Sorry, I meant 24

then you have yet another route entry that says that 192.168.2.0/23 (192.168.2.0 - 192.168.3.255) is accessible via another router with the address 10.0.0.22 which is reachable on a small link network 10.0.0.20/30 connected to R01 on eth0 which has the ip address 10.0.0.21 on that link network
but as you can see the two networks that R01 has on eth1 and eth2 is contained inside that /23 network as well but traffic to those addresses in the /27 and /26 networks will not be sent over eth0 as R01 has more specific (longer prefixes and smaller networks) routes configured which will take precedence over the bigger network with the shorter /23 prefix

#

@sacred isle does that make sense to you?

sacred isle
#

For example, line 3. Imagine that you have to fill up the blank. How would you do it?

#

Because I can't really think of an operation or idea that will get me to chosing so specifically 192.168.2.192/26

#

Like to do this exercise, for eth2, you just have 192.168.2.0/24. How is it possible to get that right answer?

cloud spruce
cloud spruce
sacred isle
#

After thinking for a long time, I get why the first one is wrong. That's because the 10.0.0.22/30 is assigned to the Router2!

#

Though yeah, the 2 last ones still confuse me

cloud spruce
# sacred isle That was my attempt

it looks like the form is covering a part of the network diagram
the furthest to the right i can see is that eth0 on R01 has 10.0.0.21
so i can't see if the next router actually has 10.0.0.22 assigned as it's address

cloud spruce
# sacred isle

and what is the prefix of the cloud to the right that is cut off?

cloud spruce
# sacred isle

now things are making more sense to me, some of the addresses are already in use in other networks which would be unreachable if you picked just any network for A

cloud spruce
# sacred isle

is there any more text that goes along with that image?

sacred isle
#

In this image it does not appear but the network A is 192.168.2.0/24 and that the links between routers all have a mask /30

cloud spruce
# sacred isle 192.168.3.128/25

because to me 0.0.0.0/0 for the prefix on the fourth row would be valid on R01 and even my preferred route/answer there unless there are any more constraints that says we should keep routing as small as possible just to accommodate this network

cloud spruce
# sacred isle In this image it does not appear but the network A is 192.168.2.0/24 and that t...

/30 is the classic prefix for any point to point link that doesn't need to accommodate more then two ip addresses
but nowadays the special case /31 is quite common for such links to conserve ip addresses in the ip space
then you don't really have any network address or broadcast address on the link just the two hosts (usually routers or other device capable of routing traffic such as a firewall or similar)
but this is not applicable to this/your case

sacred isle
cloud spruce
sacred isle
#

So does that third line now also have more sense?