#networks

1 messages ยท Page 4 of 1

cold geyser
#

you can probably send ICMP packets (which are the packets sent using ping), yourself using raw sockets or something like that
https://stackoverflow.com/a/8245667/3717467 Never tried it myself, but it's probably something in that direction.

runic shale
#

Ok thanksyou

cerulean cave
#

hello, does someone know something about webscraping? i have a problem and don't take all the html from the website

ember ledge
young fox
#

hey, i have written a simple connection listener with socket. After i see that script run mb 1min than crashes i log everything.
Now i see, there so many unexcepted logs from uknown ips on my root server.
that are all any GET Requests that causes the socket server crash

#

should i use a other port?

astral parcel
#

Hi, I am trying to make a encrypted client to client communication system. The road block I hit is with fire walls. How wold I listen for a UDP package behind a fire wall?

desert wharf
#

Hello, i am struggling with how to control Microsoft Edge using selenium, whilst using TOR to give me a random IP Address. Not only do i need to do this, but i also need to make the exit node have an IP Address that is from a specific country, which is usually done by editting the torrc file, but i am unsure how to use those country settings using TOR with a browser that is not the Firefox browser preconfigured with TOR, that you download.

desert wharf
#

ive been stuck at this for days now, i need to run multiple instances of a browser using tor, each with a differant ip but within a specific country

#

can anyone help?

unborn pilot
#

@last ore your favorite

twin thicket
#

Is this different to sockets?

lyric tide
#

i think so but the functionality is the same

twin thicket
#

Hey all just reaching out

except KeyboardInterrupt():
    print(" + CTRL + C has been pressed")
    print(" + Program will exit")
    sys.exit()
#If hostname is wrong
except socket.gaierror():
    s.close()
    print("Invalid hostname {}".format(remoteServer))
    sys.exit()

Seems like my error checks arent working what am I doing wrong?

#

Im making a little port scanner for my home network

unborn pilot
hushed agate
#

Is it possible to use ngrok with python to open a tunnel to a specific port (ex. 25565). I found an official library from ngrok but cannot decipher what i need to do in order to create this tunnel and get a public url

pale prairie
#

networking is my thing

teal wagon
#

I need some help with dns hosting and domain ssl setup

#

is this the right channe;l

ember ledge
#

Python provides two levels of access to network programming.

sacred plank
#

I am using Fabric and Paramiko to upload some files to an SFTP server. Is there some way for me to check whether a file exists AND whether its size is the same as the file that I want to upload?

I want to do this because I want to upload multiple files. Currently, my function just restarts the entire process of uploading all files anew if the connection is lost at some point or another error occurs.

compact widget
#

Hey everyone,

I'm trying to get out of tutorial land by writing python every day during my lunch break. Here is what I wrote yesterday. I'm hoping for feedback on my code. Remember my goal is to consistently write code. However if anyone has advice of how to write in a more pythonic, efficient way - I'm open to instruction!

import matplotlib.pyplot as plt
from pythonping import ping

samples = 1000
rtt = []
loss = []

def test(dest):
    global samples
    while samples > 0:
        results = ping(dest,count=10)
        rtt.append(results.rtt_max_ms)
        loss.append(results.packet_loss)
        samples -= 1

if __name__ == "__main__":
    test('1.1.1.1')
    plt.plot(rtt)
    plt.plot(loss)
    plt.title('Ping Plot')
    plt.xlabel('Samples')
    plt.legend(['rtt','loss'])
    plt.savefig('graphic')
autumn geode
#

Can someone help me on installing the SQL

prisma cobalt
#

everyday we stray further from networking ๐Ÿ˜•

meager pagoda
#

One more thing...is Django the best framework for websites, or is there another better language?

ember ledge
#

is it possible to do

username1, username2, username3 = None

Instead of:

username1 = None
username2 = None
username3 = None
winter field
#

hello, if i have 2 programs which i want to communicate with each other can i get some help here?

silver axle
#

use socket

winter field
#

i tried but it tells me : ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

steady horizon
analog holly
#

is ftp file requesting when you create an username and password in the ftp service and then create a file in the laptop text editor?

hard rapids
#

Hello, is there anyone here that knows a lot about sockets? (specifically RAW_SOCKET)
I'm trying to send a SYN packet (that I created) and receive the answer with sock.recv(1024). It works when I do it synchronously but when I run the function in multiple threads it starts doing weird things (answers that have nothing in common) even tho it looks ok in wireshark

hard rapids
silver axle
#

true

hard rapids
#

and it did bad when I threaded it

silver axle
hard rapids
zealous flint
#

Visual Studio Code

#

Looks like One Dark

storm saffron
#

swear thats pycharm

quasi wraith
cold geyser
# hard rapids

for raw sockets (or generally anything not a TCP socket), you probably need to use recvfrom() instead of recv(). The reliability of TCP streams is simply not available with raw sockets, and using recv() probably doesn't make much sense (never did anything with raw sockets myself though, but that's my assumption).

polar minnow
#

Hello friends, I am trying to make a server client application with python socket. If the server is open with a loop in the client folder, there is a block like connect or try to connect again.
I can connect once without any problem.
but when I turn off and on more than one server, the client does not connect to the server a second time.
Please I would be very grateful if someone who knows python or understands these issues can reply.
thanks in advance

ember ledge
#

hi

#

I want to differentiate one client from another client, how could I do it (using socket library)?

lavish gate
#

Ohh hi

#

Uhm okay

#

Very simple

ember ledge
#

okay

#

explain me pls

lavish gate
#

Everytime a clinet connects store their ip on a list

ember ledge
#

THX

lavish gate
#

Welcome

#

Anyways goodnight

ember ledge
#

goodnight too

jovial fable
#

Does anyone have experience using closed/private protocols? I have to decode bytes and encode bytes based on different states stored in the DB and/or returned from the device (the network protocol I am implementing is between a server and a device that communicate with each other). Any device and tips would be very much appreciated

ember lagoon
#

anyone know how to spoof cors exchanges using requests? im trying to use selenium to login to a website and then access their api but they're using cors

errant bayBOT
#

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

ember lagoon
#

ah i am a penetration tester i wasn't sure if it still violated

#

in which case nvm

cloud plover
#

is there anyone who have implemented routing algorithms in the past

cloud plover
honest glade
#

hello ๐Ÿ™‚

fallow oasis
#

is there any possible way of making a socket connection safe from bots that are joining randomly?

#

i recently tried making a socket connection with a pygame app i made and it worked, but the only problem is that i noticed that bots were joining and such

#

so i need some kind of a secure way of making the socket connection

livid lily
#

you could implement a passphrase that has to be passed between client and server connection before socket connection takes place, else: dump connections, or you could implement secure socket with SSL and exchange keys between client/server

#

if passphrase == 'None': terminate connection, etc...

ocean bay
dark gate
coarse topaz
#

Hey, does anyone know if I can use those HTTP drafted request in HTTPClient in Pycharm, if I can reuse those in Main.py?

#

sorry im a total noob, I cant really find anything about it ๐Ÿ˜…

somber valley
#

Hello can someone tell me how to connect 2 Computers with phyton?

polar granite
polar granite
fallow oasis
hollow goblet
#

a

deft patio
#

who can help me with openssh & putty

dusty ibex
#

Im dying to do python

#

school fucked me up

cloud cliff
#

which wireless IEEE standard has the highest bandwidth? and is common

small fox
#
import random
import string
import time
import requests

def generate_urls(base_url, num_urls):
    """
    We add random characters to the end of the URL to break any caching
    mechanisms in the requests library or the server
    """
    for i in range(num_urls):
        yield base_url + "".join(random.sample(string.ascii_lowercase, 10))

def run_experiment(base_url, num_iter=1000):
    response_size = 0

    for url in generate_urls(base_url, num_iter):
        response = requests.get(url)
        response_size += len(response.text)

    return response_size


if __name__ == "__main__":
    delay = 100
    num_iter = 1000
    base_url = f"http://127.0.0.1:8080/add?name=serial&delay={delay}&"
    start = time.time()
    result = run_experiment(base_url, num_iter)
    end = time.time()

I tried running this code but the connection is refused.

requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /add?name=serial&delay=100&kyxegsiftm (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f10d4be0520>: Failed to establish a new connection: [Errno 111] Connection refused'))
neat lichen
#

Do you have a web server running on port 8080 on your machine? Can you open that URL in your browser?

noble viper
#

Hello.
I'm having some difficulties understanding the fifth layer, the Session layer.
I have watched some videos, read some articles, but it didn't help unfortunately.

neat lichen
#

The session layer does what it says - it manages sessions between two devices. What is it that you're not understanding? What is it that you're trying to accomplish that your lack of understanding is preventing? If you ask specific questions that pinpoint where you're having difficulty, you're much more likely to get assistance.

fading pendant
#

Hi guys, i'm trying to send some data over blueetooth, and... well... i'm really having hard times making it... I've found this https://blog.kevindoran.co/bluetooth-programming-with-python-3/ to help out. As i couldn't manage to install Python Bluez on my linux (Pop OS), i tried with sockets as explained at the begining but everytime i get an error on "s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)" saying "AttributeError: module 'socket' has no attribute 'socket' "wich is quite odd because everywhere i look for examples, i find this syntax (even in the documentation it's the right syntax!!) !! Like here for instance : https://www.programcreek.com/python/example/116470/socket.AF_BLUETOOTH ... I have to admit... i'm running dry and was wondering if anyone as some experience with Bluetooth and sockets ??

prisma cobalt
fading pendant
#

No i have import socket

prisma cobalt
#

show us

#

the code

fading pendant
steady horizon
#

Perhaps you have made a file named socket.py in the script's directory

fading pendant
#

no it's client.py (see top of the image...) i've spent a looooot of time on the possible errors and i still don't get it... i've even tried "s = socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)" and then the error goes on socket.AF_BLUETOOTH telling me socket doesn't have an AF_BLUETOOTH attribute where it clearly has since V3.3!! : https://docs.python.org/3/library/socket.html (i'm using 3.8.5 !)... Where's my pill ? Yeah the pink one... i need it...

#

More Fun :

steady horizon
fading pendant
ember ledge
#

hi, it is posible to send messages through a server - client chatroom without the client having a open port?

cunning garden
#

<@&831776746206265384> ads

cunning garden
ember ledge
ember ledge
compact widget
#

Hello,

I'm trying to recreate an issue that I've observed in the wild. The issue is that long lived TCP connections are eventually timed out ungracefully by network appliances which are tracking state. These long lived TCP connections are not using keep-alives.

However I can't find any use-case where it is a good idea or recommended to use a long lived tcp connection...

Has anyone ran into this same use-case?

gloomy root
#

The most common case is long polling.

cold geyser
#

the only long lived tcp connection I remember, was back in the days when I was still on IRC.

gloomy root
#

Realistically I dont think it's done much anymore outside of very legacy setups.

bronze raptor
#

How could I decode socket byte data into something readable?

cosmic mantle
#

can anyone suggest me good sources to learn about network prgramming like request,http and how front end and backend works amd programming backend?

cold geyser
bronze raptor
cold geyser
bronze raptor
#

The data is all in bytes though, right?

#

is there any way to interpret that?

cold geyser
#

what do you mean by "interpret that"? there is no general way that always works. You have to know in what format the data comes, and have to unpack/decode it appropriately.

bronze raptor
#

oh okay

#

so then there are many different encoders being used, I assume?

#

if so, would there be a way to decode something like that

prisma cobalt
#

something like what?

cold geyser
#

like what?

bronze raptor
#

I'm getting my raw data from socket

#

wait, I don't think I unpacked all of the raw data

cold geyser
#

you have to know the format of the data you receive, to be able to decode it correctly.

#

that's called a "protocol"

bronze raptor
#

right

cold geyser
#

there are thousands of documented protocols, and probably many more undocumented ones.

bronze raptor
#

I'm able to determine if the protocol is tcp, udp, or icmp

cold geyser
#

that's a different layer

prisma cobalt
#

what data are you receiving and/or sending?
what format is it in?

bronze raptor
#

wait sorry what do you mean by format?

cold geyser
#

format or protocol.

#

it's the "format" the server and client agreed on, to exchange their data in

bronze raptor
#

okay

#

if the format isn't something like tcp or udp, what would it be?

cold geyser
#

TCP and UDP are on a lower layer

#

you use those likely anyway.

#

but the data that's on top of that, your application data (the stuff you .send() and .recv())

#

that can be in a different format, relatively independent of the underlying TCP/UDP

bronze raptor
#

ohh okay

#

how can I determine the format

cold geyser
#

you decide it. Assuming you write both server and client, it's up to you how you package and send your data

#

if you don't write the server, but just connect to one, then you need to know what the server expects. read it up. Look at documentations etc.

#

or find a library that already does what you need ๐Ÿ™‚

bronze raptor
#

oh okay thanks for the help

#

I'm pretty new to all of this

#

do you have any recommendations for something that just lets me read packets in a network?

cold geyser
#

wireshark probably?

#

but most data (esp. http) is nowadays encrypted, so it might not be useful.

bronze raptor
#

oh

#

so that means most of the time you can't see the payload right?

cold geyser
#

yea

#

you might see the lower IP and TCP/UDP layers, but not the application data.

bronze raptor
#

so when analyzing packets, its mostly done from looking at sources and destinations and such?

#

how is malware detected then, for example

cold geyser
#

no idea

bronze raptor
#

alright, thank you for the help though

gloomy root
#

why?

ember ledge
#

What is networking

zealous flint
ember ledge
#

Oh

rapid fog
#

self hosting: would it be be easy to set up a pi as a server if the pi is connected to a wifi connection? Is that any different than an ethernet connection directly to the router (besides latency)?

pale prairie
#

@harsh beacon

harsh beacon
#

use the forwarding url to connect both?

pale prairie
#

ok wait.

harsh beacon
#

the long link

pale prairie
#

ok

#

so change host="127.0.0.1" to that link

#

or port

#

?

#

@harsh beacon

harsh beacon
#

change 127.0.0.1 to whetever ngrok link and try if it connects

#

also ping me..im not gonna see this channel much often

pale prairie
#

@harsh beacon

harsh beacon
pale prairie
#

ok

harsh beacon
#

should work now

pale prairie
#

wait

#

@harsh beacon

#

@harsh beacon

harsh beacon
#

hmm...

pale prairie
#

what now

harsh beacon
pale prairie
#

@harsh beacon

#

still same error

harsh beacon
#

i dunno man...im not that into networks....it shoulda worked...

pale prairie
#

@harsh beacon

#

can u make ur own code for it

#

to see if it works

harsh beacon
#

what do you want to do?

pale prairie
#

https://bf6a-2604-2d80-5084-9f00-550a-ce1a-fbe8-5a46.ngrok.io

#

@harsh beacon

harsh beacon
#

yep a minute man

pale prairie
harsh beacon
#

@pale prairie is the server running on your local machine?

pale prairie
#

it is on my machine

#

@harsh beacon

#

how i fix that

#

error

harsh beacon
#

i dunno tbh

pale prairie
#

@harsh beacon

#

can u maybe help with the error

harsh beacon
#

you just keep googline crap unless errors change and eventually it works

pale prairie
harsh beacon
pale prairie
#

ok

harsh beacon
#

most of the online resources seem to have localhost sockets man

pale prairie
#

and i cant findd

harsh beacon
#

i cant find much on intra wifi sockets...

pale prairie
#

anything

#

for the error

harsh beacon
#

maybe someone with better experience can suggest ig...im at my end too .

pale prairie
#

@lofty bough

pale prairie
#

@harsh beacon

#

look

#

i decided to make my own

#

wait

#

@harsh beacon

#

i think it is going good

#

just gonna add a debuger with flask

lofty bough
pale prairie
#

i dont need nothing

#

bye now

lofty bough
#

๐Ÿซ 

pale prairie
#

@harsh beacon

pale prairie
#

are you familiar with socket.py?

#

@lofty bough

#

.

#

@ember ledge

ember ledge
#

?

pale prairie
#

can help?

ember ledge
#

with what

pale prairie
#

how can i connect this to

#

socket.py

#

@ember ledge

ember ledge
#

what do you mean

#

connect the ngrok tunnel to a socket?

pale prairie
#

@ember ledge

ember ledge
#

yes

pale prairie
#

so i want it to be public where anyone can join the server without being on the same internet

#

@ember ledge

#

so can u help?

ember ledge
#

bro

#

for that u use ngrok

#

no more

#

XD

pale prairie
#

?

ember ledge
#

u just need to use ngrok

#

and it's public

pale prairie
#

u dont understand

ember ledge
#

yeah i don't

#

wait a minute, i have things to do 2 mins

#

now

#

explain me

pale prairie
#

@ember ledge

pale prairie
#

networking has died :(

#

I am gonna crt

#

cry*

grizzled mantle
#

Well I can make it alive , I m having issues with Paramiko

#

well issues is not the right word. .. I don't know how to use it and accepted a project too big for me ๐Ÿ˜

mellow horizon
#

Hey yall, I'm having a slow UDP server issue. Video captured with CV2 is streaming at 3fps. I'm over in help-cake is anyone can help ๐Ÿ™‚

barren pendant
#

hi some here?

void cradle
#

anyone use tailscale/headscale?!

#

if not, you need to stop everything you are doing and hook yourself up right now

void cradle
#

oh crap sorry wrong chat

scarlet jungle
#

Hello I am trying to login to a website using python requests but I am not sure wat data I need to send. How do I figure it out?

zealous flint
scarlet jungle
sand oak
#

what is a nic
what is a switch
what is a hub
what is a router

celest osprey
#

its easier

#

i hv a question in sockets

#

why does my server go blank after i disconnect ?

#

this is wht happens

#

anybody knows the sol?

lunar lintel
#

Guys for learn networks is important known how works bits to bits or know who works?

pale prairie
#

hi

zealous flint
zealous flint
lunar lintel
pale prairie
#

hi

#

L)

#

:)

