#networks

1 messages · Page 27 of 1

fresh tinsel
#

Hello guys, somebody knows where I can find documentation or information about how to develop an NIDS with python?

west glade
#

So I created an API using FastAPI, Docker, Traefik, and Let's Encrypt
for some reason it works on my desktop but not on my phone
anyone knows why?

clear bobcat
late kestrel
#

Can someone please help me with the UDP protocol

#

I have searched the internet but no good resources

clear bobcat
late kestrel
#

I am trying to make a chat server using socket and UDP protocol

#

But getting an error

clear bobcat
#

It says nothing to me

late kestrel
#

k

west glade
#

I made a stack overflow post with as much detail as I can put:

storm saffron
#

ah

#

i didn't think netlify needed custom nameservers

ember ledge
#

how can i compare data when parsing?

ember ledge
#

is everyone here just doing TCP chats?

#

lol

late kestrel
near ivy
#

Hello, is this the correct channel to ask about gRPC?

iron hatch
#

@near ivy yes it is

#

When I'm running my server

#

I'm trying to send an image through a socket, and this is through my images server. However, I'm not sure if the image has to be in the same directory as my file is saved in.

#

Does anyone know if I need an actual png image or???

storm saffron
#

what

#

wait what

#

the path has to be a file path

#

not an HTTP url

iron hatch
#

@storm saffron What do you mean?

#

I don't understand.

storm saffron
#

you're doing open() on a url

#

which doesn't make any sense

iron hatch
#

oh

prisma cobalt
#

lmao

tropic sorrel
#

If you want to retrieve an image from a url you are going to have to use the requests library

chrome vigil
#

Anyone know how to setu

#

setup python to connect to mysql

#

database

untold trail
#

I assume you already have built the mysql db in this case?

north badge
#

hey folks, any websockets users in here? I'm running a dummy client against my websockets server with a bit of slow message handling on the server side and my server just crashes under load... it seems to be a crash within websockets:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/websockets/protocol.py", line 838, in transfer_data
    await asyncio.shield(self._put_message_waiter)
concurrent.futures._base.CancelledError
cerulean marsh
#

Is socket p2p? If so it’d be pretty easy to get people that are in a tcp chat’s ip

ember ledge
#

HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))
Would anyone know why i'm facing this error? i'm currently trying to ping google with proxies to check the quality of the proxies through repl.it (im building an api that uses proxies)

stable kestrel
fair dock
#

How can I send a protected payload using sockets through port 80 or 53

slender steeple
#

define "protected"

spring elk
#

hi, i want to make a tcp server that allows multiple people too connect through telnet(TCP) but for some reason the connection only allows 1 person at a time, is there a way to fix that

fair dock
storm saffron
#

that doesn't make it protected

#

you mean encypted?

ember ledge
# stable kestrel Try adding `ssl_version=ssl.PROTOCOL_TLS` to the HTTPSConnectionPool

How would I do that exactly with the python request module? i'm using the solution here https://stackoverflow.com/questions/61631955/python-requests-ssl-error-during-requests but it doesn't seem to be working

slow plank
#

Hi everyone. I'm trying to make an http proxy, and I would need some architecture advice (or verification that what I'm doing now is correct), if someone is willing to help...

fair dock
old mica
#

hello to all members of the community

torn harness
#

Does anyone happen to know of anything out there to generate network diagrams with Python?

nocturne agate
#

Hello #networks new to this flavor of python. Attempting my first 'monitoring' script where I check to see if google is up and running. When testing, I simply unplug my ethernet cable...trying to sort out my error handling.

#

def SAN_connect(): try: http = urllib3.PoolManager() r = http.request('GET', 'www.google.com') return print('SAN Drive: Connected') except socket.gaierror: print('SAN Drive: Disconnected, trying again in 10 seconds.') time.sleep(10) return SAN_connect()

ember ledge
#

gaierror is just for DNS related errors unless I'm mistaken.

You probably want to catch ConnectionError too

nocturne agate
#

@ember ledge thanks for the response <3. I'll look into adding ConnectionError.

honest silo
#

Hi, I’m usually lurking in #web-development but I have a really odd network issue. I need some advice if anyone has any. Recently deployed a django app on windows with Apache/MySQL. Works fine for most, but we’re seeing an issue with random users that are unable to reach the site. The server receives the SYN. Server just doesn’t respond to the traffic at all. Client can’t even ping the server—no response. If we ping that client IP from the server, suddenly the two hosts can communicate. This is even happening with hosts in the same network. I can’t imagine that has anything specifically to do with django or Apache as ping is also affected. Have any of you experienced an issue like this or have any suggestions?

storm saffron
#

Where's it hosted

#

The Django app

#

And the gateway I guess

honest silo
#

It is hosted internally, gateway correctly set to the upstream firewall/router

#

It’s a windows 2019 VM on ESXi

vernal stirrup
#

any way you could establish and AP and STA at the same time with one wifi chip? the idea would be to have two separate wireless interfaces perhaps?

ember ledge
#

hey, what can i do to receive multiple client responses at the same time?

#

current code:

def listener():
        
    while True:
        conn, addr = s.accept()
        print(addr[0] +" joined.")
        clients.append(conn)

def receiver():
    while True:
        if not clients:
            while True:
                if clients:
                    break
        
        else:
            clientresponses = s.recv(1024).decode()
            print(clientresponses)


threading.Thread(target=listener).start()
threading.Thread(target=receiver).start()
late wharf
#

Hi I need help with multi-threading

#

in python ^

clear bobcat
ember ledge
#

You have a few options. Spawn a thread for each connection, use the select/selectors module to wait on several connections at the same time or even use asyncio instead.

prisma cobalt
#

how vunerable is a website running of a raspberry pi behind a home router with no security measures implement other then default ones???

livid ore
#

When I have an rest api and it gives you a json with 60 items back is there somehow a general way to say the api I just want 10 items ?

#

Maybe some general query string parameter for the url

#

or maybe there is a way I modify the Http header to cut the response in half ?

clear bobcat
#

You should check API docs

storm pike
#

Can someone help me with some fundamentals arround subnetting. I am trying to figure out the answers in https://www.premiumexam.net/8-1-4-6-lab-calculating-ipv4-subnets-answers/ specifically part 2 problem 2 (but it applies to all), when they ask for the network address of "this" subnet, which subnet are they actually referring to as "this" subnet? Binary anding the original subnet or the new subnet neither produce the right answer for the network address

8.1.4.6 Lab – Calculating IPv4 Subnets Answers Lab – Calculating IPv4 Subnets (Answers Version – Optional Lab) Answers Note: Red font color or gray highlights indicate text that appears in the instructor copy only. Optional activities are designed to enhance understanding and/or to provide additional practice. Objectives Part 1: Determine IPv4 A...

livid ore
#

@clear bobcat no ?limit=n didnt work I think the api has not something like a query limit maybe its possible to cut off with http header

ember ledge
#

I dont think there is a standard there, just check how whatever API you are using handles pagination, if it does at all.

proper lark
#

.

shy pebble
#

!tvban 224629094904496128 14d do not spam to bypass the voice gate.

errant bayBOT
#

:incoming_envelope: :ok_hand: applied voice ban to @proper lark until 2021-03-17 18:01 (13 days and 23 hours).

shy pebble
#

!mute 224629094904496128 2d do not spam

errant bayBOT
#

:incoming_envelope: :ok_hand: applied mute to @proper lark until 2021-03-05 18:01 (1 day and 23 hours).

prisma cobalt
#

I have a dynamic IP with changes frequently, let's say I go on holiday and I want to connect to my computer from abroad after a few weeks

#

How can I if my IP has changed?

ember ledge
#

You cant unless you have a well defined way to get to it. Update a DNS record? Or somehow push out ip changes somewhere you know how to reach?

ember ledge
#

I'm trying to build a structure for tcp connection to transmit data, I do not understand what value to put as a checksum or the point of it. And after getting a syn ack how do I continue to transmit data? Can I put data in the first syn request to a server? Please help

trail bridge
#

what are the rules for the checksum?

#

is it suppose to be the entire header and segment?

ember ledge
#

I have no clue, I'm aware it's to make sure the data is given to the right host

#

A checksum is a pseudo header

#

And it's a segment

#

Same as say a window

#

Does anyone here know a professor who does networking I can talk to

trail bridge
#

check if this is useful for you

ember ledge
#

@trail bridge I give up back to scapy

