#networks
1 messages · Page 27 of 1
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?
Can you provide more details?
Can someone please help me with the UDP protocol
I have searched the internet but no good resources
What do you need?
I am trying to make a chat server using socket and UDP protocol
But getting an error
It says nothing to me
k
Well later on it actually started to work but then my entire api went down again
I made a stack overflow post with as much detail as I can put:
So I bought a domain at NameCheap (supposed its called mydomain.me), and I want to use this domain to host my website on netlify.
The normal way to do this is by setting 4 custom DNS servers to
dns...
what actually is the problem
ah
i didn't think netlify needed custom nameservers
how can i compare data when parsing?
Nope
Hello, is this the correct channel to ask about gRPC?
@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???
oh
lmao
If you want to retrieve an image from a url you are going to have to use the requests library
@chrome vigil https://paste.pythondiscord.com/opucocasiy.go
I assume you already have built the mysql db in this case?
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
Is socket p2p? If so it’d be pretty easy to get people that are in a tcp chat’s ip
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)
Try adding ssl_version=ssl.PROTOCOL_TLS to the HTTPSConnectionPool
How can I send a protected payload using sockets through port 80 or 53
define "protected"
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
not readable using wireshark
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
I'm learning API requests using python requests for personal interest. I'm trying to simply download the URL 'https://live.euronext.com/fr/product/equities/fr0000120578-xpar/'.
It works perfectly ...
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...
yeah
hello to all members of the community
Does anyone happen to know of anything out there to generate network diagrams with Python?
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()
gaierror is just for DNS related errors unless I'm mistaken.
You probably want to catch ConnectionError too
@ember ledge thanks for the response <3. I'll look into adding ConnectionError.
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?
It is hosted internally, gateway correctly set to the upstream firewall/router
It’s a windows 2019 VM on ESXi
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?
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()
Wrong channel but you can use threading.Thread or concurrent.futures.ThreadPoolExecutor
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.
how vunerable is a website running of a raspberry pi behind a home router with no security measures implement other then default ones???
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 ?
?limit=n is not working?
You should check API docs
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...
@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
I dont think there is a standard there, just check how whatever API you are using handles pagination, if it does at all.
.
!tvban 224629094904496128 14d do not spam to bypass the voice gate.
:incoming_envelope: :ok_hand: applied voice ban to @proper lark until 2021-03-17 18:01 (13 days and 23 hours).
!mute 224629094904496128 2d do not spam
:incoming_envelope: :ok_hand: applied mute to @proper lark until 2021-03-05 18:01 (1 day and 23 hours).
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?
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?
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
what are the rules for the checksum?
is it suppose to be the entire header and segment?
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
check if this is useful for you
hii readers,Today, I m going to share with you actual method to calculate the checksum of TCP header packet at the binary level.IntroductionAre you working o...
@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.
ehh id prefer not to rely on a third party
but i guess relying on someone with a static ip is importatnt
damn
how do doorbell apps work where you can see whoese at your door when your out??? i guess maybe they have an intermediatary server in between
yeah they don't connect directly to your home wifi
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
@prisma cobalt You could just send an email, or discord message with the ip though.
so i connect to the computer... which i cant access to send a message with the new ip???
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.
@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?
How does an app like Instagram send notification to my phone on my network
- I have a dynamic ip
- unless there’s a socket open at all times how does Instagram know which port to send data to
- how does it work really?
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
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?
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?
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
generally a naive approach like is going to suffer with UDP because it has the lack of transport rules and incase of a invalid frame being received
i'd probably look at implementing an existing protocol like WebRTC which implements UDP type streaming
Thanks for the advice. Are there any webRTC based packages or tutorials you'd recommend? I'll definitely look into this
google is your friend, i havent worked much with webrtc
I heard of this one in a podcast https://github.com/aiortc/aiortc
You've found my rabbit hole 😅 just been reading all the docs I can on it
What was the podcast just out of interest, would love to have a listen
I think it was this one https://www.pythonpodcast.com/aiortc-with-jeremy-laine-episode-191/
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
!warn 792748774871138304 IP grabbers are not something we allow here. Considering your history, this is your last warning.
:incoming_envelope: :ok_hand: applied warning to @royal sequoia.
this is not ip grabber
please do NOT say anything without knowing
i DO NOot even know how to grab ips
lol
😅
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
GLA 200
The host ip should be '0.0.0.0' and the client ip should be the public ip of host (You need to do port forwarding for that)
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
@late valve nice question, I too have same doubt long time., as i have recently upgraded to full desktop PC
Ok
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
If you know the username and password and IP of the remote computer you can scp files to and from it using the command line
But using python shouldn't be to difficult either
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?
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
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'`
@late valve you could use filezilla server and connect from your main machine with filezilla client
isn't it better to do socket.gethostbyname(socket.gethostname())?
that seems quite dangerous without authentication
you should probably just set up an SFTP server
I do prefer 0.0.0.0
Yeah as TypeError said, opening the server on 0.0.0.0 is easier and allows connections from anywhere
i know i already did that, i called my internet provider and they told me that if i wanted to port foward i got to pay them extra money.... they have a feature to foward but it wont reaaly open it untill i pay them, and i thought i was doing something wrong
such a shitty move by them
Pay for port forwarding? 🦆 that, I'd just buy a damn server!
I'm trying to build a client/server could you guys recommend a maybe a good beginner friendly resources
@ember ledge ty
You should read up on the socket and ssl modules
bruh check the channel links
thanks sorry
lol i recommend anyone looking for beginner code to a client server program to check the pins cause i have one
Try using a software named Ngrok
@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
My friend is trying to make a FiveM server and his MODEM doesn't let anything through, please help ?
@late valve I would recommend reading the official documents of the module...
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
ok, i looked it up but i dont get how i can host my server on there
DM me I'll help you
My friend is trying to make a FiveM server and his MODEM doesn't let anything through, please help ?
he probably needs to port foward the port he is running the server on
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.
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...
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.
@adam
unironically good example code
could one explain to me a way to implement voice chat/calling with Python3 sockets
This document defines a set of ECMAScript APIs in WebIDL to allow media
and generic application data to be sent to and received from another
browser or device implementing the appropriate set of real-time
protocols. This specification is being developed in conjunction with a
protocol specification developed by the...
will it work with sockets?
or just browsers
okay
Sockets gotta behave like HTTP for WebRTC to work
is there an example program you'd recommend?
Not Python
yea i found these
This document defines a set of ECMAScript APIs in WebIDL to allow media
and generic application data to be sent to and received from another
browser or device implementing the appropriate set of real-time
protocols. This specification is being developed in conjunction with a
protocol specification developed by the...
but like u said, not in python
Another alternative: https://xmpp.org/extensions/xep-0166.html
VoIP is not a beginner's project
Try something simple, like FTP and IRC, then move onto more elaborate protocols like HTTP
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.
hey there
?
What is the question?
i think they are just wondering how to make their application fetch the file faster?
is this the right place for socket connection related problems?
ig
k
u wanna help?
k
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
How you connect them? WiFi? Ethernet?
wifi probably
Probably?
Can you see connected devices using router software?
Like enter 192.168.0.1 or something similar site
Okay, first of all - both of your devices are in same network?
yup
Then open browser and navigate to your router management site - for me it's 192.168.0.1
am i supposed to have one?
You should be able to check all connected devices to your WiFi network
i'm not the one who owns the wifi or anything
Which OS do you have on both devices?
Android should show you local IP address in settings
got it
Use iftables or something similar to get local IP address of ChromeOS device
So you can use local IP addresses to communicate both devices
of which device?
What?
Open a command line and try to ping from 1 device to another
Ping 192.168.1.2 for example
Whatever the ip address is on the other device u are trying to reach
it's working
OK great so you know the other device is reachable
yup
How are you trying to communicate between the two devices in your code? TCP port?
OK is there a firewall on the destination device perhaps that is dropping the packets to the port?
not now pls
not that i know off
hi, can I run a function from another device using a server?
probably
u can prob just do smth like ```py
when receive:
os.system(receivedmessage)
Normally I would use something like tcpdump to see if the outbound packet is reaching the destination address or is dropped earlier
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
Hello everyone!
Are there any (py)zmq specialists around here?
Nevermind. Found the solution.
For anyone interested: If you want to discard old messages,
setsockopt(zmq.CONFLATE, 1) must be called before connecting.
if both client and server are written in python
then each recv is correlated to each send
Is it possible to decode an encrypted packet with a public RSA key ?
depends if its the right key
No, you need a private key to do that
yes but i mean. how could i know how many im getting without rewriting recv?
put recv inside of any kind of loop
and increase the count
whenever each executes?
i did some googling and i fount this solution. py generalTools.connectToServer(S, IP, PORT) while True: data = S.recv(BYTES) if len(data) <= 0: generalTools.test(data)
I frankly couldn't understand what you meant by rewriting recv
i meant me rewriting this py data = s.recv(1024) print(data.decode()) whenever i added something to the server
not really
recv stands for receive
send stands for well send
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
...
It messures the round trip latency
.e.g. Sending, receiving and sending the response back
@ember ledge i really am a rookie in networking hence i make silly mistaks
Yup it's RTT round trip time
how can one test ping with sockets?
Send ICMP ping request
Also not sure what you mean by separate components and why that would be useful?
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
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
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
Agree and in real world rtt is what is useful
someone help in #help-mango it's about sockets and networking
@sterile igloo if you still need help making a client-server script then ping/dm me
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)
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?
@earnest storm are you sure the port forwarding worked? It's easy to check
I've been using Ngrok for quite a while now, you can DM me and I'll help you
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.
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?
My first was an IRC bot
FTP is pretty straight-forward too, makes for good beginner's projects
Awesome, thank you!
I still got the source code for the bot if you wanna take a look, but it's in C
that would be great. I don't mind reading C and having examples is always helpful when learning concepts
Alright then, I'll dig it up in a few hours when I get home
Watch out no firewalls are still blocking traffic after port forwarding
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
You don't need to connect with external mailing server to send an email, but locally created emails can be blocked by spam/security filters
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
That's why I would like to use a server like Gmail, because I have to make every user add his credentials and someone may not have a Gmail account
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
Yes okay but I cannot store my gmail password in the code
I was following this https://stackoverflow.com/a/24271220/12346032 but I don't know how to use that fake SMTP server created
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?
I think sca.py can help https://scapy.net/
If you want to do it yourself you need raw sockets for icmp and build the packets etc..
Some random example i googled https://gist.github.com/pklaus/856268
A pure python ping implementation using raw socket. - ping.py
a pure python ping implementation 😂 the real question is why
Why not, its not like you will send 1 million icmp packets per second
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
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
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
Try connecting a socket to the ip with port 80 and catch the error if it fails, shouldn’t be more the 20 lines of code
I can't assume that every IP I scan will have port 80 open
Doesn’t a normal ping target 80?
I don't think so, I have to go back to my notes
checking...
@prisma cobalt ICMP doesn't use any port
Port 7 my bad
no.. its port 7
it's called echo port
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
Unless python blocks it you can still open a socket to those system ports
Just don’t be surprised if it doesn’t work
it won't
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
Yes, you can still ping it if the router is open
So the router intercepts and responds to all requests on port 7?
yes
Any other ports the router automatically intercepts and blocks?
Hey @ember ledge, do you mind explaining how do I import these functions?
https://scapy.readthedocs.io/en/latest/usage.html#icmp-ping
I googled it's usage still couldn't get it to work:
https://www.geeksforgeeks.org/network-scanning-using-scapy-module-python/
found this and same problem, it doesn't make sense:
https://dev.to/ankitdobhal/let-s-ping-the-network-with-python-scapy-5g18
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)
But someone above said it targets port 7?
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
I have problems with names, don't know where to import them from
This is not how it works, the target IP address will respond, be that a router or a host
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?
ICMP operates at network layer its not port bound
yeah so is the process i said above correct?
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
So it arrives at the router which decodes the header and sends back that it’s online and healthy
Exactly
Hmm surely that could be used as a dos vulnerability since decoding the header might not be strenuous but it isn’t free
Echo request from source and echo response from destination
What?
That's a ping essentially it's an ICMP echo request/response
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
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?
Yeh but icmp is lower layer so not much overhead there
It can be abused though https://usa.kaspersky.com/resource-center/definitions/what-is-a-smurf-attack
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]))
is there a way to get a bool value on weather the client is connected to a server?
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
how exactly would i return sock.connect?
Just check its value
it doesnt have a value? <class 'NoneType'>
Huh
print(type(S.connect((IP, PORT))))```
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?
I have found this tool written in golang but I need something written in python:
https://github.com/projectdiscovery/cdncheck
Hello. As far as I know it's difficult or almost impossible to find someone's IP who uses services like Cloudflare - in other case why would you pay for such service like DDoS protection, when someone can invastigate your real IP address and omit Cloudflare protection services?
I don't want to bypass cloudflare protection, I am asking how do I know if x.x.x.x is behind cloudflare
Oh, my mistake
Do a DNS lookup?
@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
Check out https://www.dnsbl.info/
DNS-based block list information/database. Resource to find out information on DNS block lists and check IPs to see if the are block listed in over 100 blacklist in just seconds.
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?
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
I was able to help you until you said via Bluetooth @spark frigate 😂
the better option lmao
bluetooth has a shorter range then wifi lol
@spark frigate why are you using bluetooth then?
just use sockets and connect to the pi's local ip
because the goal was to transmit a message via bluetooth
What is everyone using for proxy support?
I used to use nordvpn but now it seems it's official dead with python http request
I know I can do it with sockets but the goal was to do it with bluetooth
Eh fair enough
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
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?
anyone good with sockets?
Just ask, will see
Changing TCP into UDP?
I want it to be in TCP
How to connect two client in one socket?
Have you seen pinned messages?
Hmmm... Then you can try to change library which you are using
Which one?
Maybe there is problem with your program speed
This one?
Nope, at top-right corner you have pin - click into it
Even I think there's a problem in the library, currently I'm using the vidstream library (developed by NeuralNine)
Development status suggests (version also) that it's early stage of development
yeah
https://github.com/NeuralNine/vidstream
Under construction! Not ready for use yet!
🙂
thanks for helping btw
👍
Mesaage delivered duration data communication in networks can be of __ type.
a. Text
b. Audio
c. Video
d. Image
e. All of these
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?
Depends on the number rpc calls you do
oh nvm i found the article on this 😄
The code is in development, tcp protocol isn’t good for this, vid streaming is gonna be laggy anyway, quite a few factors
Try a form of compression to speed it up
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?
worst of all, https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html doesnt even mention Authentication in the header? so im almost sure its a mistake and is just supposed to be Authorization in all cases?
Are you asking about difference between authorization and authentication?
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
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
I have played with paramiko for connecting to ssh not sftp but why don't you escape that error with try:except clause?
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
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
Hmm iirc it sud work 
If the authentication worked
Ur doing it in the same session y3?
Lol
'aiohttp' has no attribute 'post' how aiohttp work?
escaping an error doesn't fix it lol
You think it's really necessary to fix EOF error? why?
because the code line is critical to the program as far as I can tell
I found another solution but thanks for this
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())
are you running the server first?
yes
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
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
post it here with python formatting
thanks
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()
what's the error?
target = socket.gethostname(sys.argv[1]) # translate hostname into 1pv4
TypeError: gethostname() takes no arguments (1 given)
!code
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.
socket.gethostname() returns the local host names and takes 0 args
you're calling the wrong function. socket.gethostname() gets the name of your host. but you don't want to get the name of your host, you want to get some other host by their name. so you'll have to call socket.gethostbyname()
ohh ok thanks a lot
replace
target = socket.gethostname(sys.argv[1]) # translate hostname into 1pv4
with
hostname = socket.gethostname() target = socket.gethostbyname(hostname)
thanks mate for your help
nw
i tried runnig the scan but it didnt showed me any any error and no result
yes, his code is wrong
you're scanning yourself
so it should show the open ports or not
do target = socket.gethostbyname(sys.argv[1])
like this
I don't understand the question
i did the same thing the other guy said do this other way
can't i scan my ip
what were you parsing as the second arg when running cli?
this is the complere code only i was learning making a port scanner
your code only has one line?
can you be more specific please i am a begginer
you're using sys.argv[1]. when you run your code in the command line, you usually use something like portscanner.py 8.8.8.8. he was asking what the IP you were passing is.
is the banner printed correctly?
i did run the same thing on my linux the cmd was pytthon3 main.py MY_IP
@thorny python
?
You are checking if the socket returns 0, but if the port is not open it will return 10061
yes that is the only that is printed
ah okay
hey wait
do you even have any open ports in that range?
i just saw why it is scanning local host inspite of giving my ip
that was the thing i was unsure about then i tried scanning www.google.com
maybe try pinging 8.8.8.8
that's googles DNS resolver
oh wait
it might only have UDP and not TCP ports
mind if i dm
go for it
I think you can, you just need admin
he doesn't bind to port 7 though, he connects to port 7. big difference
false, ICMP does not use ports
if you open a socket on a port, don't you need to bind it to that port? :)
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
i thought you could 😂
they are reserved for administrators/sudoers
because they're often 'sensitive'/default services
Do we have to host the socket anywhere to connect another computer?
https://dpaste.org/kS3C please help with that error
is there anything else that can python newtworking do than send messages?
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'
"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)
oki
@shy pebble but there's a problem
thats why i was not using b prefix
it prints b itself
print once again takes a string. So you need to decode the bytes into a string
which you do with some_bytes.decode(encoding)
oh , from the client side?
yes
got it
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
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
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??
not really... but if you think about the application of "sending messages" you can do loads of stuff, you could press a button on your phone and have a lamp light up in your room as example
ah thats for sockets at least, i misread your question
"networking" can do loads
imagine a webscraper
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
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?
what modules can do that?
The socket module
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
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_()
I tried to pip install Cartopy and this happened. Can someone explain me what to do?
anyone here knows about binanace futures in cctx?
Hello, any one can help me about that?
your server crashed or is down
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?
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
A next-generation HTTP client for Python.
Thank you!
@ember ledge
A next-generation HTTP client for Python.
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"?
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
Google, and Cloudflare
I mean cloudflare still have mixed success with HTTP/3
it still gets disabled and re-enabled fairly often
yo
looks like dst is not recognising the argument supplied. Try removing the '' from the IP address. For example:
srloop(IP(dst=4.2.2.2) OR replace the quotation marks with double quotes like this: srloop(IP(dst="4.2.2.2")
Alternatively, you can try a more simple code to get it working:
srloop(IP(dst="4.2.2.2")/ICMP())
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)
Great !
Add a GUI for it
Hi evryone , is it possible to make a worm that spreads over the LAN using python ?
I tried doing just that but no use. If I remove the double quotes from the IP Address, then it comes back as invalid syntax. I am not sure why it is not recognizing "dst" when in the documentation it clearly shows it. I'll have to find something else I suppose.
!rule 5, there’s no way this would be used for anything but malicious stuff lmao 😂
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.
Looks good, suggestion: instead of doing time.sleep(270) y, take the time at the beginning and take that away from the time now and that away from 300 to get perfectly consistent timings
m just asking , I need it against scammers
I just wanna know , is it possible ?
you want a worm... that infects everyone on the network... to fight scammers?
you gotta know how that sounds
thanks, I didn't think about that
that's a script that runs in background. Just to know, what would you use the GUI for?
to make it modern & ezier , just like the 'speed test by oklaa'
Yes, but malware in Python is meh just because it's an interpreted language
You can compile it to an ELF, but it still has GC and shit
shoud i go with with c# or wt ?
C/C++
i want statically typed, compilied python... is that just C#?
c# is nothing like python lol
with or without the static typing
C#'s closest cousin is probably Java
C# is just Microsoft's ripoff of Java
nim
nim looks very similar but it doesn't have classes soo
Why do I get 422 when adding 'Content-Type': 'multipart/form-data'
Classes 
where do u get that from lol...
ur pretty dumb
nice code
@light zealot please don’t advertise your project here
Alright, sry
does anyone any know good books for socket programming in python?
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
i just find tutorials and look at code on github, but a book would be useful for explaining stuff
yeah same tbh
can i dm, u seem like a cool guy
I would love some help on socket please, if someone could help me ^^
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.
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?
Are all the internet methodologies used 30, 20 years ago still in use today?
Anyone have any experience using mitmproxy to forward requests through another authenticated proxy `?
how to check if my selenium or requests instance is behind a proxy? How can I check if my set proxy is working?
Yep, it works quite well - I am using MITMProxy in between two off the shelf components in our stack that we weren't able to modify, but with MITMProxy, we can intercept the traffic, and do the alterations we need.
run a socket server online free python no credit card how
hosting usually requires some form of transaction, from my experience
try repl it
made me laugh bad
hey
hey
i can't get the ip
of repl.it
like i have it working on their localhost but idk the ip so idk how to connect
:c
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
well, what are you using the socket server for
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?
not necessary cuz here's what you're going to do
cool
your server.py will have a simple Flask server to handle incoming REST requests
google these terms to learn more
...
it's the same logic as your socket chat
i didn't make it :c i followed a tutorial :c
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
@boreal crane
Would this be the channel to ask about gRPC and python? Having problems generating the classes from a Pom
Love python
:c
Hie guys
Has anyone used python to print files using a printer on a network?
How best to achieve this
work prject
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?
As far as I know the problem is with NAT, maybe DMZ could be helpful
Your right, unless you port forward, outside connections can’t connect
Look up the steps of port forwarding for your router
but UPnP has anything to do with port forwarding? just wondering.
You only need to portforward lol
I’m not familiar with UPnP but I myself have portforwarded several ports to alllow connections
ok. btw, should i be worried about security while port forwarding?
hi ,everyone here, i am a beginner of python and i am learning the django now
Not really, if you don’t have a program listening on that port then the packets are discarded
But if u do (aka a server.py script) then anyone can connect
But that doesn’t allow them acces to ur computer lol
i dont.
Windows 10?!
Yep
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
noice
Is there a way to find out how a webpage generates its token? thats added in the login
Can i somehow ignore windows host file using requests or urllib
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
Hi guys
please i need help
how do i print a file using win32print using a printer on a network
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
accessing google meet using selenium is against their ToS, which is something we wont help with
!rule 5
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.
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?
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
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
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
yep. starting a hosting company is expensive and legally challenging. i urge you to talk with a lawyer about the legal requirements.
But why can't I start it if I am under 18?
because of the following
- you're not old enough to sign legally enforceable contracts in most country
- you often lack the maturity and skills to provide the services that you offer to a reasonable standard
- 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
- you're not old enough to sign for commercial contracts with internet providers
- 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
I see....
and then we get onto the other point
you got a data center laying around? if not, get ready to buy commercial spaces
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.
for what purpose?
I need to send GPS coordinates between devices.
I am thinking between using sockets and Mqtt.
well for the fastest method would be UDP sockets
however
they're un-reliable transport
Mqtt is sweet since it is easy to use and it should be quite performant.
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
You think that websockets are better than plain mqtt?
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
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?
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
Anyone know how to do a git clone with a public deploy key?
When im using pyenet with the example from github it isnt receiving anything but wireshark shows the requests coming
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
Hi, depends on the platform using gitlab or github. Everything is documented in their doc 😉
@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)
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
# (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?
That’s because of the while statement
Change l = “1” to l = True
hows that gonna change anything, the file does pass over through the socket in both cases
Is there an error?
yeah
like i can literally open the file once its done sending the data, even though it halted right at the end
hmm
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
can i alternatively just close the socket and then reopen it?
@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?
can someone help with SMTPlib?
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
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
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.
lmaoo
Does the gateway IP refer to the router?
sounds sketchy
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
Hello if i will send via sockest smth like that send(f"some text & {pickle}") how i can depickle pickled object in reciver site?
you will need to send the size of the pickle or some other way to determine where the pickle ends
I am afraid that it's not possible https://requests.readthedocs.io/en/latest/api/#requests.request
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
keep in mind that single a send could be multiple receives
and a pickle can contain any bytes, including &
Hmm, can you help me if i write you code? Im new in sockets
you do need a size, so that you know how many bytes to receive in order to get the complete pickle
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
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
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?
https://pastebin.pl/view/26729c3e this is my whole code server
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
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
hmm yea, thank you anyways 😄
You might try https://github.com/codemation/easyrpc
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.
Is there a way to hack into a bank and steal crypto currency?
Hello. We don't discuss anything that could be illegal here in Python Discord, so we cannot help you. Also, I advise you don't try to do that. It could never end well.
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
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?
found this: https://ahmed-nafies.medium.com/getting-corona-virus-covid-19-stats-using-python-cdc38e3f7faf
Lmao “pip install COVID”
Taking one for the team
lol
is there a way to get the redirected url when doing an aiohttp request?
Hey anyone got resources for python network autonation course
what are you thinking of trying to do?
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
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?
wait... do you mean automation??
please
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?
hi can some one tell me how dou i get the time when client sent something to server
what the time of the message sending or the time it takes to get to the server?
sending
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
he said put import time at start dude
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()
noice
how would you try and execute commands at given times @prisma cobalt
what do you mean?
so like say i want my program to print a message when time = 9 or smthn
no its not like that bro
like i want to know the basic structure so i can implement into my bigger project
its like "11:08pm" Hello server !
datetime module then
windows or linux?
windows
windows has task schedular
linux has cron
yeah but i dont know how to write code im new to networking
datetime isnt networking but here:
from datetime import datetime
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)
Output:
Current Time = 07:41:19
no its built into the os's
so you make seperate scripts and schedule them
ah ok
theres probably a better way tho lmao
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
i dont understand
input_s = now,'Hello, server!'
input_s = str(now) + 'Hello, server!'
lol
can someone tell me how i can receive emails via imaplib
if u dm me it will be better :)
depends
Does anyone here work with Jinja 2?
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?
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
sockets work locally and globally?