#

guys

#

?

tender violet
#

anyone knows about cisco packet tracer?

lunar lintel
#

It's a simulator of networks

tender violet
lunar lintel
#

I understand few

#

Just talk

lunar lintel
tender violet
#

there was a power outage i have to deal with in this cisco packet tracer

lunar lintel
#

Well I don't know

#

I just use for make LAN and WAN

#

Try search on YouTube, maybe help

tender violet
#

yeah i am trying to watch some

zealous flint
#

We use PT frequently in our classes

tender violet
zealous flint
# tender violet

To enable access vlan:

enable
configure terminal
interface F0/1
switchport mode access
switchport access vlan <VLAN_ID>
#

Where interface is each interface

tender violet
#

i gotta ttry that

zealous flint
#

You can use interface range if you want to edit multiple at once

tender violet
#

i tried that

#

but i forgot the command

zealous flint
#

What vlan should these ports be assigned to?

tender violet
#

interface range f0/1-9

#

hold on

zealous flint
tender violet
#

vlan 50

#

im sure

zealous flint
#
int range F0/1-9
switchport mode access
switchport access vlan 50
tender violet
#

i forgot the ACL

#

but i have done it like 2 months ago

#

i am so bad at recalling stuff XD i just got back from thanksgiving break

zealous flint
#

haha same honestly

#

i've got a cisco module test tomorrow ๐Ÿ˜”

tender violet
#

im afraid to fail this but my instructor said that it should not fail me for just this task

zealous flint
#

luckily techacad to the rescue

tender violet
#

yeah i always watch him

#

helped me a lot through my homeworks

#

sometimes i do not have to watch him because I could do it on my own

#

@zealous flint do u know this syslog client thing?

zealous flint
final meteor
#

How come ipconfig tells me my ipv4 address is not the same as when I google whats my ip?

ember ledge
#

Hi how does a TCP connection add overhead relative to UDP

compact solar
#

Hey, im a college student doing a project, and subnetting has never been my strongest suit same with Static routing, could someone go over my numbers and check if im good or not?

zealous flint
zealous flint
# ember ledge Hi how does a TCP connection add overhead relative to UDP

TCP needs to make sure that a packet arrived - that in itself adds overhead. It also needs to make sure the packets arrive in the right order. Again, overhead. UDP doesn't care as much - it just sends the packet to the other computer. If the other computer failed and isn't listening - oh well, too bad. Packets arrived in a jumbled mess? Oh well, too bad. Packets didn't arrive at all? Oh well, too bad.

final meteor
ember ledge
#

hiii, Iโ€™m searching for a co founder who is experienced in programming ๐Ÿ™‚ would love to be able to connect to some like-minded homies here ๐Ÿ™‚

zealous flint
# final meteor I don't really understand private vs public?

Let me give you an analogy -
Your private IP is similar to where you are in your house. For example, you may be in your bedroom at the moment. Or the living room, or in your kitchen.

Your public IP is similar to your house address. You may live on XYZ Drive, State, Country.

If someone asks you for your mailing address, would you tell them you live "in your bedroom" (private IP), or "XYZ Drive, State, Country"? (public IP)

final meteor
zealous flint
#

All of the devices on your LAN will have the same public IP

#

The "default gateway", which is analogous to your front door

#

The mailman delivering your package will leave it at your front door - and from there whoever is meant to get the package will come and pick it up from the door. This is called "NAT" which stands for "Network Address Translation"

final meteor
zealous flint
final meteor
#

Like if an ISP manages 2 routers that has the same IPv4 it first translates for the network and then the network translates for the devices on it?

zealous flint
#

Perhaps you mean the devices behind a router appear to have the same IPv4?

final meteor
#

Like, when I check what my default gateway is on one network it is 192.168.0.1 and if I do the same on another network I get the same gateway

zealous flint
#

So that's not much surprise

#

In fact my default gateway is also just that

#

private IPv4 can be duplicated across multiple LANs, but public IPv4s are globally unique

final meteor
zealous flint
#

Unlike a host a router can have multiple IP addresses, one for each interface

#

"One interface", being a physical port
(Note that it can get a bit more complex with subinterface and virtual interfaces, but you can ignore that for now)

final meteor
#

I thought my router "created" my network

zealous flint
#

You see the wire coming out of the router on the right side?

#

That would be the default gateway

#

It's IP would be something like 192.168.0.1 (though in this diagram it's 172.31.1.129)

final meteor
zealous flint
#

Circle

#

Labelled "R3"

final meteor
#

yeah im with you

zealous flint
#

And if you can make it out, there's another wire going from the router to the top left

#

That would be the router connecting to the ISP, and ultimately the internet

final meteor
#

So when I'm sending a package to 192.168.0.1 im sending it to my router?

zealous flint
#

Which is your public IP

zealous flint
#

All packets leaving your LAN have to go through the default gateway
Similar to how if you want to leave your house to go to work, you have to walk out the front door

final meteor
#

yes but wouldn't that mean that my routers IP is 192.168.0.1?

zealous flint
#

Your router can have more than one IP

final meteor
#

How does that work

zealous flint
#

In fact a router will usually never have just one IP, that defeats the point of a "router"

zealous flint
#

The one that you're connected to has the 192.168.0.1 IP

final meteor
#

How many IPs does it have from my ISPs perspective?

zealous flint
#

Same deal from the rest of the internet

#

You can think of it as "how many doors does my house have for someone looking at it from the front?"

final meteor
#

back to the fact that to different routers has the ip of 192.168.0.1 then lol. To the ISP it has to seem like there are two devices with the same IP?

#

Or do the routers have another "secret" IP that I can't see that is unique to the ISP

zealous flint
zealous flint
#

For example take this topology

#

R2 would be the ISP's router

#

Let's say you are R3 and R1 is your neighbor

#

Notice how the wire connecting from R2 to R3 as a different IP that the one connecting to the LAN with PC3? (this will be your home computer)

final meteor
final meteor
zealous flint
#

Keep in mind a router can have more than just an "inwards IP" and an "outward" IP however your average Cisco router will have only 3-4 ports

#

This is the entire topology for something I'm working on for school

#

In this case you can see R2 in the middle has 3 different ports

final meteor
zealous flint
#

You can see that here, in a typical Cisco 1941 Series Router

final meteor
#

aha cool

final meteor
zealous flint
#

Though PC1 and PC2 can access it from any of the other 2, it would be like going into your house from the backdoor. Like sure it's possible, but you usually wouldn't do that

#

This is also why you can ping your public IP (it would be like PC3 pinging R3, but from the other side)

final meteor
#

Like to both R1 and R3 R2 has the same IP?

zealous flint
#

This is because the link between the routers is not actually a regular link, but a "serial" cable (which is why it's a red zigzag)

#

Since when you directly connect multiple routers together, they can behave a bit strangely

final meteor
#

Huh, so to PC3 the address of R3 is 172.31.1.128 and to R3 the address of R2 is also 172.31.1.128?

zealous flint
#

You're right on PC3 and R3, but to R3 the address of R2 is 172.31.1.196 (as that's the IP connecting R2 and R3)

#

believe it or not the links connecting the routers are their own LANS:

#

This picture is the same as the one we have except it's IPv6, so you can ignore that part

#

But each of the pink highlights is "a LAN"

#

Another way to think of it - each wire coming out of a router is a LAN