ember ledge
#

This guide is an oldie but goodie

summer wren
#

@prisma cobalt you could have a running process in a machine inside your home network, curling ifconfig.me parse out the ip and auto push it to your github repo.

prisma cobalt
#

but i guess relying on someone with a static ip is importatnt

#

damn

prisma cobalt
storm saffron
#

yeah they don't connect directly to your home wifi

pliant seal
#

hey guys im trying to coummicate with asp.net code and python code in same server or computer how can i do that most effectively?

#

asp will receive the request and forward it to python and vice versa

summer wren
#

@prisma cobalt You could just send an email, or discord message with the ip though.

prisma cobalt
summer wren
#

The computer runs your program, checking its external ip every t (second, minute or hour) if it has changed since last sendt message it will send a new message.

#

Very easy to write such a script or program.

#

@prisma cobalt Use cronjob or task scheduler to execute it cause its safer then a long running loop.

prisma cobalt
#

@summer wren out of interest, if I had a static ip server in between, sure both devices could connect to it but how does the server keep track of the home router to send messages?

prisma cobalt
#

How does an app like Instagram send notification to my phone on my network

  1. I have a dynamic ip
  2. unless there’s a socket open at all times how does Instagram know which port to send data to
  3. how does it work really?
storm saffron
#

Your phone polls Instagram's servers constantly to check for any new messages @prisma cobalt

#

There are also methods like websockets or ways to keep the session alive that prevent needing to issue loads of http requests

gentle adder
#

I'd like to receive an audio stream over UDP and some data telling the application where to send that audio stream to in byte form. How would I go about this? Should I try tagging the routing instructions at the start of the audio frame and then split them back out afterwards or send and receive the instructions via a different protocol and socket entirely?

queen obsidian
#

so currently i have only one finished project that turned out not so good and i think its time to do another project this time something related to networking but i dont have many project ideas so what do you guys think?

round spear
#

I have been trying to develop a little script to help me import an "xls" file into my company system. But, I got some trouble finishing it. I would appreciate any advice. Link to my question: https://stackoverflow.com/questions/66481481/post-using-multipart-with-request-python

gloomy root
#

i'd probably look at implementing an existing protocol like WebRTC which implements UDP type streaming

gentle adder
gloomy root
#

google is your friend, i havent worked much with webrtc

gentle adder
#

No worries, thanks for replying anyway 🙂

#

Down the rabbit hole I go

ember ledge
gentle adder
#

You've found my rabbit hole 😅 just been reading all the docs I can on it

ember ledge
#

is there anything besides requests.lib

#

im so bored of requests.lib

gentle adder
ember ledge
gentle adder
#

So... WebRTC, would there be a way of doing a multichannel client with buttons where pushing button a would talk to person a and pushing button b would talk to person b? So far (and understandably) I can only find single channel or single group examples

lofty bough
#

!warn 792748774871138304 IP grabbers are not something we allow here. Considering your history, this is your last warning.

errant bayBOT
#

:incoming_envelope: :ok_hand: applied warning to @royal sequoia.

royal sequoia
#

this is not ip grabber

#

please do NOT say anything without knowing

#

i DO NOot even know how to grab ips

#

lol

#

😅

hidden crypt
#

i tried to port foward my server so i could connect from other computers and after the port is open i try to connect and get this error```
TimeoutError: [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

lethal mural
#

GLA 200

light zealot
late valve
#

hey
how can i turn my extra laptop into a storage server that can be accessed by IP address?

like i can do http://123.123.123/spunch_bob.jpg to download/see the image

crisp hill
#

@late valve nice question, I too have same doubt long time., as i have recently upgraded to full desktop PC

late valve
#

Ok

hazy lantern
#

how do i manage hundreds of networks at once cause my server crashes whenever alot of people(BOTs) are logged for testing then the server crashes

#

?

#

@late valve it is quite simple actually

prisma cobalt
prisma cobalt
lunar veldt
#
from aiohttp import web
import ssl


async def handle(request):
    return web.Response(status=200, text='OK')


app = web.Application()
app.add_routes([
    web.get('/api', handle)
])


ssl_context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
web.run_app(app, host='127.0.0.1', port=443, ssl_context=ssl_context)
```  When I go on my localhost , I can't see any response
#

am I missing something?

torn monolith
#

I know this is not really python related.

#

But does anyone here have expirience with t-pot honeypot?

#

Im trying to setup sensors with it but im stuck

ember ledge
#

Hey, I know that's it's bad practice to treat sockets as message-based, but is this appropriate for a UDP socket?

def recvall(sock):
    data = b''
    part, addr = sock.recvfrom(4096)
    data += part
    while not (len(part) < 4096):
        part, new_addr = sock.recvfrom(4096)
        if new_addr != addr:
            raise Exception('Address change from ' + render_hardware_address(addr) + ' to ' + render_hardware_address(new_addr) + ' during recvall()')
        data += part
    return data, addr```
`render_hardware_address` simply takes `(host, port)` and turns it into `'host:port'`
distant pilot
#

@late valve you could use filezilla server and connect from your main machine with filezilla client

ember ledge
ember ledge
#

you should probably just set up an SFTP server

light zealot
prisma cobalt
#

Yeah as TypeError said, opening the server on 0.0.0.0 is easier and allows connections from anywhere

hidden crypt
steady horizon
#

Pay for port forwarding? 🦆 that, I'd just buy a damn server!

worldly haven
#

I'm trying to build a client/server could you guys recommend a maybe a good beginner friendly resources

worldly haven
#

@ember ledge ty

ember ledge
#

You should read up on the socket and ssl modules

worldly haven
#

@ember ledge on the python docs

#

or on the link

worldly haven
#

thanks sorry

prisma cobalt
#

lol i recommend anyone looking for beginner code to a client server program to check the pins cause i have one

light zealot
late valve
#

@hazy lantern
@prisma cobalt
any tutorials online you could reccomend pls?
and yea i do want it to be possible to upload/delete/retrieve files with python

ember ledge
#

My friend is trying to make a FiveM server and his MODEM doesn't let anything through, please help ?

ember ledge
#

suppp hommie

#

how do you draw networx graphs

#

nicely

hazy lantern
#

@late valve I would recommend reading the official documents of the module...

tame dagger
#

Hi guys, i've been searching but I can't find anything good on this. Can someone please link me to a guide that will help me create a local proxy server?

I basically want to be able to send a get request through a local proxy server, then have the local proxy server send a request through an external proxy, then return the response/everything back to the original get request.

So:

Get request - Local Proxy Server - External proxy server - Target Website

hidden crypt
ember ledge
#

My friend is trying to make a FiveM server and his MODEM doesn't let anything through, please help ?

hidden crypt
torn imp
#

I'm not the best when it comes to python or HTTP and redirects.
But lets say I make a request to eu.something.com and I get a request back to towards us.something.com
Is there some nice libraries or tools to keep track on these redirects and keep it in cache? so when next url is called it goes directly to the us.something.com?
Any links to resources is very much welcome.

ember ledge
#

Just look at the response header @torn imp

#

The HTTP Location header field is returned in responses from an HTTP server under two circumstances:

To ask a web browser to load a different web page (URL redirection). In this circumstance, the Location header should be sent with an HTTP status code of 3xx. It is passed as part of the response by a web server when the requested URI has:
Moved...

buoyant kernel
#

I have problem with resolving fonts.gstatic.com . Ping says: (ping: fonts.gstatic.com: Name or service not known) but dig resolves it OK. When I ping IP that dig returns I get ping back. I don't seem to have problem with other domains ... fonts.gstatic.com IS NOT in my /etc/hosts block list.

ember ledge
buoyant kernel
#

I realise that this works for others but not sure how to debug it 😄

ember ledge
#

unironically good example code

jaunty ice
#

could one explain to me a way to implement voice chat/calling with Python3 sockets

ember ledge
jaunty ice
#

or just browsers

ember ledge
#

Browser are sockets with GUIs

#

So yes

jaunty ice
#

okay

ember ledge
#

Sockets gotta behave like HTTP for WebRTC to work

jaunty ice
#

is there an example program you'd recommend?

ember ledge
#

Not Python

jaunty ice
#

yea i found these

#

but like u said, not in python

ember ledge
jaunty ice
#

that seems even more confusing

#

im just bad

ember ledge
#

VoIP is not a beginner's project

#

Try something simple, like FTP and IRC, then move onto more elaborate protocols like HTTP

jaunty ice
#

k

#

thanks

smoky glade
#

anyone who can help me with web sockets??

#

i am really facing problem

#

to even fetch something from server it is taking a huge time.

#

and i need to fetch data for 500+ files.

royal sequoia
#

hey there

clear bobcat
jaunty ice
sterile igloo
#

is this the right place for socket connection related problems?

ember ledge
#

ig

sterile igloo
#

anyone willing to help?

#

it might be an easy question

#

idk tho

ember ledge
#

k

sterile igloo
#

u wanna help?

ember ledge
#

k

sterile igloo
#

pog

#

so

#

i'm trying to simply connect two devices using socket

#

and i've tried every logical address, but i cant seem to connect the two

#

i've tried localhost, 127.0.0.1, 127.0.1.1, my ip, and so on

#

but it just wont work

#

and idk why

clear bobcat
sterile igloo
#

wifi probably

clear bobcat
#

Probably?

sterile igloo
#

definetly

#

wifi's the one

clear bobcat
#

Can you see connected devices using router software?

#

Like enter 192.168.0.1 or something similar site

sterile igloo
#

u mean the ip of my device?

#

e.g. https://MYIP

clear bobcat
#

Okay, first of all - both of your devices are in same network?

sterile igloo
#

yup

clear bobcat
#

Then open browser and navigate to your router management site - for me it's 192.168.0.1

sterile igloo
#

am i supposed to have one?

clear bobcat
#

You should be able to check all connected devices to your WiFi network

sterile igloo
#

i'm not the one who owns the wifi or anything

clear bobcat
#

Which OS do you have on both devices?

sterile igloo
#

ChromeOS (linux) and android

#

i got a linux thing running on android tho

clear bobcat
#

Android should show you local IP address in settings

sterile igloo
#

got it

clear bobcat
#

Use iftables or something similar to get local IP address of ChromeOS device

sterile igloo
#

got that as well

#

i think

#

i got two adresses lmao

clear bobcat
#

So you can use local IP addresses to communicate both devices

sterile igloo
#

of which device?

clear bobcat
#

What?

dreamy patio
#

Open a command line and try to ping from 1 device to another

sterile igloo
#

hmm

#

with what command?

dreamy patio
#

Ping 192.168.1.2 for example

sterile igloo
#

i know the ping command but i've never pinged another device

#

ooh

#

k

#

lemme try

dreamy patio
#

Whatever the ip address is on the other device u are trying to reach

sterile igloo
#

it's working

dreamy patio
#

OK great so you know the other device is reachable

sterile igloo
#

yup

dreamy patio
#

How are you trying to communicate between the two devices in your code? TCP port?

sterile igloo
#

i think so

#

i'm using socket

#

just the normal bind((addr, port)) thing

dreamy patio
#

OK is there a firewall on the destination device perhaps that is dropping the packets to the port?

sterile igloo
#

not now pls

meager wadi
#

hi, can I run a function from another device using a server?

sterile igloo
#

probably

#

u can prob just do smth like ```py
when receive:
os.system(receivedmessage)

