#networks
1 messages ยท Page 16 of 1
https://github.com/rhelmot/nclib
@thorn stratus no no bro they were suggesting the script of netcat
the program that was already there
and I specifically wanted a python listner
IK this too I have used them both
You aren't writing it yourself? This is the wrong server
@thorn stratus why??
I tried tho
You aren't writing it yourself? This is the wrong server
@thorn stratus this was the networking server so I thought I would get some help
leave it thanks

addrInfo = socket.getaddrinfo(url, port)
Always gives the same error: [Errno 11001] getaddrinfo failed
addrInfo = socket.getaddrinfo(url, port)Always gives the same error: [Errno 11001] getaddrinfo failed
@cinder prawn maybe the port you entred associated with the url maybe closed
so you can't get the info
hence you will get the error
you will not get any info or connection if the port is closed or filtered
sometimes works for filtered
What is in the url and port variables
@thorn stratus the url and the port you want to get an info about that is associated with you target
you will not get any info or connection if the port is closed or filtered
sometimes works for filtered
@empty solstice try using an open port that is associated with you target
@empty solstice What is your use case? What are you trying to do?
@empty solstice What is your use case? What are you trying to do?
@jaunty aurora me??
I was building a python backdoor
and I made๐
but I was making it custom I mean I copied the backdoor shell script from someone else and customized it
but he used netcat for listening to that backdoor
but I wanted to make a customised python listner for that backdoor
I created it
but it was not connecting due to some error I really don't know why was that so I asked here for some help
BTW @jaunty aurora if you know something that would help me you are so much welcome to tell me๐
but pls DM me as here they won't allow that
**OR if anyone knows that **
@empty solstice I think you've been told quite clearly before that we don't assist with those type of applications.
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.
@jaunty aurora ||I'm just doing a pen-testing||
That does not matter. We do not provide help with applications that can be used for malicious purposes and a backdoor application is certainly not something we provide help with. I advice you to drop this line of inquiry now.
That does not matter. We do not provide help with applications that can be used for malicious purposes and a backdoor application is certainly not something we provide help with. I advice you to drop this line of inquiry now.
@jaunty aurora sure
Hi guys , can I use socks5 proxy with scapy ?
how do i disable ssl verification with aiohttp? my organization MITMs all HTTP with a self-signed certificate and i have no idea where the CA file is, so i'd rather just disable verification for now (i know the security implications and it's fine in this application)
i tried
sslcontext = ssl.create_default_context(cafile=certifi.where())
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=sslcontext)) as http_session:
but i still get the same SSL error, so clearly the standard PEM file doesn't work
ah nvm i got it, i used ssl=False
Can i disable Selenium from sending data to Google analytics
I need to filter out anything Analytics related when checking a website in Selenium.
I can see when i run my tool on my own website, it shows up in Google analytics under direct traffic, that's bad ):
Anybody have a good idea to overcome this issue. ?
This doesn't really sound like a question for this channel but I suppose one solution may be to block the google analytics domain via DNS
how do u mean?
Hi there,
This question might sound dumb, but can't resist without asking :P, so bare with me please
I have been always fascinated with the thought of how I can implement a network protocol from scratch by just reading the RFC. But unfortunately, once I complete reading the RFC, I don't get a clear picture on how the implementation should be. But I understand the internals of that protocol. Can any of you folks having experience in protocol implementations can point me in the right direction to go on to implement some protocols from scratch? :)
Any sort of tips would be a great help! :)
I've had this experience with implementing NTP and Websockets. the RFC is a nice reference, but hard to see the full picture. sometimes I've had to use wireshark or other means to look at examples of actual traffic, other times I've managed to get by looking at screenshots of people who have done this
Can anyone tell me if I have this right?
Cookies are client side, while sessions are usually server side.
Cookies are accessible by the user to view.
Usually you will use a cookie as an access point to some information on the session.
But, you can use just a cookie to store info, though not very secure.
yes, a cookie can hold a session ID
cookies are automatically sent to the server by the browser as part of requests
and cookies have certain rules about which servers a cookie will be sent to. this provides some cross-site security (but not a lot)
Python doesn't understand that at least one of these IF clauses would match, thus it complains.
don't use wildcard imports, its confusing and pollutes the namespace
What if the packet is ICMP?
or arp
@real cedar
@thorn stratus thx now i am more specific to from scapy.all import sniff, IP, UDP, TCP
Not every packet has a port
@thorn stratus thanks , i did not know that, i thought every communication has port to communicate with remote host.
hi, i am curious on how to make a script that displays specific network information
ipv4, ipv6, dns, mac, etc
i know there are command line tools like ip that display network traffic info in the terminal
but does someone have python scripts for these tools?
what specifically do you want
Ah, thanks @frosty bone
So, to check, session variables are stored in the web server and can be accessed with a session ID, which times out every now and then meaning you need to do something to get another session ID to access that data again?
Does anyone here know any good courses about networking that is worth having a look through prior to learning cyber security?
Hey everyone, I need to understand asyncio. Could someone help me?
@exotic solar yep, thta's right. When the session ID times out, the user usually has to log in again to get a new session ID. Sometimes you can add a "remember me on this computer" checkbox that increases this session ID timeout from say 1 day to 30 days; you can add more time to the timeout whenever there is activity, this means sessions time out only after a set amount of inactivity
anyone able to help me with sockets?
i have a script which sends a continuously increasing amount of bytes and reconnects on every iteration.
when the program finally crashes (due to too many bytes received) i want it to error out and tell me.
i currently have an except socket.timeout: which isn't very reliable because it could legitimately take more than 5 seconds (my defined timeout) to connect.
a general except: doesn't seem to catch this so i'm wondering what other way i can do this?
If I wanted to build a browser with python can this be possible?
you mean like a browser like firefox or chome?
with Chromium you could probably use a python binding for CEF
probably this project: https://github.com/cztomczak/cefpython
@scenic pike https://wiki.wireshark.org/Python
try giving that a readover
@scenic pike https://stackoverflow.com/questions/39325093/how-to-do-deep-packet-inspection-before-forwarding-it
that may help also, i know youd have to do some dpi to ensure the packet is full before sending
Is this networking as in computers or as in LinkedIn
Did you read the channel description kek
why not both? https://pypi.org/project/python-linkedin-v2/
Works for me that Networking people should network here
So ya'll wanna connect on linkedin ๐
Did you read the channel description kek
@shut robin ^^^^^^
hi I am extremely new to networking stuff. let's say I have two computers that are connected to the internet through different ISPs or the same ISP but from different places. is there a way to make contact between the two computers without any third party server or anything like that? assuming further that both ISPs provide only dynamic IP instead of static
what do you mean by "third party server"?
do you consider a DNS server "third party"?
you could also just manually share IPs every time it changes
you could also run your own DDNS server on the cloud
by their party server I mostly mean someone I need to pay to lol
I know this is a bit of a general question but, what is the best way of connecting 2 clients peer to peer style? I
They need to know each other's IP, so you either need to share them manually or use a service like this one
From there you just use sockets like any other connection
Okay thank you friend
nice
Can anyone tell me, Where I can find the beginner course, I'm a Ntework student and I want to learn Python for Automation.
@rain dirge http://automatetheboringstuff.com/ would be a great start for you.
@rain dirge http://automatetheboringstuff.com/ would be a great start for you.
@atomic warren Is this is from scratch?
it doesn't assume any prior coding experience, if that's what you mean
im trying to make a server, (like when you send "hi" in one computer it appears in the other computer and both of them connect to a server running in my computer using python) just a simple one, it trying to learn networking
help would be appericated
Would suggest this tutorial for begginners
https://www.youtube.com/watch?v=3QiPPX-KeSc&t
tysm
i need help with pickle and socket
how can i send a dict data to another machine using socket and pickle?
Hi everyone currently i am running in a weird situation, where my code ( using epoll with nonblocking socket ) is working for http connections, but in https sock.recv always return empty byte, even though socket is mared as readable
1 vote and 1 comment so far on Reddit
Here is the related post, i can copy paste the whole thing here if it's required, let me know
How can you configure websockets to also work with public ip as it's just raising an error when im giving it my public ipv4 address. It works with localhost though or any other private ip...
You need to port forward if you are behind a NAT
Hello Everyone,
Has anyone successfully implemented TCP NAT hole punching.
I have tried this https://github.com/dwoz/python-nat-hole-punching
but could reuse the tcp session to communicate.
im learning on socket programming
and i have an error:
file name : server.py
import socket
import threading
HOST, PORT = "127.0.0.1", 55555
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))
server.listen()
clients = []
nicknames = []
while True:
client, address = server.accept()
print(f"[NEW CONNECTION] - {address} connected to the server")
data = client.recv(1024)
print(data.decode())
file name : client.py
import socket
import threading
nickname = input("enter your nickname: ")
HOST, PORT = "127.0.0.1", 55555
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((HOST, PORT))
while True:
data = client.send(nickname.encode())
and when i send the nickname
the server spam it...
like that:
the output:
[NEW CONNECTION] - ('127.0.0.1', 61036) connected to the server
hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
what is the problem?
It looks like your code is constantly sending data to the socket inside your while True.
So you code is essentially doing this
data = client.send(nickname.encode())
data = client.send(nickname.encode())
data = client.send(nickname.encode())
data = client.send(nickname.encode())
data = client.send(nickname.encode())
... # continues forever
no problem, hope that helps
if you want this to repeat, I would create a function, like
def set_nickname():
return input("enter nickname...\n")
while True:
data = client.send(set_nickname().encode())
@ember ledge
no problem, hope that helps
@zinc bane
yup thx i fixed it
Just had a really easy time setting up an internet-connected egress only private network in AWS thanks to this tutorial https://start.jcolemorrison.com/aws-vpc-core-concepts-analogy-guide/
explained all the AWS concepts super clearly- though I'd share
(by "easy" I just mean I wasn't pulling my hair out, it still took a while to fully understand and implement)
Hi guys, so there's a POST request in a website that I use requests module to get data from.. that post happens after I use GET to receive data from that page, is there a way to make request wait for the POST request that happens few seconds after the GET request?
Hi guys, so there's a POST request in a website that I use requests module to get data from.. that post happens after I use GET to receive data from that page, is there a way to make request wait for the POST request that happens few seconds after the GET request?
@simple tinsel
import threading
def post():
pass
def get(arg1, arg2):
pass
# call the get method in diffrent thread and wait for it to complete
get_thread = Threading.thread(target=get, [arg1, arg2])
get_thread.start()
get_thread.join()
# call post method
post()
Hey @pseudo pond!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Here, after opening the link, a file gets downloaded. The next command is supposed to be executed after the file is downloaded. Is there a way to control the execution of findStaticFolder(link) after the file gets downloaded?
what does findStaticFolder do exactly here
It is used to import a fbx file inside a game engine (UE4)
the file that I'm downloading using the url in the command above it
check if the file is downloaded to a default location after running the script
well, it might happen that the file is still downloading when I check. Right? So I will have to keep checking at intervals until it shows that the file is downloaded and then I can continue with the script. Is this what you mean?
what is the file size?
I see
try using requests for the purpose of downloading the file maybe
and then pass the file downloaded to the findStaticFolder method instead of link
uh oh!!! My bad, I made a quick change after clicking the screenshot. I'm not passing the link but the path of the file where it's getting downloaded which is set beforehand. Anyways, how can I pass the file downloaded directly? Is it different than choosing a path beforehand where the file is supposed to get downloaded?
if the file will fit into memory, you could switch to using requests, as @late raven suggested, with something like this:
import requests
r = requests.get(url)
with open(download_path , 'wb') as f:
f.write(r.content)
or to stream to file (if it will be too big to fit into memory): https://stackoverflow.com/a/16696317
the program won't proceed until the download is finished
throw some print statements in there for logging maybe
thanks, will try this out!
Good luck
๐
@olive shuttle (i made a typo in the code above, forgetting the 'f'):
import requests
r = requests.get(url)
with open(download_path , 'wb') as f:
f.write(r.content)
[Errno 13] Permission denied: 'D:/temp/'
This is what I get ๐ฆ
url = 'https://www.turbosquid.com/Download/1067193_24018098'
r=requests.get(url)
with open('D:/temp/', 'wb') as f:
f.write(r.content)
My code
Moreover I don't want to run as admin because I need to use this code inside a game engine (UE4)
Try adding a filename to d:/temp/.
I.e. 'd:/temp/1067193...'
You shouldn't need to run as admin
The download worked but I think it messes with the integrity of the file. Since I'm importing the fbx file into a Game Engine, this doesn't seem to work
LogFbx: Error: Call to FbxImporter::Initialize() failed.
LogFbx: Warning: Error returned: Unexpected file type
FBXImport: Warning: Can't detect import type. No mesh is found or animation track.
LogAssetTools: Warning: Failed to import 'D:/temp/trial.fbx'. Failed to create asset '/Game/StaticMeshes/trial'.
Please see Output Log for details.
did you set the download path to: 'D:/temp/trial.fbx' ? i.e. with open(' D:/temp/trial.fbx')
what do you end up with in the folder?
hmm, i see that you need a log in to download the file. that explains why requests might not work, whereas using the browser does.
the easiest thing would be your original approach and a while loop...
did you set the download path to: 'D:/temp/trial.fbx' ? i.e. with open(' D:/temp/trial.fbx')
@latent fractal yes I did. I have kept my browser open and logged in before I run the script.requestsdownloads the file successfully and I can see it in the folder, but if I try to import into the engine, it shows the above error. So I'm guessing the file gets corrupted or something.
I will try the selenium approach again. Thanks!
i guess that requests is downloading a html file, rather than a fbx file (you can try opening the file that requests downloaded in notepad to check).
logging in with your browser isn't enough to get requests to log in, you would need to use a requests session, and POST the correct data to turbosquid's API to log in. this doesn't look straightforward for turbosquid.
so using the code you have that already works, and looping to check whether the file has downloaded seems like the easiest approach.
good luck!
guys hello
i have question for everyone
it is possible to set up a website that cannot be traced in the internet world
so yes but no
well technically, if you expose if to the internet, you're ip is available for bots and such to be find you
Tell me, can we?
If we change the IP address of the website constantly?
if it's in a local network where it sits safely behind a access list (firewall) and such, technically you're not exposed
for example intranet sites are not exposed to the outside web
you see, it's very much based on your definition of "can be traced in the internet world"
you can set up a site only you can use
if that's what you're asking
dynamic ip doesn't solve everything
okey thx man
np
Does anyone happen to have any experience proxying HTTPS requests using Tornado (https://www.tornadoweb.org/) or implementing a CONNECT method to handle this. From my understanding I have to make use of tornados BaseIOStream but so far I have only been able to pick up that a client has called the CONNECT method but am unable to respond to it. I haven't been able to find much documentation relevant to the subject.
Tell me, can we?
If we change the IP address of the website constantly?
@high oracle well that will just lead to indexing the IP's you use for the website and that will just create an increased exposing.... but less tracing tho๐คทโโ๏ธ
Is this the place where I would ask questions about things like BeautifulSoup?
ooo python just keeps suprising me,it even has funcions for networking
Is this the place where I would ask questions about things like
BeautifulSoup?
@tribal spire yeh well you can but it is more likely for automation like things tho
ooo python just keeps suprising me,it even has funcions for networking
@open jackal lol
Is there anybody here that knows anything about selenium and browsermob?
there are plenty of people who know about selenium but you might want to ask in #web-development
Is this the place where I would ask questions about things like
BeautifulSoup?
@tribal spire why not, it probably belongs more to a scraping channel, but there's nothing solely dedicated to that, so why not
maybe web dev, doesn't really matter though
#web-development tends to have the scraping stuff
web_1 | Round 1 | Sandman: Requests/sec: 9564.20 Round 1 | Uvicorn: Requests/sec: 8298.75
web_1 | Round 2 | Sandman: Requests/sec: 9066.42 Round 2 | Uvicorn: Socket errors: read 20, timeout 3
web_1 | Round 3 | Sandman: Requests/sec: 9242.25 Round 3 | Uvicorn: Requests/sec: 8577.19```
So i current have this on my hands
which is pretty cool that its beating Uvicorn with 4 workers vs 1 Sandman worker
the issue is how df do you load balance sockets across several workers?
i feel like just cycling around workers is obviously not how it works because you'd start having stuff go out of sync and other stuff
do you mean websocket connections? or just sockets on the lower level?
sockets on the lower level
I'm confused about what you mean by that, what specifically needs load balancing?
im thinking more how Gunicorn worker's load balance
Hi everyone. Thereโs a question Iโm a kinda beginner.
Can I connect to a client on the current network to send data using python socket module?
broadly speaking yes
Yeah I just tried and itโs working
Thanks though but....
Can I do something that I can connect to client without any kinda action from the client
wdym?
I started terminal and started netcat to connect to the server. I mean is there anyway to connect to the client without these actions
Ok forget it
I have a last question
Can the data that I send be any kinda data?
Like a executable file?
hi, I'm looking to write a server that does some opencv processing, pulls out the data, and lets clients on other devices on lan access a live stream of this data
what should I start with learning for figuring out how to send data like this over a network?
I'm not really familiar with what tools or libraries Python has so if anyone can point me in the right direction it would be much appreciated
what do you mean by a live stream of data
covert-ink wow great idea
well
like, update a set of numbers at 60 times per second or more
I was thinking maybe I could figure out how to set up some sort of web server that returns json and just query that web server over and over if it came to it
but ideally some sort of stream where the server is determining a push on update would be best
like some sort of subscription and then udp at the subscribers
If you want to send from server to client, you can use websockets or eventstream
What are you using for the server? You will have to write some JS as well to make it work. Actually, for video there are also the streaming protocols things like twitch use, but IDK much about those
If I am connecting to a service through a proxy, is the service Im connecting to Upstream or Downstream from the proxy?
Which is the correct terminology?
my friends keeps screaming in NGINX that they have an issue, but i tried my best to find the issue to no avail
server {
listen 80;
server_name 127.0.0.1;
location / {
listen 777;
proxy_pass http://127.0.0.1:777;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 5M;
}
}
I don't know how to help you because you didn't say what the issue is, but don't use port 777 https://www.adminsub.net/tcp-udp-port-finder/777
Internet free online TCP UDP ports lookup and search. Enter port number or service name and get all info about current udp tcp port or ports. Find ports fast with TCP UDP port finder.
its only for LAN testing
but this server block is throwing errors
but im not sure of what
what do the errors say?
-- Unit UNIT has finished shutting down.
Jul 24 01:16:41 {ip} systemd[30928]: Stopped target Paths.
-- Subject: Unit UNIT has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit UNIT has finished shutting down.
Jul 24 01:16:41 {ip} systemd[30928]: Received SIGRTMIN+24 from PID 30941 (kill).
Jul 24 01:16:41 {ip} systemd[1]: Stopped User Manager for UID 33.
-- Subject: Unit user@33.service has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit user@33.service has finished shutting down.
Jul 24 01:16:41 {ip} systemd[1]: Removed slice User Slice of www-data.
-- Subject: Unit user-33.slice has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit user-33.slice has finished shutting down.
Jul 24 01:16:41 {ip} sudo[30946]: {user} : TTY=pts/0 ; PWD=/opt/nginx-1.14.2/conf ; USER=root ; COMMAND=/bin/journa
Jul 24 01:16:41 {ip} sudo[30946]: pam_unix(sudo:session): session opened for user root by {user}(uid=0)
actually this isnt it
how do you get the debug log
aight we got it to actually work
but we hit another wall, refused to connect error on our site
server {
listen 80;
server_name 127.0.0.1;
location / {
proxy_pass http://127.0.0.1:666;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 5M;
}
}
lots of known trojans use that port https://www.speedguide.net/port.php?port=666
Port 666 tcp/udp information, assignments, application use and known security risks.
try a port like 3065 or something
also, if your application isn't run with root, applications cannot open below port 1024
so if you are running Gunicorn with Nginx, it needs to be above 1024 for it to properly bind
^
don't use port 666 either
people might think you're running a DOOM server
and when talking about connection errors and the like with HTTP it's always helpful to provide what Status Code was produced
and to look at or provide nginx error logs as rdbaker said
Hey everyone! I am using requests to download a file from a website which requires log in. How to tackle that?
def download_file(url):
local_filename = url.split('/')[-1]
with requests.get(url, stream=True) as r:
with open('D:/Temp/' + local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
request.Session will be your friend
basically, log in in a browser, track which parameters are being posted, and repeat programmatically
keep an eye on csrf tokens and the like
Hey everyone! I am using requests to download a file from a website which requires log in. How to tackle that?
def download_file(url): local_filename = url.split('/')[-1] with requests.get(url, stream=True) as r: with open('D:/Temp/' + local_filename, 'wb') as f: shutil.copyfileobj(r.raw, f) return local_filename
@olive shuttle use selenium if you can
You don't need to use selenium
request.Sessionwill be your friend
@open mulch thanks! I will look into it.
@olive shuttle use selenium if you can
@empty solstice Tried selenium before, it's a bit messy.
https://stackoverflow.com/a/17633072
@thorn stratus thanks, will go through it!
hopefully something happens! ๐ค
yes
(just bumping message i sent in general)
hey is there are a way i can route an application's (my web browser) traffic through a proxy to (essentially) make a VPN? I know how to send requests through a VPN but it's no use to me if i cant use my browser with it.
it's a lot of work to write a VPN yourself, but you can install an open source VPN on your computer (the client) and your host (the VPN server) and use that https://openvpn.net/
@thorn stratus yeah i know im just using a vpn as a comparison to it, basically just a program that runs (if possible) all traffic coming from the system through a proxy server, or all traffic coming from an application (chrome in my case)
Proxy's are generally for one type of traffic, usually http/https
Then set your proxy settings on chrome
i uh........ lets just say i cant exactly do that
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.
a
just my mom got me a laptop and she restricted literally everything on it and i dont even know why
That sounds like something you need to take up with her
eh... i can probably figure out a way to watch youtube
I would think outside networking
ok but separate from that-
I'd rather not have all my search history looked at by her so can i actually do that? it's not even violating rule 5 thats just basic privacy.
Is BIOS/the boot menu locked
No i dont think
(and by the way i genuinely do want to get into security as a career so are there any good modules to learn if i wanna start developing a VPN service?)
like would socket and stuff be good?
As rdbaker said, it isn't practical to make a VPN by yourself. Security is hard, and takes more than just one person
Learning how to securely host a VPN server would be valuable though
Are you wanting to do more red team stuff like trying to hack into things or blue team stuff like preventing things from being hacked
blue team
yeah youre right., but i would just like something that reroutes my internet traffic into a server i find online, if thats possible of course, i probably wouldnt use it since thats very not-secure but it'd be great to learn how to do... do you think thats possible to do over about a month (just something that redirects your traffic to a proxy server)?
@thorn stratus
I'm not sure what you mean
it would take all the requests coming from your pc and run them through a proxy server
I'm currently trying to get my raspberry pi to connect to a socket to a node js webserver i have running on my pc
i can connect to the socket just fine when i run the python socket connection on my pc
but when i try on the raspberry pi it refuses to connect
anyone have any ideas?
nevermind fixed it
can someone help me code a server for my game? client is made in gamemaker studio 2
with python?? @ember ledge ?
This might like a stupid question but new to networking so please go easy :(
I'm trying to log in using requests, how to know if I have successfully logged in?
it really depends on the website. For instance, some website displays something like <h1>success!</h1> in their html in a success login so you could use something like bs4 to parse that data. Some website also throws back a 4xx status code. It really just depends for what site but inspecting the source (html) and finding differences between a failed and success login attempt will most likely help.
@narrow oak just looked into their robots.txt ๐
Nothing will work anyways, at least legally, I guess.
welp, good thing you found out
yeah ๐
@empty solstice yea why?
Hi, could someone help me with my port forwarding error.
I tried opening port 2222 on my router but when I went to check if it's opened (Used port checker) it was closed.
Anyways if anyone is abled to help, please tag me. Thanks in advance!
try using a different port maybe @carmine nexus
@carmine nexus you need to be running a service on the port to check if it's open
Or else the router will just send the packet the computer, and it will get no response back
:incoming_envelope: :ok_hand: applied mute to @ember ledge until 2020-07-27 04:42 (9 minutes and 58 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
@carmine nexus you need to be running a service on the port to check if it's open
@thorn stratus You mean like running a website?
A service could be anything that's listening for a request (website, ftp server, webui for a program, etc)
Ok and lets say I want to host a mc server. I tried that back in the day and it again, didnt work. I used the port I port forwarded (2222) and no one could have connected to it.
Is the server running
You mean like, is it opened to LAN?
Sure
Well then yeah. I did that and my friends still couldn't join the server.
The server was running on the correct port?
Your firewall is open? the IP in the port forwarding rule is correct? correct selection of TCP/UDP in the rule?
How do you close a flask webserver without context?(running flask with discord.py)
Trying to close it in another file (flask on api.py, closing it at bot.py)
instance launched with
(on api.py)```py
part = partial(app.run, '0.0.0.0', port=5000, debug=True, use_reloader=False)
t = Thread(target=part)
t.start()
close function needs to be on bot.py
The server was running on the correct port?
@wraith grove Yes
Wdym by "Your firewall is open" @wraith grove
The IP in the port forwarding rule is correct, and when I was doing it, it asked me if I want to automaticly port forward both UDP and TCP so I chose both.
hey how should i start learning networking
I started with learning sockets tho @ember ledge
@empty solstice any ideas on how i should start
like what to learn in sockets
alot of stuff are too complicated to learn from
well I first did making a simple server and client
ive done that actually
a simple message sending thing that the client sends to the server
@empty solstice i didn't knwo how continue
i actually did that
yeh that can be done BTW
then just try searching some different projects
and think of it's logic
well I'm doing one myself
ok
yes
did you try connecting different clients to one server?
is sockets the only way to do netwroking
yeh ask?
or the core of networking in python
well for me I have discovered till sockets tho
there maybe some other module or something
ahh
that helps in networking
ohh great
but i got intrested in learning it
yeh sockets will help
and when i tried i failed miserbally
try again lol
Asyncio
Diesel
Pulsar
Pyzmq
Twisted
TxZMQ
NAPALM
these are some libraries for networking in python
I searched web
i made a chat app using file handeling
@ember ledge ohhh great
I'm trying to make one too
but it is hard AF
ooh i know asyncio
great
as they are coroutines
I searched web
you should learn it
i m a beginner in networking
i actually completed the entire igce sylybus in 0ne hour
what is that?? lmao
its a board
its an international board by Cambridge
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
that's so coooll๐ฅ๐ฅ๐ฅ
mmh that too it was my first time programming
ohh greaaat
so my teacher said i had some potentaial but now everthing is going bad
im not able too learn anything new
im a boy
the image was a commision someone made for me for free
what image?
icon
@carmine nexus Minecraft might do it automatically but you also might need to manually open the port in your firewall
press Windows key + r, then type wf.msc in the box and press enter
click into the inbound rules tab on the left, then click new rule on the right
then port on the first page, TCP and the port you want to allow on the next page, then you can click through the rest of it pretty much and give it a name on the very last page
looking for someone good in network programming, please send me a DM if interested.
why not just ask here
If your not paying, and you give no real information about it, why would anyone wanna dm you about it
ok, my fault. it's actually about a project i have and wanted it to be discrete
you mind if i send you a dm? @wraith grove
then port on the first page, TCP and the port you want to allow on the next page, then you can click through the rest of it pretty much and give it a name on the very last page
@wraith grove Do I need to repeat the same process for the UDP port?
I did what you told me to do so know I am just confused is it opened or not lol.
You shouldn't need to, afaik minecraft uses tcp exclusively, at least for the desktop version
does it work now?
Ok but the thing is I am trying to host web page ๐ mc was just like an example. Anyways I ran into another problem ._.
Is it ok if I dm you? @wraith grove
Ok I'll just send all here then.
import serial
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
import serial
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
from flask import Flask
app = Flask(__name__)
class RequestHandler_httpd(BaseHTTPRequestHandler):
def do_GET(self):
ser = serial.Serial("/dev/ttyUSB0", 9600)
getVal = ser.readline()
value = str(getVal)[2:]
print(value[:-5])
messagetosend = bytes(str(value[:-5]),"utf")
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.send_header('Content-Length', len(messagetosend))
self.end_headers()
self.wfile.write(messagetosend)
print(self.requestline)
return
@app.route("/")
def home():
RequestHandler_httpd(BaseHTTPRequestHandler)
server_address_httpd = ('192.168.1.10',8080)
httpd = HTTPServer(server_address_httpd, RequestHandler_httpd)
print('Server starting...')
httpd.serve_forever()
while True:
RequestHandler_httpd.do_GET()
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=2222)```
so
put py after the backticks at the beginning
My arduino reads the temp and by serial communication sends it to pc which then puts it up on the web
well yeah you are trying to connect to 0.0.0.0
thats not a real IP
0.0.0.0 in your program just represents it will respond on any interface
its not what you are actually connecting to
yeah but, it has to be that cuz then other ppl can remotely access it
well it doesn't have to be that
basically my friend has the same this set for his web page and it works...
but regardless you connect using the IP of the computer running the server
so I should change it right?
not in your script
Type the IP of the computer running the script in your address bar
the IP is what tells your computer where the website is
either one should work if you have portforwarding set up
local ip is normally how you test it at first
this comes out
I told you not to change your script
You are getting an error because your computer doesn't have an interface with that IP, since it is on your local network
Revert your script, then do what I said
ok I changed it back how it was ("0.0.0.0")
lmao its in the error message
crap
your IP isn't sensitive information
still the location cant be reached
how tho
it tells you at the bottom of that error message
I am noob at flask sry if I am annoying
RequestHandler_httpd(BaseHTTPRequestHandler) this line is incorrect
what do you expect it to do?
so basicly whenever I connect to it it creates like the header with info about temp
basically it worked before without the flask but it was so dumb and impractical
Not sure what you mean
what do you expect that line specifically to do, not the whole script
To be honest idk lol I found it on the internet, basically found this on someone's website
ok but now all other stuff are not working
from the defined function
oh ok that's why I needed the class
What do you get when you visit the website
uh why are you sending out the data out on usb with port 9600
oh wait I see what your doing lmao
silly me
haha lol
So it loads but gives a blank page?
I think that would imply your input is doing something funky
so I would debug around that
every time it said that the site cant be reached
ip wrong?
At the same IP as the previous error page?
i have this error
Traceback (most recent call last):
File "C:/Users/Mashiro/Desktop/projectsChallenge/DB/server.py", line 48, in <module>
main()
File "C:/Users/Mashiro/Desktop/projectsChallenge/DB/server.py", line 37, in main
_client, _address = server.accept()
File "C:\Users\Mashiro\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 292, in accept
fd, addr = self._accept()
OSError: [WinError 10022] An invalid argument was supplied
file name = server.py
import socket
import threading
from tkinter import *
from tkinter import messagebox
import json
import pickle
import configparser
config = configparser.ConfigParser()
config.read('settings.ini')
_dataSize = 1024
HOST = "127.0.0.1"
PORT = 566
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))
clients = []
dc_servers = {}
def recv_data(client):
while True:
data = client.recv(_dataSize)
if data.decode() == "login":
print("login data....") ## testing...
def main():
while True:
_client, _address = server.accept()
clients.append(_client)
print(f"[NEW CONNECTION] {_address} connected to the server.")
recv_data_thread = threading.Thread(target=recv_data, args=(_client,))
recv_data_thread.start()
if __name__ == "__main__":
main()
what is the problem..?
At the same IP as the previous error page?
@wraith grove yes
@ember ledge Decently sure you need admin rights to be able to host on ports <1024, might be wrong tho
try a higher port
Nothing gets printed from the script right @carmine nexus
yup
have you tried rebooting the script
@ember ledge Decently sure you need admin rights to be able to host on ports <1024, might be wrong tho
@wraith grove
no this is the ... like when i want to receive data
try a higher port
@wraith grove
i tried
same error?
yup
its c, addr = server.accept() not _server.accept() pretty aure that womt work
This is what it used to display when connected to the specific local IP
oh so its working as expected
So your port forwarding is wrong
can you send me a screenshot of the rule
so basicly the script would create a temporary website kinda and send <h3>data</h3>
oh I know the problem
I'll try setting it to Welcome
okay wait so it gets called every time you go to "/"
and try running it and see what happens
you are def misunderstanding how to use flask
look what I showed you that used to work was when there was NO FLASK CODE
its not the same as a httpserver from python
Yeah that makes more sense now
basically with flask you just return the stuff you want to appear on the page
so just return the data
Thats because its a WSGI interface
Hes using raw sockets from the looks
nvm wrong person
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
this is the example code from their docs
bruh
I am so god damn stupid
I think I know how to make it work
wait a sec pls
yeah should be pretty easy to fix it now
Why are you making a http server on every request to that endpoint ๐ค
yeah I just pointed that out a little bit ago
That is a very insecure method
and they shouldnt be used in production or globally accessible sites
It's also why his website wasn't working
bruh do I look like Bill Gate to you? ๐
if you port forward, your website is globally accessible
still some errors...
Ohhhhhhhh wait
It works!!!!
@wraith grove thanks for everything, including putting up with me.
but still doesnt work if I dont access it from local ip ๐ฆ
Send me a screenshot of your portforwarding rule
and how do I do that
you mean like the thing on internet?
like 192.168.1.1. thing
i mean you have to if you want to expose it
Name: MyHttpServer
Protocol: Both
WAN Host Start Ip Address: 0.0.0.0
WAN Host End Ip Address: 255.255.255.254
WAN Connection: Internet_Ethernet
WAN Start Port: <server port>
WAN End Port: <server port>
Enable MAC mapping: un-ticked
LAN Host IP addres: 192.168.1.100
LAN Host Start Port: <server port>
LAN Host End Port: <server port>```
That should be what you need to portforward
tho im not 100% surte
that's what it is bro
BRO
wait
I think it works
but I need someone to try accessing it
@carmine nexus If its that same public IP as before it doesn't work for me
is the LAN Host IP address the same as the local ip of the server
I mean it didnt work for you cuz I turned the web site off
wait I'll turn it on so you can try accessing it
@wraith grove here's the link http://93.137.129.223:8080/Welcome
try accessing it and tell me if you see anything
yep works
Thanks once again!
hey
can anybody help me with putting my public IP
cause I'm not able to make a website for WAN
it is only running on localhost
if anybody knows pls tell me
i don't understand the question, can you try to phrase it differently?
ohk listen
I'm making a website
and I have used python for backend
and I have been testing it on local host 127.0.0.1
but when I tried to put it online
I set the host as my public IP
but it was still in the local host server
still need more information
what are you using to serve your site
how did you specify the IP
okay can you share the code for how you bind your sockets
hello
okay can you share the code for how you bind your sockets
@tall olive well it is a whole F website
so may I DM?? you @tall olive
dumb question, so duno if i should use websockts or just POST , i need to update data aprox evry 5 seconds?
maybe event stream is what you want?
@app.route("/")
def home():
return render_template("main.html")```
Doesnt work for me
It says that the html file cant be found but its in the same directory as the py program. Any ideas?
@empty solstice i think generally we like to solve problems in channels so others can learn from them or help. just wanna see the socket bind line
@carmine nexus i assum that's flask?
Yeah, it is. Sorry I should've mentioned that.
by default flask will look for your templates in a tempates directory
Oh, okI didnt know that. I'll try that.
https://flask.palletsprojects.com/en/1.1.x/quickstart/#rendering-templates
Flask will look for templates in the templates folder. So if your application is a module, this folder is next to that module, if itโs a package itโs actually inside your package:
no problem
Also I have 1 more question.
When ever my site is opened, I want my flask apk to send a random value as a label on a specific position on the html file. How can I do that? Is it even possible with flask?
Basically I want to update value of html label from flask apk.
@carmine nexus you want the value to be different on page refresh or to change without reloading the page?
well I would prefer for it to change even if it's not refreshed
so you have two options with web development. server side rendering which you can do in many langauges, you're using flask for that. you can pass context into your templates with flask to do things dynamically on the server but ultimately you're just serving a rendered html page to the browser
you can also do things client side to update the page dynamically based on client inputs, time, etc. this would be done with JavaScript (or another client language that compiles to JavaScript). usually how this works is you could expose an api endpoint that serves something like json which is easily parsed by multiple languages as your'e sharing data between python and JavaScript. then you'd use ajax requests to fetch data from an API if you need to get some information, like your label to update and update the DOM directly via JavaScript
@empty solstice i think generally we like to solve problems in channels so others can learn from them or help. just wanna see the socket bind line
@tall olive OK I'll send the code in some time
Ok and how could I make the value to be different on page refresh? @tall olive
@carmine nexus do you know how to pass context to your template?
when you render your template you can pass in variables and then render those variables
No. I am new to all of this...
Oh ok.
I'll try to find something about that. Thanks.
check out this tutorial https://flask.palletsprojects.com/en/1.1.x/tutorial/
should give you a lot of info
#web-development might be a better channel for flask questions as well
Ok, thanks once again! Really appreciate your help. ๐
Hey, using scrapy with beautyful soup is silly?
silly in what way?
they do different things
so it can make sense to use both
oh wait
i read that as scapy
yup, but when I browse net, they always compare which one to use..
๐
I got spiders with scrapy, and then I use BS4 for easier extractions ๐
seems find to me if neither are a superset of the other that you'd use both
Who ever is connecting to my website from 35.196.132.85 please stop it...
obvious bait?
@carmine nexus it's possible you're just using an IP that used to be used for something else. also people just scan the web constantly to bogus requests.
you can add a firewall rule to block it if you want
address belongs to google
it's pretty common for some client to keep hitting an IP long after it stops being in use for its previously intended purpose... heh
Aight then. Thanks.
@carmine nexus are you in Brazil
shodan
?
I'm not sure this is a well-baked question, but I'm gonna ask it anyway: does socket.socket(socket.AF_INET).bind(('', port)) bind atomically, or is there a possibility of race conditions if multiple (potentially thousands) of instances of Python execute this at the same time
What would bind atomically mean here, its not a read-then-write operation
I'm imagining a loop like:
port = 1024
sock = socket.socket(socket.AF_INET)
while True:
try:
sock.bind(('', port))
except OSError:
port += 1
continue
break
(this may not be the best way to structure this loop but hopefully the intent is clear)
and this will be running in thousands of instances on the same computer, and I want each instance to get its own port for communication
some context: this will be running on scientific high-performance computing clusters to manipulate and manage other more cpu-intensive calculations running on other "compute nodes" in the cluster
I am not sure what would happen if two threads tried to bind the same port at the same time, but rather than brute forcing a port, why don't you handle it in the startup of the scripts
e.g. pass a unique unused port number to each script
the workflow doesn't really permit that approach
the scripts have a complex dependency between them which is managed by a separate project, Balsam, developed out of ALCF (Argonne labs) for peta- and exa-scale compute clusters
we have basically no way of knowing ahead of time how many total scripts will be running or the order/timing with which the scripts are executed
little bit less hacky of a solution
ok, that's a cleaner solution. basically bind to port 0 and figure out the port number after the fact. thanks!
So Iโm almost finished with my website fetcher designed to give the user a url based on input letโs say the user types in google it will return https://google.com: the program will request the url to check to see if itโs valid.
But some things Iโve read say thatโs illegal. Is it illegal to make a website fetcher.
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
i couldn't rely on people online to give you advice about whether something is legal or not. that's what lawyers are for :X
If you're simply checking if an address resolves to a webserver, you don't need to actually "fetch" from the server.
HOST = 'localhost'
PORT = 6666
ADDR = (HOST, PORT)
# GLOBAL VARIABLES
persons = []
SERVER = socket(AF_INET, SOCK_STREAM)
SERVER.bind(ADDR)
well this is how I bind my server @tall olive that you asked
I put my public IP to try to make it available tho but IDK why it still runs on localhost
It should run on localhost
Your computer is serving the website to any body who connects to your computer with port 80
Localhost just connects back to your own computer
yep
It's just another connection on port 80
yeh but when I put my public IP into the HOST variable it still run's on localhost
yeh IK that bro
well ok
then just tell me
how not to run it on local host
?
I mean it shouldn't run at all if you put your public IP as your host I'm pretty sure
Just put 0.0.0.0 as your host
The host here just tells what the destination address has to be for it to be accepted
that output looks like flask but the code does not look like flask
is the output from running a flask server?
yeah, that output is not even the same port
if you're trying to change to host/port flask listens on you pass that to flask's app.run or environment
is the output from running a flask server?
@hexed epoch yep
if you're trying to change to host/port flask listens on you pass that to flask's app.run or environment
@tall olive ohk
thanks BTW I'll try
the code isn't code for a flask server
WDYM?
running:
export FLASK_RUN_PORT=6666
will switch your local dev flask port
the code you pasted has nothing to do with flask
ok
you're declaring a few variables, creating a socket, and binding an address to it
so the code and the terminal output aren't related really
ah, ok yeah that's not how you bind a flask server
yeah, that code has nothing to do with flask ๐
you never said you were using flask you said you were doing a socket server
ohk ohk
hey guys, im making a neural network, does anyone think they could help?
its pretty long though.
i think that's a different kind of network than the intention of this channel ๐
Hi guys, I'm working on this project: https://gitlab.com/seepiol/rasp2pc . It works fine (except for one small bug but we can talk about that later), but I have some questions about sockets. First of all I would like to know if my implementation (see pc.py L289 (https://gitlab.com/seepiol/Rasp2Pc/-/blob/master/pc.py#L289) and rasp.py L472 (https://gitlab.com/seepiol/Rasp2Pc/-/blob/master/rasp.py#L472) ) it's ok or there is a better way
@severe halo couple things:
first it's just a lot of code to be at the top level, some functions for organization would be nice. as for some feedback
it's a pretty basic protocol you have. The client kind of assumes it'll never get partial messages back from the server or that you'll never need to receive a message larger than 1024 bytes. probably find in this simple protocol for now but there's no guarantee you'll get all the bytes back in one recv but in practice in your environment you might not ever have a problem.
the server can only accept messages from one client at a time. if multiple clients try to connect they'll overflow the listen backlog. again, might be fine for your environment but something to consider when writing larger socket servers. you also have a superfluous pass on connection accept
you have functions referring to raspsocket which is defined in a __main__ gate so this code can't work as a library at all. you should pass raspsocket to your UI_Mainwindow constructor and store as an attribute vs accessing it globally.
not a bad attempt if you're new to sockets though
is there any coherent guide or reference for setting up nonstandard CA certificate bundles in such a way that python can find them with urllib and urllib3/requests, on linux?
@tall olive Thank you so much! What do you mean with the first paragraph? I don't really understand๐ฌ Anyway yeah, I didn't pay much attention to the reciving stuff because for now and I think also in the future I'll continue to send only that sort of index (which is "short"). Maybe in the future Maybe in the future I will want to allow more clients to connect, how should I do it? Just increase the backlog? About the IU you're right, I was quite approximate and I simply copied the qtdesigner code without going into it in depth. Huge thanks!
@severe halo with tcp just because you send("foo") on one end doesn't guaranteed that recv(1024) will get "foo". it could get "fo" and a subsequent call could get "o"
with a streaming protocol you usually mark the end of your messages some how so you know when you've received a full message
but in practice on your home network you'll likely never see that happen
thanks! ill take a look
@severe halo also if you want to work with multiple clients you'll want to move your handler into a thread or look into handling it with async code so you can have some code always ready to accept
a common pattern is to have your main thread just running accept in a loop and spinning off a thread to handle the client connection
oh wait you wanted a CA
no i think this is it
at larger scale you'd look into async
oh okay
my company MITMs SSL connections
and it breaks everything: git, pip, conda (which uses requests/urllib3), requests/urllib3
they use a self-signed certificate to do so
oh so you just need to know how to trust them
yes
tbh that should be done with group policy or something similar
unfortunately i dont know where the certs have been installed on our machines
this is on linux
on windows its a lost cause
IT just doesnt care
but at least on our linux work machines id like to understand how it's supposed to work
Its kinda baffling to me that your IT doesn't make all the machines trust their own certificates
๐คทโโ๏ธ
on windows for example i can connect to websites fine, so whatever the browsers use works
but python and git break
that is really strange
on linux, everything started breaking recently. these are SSH only on prem servers so i dont even know if they bothered to install the CA certs anywhere
everything breaks on the linux machines, even curl
oh does it just give you a warning on browsers
nope the web browsers on our windows machines work fine, no warnings or anything
again i dont really care about the windows case right now, because 1) i know it's complicated w/ AD and group policy, and 2) my team mostly works on the linux servers
i say "servers" but really are just big beefy computers sitting in an on-prem data center somewhere
Yeah I'm just curious on what is going on there
me too ๐
let me give you an example
% git clone https://github.com/gwerbin/scientific-colourmaps
Cloning into 'scientific-colourmaps'...
fatal: unable to access 'https://github.com/gwerbin/scientific-colourmaps/': Peer's certificate issuer has been marked as not trusted by the user.
this is actually a different error compared to what i used to get ๐ค
maybe they have browser configs managed to use proxy rather than setting up a system CA 
You have the CA file right
no i have no idea where it would even be
that's part of the problem
i've asked repeatedly and i never get a response
and now pip install is magically working x_x
I'm pretty sure you would have to get it from your IT
im so confused
let me see if i can find it..
theres a bunch of stuff in /etc/pki
It might be in there, but if its not already trusted why do you think its on your machine at all
thats a good question and i was going to ask
it is possible that they didnt bother to put it on these machines at all right?
Yeah I would say thats the most probable
ugh
alright ill ask
in any case, how does this typically work?
a library like openssl would have to find the certificate used to self-sign?
I believe the CA is usually stored in /etc/pki/ca-trust/
so just looks in there for it
varies by distro
makes sense. it's been a little while since i read about all this. a "self-signed" certificate means that the certificate represents both the website and the custom/nonstandard CA itself?
It just means the certificate was signed by a CA that is only trusted in your organization
makes sense
but in order to trust it, i need the actual CA cert
which is either tucked away somewhere or just not available to me right now
hello , I have an issue of building psutils on my docker image for python 2.7
it fails every single time , and the image Im trying to build is ubuntu 20.04
Building wheel for psutil (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-UhM3mw/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-UhM3mw/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-Cqscj2``` this is the backtrace
is there more?
yes @tall olive
would need to see more off the error.
cwd: /tmp/pip-install-UhM3mw/psutil/
Complete output (45 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/psutil
copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil
copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
creating build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/runner.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests```
copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_memleaks.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_testutils.py -> build/lib.linux-x86_64-2.7/psutil/tests
copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/psutil
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-1x6jhf/python2.7-2.7.18~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=572 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
9 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
guest or container?
where you're running that install
ubuntu 20.04
u mean the image right @tall olive?
you need python-dev installed
ohh
@tall olive oh OK, how is usually marked the end of the message? And ipotetically speaking, if the client doesn't receive the complete message, what happens? The client have to re-request the information? Also, do you know an OS program that uses socket in an optimal way from which I can take inspiration for the multi-client multi-threaded or asynchronous programmed stuff?
@dusk sparrow you probably just need to apt install python-dev then
you need python-dev installed
@tall olive so python2.7-dev would do?
@dusk sparrow you probably just need to
apt install python-devthen
@tall olive alright thank u so much
python2.7 
thank u so much @tall olive for the quick reply and a solution , much appreciated
yes it works
thank u once again!
Building wheel for psutil (setup.py): finished with status 'done'
@severe halo that's up to your protocol on how you mark the end of a message. nothing to do with tcp
if you don't get a complete message you just buffer and keep requesting
most people these days just use http as it handles most of this for you over raw tcp
i don't know any easily digestible examples off the top of my head
https://en.wikipedia.org/wiki/Type-length-value is common in protocols
Within data communication protocols, TLV (type-length-value or tag-length-value) is an encoding scheme used for optional information element in a certain protocol.
The type and length are fixed in size (typically 1-4 bytes), and the value field is of variable size. These field...
other protocols use new lines as a delimiter
there are a lot of options
if someone would help me to do a chat server using only python and so anyone could get on it even if they are not connected to my router, please if so DM me
@visual sedge i prefer to help in chat so others can join or pick up if i have to run and others can learn from the discussion. do you have specific questions about what you're stuck on?
ok if you help it'll be great anyway
and i don't have any specific question really but i can show you what i got and you could help me do it as a want to
do you want me to put the code here?
what i've tried is basically a chat server but in my own computer using port 9999 so i don't get any interference
i think it works but only in my own computer and i wanted so anybody could get in
although is 3 code, what i mean is that i have one code file for the client, other file for me and the other as the server itself
that's why i said to do it on dm so i don't disturb with all that code
@tall olive
is the code not working like you expect in some way?
yes
what is that?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
i can translate the code to HTML but you could see my ip adress
i'm going to try the ! paste instead
but @tall olive i used daemons is that a problem?
no
@tall olive this is the server
you'll notice some things in spanish
that's normal since i sometimes do it like that
so i don't get confussed
@tall olive what do you think
you didn't link anything
also you haven't said what doesn't work about it
does it error or just not work how you expect?
i think the problem is that he doesn't want to host it on his own PC (and i don't blame him lol)
it does work but i just wanted to be so anybody could get in it and not like it is know
@vernal surge exactly
so first things first, don't bind to localhost on line 54
localhost will not allow any other machine to connect
localhost is typically a DNS name to 127.0.0.1 which is a local loopback and purposefully block external packets
you can use 0.0.0.0 to bind to all interfaces
do one of two things, bind it to an actual IP address, or use 0.0.0.0
0.0.0.0 is preferred, that way the code is portable
0.0.0.0 = any ip address i'm listening on
if i use 0.0.0.0 do i have to change the client and other client code?
let me show you them first
probably not, i've not seen the client lol
unless you are statically connecting to localhost
if you bind on 0.0.0.0 connections to localhost still work
but they wont if he distributes that client code ๐
๐
this is the client >_ https://paste.pythondiscord.com/oxupuqayex.rb
okay, if they're on different computers, no, it won't still work 
ah yeah, see you are hardcoding localhost in the client
that just looks like the server with some stuff commented out
ignore me, that syntax highlighting is weird
oh no, oyu have an unescaped "
or """s
this is the other client>_https://paste.pythondiscord.com/itavuwavur.py
made everything look commented out at the end ๐
why two clients?
are they not the same thing?
oh, i see, you are mocking out two users
that is a little hard to scale ๐
i know i forgot a " and i din't put a single # but i was rushing to copy and paste and the " missed out and the #s i just didn't pu them tbh LOL
@vernal surge i wrote code for both users so they can exchange the messages
i don't know other way LOL
anyway, you need to find a server to run your code (after you change it to a 0.0.0.0 binding) ... so the way you are doing it would require a VM because you are threading
you ought to probably try running your server in a container first
and then run client against it
that will show you more of what you are wnating
and if it works, containers are easier to deploy
that is what i did on my own computer isn't it
i haven't seen a dockerfile so i have no idea
i opened the cmd on my pc 3 times, so then one was the server itself, the other 2 were the clients
nope, that isn't a container
isn't that it?
google docker
wow i didn't think this would be that hard ๐ and i thought doing a calculator with username and password in order to use it on visual interface was hard
when you start doing client/server applications, the complexity is exponential
i see
you don't need a container. once you're listening on 0.0.0.0 if you want people to connect to your home computer you'll need to setup port forwarding on your router but that's pretty sketchy
you'd wanna look at some kind of hosting provider
he doesn't want them to connect to his computer
but in lue of teaching actual daemonization (e.g. systemd or something), plus firewalling, plus networking ... docker is a bit easier lol
i read it as they wanted people to get in, not that they didn't want them to connect to home computer
i think it works but only in my own computer and i wanted so anybody could get in
but docker is like a python capsule or something?
but i can understand not wanting that ๐
docker is like an all things container lol
i use it for almost everything these days ... so i am a little biased
with the exception of true system apps
wait what if i convert the code to a executable file(.exe) but then, what server could i use?
i wouldn't do that, because then you are stuck with running it on windows... and those VMs are more expensive lol
python is nice and portable
but someone would have to have python to use the server then
not with docker ๐
ohhh i seee
although you would need docker... lol
so it's basically like a on-line code executor isn't it
but docker is not free is it
docker is free
and how do i apply docker to my code
you don't, you have docker RUN your code
you need to pick a host ... sign up for AWS, they have a fair number of free-teir services
okay i will check it out
thanks a lot man
to both you @vernal surge and @tall olive
i will tell you all when i investigate on that
thanks
good luck!
there's a ton to learn in this space
writing and deploying networked applications is a big scope
so feeling overwhelmed is definitely normal
Yeah, is still overwhelming for me at times and I've been doing it for years lol
Although, the overwhelming bits are different now
Does sendall work on UDP sockets? (Im using the standard socket library)
I see no reason why it wouldnt