zealous flint
final meteor
zealous flint
# final meteor I don't understand what you mean by one IP connecting R2 and R3? I thought there...

Ah yeah. So like I mentioned the link between R2 and R3 is actually a whole network on it's own. Same deal with the link between R2 and R1. All networks have a "network" IP - for example 192.168.0.0. You cannot assign this to any device. I can try to set my computer's IP to 192.168.0.0 but it would error out. So your router takes the "first usable address" which is 192.168.0.1. Your switch takes the second, 192.168.0.2, and your PCs the rest - 192.168.0.3, .4. .5, etc

#

So those IPs on the diagram are really the "network IP"s of each network

final meteor
#

aha

#

So on the vlan that has PC1 on it R1 has a certain IP while on the VLAN with R1 and R2 R1 has a different IP?

zealous flint
final meteor
#

oh right a VLAN is designed by the router while a LAN is a real one?

#

ish

zealous flint
#

VLANs are more complex so it's best not to confuse yourself with them just yet

#

All you need to know is that "VLAN" stands for "Virtual LAN" so it's not exactly a physical, real LAN

final meteor
#

alright

#

one last question lol if thats okay

zealous flint
#

Of course!

final meteor
#

People say that you shouldn't "leak" your IP. What do they mean by that?

zealous flint
# final meteor People say that you shouldn't "leak" your IP. What do they mean by that?

Giving our your public IP. It's like telling people where live, and your house address.
These days it's not "bad bad" because most people have dynamic IP (it costs more to get a fixed IP) so given a few days to a week your IP will naturally change.
The bad part is that they can (D)DoS you - but even then modern ISPs have protections in place to prevent their customers from getting a (D)DoS attack.
They can also know your rough geographic location (plus or minus say, 5 miles)

#

It's not a major deal but you know
Don't go telling people what your public IP is, lol

#

However you can tell people your private IPv4, that doesn't really matter much. In fact, here's my private IP:

#