dreamy patio
#

Normally I would use something like tcpdump to see if the outbound packet is reaching the destination address or is dropped earlier

iron fjord
#

im sure this is a basic question but how could i check how many messages im receiving from the server
(i am using sockets)? py data = s.recv(1024) print(data.decode()) currently i have something like this but then that means i have to add it everytime i want to add something new to the server

ember ledge
#

Hello everyone!
Are there any (py)zmq specialists around here?

ember ledge
#

Nevermind. Found the solution.
For anyone interested: If you want to discard old messages,
setsockopt(zmq.CONFLATE, 1) must be called before connecting.

ember ledge
#

then each recv is correlated to each send

oak spoke
#

Is it possible to decode an encrypted packet with a public RSA key ?

small moat
#

depends if its the right key

ember ledge
iron fjord
ember ledge
#

and increase the count

#

whenever each executes?

iron fjord
ember ledge
iron fjord
hazy lantern
#

is netwirking difficult

#

?

#

@ember ledge what does recv mean?

ember ledge
#

recv stands for receive

#

send stands for well send

clear panther
#

Does ping measure the time it takes for the client's request to reach the server + time it takes for the client takes to receive a response from the server, or just one of the components? If it's the former, how should I go about measuring the two separate components? Thanks in advance.

PING google.com (74.125.68.138): 56 data bytes
64 bytes from 74.125.68.138: icmp_seq=0 ttl=107 time=7.984 ms
64 bytes from 74.125.68.138: icmp_seq=1 ttl=107 time=8.620 ms
64 bytes from 74.125.68.138: icmp_seq=2 ttl=107 time=8.677 ms
64 bytes from 74.125.68.138: icmp_seq=3 ttl=107 time=7.761 ms
64 bytes from 74.125.68.138: icmp_seq=4 ttl=107 time=16.289 ms
...
gloomy root
#

It messures the round trip latency

#

.e.g. Sending, receiving and sending the response back

hazy lantern
#

@ember ledge i really am a rookie in networking hence i make silly mistaks

jaunty ice
#

how can one test ping with sockets?

clear bobcat
dreamy patio
clear panther
#

since RTT is made up of time for client request to reach server + time for server response to reach client, I'm wondering if there's a way to measure both separarely

#

but I guess I can just take 1/2 of the average ping for a rough estimate

dreamy patio
#

Perhaps but what would be the reference point to measure against? The clocks would need perfect synchronisation to calculate the one way trip time on the reciever

#

Network elements would probably prevent this being accurate as the sender and receiver clocks would never be perfectly in sync

#

I suppose ita feasible in some kind of ideal environment but if you had that then you would have synchronous trip times anyhow

clear panther
#

it's ok I just needed to know whether the ping result is RTT or not that's all. taking 1/2 of that as an estimate should be good enough for me, I don't need it to be so precise

dreamy patio
#

Agree and in real world rtt is what is useful

sullen crag
#

someone help in #help-mango it's about sockets and networking

prisma cobalt
#

@sterile igloo if you still need help making a client-server script then ping/dm me

near ivy
#

Does anyone have any idea why post is equal to [] but when I check the posts stream through redis-cli it has items in it? When I append a new item the post is still equal to []

async def post_event_generator(request: Request, userID, redis: aioredis.Redis, latest_post_id: str = None):
    delay = 3
    while True:
        if await request.is_disconnected():
            break
        post = await redis.xread(["posts"], timeout=15)
        yield {
            "event": "OK",
            "data": {"test": True}
        }
        await asyncio.sleep(delay)
earnest storm
#

Hey guys so for the past weeks I was trying to make 2 sockets communicate with each other, it worked and everything was fine until I gave my friend the client file and he wasn't able to connect. I googled the problem, and it turns out I should port forward I did that but it didn't work so someone recommended ngrok for me but I had a very long discussion with a dude about how I can make it work and my friend was not able to connect can someone honestly help me?

pearl stag
#

@earnest storm are you sure the port forwarding worked? It's easy to check

light zealot
unborn kelp
#

Does anyone know of a good intro to networking course. I understand most of the basics from my security courses, but I would love to fill in the gaps on my knowledge.

ember ledge
unborn kelp
# ember ledge Read about the OSI model and various RFCs

Thank you, yeah I have read a little on the OSI model from my security classes, but I have never looked at RFCs. I was able to find the IETF site with RFCs listed. Any recommendations on where to start? Important ones to read?

ember ledge
#

My first was an IRC bot

#

FTP is pretty straight-forward too, makes for good beginner's projects

ember ledge
#

I still got the source code for the bot if you wanna take a look, but it's in C

unborn kelp
#

that would be great. I don't mind reading C and having examples is always helpful when learning concepts

ember ledge
#

Alright then, I'll dig it up in a few hours when I get home

dreamy patio
kind bridge
#

Guys I would like to send an email with Python, I found online that I have to connect to an SMTP Server like smtp.gmail.com but I don't know if the people that will use the program use gmail (and it doesn't work with 2FA I think).
Is it possible/reasonable to create a temporary SMTP server on localhost and send the email with the local host? So that I don't need a password and I don't need an account on any other platform

clear bobcat
#

Despite of this, when you are connecting to Gmail's SMTP server you are using your own account, not anyone else so you should know password and other factors to successfully authenticate

kind bridge
clear bobcat
#

I don't get it

#

If you want to send emails to users you can connect your Gmail account to your application and you can send emails to whoever you want

#

You don't need any details about receiver's account

#

Except email address ofc

kind bridge
#

Yes okay but I cannot store my gmail password in the code

kind bridge
ember ledge
#

Hi

#

I need a resource or anything that can help me in building an ICMP scanner, basically I want to build the equivalent of ping but something shorter just to see if an IP address is live or not, any ideas where I can begin?

#

If you want to do it yourself you need raw sockets for icmp and build the packets etc..

prisma cobalt
#

a pure python ping implementation 😂 the real question is why

ember ledge
#

Why not, its not like you will send 1 million icmp packets per second

prisma cobalt
#

Fair enough, and for the learning experience

#

But if you were checking if an ip was open surely you would just use a try except block to simply connect a socket

ember ledge
#

Ah yes good point i was assuming OP had a specific reason to want ICMP

#

@ember ledge thanks

#

@prisma cobalt I didn't know any other way but now that you said something about a socket, I am wondering if that's simpler and can you give an example?

#

initially I thought a TCP handler would do the job but from my networking experience icmp works all the time no matter what type of firewall is installed

dreamy patio
#

Ping responses aren't usually blocked whereas a tcp or udp socket could be so ping serves a lot of use

#

Ping is a great way to test basic reachability

prisma cobalt
ember ledge
prisma cobalt
ember ledge
#

I don't think so, I have to go back to my notes

#

checking...

#

@prisma cobalt ICMP doesn't use any port

prisma cobalt
#

Port 7 my bad

lunar veldt
#

no.. its port 7

prisma cobalt
#

Oh my bad again

#

Wait...

lunar veldt
#

it's called echo port

prisma cobalt
#

Ok try opening a socket on port 7, I think your gonna have to portward tho

#

Does the router intercept traffic on port 7 then to reply to then? I don’t understand

#

A computer shouldn’t need to be on in the network to check if the ip is active

lunar veldt
#

you can't open a socket on port 7

#

ports lower than 1024 are reserved to the system

prisma cobalt
#

Unless python blocks it you can still open a socket to those system ports

#

Just don’t be surprised if it doesn’t work

lunar veldt
#

it won't

prisma cobalt
#

If you ping an ip (which defaults to port 7) is it the router that responds ? Since you don’t need a computer to be on for the ip to be open

lunar veldt
#

Yes, you can still ping it if the router is open

prisma cobalt
#

So the router intercepts and responds to all requests on port 7?

lunar veldt
#

yes

prisma cobalt
#

Any other ports the router automatically intercepts and blocks?

ember ledge
#

I think you need root/sudo for raw sockets. Else i havent used scapy in a while so I dont remember the specifics

#

Also icmp doesnt have ports in the udp/tcp sense but packet types. And you can definitely block ping too with e.g. iptables

#

The OS answers to ping, if it is allowed, so you dont need a process to bind the port (there is no port)

prisma cobalt
ember ledge
#

Huh there is indeed this on port 7 https://en.m.wikipedia.org/wiki/Echo_Protocol

But its not what people generally mean with ping

The Echo Protocol is a service in the Internet Protocol Suite defined in RFC 862. It was originally proposed for testing and measurement of round-trip times in IP networks.
A host may connect to a server that supports the Echo Protocol using the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP) on the well-known port number...

#

"On various routers, this TCP or UDP port 7 for the Echo Protocol for relaying ICMP datagrams"

#

I doubt this is avaible by default on many hosts these days

ember ledge
ember ledge
#

would i look for help in or somewhere else

dreamy patio
prisma cobalt
#

ah yep, someone on a defference server said. A packet is sent to the router with the ICMP protocal in the protocol section of the packet header right?

#

no port needed

#

then the router responds

#

is that right?

dreamy patio
#

ICMP operates at network layer its not port bound

prisma cobalt
#

yeah so is the process i said above correct?

dreamy patio
#

The router will respond if that's the IP address you're pinging otherwise it will just forward it

#

If the router is 192.168.1.1 and you ping that address then the router will respond yes

prisma cobalt
#

but the thing about the ICMP thing in the header?

#

thats how the packets work?

dreamy patio
#

Yes it's protocol 1

#

In the header

#

RFC792 for ipv4

prisma cobalt
#

So it arrives at the router which decodes the header and sends back that it’s online and healthy

dreamy patio
#

Exactly

prisma cobalt
#

Hmm surely that could be used as a dos vulnerability since decoding the header might not be strenuous but it isn’t free

dreamy patio
#

Echo request from source and echo response from destination

prisma cobalt
#

What?

dreamy patio
#

That's a ping essentially it's an ICMP echo request/response

prisma cobalt
#

But if it takes a tiny bit of computing power to decode the header then, with enough requests it could shut down the router no?

#

Aka a dos attack

dreamy patio
#

But not most effective form of ddos

prisma cobalt
#

Hang on, if I’m not mistaken it doesn’t matter if it’s ICMP cause any packet sent will have to be decoded right?

dreamy patio
#

Yeh but icmp is lower layer so not much overhead there

ember ledge
#

For whatever reason I couldn't get scapy to work however I found another tool and made something out of it that works:

import pingscan, sys

def ip_scan(ip):
    if len(pingscan.scan(ip)) <= 0:
        status = False
    else:
        status = True 
    return status 

print(ip_scan(sys.argv[1]))
ember ledge
#

Thanks

#

Good work

#

ty, enjoy

#

I try this

iron fjord
#

is there a way to get a bool value on weather the client is connected to a server?

ember ledge
#

Return value of sock.connect for starters

#

I don't know exactly how Python handles sockets, but in C you're connected as long as recv() is a non-negative integer

iron fjord
ember ledge
iron fjord
ember ledge
#

Huh

iron fjord
#
    print(type(S.connect((IP, PORT))))```
ember ledge
#

Hi again

#

How does one recognize an IP address that's behind a CDN like cloudflare?

#

I just think that I need to get rid of any IP that's behind cloudflare because I cannot do a reverse IP lookup on them, any ideas how to get rid of them?

clear bobcat
ember ledge
#

I don't want to bypass cloudflare protection, I am asking how do I know if x.x.x.x is behind cloudflare

clear bobcat
#

Oh, my mistake

ember ledge
#

@ember ledge I need something to implement in my own project, I found this site which shows the IP's ISP as Cloudflare which is good enough:
https://whatismyipaddress.com/ip/104.21.12.42
however I don't know how to do that on python, I can of course use this website and then scrape results but I don't want to scan all IPs using this website, it's gonna cause a DoS attack

#

that doesn't give me what I want

#

I don't know how to do that on python
Send a GET or POST request

it's gonna cause a DoS attack
It's not, don't worry about it

#

Any modern web servers on any serious server can handle millions of simultaneous requests

#

No, from where I see it, it's gonna be an overload on that service, how can I implement something on my own?

#

ah right, because I was about to do 4 billions 😛

#

You only want to verify IPs that connects to you, right?

#

If not just throw in a second sleep timer after a few hundred thousand requests

#

but what if I wanted to do implement something like that purely in python?

spark frigate
#

I'd like to know how to make a python script on a raspberry communicate with another python script on my pc please?

#

via bluetooth

prisma cobalt
#

I was able to help you until you said via Bluetooth @spark frigate 😂

spark frigate
#

ow sorry 😂😂

#

yes else i use sokect

prisma cobalt
#

bluetooth has a shorter range then wifi lol

spark frigate
#

yes

#

maybe I should post in general

prisma cobalt
#

@spark frigate why are you using bluetooth then?

#

just use sockets and connect to the pi's local ip

spark frigate
ember ledge
#

What is everyone using for proxy support?

#

I used to use nordvpn but now it seems it's official dead with python http request

spark frigate
#

I know I can do it with sockets but the goal was to do it with bluetooth

prisma cobalt
#

Eh fair enough

pure chasm
#

Anybody have experience dealing with the Paramiko library getting an EOFError seemingly (randomly) for a specific sftp server?

occurs on this line:

with paramiko.SFTPClient.from_transport(transport) as sftp:

Works completely fine for other sftp servers. But for one server about 50% of the time a EOFError exception will be raised.

Debug logs show Authentication was successful then prints "EOF in transport thread" right before failing

light zealot
#

How do you minimize the network congestion delay in WAN?

#

I have a TCP client-server program that runs on WAN but sometimes the speed is incredibly slow

#

It's unnoticed while chatting but when streaming your screen, it lags a lot

#

Do you guys have any sort of tips/hacks for speeding up the program?

fossil thorn
#

anyone good with sockets?

clear bobcat
clear bobcat
light zealot
fossil thorn
#

How to connect two client in one socket?

clear bobcat
clear bobcat
fossil thorn
#

Which one?

clear bobcat
#

Maybe there is problem with your program speed

fossil thorn
clear bobcat
light zealot
clear bobcat
light zealot
#

yeah

clear bobcat
clear bobcat
fast crescent
#

Mesaage delivered duration data communication in networks can be of __ type.
a. Text
b. Audio
c. Video
d. Image
e. All of these

teal roost
#

does implementation of RPC in different language effects the performance ???

#

let say im using gRPC implemented in C++? is it gonna make much diff compared to its counterpart like go and java?

modest pebble
#

Depends on the number rpc calls you do

teal roost
#

can u be a bit descriptive about it ??

#

like how ? specially for gRPC?

teal roost
#

oh nvm i found the article on this 😄

prisma cobalt
#

Try a form of compression to speed it up

quasi juniper
#

anyone knows the difference between

`header = {'Authentication' : 'Bearer' + token}