(i'm on the 192.168.1.0 network)

final meteor
#

But to reach my network, wouldn't they have to know both the ISPs and my routers IP?

zealous flint
#

Router (default gateway) takes the first IP as usual, and my PC just happened to take .228 because it's using DHCP and I can't be arsed to manually configure it

zealous flint
#

So they just need to know your router's IP

#

And of course using a VPN mitigates all of these risks
Moral of the story: use a VPN

final meteor
#

alright cool! Ty so much for the help

#

btw what are you studying?

zealous flint
#

I'm currently working towards a CCNA certification to become a network engineer as a dual-enrolled student

#

So we concern ourselves mostly with this sort of stuff

final meteor
#

cool, sounds very interesting!

#

Aight I gotta sleep cya

zealous flint
#

It was nice chatting with you! I hope I made things clear and not the other way around :P

lunar lintel
#

guys is it important to know how flow control with bits works, and other things like checksum or just know what it is for?

glad stirrup
#

Hi, I need someone to go through my code and probably optimize it
It's the config file for an SNMP

rough comet
#

Im going to get that

ember ledge
#

does python still support socket

gloomy root
#

yes, socket is a core library

sudden wigeon
#

can you guys suggest some book about django

lunar lintel
#

Web Development with Django

scarlet mortar
#
When I try to connect with paramiko module, I get this error: paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[WinError 10054] An existing connection was forcibly closed by the remote host Even if I try not to display this error, using try/except keywords, it still show on my screen.

CODE:
> 
try:
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect(host,username=username,password=password,port=22)
    with open('vps.txt','a') as file:
        file.write(host+' '+username+' '+password+'\n')
        file.close()
except Exception as error:
    if 'Authentication failed.' in str(error):
        print("ERROR")
    return
scarlet mortar
spiral pond
#

how to fix this error?

errant bayBOT
rigid moat
spiral pond
deep dome
#

How can an application evade fiddler?

#

The application works correctly regardless of whether Fiddler is running or not

#

So there's no anti-Fiddler stuff going on either

prisma cobalt
#

why do you want to evade fiddler?

small spoke
#

True dynamic addresses are getting rarer

#

Even rarer are static IPs, which I'm actually not a fan of due to obvious reasons.

small spoke
zealous flint
#

Rewrite all of it

zealous flint
small spoke
#

It's an interesting technology, but for the end user it's an absolute disaster. It's time we switch to IPv6

zealous flint
#

indeed

zealous flint
#

Sure, since you're in the #networks channel Cisco provides certificatations

#

Microsoft provides MTA I believe they're called

ember ledge
#

When creating a REST API what is the best way to handle posting files (1MB+ data)? Is it fine to just post the entire data

prisma cobalt
ember ledge
prisma cobalt
prisma cobalt
#

fastapi is amazing

ember ledge
#

I also had a fastAPI related question about Pydantic

@app.post("/createposts")
def create_posts(new_post: Post):

where Post is a pydantic model

How does the type hinting work here with a class? I've not really used type hinting a lot before. The course I am watching says it "automatically checks the contents of the post to see if it matches the model"

prisma cobalt
#

your Post class defines a few attributes that represents its structure
when a request comes in, fastapi will parse the given args and see's if it can match them with your Post object

ember ledge
#

So behind the scenes FastAPI and Pydantic are doing some functions/comparisons to see if the post JSON matches the post object

prisma cobalt
#

yes, and if it matches, a Post object will be created and passed into the function

#

if it can't match then the client will receive an error

ember ledge
#

So with type hinting its actually calling a Post constructor?

#

with the data

prisma cobalt
#

by type hinting, you are telling Fastapi that you want to receive a Post object

#

type hinting doesnt actually do anything meaningful, it just tells fastapi how you want the request to be handled

#

that make sense?

ember ledge
#

I had thought there was some kind of type conversion going on

#

Because, a Post object is not strictly a JSON object

prisma cobalt
#

an example:

#
class Post(BaseModel):
    title: str
    content: str
    upvotes: int

the JSON in the request would look like this:

{
    "title": "FastAPI Is Cool",
    "content": "Whatever here",
    "upvotes": 78
}
#

you can also nest models inside each other which is pretty cool

#

as is support for different data types like lists

ember ledge
#

Huh, magical

ember ledge
#

yo i have question about the python socket module

#

what happens when you do socket.recv()

zealous flint
#

I don't know if there's an actual message queue but I find it helpful to think of it as one

prisma cobalt
ember ledge
#

i found out that you dont go to next line while .rcv()

ember ledge
prisma cobalt
ember ledge
prisma cobalt
#

That would work yes

#

Or you could handle them using some sort of selector in a single thread (an advanced topic, threads will work fine)

ember ledge
#

Where to learn streaming?

ember ledge
ember ledge
#

anyone here finished with their comptia certifications?

#

and/or have completed net+ / sec+ ?

lone sand
#

did anybody here manage to make a p2p connection with no public IP using a google stun server?

ember ledge
#

hello ! i started to make a socket in python but the problem is that the server is on my pc so my own ip and i don't really want the people who connect to my socket to get my ip do you have any idea how to hide my ip address ?

steady horizon
#

Own a server to which you will let people have the address

#

Preferably not in the same network as your home I guess

limber urchin
#

is there a way to detect when a client socket disconnects from a server socket? i could just do a while loop on a separate thread and check if the client is still connected, but that seems like it'd be inefficient and i want to know if there's a callback or something

dense escarp
#

guys I have a question...
I'm making an amazon Alexa skill, and I'm trying to control my pc over WIFI (with alexa commends)
do you guy know a way / python lib that could be usefull to control my pc

limber urchin
#

flask probably

#

idk how alexa works but if it requires a server on the other end you could do flask

#

and you could use an ngrok webhook to tie it all together

#

@dense escarp

half shadow
#

is there any way I could use to download file from mega? (exe file)

dense escarp
limber urchin
hearty abyss
#

Hey , does anyone know loop back address in IPv6 other than ::1?
Like in ipv4 we have a range of loop back addresses , do we have it in IPv6?

light zealot
#

how do I check if my udp server is listening on a particular port?

#

its for a chat app

quiet aspen
#

Does anyone have any examples or resources on how to stream large data from client to service using grpc?

zealous flint
hearty abyss
sand dome
#

i had a question about selenium, if i wanted other people with different browsers to use my thing could i pre-package a version of firefox or is there a better way?

hearty abyss
#

stuck with this issue since the last 3 days

heady fractal
#

Hello. How to enable internet access from github actions on github please?

static swan
#

yo

#

so I'm trying to figure out how to keep a session alive in python indefinitely

#

so if there was a website, I could login with my password and user, and indefinitely scrape stuff out of the website with that session

#

is that possible?

#

to be permanently logged in with a bot?

#

I want to scrape a forum/website with my login credentials and let it keep scraping indefinitely

#

or can I manually login to a website that requires a captcha, but can I grab the captcha and type it out manually

ember ledge
#

Quick question how long did it take for you guys to be decent at coding

heady fractal
shadow swift
#

Hi, I need help

amber bear
#

hi, has anyone encountered the following problem:
To connect to a server, for example 1.1.1.1, you need a vpn (ssl vpn plus), if you install vpn on windows and try to connect via ssh, then the connection will be successful. If you write a simple echo server with port 8080 and they knock on it from Windows, it also works fine, if you install vpn on linux, then only the connection via ssh goes through, the curl to the echo server does not work.

final meteor
#

Can a single port accept both TCP and UDP or just one of them?

#

Such that for example port 80 can accept both TCP and UDP packets?

final meteor
#

Cool thanks!

dark copper
#

Hi guys, I'm looking for a way to connect my app to a remote server, could you help me with the code?

storm saffron
final meteor
#

So one 80/TCP and UDP/80? And depending on the protocol used it goes to either?

#

@storm saffron

zealous flint
#

It just receives packets

final meteor
zealous flint
#

It's similar to how your ears can hear multiple languages

#

You don't need seperate ears for separate languages

#

The port itself has no concept of a "protocol"

#

All it knows is how to receive packets and how to send them

final meteor
unborn pilot
#

nice diagram

zealous flint
#

There's a "protocol" field in the packets

#

The host is like, "oh hey, this is UDP. I don't have to worry about all the TCP handshake stuff"

final meteor
#

aha cool so its not the port itself that decides what protocol it wants to accept: Its the program that actually processes the packet that does?

errant bayBOT
#

Hey @slow bobcat!

It looks like you tried to attach file type(s) that we do not allow (.docx). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

drifting trench
#

Hi, it's mustafa.. I am interested in python, data science, machine learning and sql. https://www.kaggle.com/mustafagerme

runic breach
#

Hello everyone . I would need help regarding an event that has a high probability of happening while using my program , and it is an ip address conflict .
I would need to add a function in my python script , that checks if 2 ip addresses have the same address in the same network . I don't mean 2 or multiple ip addresses as strings , but it should really analyze the network and tell me if there are 2 ip addresses with the same address .
At that point the program would wait until this conflict is eliminated . How can this be done ? Thanks to all

zealous flint
#

It's possible to accidentally configure 2 static ips tho

runic breach
# zealous flint There shouldn't be 2 ip addresses if you use dhcp

Yes I know . the thing is that these are devices that by default must connect to the network with an equal static address ,since this address is embedded in the firmware of these devices .
So this conflict event is normal to happen and I have to be able to wait until it is resolved (automatically it is done)

#

I would need a simple function that analyzes the network and checks for a conflict event .
If there is it should wait until this conflict is eliminated

zealous flint
#

IPv6 commonly has this issue with duplicate addresses

#

It uses a process called "duplicate address detection" or DAD, for short

#

Basically it sends a neighbor solicitation ping with the address as the destination

#

If a ping is not received, the ip is considered to be unique

#

You should be able to apply this same concept to ipv4

runic breach
#

Right ! I hadn't thought about the "ping" command. , so if there is a conflict of two ip addresses and I try to ping the duplicate address , it should fail ?

runic breach
#

Very Interesting , i'll try that and also DAD . Thanks for your help

zealous flint
#

Your last usable host is your broadcast

#

So shift that column over

junior fjord
#

Hello guys, I want to ask if it is possible to make a neural network in python so that it draws pictures and arts like a midjourney neural network

celest scarab
#

HI, every one i have some questions for my code and it's important to my career

#

I created a Network Analysis code but when I send ICMP or any other packet, I get an error. Is there anyone who can help me?

#

and i have a problem in return function

broken kestrel
#

Anyone have a good tutorial series for networking/sockets? Specifically communicating between multiple clients through a server (multiplayer)

nova hollow
#

Anyone here able to do a quick run down for me about subnet masking

zealous flint
nova hollow
zealous flint
#

You don't really have to these days
Classful addressing was abolished

#

But if you really want to...

nova hollow
#

Oh dang they are teaching that in my class idk why lol

zealous flint
#

Mine did too.

#

Not sure why they still do it but hey, who are we to argue with the curricula, eh?

nova hollow
#

True

tough canyon
#

Hello, i am try to send a json file to my ip address and then use it on unity , i have the following python script
Any suggestion to what i am doing wrong? host = '0.0.0.0' # I have set my ip here??

import requests
import json
import time

# app = Flask(__name__)
# # app.config['CORS_HEADERS'] = 'Content-Type'
# CORS(app)

class PostClient(object):
    def __init__(self):
        self.url = "localhost"# set an ip address
        self.ip = "5052"
        # instantiate a channel
        self.headers = {
            'accept': 'application/json'
        }

    def post_message(self, msg):
        """
        Client function to call the rpc for GetServerResponse
        """
        example = {'command': 'summary'} #this would be the json msg to the server
        example_json = json.dumps(example)
        try:
            response = requests.post("http://{}:{}/send".format(self.url,self.ip), headers= self.headers, data=example_json)
            print(response.content)
        except requests.exceptions.RequestException as e:
            response = e
        return (response)

if __name__ == '__main__':
    try:
        # Parse arguments
        parser = argparse.ArgumentParser()
        parser.add_argument('--host')
        parser.add_argument('--port')
        args = parser.parse_args()

        # If the user has provided custom IP and port
        host = args.host
        port = args.port

    except Exception:
        # Use default values
        host = '0.0.0.0' # I have set my ip here??
        port = 5002

    #app.run(debug=False, host=host, port=int(port))
    post = PostClient()
    while(True):
        post.post_message(100)
        time.sleep(1)```
short jackal
#

I'm building a proxy server, and I have a couple of ways to implement it but I'm not sure which one is the best one to do:


option 2: make a new process for each user, and not run a thread for each connection this user have

option 3: make a new thread for each user, and a thread for each connection this user have

option 4: make a new thread for each user, and not run a thread for each connection this user have```
which one is the best?
desert loom
#

Can someone help me with a server client problem? I transfer a file via Socket but I also want to give the filename. The way I implemented this now skips writing the file bytes

desert loom
#

I got it

zealous flint
#

We're not allowed to help with exams sorry

past siren
#

I thought this channel meant โ€˜networkingโ€™ as in getting to know programmers so they can help you. Though it looks like this is โ€˜networkingโ€™ as in creating a network, right?

zealous flint
ember ledge
#

whats a tcp proxy (some resources pls) ? (edited)

short jackal
finite dock
#

what are your guys opinion on best cisco apps.. ansible, genie, etc.. I need to pick one and start learning it

finite dock
#

?

finite flame
#

i have the same problem

#

im learning network automation using python

#

paramiko and netmiko

celest scarab
#

Hi guys i had a problem in my code, i created python script for MySQL database and i used flask, every time i tried to run the script, it's response in this error:

||RuntimeError: Working outside of request context. This typically means that you attempted to use functionality that needed an active HTTP request. Consult the documentation on testing for information about how to avoid this problem.||

I tried to search in google but i didn't find the solution, can any one help me?

gray laurel
#

hi,does anyone have experience working with ngrok in a restrictive firewall

pure pike
#
while True:

    s.listen(5)

    conn, addr = s.accept()
    print("User" + " " + host + " " + "has joined")

    welcomeMessage = "Welcome."
    conn.send(welcomeMessage.encode("utf-8"))

    data = conn.recv(1024).decode()
    print(host + " " + "wrote:" + " " + data)
#

hello, i can only seem to send one message to the server

#

once i send the message to the server and try to send another it doesnt register anymore

#

im using inputs on my client side

small spoke
#

Kind of late, but this is wrong. Understand the basics of IPv4 and Subnetting. Network ID, Broadcast addresses and usable hosts are important to know. Lets say you have following IP address 10.0.0.66/27 in this case the Subnet Mask is 255.255.255.224. So you have 5 bits out of 32 you can fill. 2^5 is 32 so from 64-95
Broadcast Address is the Last Address
Network ID or Address is the First Address
First Host is the first Address after the network ID!
last Host is the Address before the Broadcast Address
Everyone uses a different method to calculate subnets, you will have to find out what suits you better

ember ledge
#

In select, how can i check if my socket connected to the server?
I for the life cannot figure out how to check if my non blocking socket has connected, working on kernel 1.0 linux.

#

It states, when a socket is connected it becomes readable, all is well, but when the server it connected to sends something it becomes readable and writable, which is a problem because its our only way to check if the socket is errornous

errant bayBOT
#

Hey @ember ledge!

It looks like you tried to attach file type(s) that we do not allow (.c). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

outer mirage
ember ledge
#

Do you know c?

#

@outer mirage

#

Okay, do you know python?

outer mirage
#

it doesn't matter, just send the example.

ember ledge
#

OK!

#

!paste

errant bayBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

ember ledge
#

There.

outer mirage
ember ledge
#

It's written in c

outer mirage
#

yeah which is probably important to mention in your original question

#

alas

ember ledge
#

Yeah sorry

outer mirage
#

you are never able to detect a silently broken socket - like for example if the connection is killed by the other side without a proper log-off

#

thats impossible simply by how socket connections work

ember ledge
#

So the conclusion simply becomes, to ping pong application layered?

outer mirage
#

you're already using getsockopt with SO_ERROR which is able to detect any other errors so yea, the only thing left is keepalive or ping

ember ledge
#

Now, who pings who?

outer mirage
#

it ultimately doesn't matter as long as both parties are aware of the rate at which the pings should come through

ember ledge
#

What would you suggest?

#

And you are 100% sure there is no other way besides ping pong?

outer mirage
#

you might want to try keepalive first

ember ledge
#

the old kernel i work on has no getsockopt and or those flags

#

it does not even have send(), recv() so i need to use write() and read()

outer mirage
#

ah yeah if keepalive is missing you have to manually implement something similar

#

do you have control over both client and server?

ember ledge
#

Ye

outer mirage
#

okay yea

ember ledge
#

Luckily

outer mirage
#

which side sends the ping would depend on the actual application

#

ask yourself: for which side is it more important to immediately know a connection is terminated?

ember ledge
#

I want to use epoll() or asyncio + uvloop + asyncio tcp streams

#

on the server side

#

I know epoll() just works

#

but i'm really curious to the performance of asyncio

outer mirage
#

then i would send from the serverside

ember ledge
#

the client has to connect to the server to revive further instructions, like updating etc

outer mirage
outer mirage
ember ledge
#

Ah you mean as soon as the server gets a client connection, the server sends the ping?

outer mirage
#

not really? just periodically

#

how often depends on how fast the server needs to know

ember ledge
#

it has many clients that connect

outer mirage
#

and it would have to ping each

ember ledge
#

yeah

fiery wedge
#

How do I expose my localhost with a tunnel and use my custom domain?

ember ledge
#

this is just a part of my code i have the chromedriver exe in the same directory as my code in but i still keep getting this error below:

[4104:2584:1217/000435.860:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
[4104:2584:1217/000436.126:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
[4104:2584:1217/000436.169:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
[4104:2584:1217/000436.497:ERROR:ssl_client_socket_impl.cc(982)] handshake failed; returned -1, SSL error code 1, net_error -101
from selenium import webdriver

d = webdriver.Chrome()
d.get('https://uscash.sbs/')
#

i have tried everything i can, be it mentioning the path of it in the webdriver.Chrome(path) like this or even using an auto installer of driver with chromedriver_autoinstaller.install()
but all of it doesnt work

#

can someone please help

#

how do i fix this ssl handshake error

#

i also used this but it didnt work either

options = webdriver.ChromeOptions()
options.add_argument("--ignore-certificate-error")
options.add_argument("--ignore-ssl-errors")
browser = webdriver.Chrome('C:\\webdrivers\\chromedriver.exe',options=options)
ember ledge
#

hi, is there a way to encrypt a connection to a server so the connection cannot be sniffed?

errant bayBOT
gilded vigil
#

`# Import subprocess so we can use system commands
import subprocess

Import the re module so that we can make use of regular expressions.

import re

netsh_output = subprocess.run(
["netsh", "wlan", "show", "profiles"], capture_output=True).stdout.decode()

profile_names = (re.findall("All User Profile : (.*)\r", netsh_output))

wifi_list = []

if len(profile_names) != 0:
for name in profile_names:

    wifi_profile = {}

    profile_info = subprocess.run(
        ["netsh", "wlan", "show", "profile", name], capture_output=True).stdout.decode()
    if re.search("Security key           : Absent", profile_info):
        continue
    else:
        wifi_profile["ssid"] = name
        profile_info_pass = subprocess.run(
            ["netsh", "wlan", "show", "profile", name, "key=clear"], capture_output=True).stdout.decode()
        password = re.search(
            "Key Content            : (.*)\r", profile_info_pass)
        if password == None:
            wifi_profile["password"] = None
        else:
            wifi_profile["password"] = password[1]

        wifi_list.append(wifi_profile)

for x in range(len(wifi_list)):
print(wifi_list[x])
#create with Arj#2784`

#

Hello, this file shows the Wi-Fi password that you have connected
From the first Wi-Fi you connected to now

lost chasm
#

if im making a game that will have player one be the host, and other players, (one other for now but i may increase this later) do i need to worry about the hosts device ip being sent to whoever connects. and is there a tutorial for this kind of connection.
so far all the tutorials have a server program and client programs, rather than the host device just running the server and that having the client integrated... or is that a dumb idea.

current setup has server which has to be opened, then client program on that same device and then another client from an external device. (which is bad because it sends the data (client program) out of the socket which then just returns though that socket again.(to server program))
i want it to be host (server and client program integrated) opened and then external devices to connect. which means the device hosting does not sent data out just for it to be returned to itself.

  • note i may be wrong with how this works lol.
vivid pumice
#

They work by, when the client program is told to host, opening up a thread/subprocess in the background to run the server-side of the code, and then connecting to the local server

lost chasm
#

im thinking it could cause added unnessicary delay. because if youre connected over wifi(local network) then youre sending data to the wifi router just to receive that back on the same device. makes sense to just thread to run the client after the server is started.

vivid pumice
#

so its not actually going through the wifi router at all, and the delay is for all intents and purposes nonexistent

lost chasm
#

Alright that makes sense

main minnow
#

Hi, anybody familiar with uplink (https://uplink.readthedocs.io/en/stable/index.html) package?
Currently I have below code

from uplink import *

class auth_client(Consumer):
    @returns.json
    @post("auth/access_token")
    def get_access_token(self, payload: Body):
        pass

The code above could be used like this:

the_client = auth_client(base_url="https://test.example.org/us/")
the_client.get_access_token()

But, I want something like this instead:

the_client = auth_client()
the_client.set_country("eu")
the_client.get_access_token()

The set_country method would then override the base_url subdomain.
(from https://test.example.org/us/ to "https://test.example.org/eu/"
How can I do this?

Thanks!

finite dock
#

Anyone have a way of getting the usable ip's based on a subnet? Like say, 10.0.0.1/27 would print out Total:32, Usable:30 Range:10.0.0.1-30 , and then add each IP to a list?

zealous flint
#

Usable = total - 2

turbid shale
#

not sure i should be asking here but here's my problem:
I have a GUI that sends a request every second to an api endpoint to retrieve updated data
whenever I try to start my GUI and after some times, my wifi bars drop from 5 to 1 until I restatrt the program
something I've thought is the response body being too big to handle by my internet, I don't know tho

#

I just wanna know what causes it and eventually fix it

ornate turret
#

How do I check if a url starts with a link and contains .mp3 in it and returns it?
Here's what I tried:

import requests
from requests_html import HTMLSession
class Test():
  def Test(self, input):
      name = input.replace(" ", "_")
      l = f"https://example.com/{name}"
      r = HTMLSession().get(l).content
      if "https://example2.com/" and f"{str(name).title()}.mp3"  in r:
              # Here's where I was stucked.
tender nexus
#

/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/ url regex

#

after finishing request check response content-type

#
>>> import requests
>>> s = requests.Session()
>>> r = s.get("some-mp3-site")
>>> r
<Response [200]>
>>> r.headers["Content-Type"]
'audio/mpeg'
#

@ornate turret

#

hope it helped

hexed moss
#

Hi, I want to build a live geolocation sharing (only for family use), I m setting up a oracle server for python server socket, do i use async / sync socket server, which protocol would be better for this kind of use TCP or UDP, can you provide me more resource in asyncio.

tender nexus
#

look at aiohttp.ClientSession.ws_connect()

pearl anchor
#

How's it going guys. I happen to be in need to develop myself a personal/proprietary "cloud" based file storage server for a webapp which is based around storage service. I have to chunk the files and write a file hash. Here's the complicated part, idk how the industry does file storage. I imagine the files are encrypted, chunked and flattened but I don't know what strategies Microsoft or other high end companies use that i could also employ to achive secure and optimised file storage server design

pearl anchor
#

if this is how the industry does file storage, ig i dont have any other questions other than, how should access be provided as this server is seperated from the main api server backend.

hollow furnace
pearl anchor
#

what are the other strategies

hollow furnace
#

Encryption and hash are 2 big ones

pearl anchor
#

well right now, the current physical file storage arch uses folders with are named with keys that are indexed, within, file chunks are freely stored, in which i keep track of chunks with a file hash, alongside ill probably come up with some naming strat to make sure the files are easy to query

left garnet
#

Who holds decrypt key

#

That will be security issue

pearl anchor
#

thats the issue, idk what the decrypt key should be, i was thinking it would be a 2fa based key, but idk how dynamic encrption would work

#

i could use the user password hash as a encrypt/decrypt key

hollow furnace
#

All our decryption keys are stored locally in the game files and if a user were to breach the files they would have to first find it and know what they are looking for. And obviously we get people who do this but it requires rooted devices

#

We have algorithms which automatically use the decryption key to decrypt the files

left garnet
#

Favor client holding the key and client side encryption

#

Unless not feasible

pearl anchor
#

isnt that bad security?

#

well not bad

#

but well understood

left garnet
#

If you hold the keys

pearl anchor
#

i? the backend?

#

or the user's devices

left garnet
#

Then government can force you to decrypt

hollow furnace
#

Itโ€™s using many different hashing techniques itโ€™s well protected

left garnet
#

Like in cases where FBI /CIA want access

pearl anchor
hollow furnace
#

But yes

pearl anchor
#

but techno, what do you think of using user password hash as the encryption/decryption key

left garnet
#

That podcast covers security

#

Heard pre internet encryption there

left garnet
#

I think security as layers

#

You can have that

pearl anchor
#

well that would be the last layer

#

the deepest layer

#

i gotta figure out the outer layers as well, but currently, i gotta figure out access to the last layer rn

left garnet
#

Plus extra layers the client side encryption

#

And the secure SSL tunnels

#

Only as strong as weakest link

pearl anchor
#

ssl tunnels

left garnet
#

Kinda complicated but there are bad actors

pearl anchor
#

i gotta program this now :/

#

idk if i should write this in python though, working with files, i would need a statically typed language to be more performant right?

left garnet
#

Yes as struct

pearl anchor
#

java has alot of file and data indexing tools

left garnet
#

Although can be done

#

Java is a pain sometimes thou

pearl anchor
#

yeah im not writting anything in java

#

forget about it

#

i can rewrite later xD

left garnet
#

I go with go or rust or py

#

Even C#

pearl anchor
#

should i use c#?

#

i've been using it recently for wpf

#

ig it would be a good idea to use a lang which built azure, which is what im trying ot mimic

left garnet
#

If you are MS platform

pearl anchor
#

well, im currently just doing web based client

left garnet
#

C# clean

pearl anchor
#

also, this server, is only going to communicate with my backend

#

which is in python,

#

i should create a diagram

#

but this server is proprietary, but its standalone to act as a database for physical files and server to serve the files to the backend to be reconstructed and dispatched

left garnet
#

Up to you if you can hold lt all in your head no diagram needed but later you might forget so diagram it

pearl anchor
#

its mentally diagrammed

#

just explaining it could be misinterpreted xD

#

but yeah, lots of sharp edge to sand down

left garnet
#

Kinda a game of telephone

#

I been discussing startup ideas with someone else and yes it happens

pearl anchor
#

what happens

left garnet
#

So yeah paper great

#

At least consensus is written

pearl anchor
#

oh i've been using paper alot

#

i've "sketched" the physical file storage arch

left garnet
#

Neat

pearl anchor
#

damn this is a huge project

left garnet
#

Good luck

pearl anchor
#

ig im just anxious about missing out on industry standard functionality

left garnet
#

If it works it can be big

#

Then pitch to venture capital

pearl anchor
#

is that a noun? or are they a company

left garnet
#

It's a type of corporation

#

A bank for startups

pearl anchor
left garnet
#

Go think global

#

There are Startup Accelerators

#

YCOMBINATOR is best

pearl anchor
#

idk about being a start up, my main competitor is google photos

#

they do lossless file hosting for up to 15 gb free for millions

left garnet
pearl anchor
#

but ig i've got some neat features that could please some privacy anxious people

left garnet
#

Which is great

pearl anchor
#

were all those companies funded by y combinator?

left garnet
#

Yes

#

And all started by folks like us

#

Why not us

#

Pivoting is ok

pearl anchor
#

oh yeah

left garnet
#

Some apply with idea only

pearl anchor
#

no way

#

thats gotta be hard to consider

left garnet
#

40 percent they say

#

It's better to apply with POC

#

And market traction

#

And revenue

#

But they don't exclude idea stage

pearl anchor
#

im working towards the PoC, and i've been working on my culpability as an application and its integrity

left garnet
pearl anchor
#

damn, i literally had no idea who y combinator were

left garnet
#

Everyone needs secure file storage

left garnet
pearl anchor
#

i can tell, you've been nothing but insightful and helpful

left garnet
#

Keep in touch then

pearl anchor
#

mate, you got it

#

okay well ig i should just stick with python and produce a file digest pipeline for now

#

i'll get a PoC and let you know how it goes

#

again, thank you sm for the advice mate, your a god gift

left garnet
#

No probs

zealous flint
#

What does the API docs say?

steel mulch
#

help please!

ember ledge
#

hi, i have a server that send to client like 10 times data, but i want to the client to print all the data that the server sent (like 10 times data). How i can do that?

#

but the client only print only 1 time data

#

no the 10th

#

summary: My Server send a message but i want to send a second message and I want to receive second message in the client

bold lark
#

I'm working on a tool that is mainly used with the command line. It establishes a network connection after being called from the CLI and keeps that network connection running as it shows the CLI GUI. The tool allows to send messages over the network and receive responses. Sometimes, there are messages received that are not expected responses and could be, for example, just for network management/status reasons. What are the best practices to manage network messages with such a tool? For a long while, I thought about having a different thread for network messages but then there's also the problem of IPC. I would appreciate some advice if anyone could help with this!

junior latch
#

Hello, I'm not really sure where to ask this, but how do I map an ip address to a domain or perhaps another ip address in windows 10? I've been searching for quite a while and couldn't find an answer, all I found was how to map a domain to an ip address where on the other hand I want to do the opposite.

lost chasm
#

how do i make a program that can connect via a room system.
ie one user hosts a room, and another can enter a code and connect to that with sockets.

indigo walrus
#

please help me - how to connect an IP camera to python ???

wicked vigil
#

Use its api

ember ledge
#

Hello, is there any way to control this raise that he throws?

#

try this:

        try:
            client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            client.connect((self.data["host"], self.data["port"]))  
        except (
            ConnectionRefusedError,
            socket.error,
            socks.ProxyConnectionError,
            Exception,
        ) as e:
            errorHandler(e, raise_=True)```
#

But it follows me without taking the exception

cold geyser
#

errorHandler raises the error?

#

if you catch it and then reraise it, it's quite obvious, that it's shown to you

jovial fable
#

I need to add a TCP server to my backend, we're currently running Django on the backend. I was thinking of adding it to Django since it is possible to add it, however since it can be deployed separately and Django is geared towards http requests, I was thinking of using another way, e.g. asyncio or twisted. Any tips/advice? (please @ me when responding/discussing ^^)

muted crypt
#

I'm trying to add optional reliability to a UDP socket connection. My choices are:

  • add my own packet headers with sequence numbers/acks
  • add a second TCP socket next alongside the UDP socket, just for the reliable items
#

the reason im not heading in the TCP socket direction by default, is it seems trickier to manage the connection state of two sockets everywhere than to just have one socket

#

anyone done anything like this / have a reco?

carmine narwhal
carmine narwhal
#

Anytime !

carmine narwhal
# muted crypt anyone done anything like this / have a reco?

Using option 1 requires you to manage the state of the connection and track the sequence numbers and ACK messages yourself manually, which is a little complex and annoying.

The second TCP socket means you can take advantage of the built in reliability of the TCP protocol, but you'll need to manage the state of twice as many sockets.

Up to you when it boils down to it. Which would you prefer?

muted crypt
#

I'm running python on embedded hardware that's pretty weak, ultimately if adding a TCP socket is not too much extra overhead, that's probably going to have less bugs than trying to roll my own on UDP

#

(pretty weak = 16mb system ram)

#

each device will only have to have one of these optional-reliability connections

carmine narwhal
long bobcat
#

Hey guys, I'm new in this srvr

#

So, I am having a Nokia G-140W-F WiFi GPON router, and I want to install OpenWrt on it, but its not supported by OpenWrt, so can someone please tell me how to do that

#

I even have its serial access with 115200 bps

#

It has an ECONET MTK7526G SoC or direct name EN7526GT its Clock Freq is 900 MHz. It has 512 Mb of DRAM.

#

Its a MediaTek Soc, but afterward MediaTek was acquired by EcoNet.

#

It uses 12V 1.5 A Supply to Power itself

#

Its default Software Which is made by Nokia X Airtel is very poor, because even in its Serial Access I don't get root access, its login & password are forbidden idk where, and even when I got to know its login & password I was not able to get the root access, because the Password2 Algorithm was not working in the software.

#

Also I'm using MobaXTerm & Putty for Serial Interface

carmine narwhal
#

@long bobcat It's not possible, because openwrt doesn't support ECONET MTK7526G SoC. It just isn't compatible with specific hardware. If you want to use a different operating system on your router, you may want to look for a different router that is supported by openwrt or a different OS. You should make a config backup first though! Just in case

#

There just isn't a way without some seriously hacky monkeypatching

zealous flint
#

I would not recommend monkey patching security systems into a router

carmine narwhal
#

Yeah that's why I said that it isn't possible

long bobcat
#

Btw, Tq for ur reply

keen gyro
long bobcat
#

Thank You

keen gyro
long bobcat
#

Tq

#

Spell it

#

Thank q

#

Spell Thank q

#

now from here q comes

carmine narwhal
long bobcat
#

k

carmine narwhal
#

I was using it as a metaphor to basically say it's impossible

ember ledge
#

I'd like to learn how to set up a peer to peer connection for my application. My application is coded in C. Where should I begin?

narrow axle
#

socket and selectors modules are interesting for this, you could also look into asyncio

lavish heron
#

Anyone from India?

fervent bear
#

To set up a P2P connection for your application in C, you need to Choose a networking library: There are several networking libraries available for C that can be used to set up a P2P connection. Some popular options include sockets, libp2p, and Boost.Asio. You will need to choose a library that meets the requirements and goals of your application. Then design the P2P architecture: You will need to decide on the overall architecture of your P2P network. This will involve deciding on the topology (e.g. mesh, star, etc.), the communication protocol (e.g. TCP, UDP, etc.), and the method of addressing and identifying peers. And finally implement the P2P connection: Once you have chosen a networking library and designed the P2P architecture, you can begin implementing the P2P connection in your C code. This will involve using the functions and APIs provided by the chosen networking library to create sockets, bind to a local port, listen for incoming connections, and connect to other peers.

quasi widget
#

i got a question, my phone is connected to wifi and i am using usb tethering on my phone to give my laptop internet as wifi is broken there, is there any way i can do port forwarding on my laptop?

carmine narwhal
#

That should be an option in your phone's hotspot settings

jovial fable
#

I am looking for advice on python network libraries to build a standalone tcp server that will communicate with a sql database and iot devices to get back data about them. I am looking for something using async/await syntax, currently looking into using tornado with uvloop. Any advice? Please do @ me

finite hill
#

anyone here doing mikrotik and python?

ember ledge
finite hill
finite hill
ember ledge
#

anyone have any recourses/docs for networking modules like py socket & OS

ember ledge
#

routeros_api

sudden pine
#

how do i start

lofty bough
#

Any decent resources on networking in games? I've never done that sort of thing, but I do have some general networking experience

zealous flint
lofty bough
#

๐Ÿ‘‰ ๐Ÿ‘ˆ @zinc bane

#

I'm actually also planning to fiddle with websockets

zealous flint
#

It's sort of a go to for games from what I hear

lofty bough
#

huh?

zealous flint
#

You can also take the easy way out with Unity or Unreal Engine which make multiplayer easier

lofty bough
#

I imagine there's a lot of overhead in websockets for very intensive games

#

but I may be wrong

#

I guess it's not huge

zealous flint
#

I'm not 100% on what the big engines uses for their network stuff

#

Probably their own protocols I'm guessing

lofty bough
zealous flint
#

Oh
C# and C++ might be able to compile to WASM if that's desirable

#

But if you're just writing your game in JS it's not a far cry (see what I did there?) to throw in web sockets with the rest of the stack as well

lofty bough
#

I guess there is an alternative, namely HTTP ๐Ÿซ 

zealous flint
#

Eugh

#

I wonder if that's feasible

#

Maybe for a turn based game? Lol

lofty bough
#

There's also SSE

zealous flint
#

Not familiar with that; what is it?

lofty bough
#

Server-sent events

#

it's something between websockets and HTTP... basically, the server provides an iterator of events

zealous flint
#

Ooh

#

Looks like reverse HTTP

lofty bough
#

ptth

zealous flint
#

Though I'm not sure what advantages/disadvantages it may have over websockets

lofty bough
#

well, it's a simpler protocol

#

The disadvantage is that the client cannot push events to the server. Although that can be done with just post requests if the game is simple enough

#

my parents played DOOM over lan before I was born, so surely modern networks can take a bit of an inefficiency ๐Ÿ™‚

red trellis
#

Hello guys can anyone help me udp client/server ipv6

torpid sparrow
quasi widget
#

i need port forwarding

crimson tundra
#

hello, Happy New 2023 first of all

#

Does anyone knows how i can get the subnet mask of the machine running the python code

#

i can get the ip address using "gethostbyname" but i can't find a way of getting the netmask

storm saffron
#

you'll need to know the interface you want to check on

#

or i believe you can accomplish it with built in socket

void cradle
#

not exactly python related, but can anyone recommend a good option for NAS ontop of Ubuntu Server running on a Libreboard (Rpi 4 alternative)? I am looking for a good way to take advantage of this 2TB SSD and SBC so I can share directories between machines, you know for python stuff

lost chasm
#

How would I go about setting up a peer to peer room system (preferbly with sockets).
So a user can open a room and another can enter the corresponding code to enter that same room

queen axle
#
import socket

def main():
    HOST = ""
    PORT = 50007
    with socket.socket() as s:
        try:
            s.connect((HOST, PORT))
            print("Connected!")
            while True:
                cmd = input("[SHELL] >> ")
                s.sendall(cmd.encode())
                while True:
                  data = s.recv(1024)
                  if not data: break
                  print(data.decode(), end='')
        except:
            print("Connection failed.")

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

someone said it could be blocking but I've tried messing around with that, didn't do anything

open isle
#

recv() will only return an empty response when the other side closes the connection somehow (manually or the connection failed), otherwise it will block until something is sent

queen axle
open isle
#

block as in the function call won't return until more data is received

queen axle
#

ah

#

I tried using socket.setblocking(False) and that didn't do anything

queen axle
open isle
#

yeah, setting the socket to nonblocking causes the socket.recv call to immediately return if there's nothing to be read, but that doesn't help much since input() is also blocking

#

you're trying to do two blocking operations at once, input() and recv() and multiplexing them in a single thread is tricky

queen axle
#

it works without the inner while loop, but then not all data is sent if it's larger than 1024 bytes

#

or is it bits

open isle
#

bytes

#

there are a few ways of dealing with this, use multiple threads to allow multiple blocking calls to run "at once" or other one which I recommend first

open isle
queen axle
open isle
#

sorry, gimme a moment to write some example code, it's easier to explain with some code

queen axle
#

I'm thinking to change up the if not data: break to a different condition

#

but what does the function return with when there's no more data to send (all data is sent, and now just an extra call)

open isle
#
bytes_sent = int.from_bytes(s.recv(4), byteorder="big")
response = bytearray()
while len(response) < bytes_sent:
    data = s.recv(1024)
    if not data: break
    response.extend(blob)
#

The important part is that the bytes describing how long the rest of the response is (in bytes) is of known fixed length (in this case, 4). The code can first recv the first 4 bytes (which shouldn't block indefinitely as the other side will at least send 4 bytes), decode that into an integer and then keep calling recv() until the response length matches what's expected

queen axle
#

oh I see

open isle
#

this way, your code knows when to stop calling recv()

queen axle
#

wouldn't it better to declare the data variable before the while loop?

open isle