header = {'Authorization' : 'Bearer' + token}`?

I know AAA, i know basic / bearer, but some examples from another API environment seem to use authentication vs authorization randomly, and i cant see a pattern?

clear bobcat
quasi juniper
#

in the specific context of HTTP headers, yes - or rather if Authentication in the header is even a thing, because i cant find anything on it

teal roost
#

isnt it just what authentication and authorization literally means ?? 🧐

#

normally to authenticate , u usually send authorization in the header which contains your credential (based on that ur gonna get authenticated) ----> for basic authentication

ember ledge
teal roost
#

and other interpretation for authorization can be if that token holder are able to request for performing certain task (like if they are admin , or just normal stuffs ) and authentication can be just authenticating the user credentials to sign in ---> for oauth

quasi juniper
#

you usually just send authorization + bearer/basic with a token. the question is if the header is still valid if you write Authentication instead of authorization, or if that is not a thing in HTTP headers

#

when i replace Autho with Authen 1:1 i get a 401 error, so im assuming it dont work like that

teal roost
#

Hmm iirc it sud work thinkmon

#

If the authentication worked

#

Ur doing it in the same session y3?

ember ledge
#

Lol

ebon mirage
#

'aiohttp' has no attribute 'post' how aiohttp work?

ember ledge
ember ledge
#

because the code line is critical to the program as far as I can tell

ember ledge
ember ledge
shy island
#

No connection could be made because the target machine actively refused it

#

i was trying socket programming and it threw this error while connecting to localhost

#

what does it mean

#
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('127.0.0.1', 55555))
s.listen()

while True:
    client, address = s.accept()
    print(f"Connected to {address}")
    client.send("You are connected".encode())
    client.close()
#
import socket
s=  socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 55555))
message = s.recv(1024)
s.close()
print(message.decode())
river sphinx
#

are you running the server first?

shy island
#

yes

#

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

normal whale
#

hello everyone i was making a port scanner after making it i am getting one error where should i post program

#

any type of help would be appriciated

thorny python
normal whale
#

import socket
import sys
from datetime import datetime

define_target

if len(sys.argv) == 2:
target = socket.gethostname(sys.argv[1]) # translate hostname into 1pv4
else:
print("invalid amount of argument ")

add a pretty banner

print("-" * 50)
print("scanning target" + target)
print("Time started:" + str(datetime.now()))
print("-" * 50)

try:
for port in range(50, 85):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(1)
result = s.connect_ex((target, port))
if result == 0:
print("the port {} is open".format(port))
s.close()

except KeyboardInterrupt:
print("\nExiting program.")
sys.exit()

except socket.gaierror:
print("Hostname could not be resolved")
sys.exit()

except socket.error:
print("couldnt connect to server")
sys.exit()

thorny python
#

what's the error?

normal whale
ember ledge
#

!code

errant bayBOT
#

Here's how to format Python code on Discord:

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

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

thorny python
ember ledge
thorny python
#

replace
target = socket.gethostname(sys.argv[1]) # translate hostname into 1pv4

with

hostname = socket.gethostname() target = socket.gethostbyname(hostname)

thorny python
normal whale
# thorny python nw

i tried runnig the scan but it didnt showed me any any error and no result

ember ledge
#

you're scanning yourself

normal whale
ember ledge
#

like this

ember ledge
normal whale
normal whale
ember ledge
#

ah

#

well uh

#

I guess

#

yeah probably

thorny python
ember ledge
#

then there are probably some more errors in your code

#

post the complete code please

normal whale
ember ledge
#

your code only has one line?

normal whale
normal whale
ember ledge
#

is the banner printed correctly?

normal whale
ember ledge
#

@thorny python

ember ledge
thorny python
#

You are checking if the socket returns 0, but if the port is not open it will return 10061

normal whale
ember ledge
#

ah okay

normal whale
ember ledge
#

do you even have any open ports in that range?

normal whale
#

i just saw why it is scanning local host inspite of giving my ip

normal whale
ember ledge
#

maybe try pinging 8.8.8.8

#

that's googles DNS resolver

#

oh wait

#

it might only have UDP and not TCP ports

normal whale
ember ledge
#

go for it

ember ledge
ember ledge
ember ledge
lunar veldt
ember ledge
#

when I connect to www.google.com on port 80, I don't need to bind to port 80 on my machine

#

likewise when I send a packet to port 7 on some machine, I don't need to bind to port 7 on my machine

prisma cobalt
storm saffron
#

they are reserved for administrators/sudoers

#

because they're often 'sensitive'/default services

fossil thorn
#

Do we have to host the socket anywhere to connect another computer?

merry ferry
near current
#

is there anything else that can python newtworking do than send messages?

shy island
#
import socket 
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
    s.sendto("sup",("127.0.0.1",5002))
#

it is throwing an error

#

TypeError: a bytes-like object is required, not 'str'

shy pebble
#

"sup" represents a sequence of unicode codepoints, but networking operates on sequences of bytes. In order to get a sequence of bytes, you can do b'sup'

#

or "sup".encode(some_encoding)

shy island
#

@shy pebble but there's a problem

#

thats why i was not using b prefix

#

it prints b itself

shy pebble
#

print once again takes a string. So you need to decode the bytes into a string

#

which you do with some_bytes.decode(encoding)

shy island
#

oh , from the client side?

shy pebble
#

yes

shy island
#

got it

shy pebble
#

if you want to send a string, you need to convert it into bytes, send it, then convert it back into a string on the other side

shy island
#

ohk thx!

#

@shy pebble also if i use break then the program doesn't wait for the message to receive

#

it just endss

#

is there a way to end the program after I receive

fleet venture
#

Hi, I'm trying to make a web scraper(only 2nd day doing python), The website has now blocked me and returns "ACCESS DENIED" when I view in chrome same thing, when I use proxy in chrome I can see the website, but then when I use proxy in python its still "ACCESS DENIED", I am changing user agent, but what else can I try? how can they detect me??

prisma cobalt
#

ah thats for sockets at least, i misread your question

#

"networking" can do loads

#

imagine a webscraper

native zinc
#

I'm running a simple ICMP script using scap:

response = srloop(IP(dst='4.2.2.2')/ICMP(), count=5, timeout=5)
if response:
    response.show()```
And after I run it I get the following error:
```Traceback (most recent call last):
  File "/Users/mali/Documents/Python/Scripts/icmp.py", line 2, in <module>
    response = srloop(IP(dst='4.2.2.2')/ICMP(), count=5, timeout=5)
TypeError: IP() got an unexpected keyword argument 'dst'```
Any idea what I am I doing wrong?
#

Reading through their documentation that is how it is supposed to look like. Not sure why dst is showing up as unexpected

prisma cobalt
#

when i send a message on discord, several packets are sent to their servers (162.159.135.232), if i resend the exact same packets would the same message be sent on the same channel?

prisma cobalt
near current
#

any other?

#

i tried and i found on yt just texting

prisma cobalt
#

I mean, the lamp would have to be connected to WiFi and able to accept commands, another way of doing it would be to get a raspberry pi, run the recieving script and set up a servo to turn the light on and off

tame tinsel
#

Hi, guys. Trying to get QtWebsocket connected to the starlette FastAPI websockets. Can't seem to get them connected in a local host scenario since its giving me an authentication problem 403. Mind if could get some help?


from fastapi import FastAPI, File, Body, WebSocket
from fastapi.responses import HTMLResponse, JSONResponse

app = FastAPI()

class ConnectionManager:
    def __init__(self):
        self.active_connections: List[WebSocket] = []

    async def connect(self, websocket: WebSocket):
        await websocket.accept
        print('mother fucking connect')
        self.active_connections.append(websocket)

    def disconnect(self, websocket: WebSocket):
        self.active_connections.remove(websocket)

    async def send_personal_message(self, message: str, websocket: WebSocket):
        await websocket.send_text(message)

    async def broadcast(self, message: str):
        for connection in self.active_connections:
            await connection.send_text(message)

manager = ConnectionManager()

@app.websocket("qt_ws_test")
async def websocket_endpoint(websocket: WebSocket):
    #await manager.connect(websocket)
    await websocket.connect()
    try:
        while True:
            peep = await websocket.receive()
            print(peep)
    except WebSocketDisconnect:
        manager.disconnect(websocket)
#

And my Client Websocket is straight out from an example:

import sys

from PySide2 import QtCore, QtWebSockets, QtNetwork
from PySide2.QtCore import QUrl, QCoreApplication, QTimer
from PySide2.QtWidgets import QApplication


class Client(QtCore.QObject):
    def __init__(self, parent):
        super().__init__(parent)

        self.client =  QtWebSockets.QWebSocket("",QtWebSockets.QWebSocketProtocol.Version13,None)
        self.client.error.connect(self.error)
        #self.client.open(QUrl("ws://localhost:8000/qt_ws_test"))
        self.client.open(QUrl("ws://127.0.0.1:8000/qt_ws_test"))
        self.client.pong.connect(self.onPong)

    def do_ping(self):
        print("client: do_ping")
        self.client.ping(b"foo")

    def send_message(self):
        print("client: send_message")
        self.client.sendTextMessage("fefefefefefefepppppppp")

    def onPong(self, elapsedTime, payload):
        print("onPong - time: {} ; payload: {}".format(elapsedTime, payload))

    def error(self, error_code):
        print("error code: {}".format(error_code))
        print(self.client.errorString())

    def close(self):
        self.client.close()

def quit_app():
    print("timer timeout - exiting")
    QCoreApplication.quit()

def ping():
    client.do_ping()

def send_message():
    client.send_message()

if __name__ == '__main__':
    global client
    app = QApplication(sys.argv)

    QTimer.singleShot(2000, ping)
    QTimer.singleShot(3000, send_message)
    QTimer.singleShot(5000, quit_app)

    client = Client(app)

    app.exec_()
ember ledge
#

I tried to pip install Cartopy and this happened. Can someone explain me what to do?

slender steeple
#

pip install Cython?

#

Also this is the wrong channel

vernal jackal
#

anyone here knows about binanace futures in cctx?

pine pulsar
#

Hello, any one can help me about that?

prisma cobalt
#

your server crashed or is down

slow kraken
#

Hi a question, is there any way to see the connection history with Python. That is, I want to see all the connections that have been made to the pc since it was turned on. Is there any way?

ember ledge
#

How do I make HTTP/2 requests with requests library? According to official documentation of requests library, it seems to only support HTTP/1.1 request. Would you please tell me if there is another library for making HTTP/2 requests?

#

@ember ledge

ember ledge
#

@ember ledge

#

And another question: I want to try out the new HTTP/3 (QUIC) protocol and I found the repository aiortc/aioquic on GitHub. Is it really necessary/useful for HTTP/3 (QUIC) support, or should I wait until QUIC is a formal RTC instead of "draft"?

gloomy root
#

litterally no point trying todo HTTP/3 rn

#

HTTP/2 is only just starting to be developed for most frameworks and servers HTTP/3 is still a distance dream for anyone other than Google

gloomy root
#

I mean cloudflare still have mixed success with HTTP/3

#

it still gets disabled and re-enabled fairly often

smoky belfry
#

yo

spiral drift
kind bridge
#

Guys I made this, https://github.com/0xfederama/connection-analyzer, my first program in Python. It's a tool that analyzes your internet speed and prints it to json, calculating averages and other values and detects issues.
What do you think? I don't want to spam, I'm only asking for code review and things like that (it's only 100 lines of code)

ember ledge
#

Hi evryone , is it possible to make a worm that spreads over the LAN using python ?

native zinc
prisma cobalt
errant bayBOT
#

The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.

prisma cobalt
ember ledge
prisma cobalt
#

you want a worm... that infects everyone on the network... to fight scammers?

#

you gotta know how that sounds

kind bridge
kind bridge
ember ledge
ember ledge
#

You can compile it to an ELF, but it still has GC and shit

ember ledge
prisma cobalt
#

C/C++

ember ledge
#

ow , tnx

#

I've very recently taken a liking to Crystal

#

It's Ruby, but compiled

prisma cobalt
#

i want statically typed, compilied python... is that just C#?

gloomy root
#

c# is nothing like python lol

#

with or without the static typing

#

C#'s closest cousin is probably Java

steady horizon
#

C# is just Microsoft's ripoff of Java

steady horizon
#

nim looks very similar but it doesn't have classes soo

rare leaf
#

Why do I get 422 when adding 'Content-Type': 'multipart/form-data'

ember ledge
#

Classes lemon_grimace

teal roost
obtuse grotto
gentle bobcat
#

nice code

modest pebble
#

@light zealot please don’t advertise your project here

ember ledge
#

does anyone any know good books for socket programming in python?

jaunty ice
ember ledge
# jaunty ice i'm interested in this too

i am like thinking of creating like a simple sever that me and my friends can chat on, so was just wondering if there are good books out there cos like yt tutorials on it aint that good

jaunty ice
jaunty ice
#

can i dm, u seem like a cool guy

ember ledge
#

pickle data was truncated

#

:((

#

Someone who can help me with this error?

sharp geyser
#

I would love some help on socket please, if someone could help me ^^

ember ledge
sharp geyser
# ember ledge Help with what exactly?

I've set up a socket server and clients for my game, but I might did some oppsies and it's not working as I thought. I was thinking of two different computers can see their opponent's score in sync.

fossil star
#

I am using selenium to do web scraping and using some proxies with auth and there is no way with chrome to set up a proxy with auth using the headless mode, therefore I am looking into setting up a local proxy with no auth which will then forward the request through one of the proxies with auth that I have

#

Anyone have any libraries or examples to get that going quickly?

solar oyster
#

Are all the internet methodologies used 30, 20 years ago still in use today?

fossil star
#

Anyone have any experience using mitmproxy to forward requests through another authenticated proxy `?

cold charm
#

how to check if my selenium or requests instance is behind a proxy? How can I check if my set proxy is working?

ember ledge
rose patrol
#

run a socket server online free python no credit card how

ember ledge
boreal crane
opaque hedge
rose patrol
boreal crane
#

hey

rose patrol
#

i can't get the ip

#

like i have it working on their localhost but idk the ip so idk how to connect

#

:c

boreal crane
#

hmmmm

#

is there any chance you could use an http server instead?

#

they're easier to work with on repl.it

#

if not, still set up a simple flask webserver, then you can get the URL for your webapp

#

use an ip lookup tool to get the ip from the URL

rose patrol
#

can you help me convert my app to that @boreal crane cause im confused

#

lol

boreal crane
#

well, what are you using the socket server for

rose patrol
#

chat app

#

gonna send you the link in dm

#

@boreal crane accept fr

#

you there?

boreal crane
#

yes

#

dms are closed

rose patrol
#

i see

#

cool

#

just open the link then ill delete it k?

boreal crane
#

so, you could make the socket server an http server instead, that has more benefits anyway

#

is your chat app 1 on 1 or group?

rose patrol
#

group as many people can join

#

as they want :c

#

what is your repl username

#

:c

boreal crane
#

not necessary cuz here's what you're going to do

rose patrol
#

cool

boreal crane
#

your server.py will have a simple Flask server to handle incoming REST requests

#

google these terms to learn more

boreal crane
#

it's the same logic as your socket chat

rose patrol
#

i didn't make it :c i followed a tutorial :c

boreal crane
#

just use a flask server instead

#

oh

#

then you can either change it to use an http server or you can host it on something other than repl it

#

but no one really uses raw sockets

rose patrol
#

how

#

@boreal crane

rose patrol
#

@boreal crane

storm saffron
#

So

#

What

#

You didn't even make this program

#

Why bother converting it

ember ledge
#

Would this be the channel to ask about gRPC and python? Having problems generating the classes from a Pom

ember ledge
#

Love python

boreal crane
#

there's plenty of tutorials

rose patrol
#

:c

pseudo pawn
#

Hie guys
Has anyone used python to print files using a printer on a network?
How best to achieve this
work prject

velvet lichen
#

Hi. i have a tiny noob question:
I'm messing around with python socket and i came a cross a problem....
Computers outside my network cannot connect because my router blocks them. Right? anyway, i looked it up all day and the only thing i found about it is that i need "port forwarding". I also saw something called "UPnP". The only thing i know about it is that: it can forward ports.... Again, i'm a total noob at networking..... Anyway, is there a way i can maybe use UPnP in python (if it has anything to do with my prob) or there's other stuff i can do about it?

clear bobcat
prisma cobalt
#

Look up the steps of port forwarding for your router

velvet lichen
#

but UPnP has anything to do with port forwarding? just wondering.

prisma cobalt
#

You only need to portforward lol

#

I’m not familiar with UPnP but I myself have portforwarded several ports to alllow connections

velvet lichen
#

ok. btw, should i be worried about security while port forwarding?

atomic helm
#

hi ,everyone here, i am a beginner of python and i am learning the django now

prisma cobalt
#

But if u do (aka a server.py script) then anyone can connect

#

But that doesn’t allow them acces to ur computer lol

velvet lichen
#

ok

#

unless ssh is on that port right?

#

i dont have ssh on anyway so idc

prisma cobalt
#

Your trying to implement ur own ssh?

#

But... why 😂

velvet lichen
#

i dont.

prisma cobalt
#

Oh

#

Ssh is already a feature of windows 10 and Linux

velvet lichen
#

Windows 10?!

prisma cobalt
#

Yep

velvet lichen
#

lmao

#

"they stole it from us"

prisma cobalt
#

Altho you have to install a feature to connect to a win 10 PC, connections FROM a win10 pc work out of the box

#

Lol

velvet lichen
#

noice

sage yew
#

Is there a way to find out how a webpage generates its token? thats added in the login

true ocean
#

Can i somehow ignore windows host file using requests or urllib

lunar dune
#

Hey trying to use

Repo.clone_from(url,repo)

This is for an internal private github repo. Already have a .pub ed25519 key attached. How do I pass the key in python to clone?

Mind you this script will be ran by standard users

pseudo pawn
#

Hi guys
please i need help
how do i print a file using win32print using a printer on a network

coarse mango
#

i m using selenium for automation in web but it opens in another google chrome window resulting for me to sign out n note able to join google meet through it
pls help me with this

outer mirage
#

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

sterile loom
#

Where can I learn the inner mechanism of a VPS hosting service?
I mean the protocol, VPS management, VPS management automation, user dashboard, VPS building automation after purchase or after order, IP management, backup management, user admin services etc.....
I mean the whole system if I want to start my own VPS hosting business, not the reselling one.
Can anyone please tell me if you know anything?

gloomy root
#

That is a incredibly big task for a single person todo

#

you need to buy the servers, the internet, the ip blocks, the panels, build a dashboard, setup micro k8s, setup licenses, repos, virtual routers etc....

#

handling billing

#

handle load balancing

#

handling data protection

#

handling security

#

the list goes on

sterile loom
#

No, I am not doing it alone. I also have my friends on it. Is there any source where I can learn the building process of this system? If you know please kindly tell me. @gloomy root

gloomy root
#

i mean its not something you just follow an article on

#

its hundreds of tools and software

#

and btw, if you're under 18 then you legally shouldnt be trying to make a hosting company

#

if you're over 18 i still recommend you consider the legal implications before doing anything

#

and then you're gonna need to get really good at dev ops tools like K8s, look into spend a few thousand on Ips and servers etc... atleast

outer mirage
#

yep. starting a hosting company is expensive and legally challenging. i urge you to talk with a lawyer about the legal requirements.

sterile loom
#

But why can't I start it if I am under 18?

gloomy root
#

because of the following

#
  1. you're not old enough to sign legally enforceable contracts in most country
  2. you often lack the maturity and skills to provide the services that you offer to a reasonable standard
  3. you lack the funds, hosting company cost tens of thousands for even a small system, even a small hosting company will put hundreds of thousands of dollars into setup and infa
  4. you're not old enough to sign for commercial contracts with internet providers
  5. You're not old enough to understand how much liability you put yourself under with GDPR
#

If i am a customer of your company

#

and you have a security leak and my data gets leaked as part of that

#

i can guarantee that im going to be coming after you with a lawsuit miss-handling my personal data

#

And im sure your parents arent going to be happy if you have to turn up to court and pay and incredibly large amount of fines just from one person let alone if others took action

sterile loom
#

I see....

gloomy root
#

and then we get onto the other point

#

you got a data center laying around? if not, get ready to buy commercial spaces

hardy hatch
#

Hi!
I want to communicate between two devices on the same network.
The communication doesn't need to be bidirectional, but I need it to be as quick as possible.

gloomy root
#

for what purpose?

hardy hatch
#

I need to send GPS coordinates between devices.

#

I am thinking between using sockets and Mqtt.

gloomy root
#

well for the fastest method would be UDP sockets

#

however

#

they're un-reliable transport

hardy hatch
#

Mqtt is sweet since it is easy to use and it should be quite performant.

gloomy root
#

easiest is probably Websockets offer good latency while being relatively simple and easy to use

#

but anything like http request or that are gonna be about the same time in reailty

#

only a couple ms betwen the two but you're looking at probably at most 5ms around a local network providing you're not on some 50kbps local network or smth

hardy hatch
#

You think that websockets are better than plain mqtt?

gloomy root
#

shrug depends on what you want todo and their implementations

#

typically with MQTT implementations have a decent amount of extra processing but ig try it and see

hardy hatch
#

okay

#

another quick question

#

do you have any tips for me how to handle latency and dropped packages?

#

where should I get more info? what to look for?

gloomy root
#

well for dropped packages you generally shouldnt worry if its via tcp because it's reliable

#

if you're talking about say multiple workers and if a worker goes down the task isnt lost then RabbitMQ is good

#

but equally that increases latency

lunar dune
#

Anyone know how to do a git clone with a public deploy key?

true ocean
#

When im using pyenet with the example from github it isnt receiving anything but wireshark shows the requests coming

storm saffron
#

well

#

use websockets i guess

#

not sure what your question is

rancid geyser
#

how do i pass arguments to ipc on discord-ext-ipc?

#

i have this

        guildobj = await ipc_client.request(f"get_guild", guildid)

and want to pass the guildid

errant pine
sterile loom
#

@gloomy root
I understood why I should learn DevOps but I can't understand why should I learn k8s regarding yesterday's topic. (My knowledge is very low on k8s)

gloomy root
#

Which is exactly my point in why you ahould know it

#

But this goes back to whole: setting up a hosting company is a really bad idea for a group of kids or even a group of adults todo

supple oak
#
# (TCP)
# CLIENT
with open(src_file, "rb") as f:
    l = "1"
    while l:
        l = f.read(4096)
        sock.sendall(l)
# resp = sock.recv(1024).decode("utf-8")

# SERVER
with open(dest_file, 'wb') as f:
    l = "1"
    while l:
        l = clt.recv(4096)
        f.write(l)
# clt.send("0".encode("utf-8"))

so if i execute this code alone the program(s) run correctly. but if i do the same with the post-file-sending part uncommented, it just halts. why?

prisma cobalt
#

Change l = “1” to l = True

supple oak
#

hows that gonna change anything, the file does pass over through the socket in both cases

prisma cobalt
#

Is there an error?

supple oak
#

so the program does enter the while loop

#

no

#

it just halts, stays completely still

prisma cobalt
#

Hmm

#

are you sure it’s relieving data?

#

Cause the .recv is a blocking method

supple oak
#

yeah

#

like i can literally open the file once its done sending the data, even though it halted right at the end

#

hmm

prisma cobalt
#

You know every time you run the server script the file wipes itself before writing data

#

Just checking

#

I can’t see an issue from that tho

supple oak
#

can i alternatively just close the socket and then reopen it?

sterile loom
#

@gloomy root
Sorry I wasn't clear enough in the above question. At that time I meant which types of activities do they perform on VPS or web hosting company using k8s?
Would you please explain if you know?

merry ferry
#

can someone help with SMTPlib?

slim apex
#

What would I use to make a program that would run on my main computer and have some type of function called runProgram() which would run a different python program on a different pc which would return some type of info like true or false back to the main computer

#

Different ips too

ember ledge
#

Guys yesterday I made an email spam machine check it out

#
import smtplib
print("THE SPAM MACHINE")
chabon1 = input("Ingresar nombre de usuario:")
contra = input("Ingresar contraseña:")
chabon2 = input("Direccion:")
mensaje = input("Mensaje:")
iteraciones = input("Iteraciones:")
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(chabon1, contra)
for i in range(int(iteraciones)):
    server.sendmail(chabon1,chabon2,mensaje)
#

Sorry for the weird language, it's argentinian spanish

prisma cobalt
#

This... spams emails?

#

!rule 5 lmao what is it with people

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.

lunar veldt
#

Does the gateway IP refer to the router?

ember ledge
#

Hack

#

Good

limber shoal
#

is there a way to pass ssl cert & key into python requests as a variable? only ve seen that i have to pass the file paths

ember ledge
#

Hello if i will send via sockest smth like that send(f"some text & {pickle}") how i can depickle pickled object in reciver site?

shy pebble
#

you will need to send the size of the pickle or some other way to determine where the pickle ends

ember ledge
#

sending works fine, but there is string insted of pickle, i was trying to msg.split('&') but there will be still lists of strings

#

and i can't unpickle it

shy pebble
#

keep in mind that single a send could be multiple receives

#

and a pickle can contain any bytes, including &

ember ledge
#

Hmm, can you help me if i write you code? Im new in sockets

shy pebble
#

you do need a size, so that you know how many bytes to receive in order to get the complete pickle

ember ledge
#

yeah i got size as well

#

while connected:
msg_length = conn.recv(HEADER).decode(FORMAT)
if msg_length:
msg_length = int(msg_length)
msg = conn.recv(msg_length).decode(FORMAT)

#

is from server loop

#

def send(msg):
message = msg.encode(FORMAT)
msg_length = len(message)
send_length = str(msg_length).encode(FORMAT)
send_length += b' ' * (HEADER - len(send_length))
client.send(send_length)
client.send(message)

#

if from client site

#

send(f"smth &{player_class_dictionary_global_ready_to_send}") this is the send commend i try to use

shy pebble
#

try smth, ampersand, pickle = msg.partition(b'&')

#

also don't decode the received bytes if they contain a pickle

#

since well, a pickle isn't text

ember ledge
#

okey so there will be smth like that msg_pickle = conn.recv(msg_length)

#

smth, ampersand, pickle = msg.partition(b'&') where i have to try it?

ember ledge
#

If you @shy pebble or someone else will be kind to show me how to loads pickle in that loop, i will be more than greatfull

limber shoal
kind furnace
slate spear
#

hi! im working with sockets and im trying to create a chat room. i have server.py and client.py. this is server.py: https://mystb.in/AnnaOakTerminals.python

at the moment, clients can only send messages to the server and those messages appear in the terminal. im not sure how to make it so that when a message is sent, it is broadcast to all active threads. im also unsure how to configure the listener in client.py so that it can detect incoming messages, as im using tkinter in client.py.

sonic pendant
#

Is there a way to hack into a bank and steal crypto currency?

carmine charm
north timber
#

How can I use onionshare in my python client code so that the code can send files to a tor server or a server that also uses onionshare? and it would be best if I could implement onionshare in the client so that I don't have to have the lib installed on the pc, has advantages if I convert the project later. I'm still trying it out locally on my pc, that is, sending files and connecting via tor, but I want to use onionshare so that everyone can send files anonymously to my tor server with the client code. would be nice if someone could explain that to me

jaunty ice
#

I know many people have already created such a thing, but I'd like to make a COVID tracker. It'd be just for fun. Is there an API for python for the CDC website or COVID tracker, or do I just need to scrape?

jaunty ice
prisma cobalt
#

Taking one for the team

jaunty ice
#

ooo, nvm lol

bronze river
#

lol

prime bolt
#

is there a way to get the redirected url when doing an aiohttp request?

ember ledge
#

Hey anyone got resources for python network autonation course

prisma cobalt
ember ledge
#

hello, does anyone know if there's virtual lan program made in python (something similar to hamachi)

#

a github link or something like that would be highly appreciated

ember ledge
# prisma cobalt what are you thinking of trying to do?

Thanks for the reply mate, well I actually got pretty into networking in college even though my Prof is trash. And I've been wondering would I be able to get a job doing autonation for small or large networking company.for example building softwares for to subnet the networks or make network more secure with different integrations built with software.

#

just curious is it possible to host a python socket server with a computer cluster?

prisma cobalt
#

wait... do you mean automation??

green arrow
#

I am trying to make a discord bot but it needs to be connected to the discord websocket and a chess websocket. Any idea how I should structure a project like this? Should/can all this be running in one event loop?

ember ledge
#

hi can some one tell me how dou i get the time when client sent something to server

prisma cobalt
prisma cobalt
#

import time

#

Time = time.time()

ember ledge
#
import socket
from datetime import datetime
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
server_port = 65533
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
input_s = 'Hello, server!'
client_socket.sendto(bytes(input_s, encoding='utf8'), ('111.1111', server_port))
input_s_modified, address = client_socket.recvfrom(65535)
print ('[CLIENT] Response from server {}, is: "{}"'.format(address, str(input_s_modified.decode('utf8'))))
client_socket.close()
#

this is my code

marble gulch
#

he said put import time at start dude

prisma cobalt
#
import socket
from datetime import datetime
import time
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
server_port = 65533
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
input_s = 'Hello, server!'
client_socket.sendto(bytes(input_s, encoding='utf8'), ('111.1111', server_port))
print(time.time())
input_s_modified, address = client_socket.recvfrom(65535)
print ('[CLIENT] Response from server {}, is: "{}"'.format(address, str(input_s_modified.decode('utf8'))))
client_socket.close()
marble gulch
#

noice

prisma cobalt
#

wait it depends what format u want it in

#

@ember ledge

marble gulch
#

how would you try and execute commands at given times @prisma cobalt

prisma cobalt
#

what do you mean?

marble gulch
#

so like say i want my program to print a message when time = 9 or smthn

ember ledge
marble gulch
#

like i want to know the basic structure so i can implement into my bigger project

ember ledge
#

its like "11:08pm" Hello server !

prisma cobalt
marble gulch
#

windows

prisma cobalt
#

windows has task schedular
linux has cron

marble gulch
#

as a prebuilt software?

#

oh as a module

ember ledge
prisma cobalt
prisma cobalt
#

so you make seperate scripts and schedule them

marble gulch
#

ah ok

prisma cobalt
#

theres probably a better way tho lmao

ember ledge
#

what did i dou wrong ?

#
import socket
from datetime import datetime
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
server_port = 65533
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
input_s = now,'Hello, server!'
client_socket.sendto(bytes(input_s, encoding='utf8'), ('1111.1111.111
', server_port))
input_s_modified, address = client_socket.recvfrom(65535)
print ('[CLIENT] Response from server {}, is: "{}"'.format(address, str(input_s_modified.decode('utf8'))))
client_socket.close()```
#

File "c:\Users\pro21\OneDrive\Desktop\ghost projects\python net programing\udp_client.py", line 8, in <module>
client_socket.sendto(bytes(input_s, encoding='utf8'), ('192.168.1.2', server_port))
TypeError: encoding without a string argument

prisma cobalt
#

input_s isnt a string

#

you need a string to encode it

ember ledge
#

i dont understand

prisma cobalt
#

input_s = now,'Hello, server!'
input_s = str(now) + 'Hello, server!'

ember ledge
#

i feel stupid now

#

XD

prisma cobalt
#

lol

potent nymph
#

can someone tell me how i can receive emails via imaplib

#

if u dm me it will be better :)

copper hearth
wide nest
#

Does anyone here work with Jinja 2?

trim moth
#

i had a idea, to implement a terminal chat using sockets. but turns out it can only be done using sockets

#

but sockets tend to work locally only

#

coz the ip address i have is the local one

#

but i don't have a router to get a global ip address

#

jsut a hotspot from a sim card, is there anything i can do?

woeful willow
#

everyone has a global ip but that doesnt mean you can chat with anyone, u need to forward a port to do that

#

u can try by connecting multiple devices to same hotspot and then chatting

prisma cobalt