#networks
1 messages ¡ Page 39 of 1
can I share any network information here?
well
I will assume so
If I can't I am willing to stop
I have a question and that is
Does anyone know how a pfsense work?
I started running mitmproxy (technically mitmweb) and a little 5-line Python script to basically archive my browsing history, but this thing is a real memory hog. I'm not loading any insane, huge sites or making tons of calls, but after about 20 minutes I have to shut it down to my cat doesn't get sucked through a computer fan.
Even crashed my macbook pro once because of memory issues
I really want to run this full time, has anyone else experienced this? And preferably solved it?
How can I get my backtesting software on a remote server to run instead of my local machine. Plz help
:incoming_envelope: :ok_hand: applied mute to @ember ledge until <t:1640092904:f> (9 minutes and 59 seconds) (reason: burst rule: sent 8 messages in 10s).
can anyone guide me how to start learning sockets?
youtube
Hey pals!
I gotta question here
I was trying to scrape the response from this api
I finally did it with selemiumwire
but after all the hardwork of reasearching and trial and error
I discover that I had , in one of the thousand tabs that I have opened in my browser, the json response from that url
nubimetrics is a platform that requires username and password to login
I did it by capturing the har fil
file
Now I'm trying to see how i managed to do it
If i click on refresh the api displays error again
but in the tab that is working this appears
with this commented : `Determine if an object is a Buffer
*
- @author Feross Aboukhadijeh https://feross.org`
Okay so I'm using the apache benchmarking tool(ab) to test the concurrency of a reverse proxy(nginx) for a gunicorn+uvicorn server,
ab -n 100 -c 100 http://0.0.0.0:80/hello
I was binding gunicorn to a unix_socket because it's better for internal communication and there is no need for an inet socket(or thats what I understand)
$ gunicorn [options] -b unix:/path/
# nginx.config
upstream test {
server unix:./serv1.sock;
}
however, when I run ab, the first request always blocks the others,
100 request -> wait for the 1st request then send concurrent 99 requests, I then out of curiosity bound gunicorn to localhost:8081 which surprisingly was faster, all 100 requests were concurrent, any idea why this is happening?
Hey Guys i want to scrap from https://tokensniffer.com/ but every time i try i get no response only []
hello guys
im new in packet tracer and im trying to set the ip root for this network
Can you clarify what you mean? IP root doesn't really mean anything
@thorn stratus the ip route that the messege use to travel from a pc to another
okay you just need to tell each router which networks are behind which interfaces
you see that the router only knows about the networks that he is attached to
you see i fixed the ip root between all the pc but the root from pc 0 to pc2
that i dont know how
so for pc 0 to get to pc 2, router 1 and router 2 need to know how to get to the 192.168.3.0 network,
then, for the return traffic to get back, router 3 and router 2 need to know how to get to the 192.168.1.0 network
!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.
Use proper formatting.
You need to find a way to send ICMP packets.
!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.
!code print('hi')
- is it possible to run an authoritative DNS server + TOR hidden service on the same machine in the cloud and parse any DNS requests coming from the client side to the actual DNS resolver running on port 53, via hidden service address, not direct IP
- clients also don't have Tor client installed
i know tor doesn't support subdomains but i advanced in this a little which gave me hope, by using clear net to onion router such as https://onion.pet/ (not promo) i was able to send a normal request to https://hiddenservicestring.onion.pet which did forward the request from clearnet to onion and eventually to my VPS
but thats HTTP interaction to my HTTP server, how about DNS interactions to my DNS server over tor
is this possible
yep that sounds accurate
@ember ledge https://stackoverflow.com/a/20763318/1357527
sounds like it can't really be done in python
is there a way i can use my python socket over internet without paying anything
Heroku?
yes, usually
you usually just need to configure port forwarding your router
you obviously will still be paying for the cost of your internet, electricity to run the computer, etc. but you probably were paying for those already
because the two gigabit ethernet connections have a lower cost than the single fast ethernet connection
Alright thanks
@thorn stratus is this how it is?
And g0/0 was root port because of the 8 root path cost vs 19 of f0/1?
Looks correct to me
daemon: mifd[1793]: dpi_util_read_fd: fd = 13: truncated: buf = ================= Policy Link list ==================== Ver-1.244 # policies:7498, # patterns:17015 *** Matched List *** rule_id: 1160767, # hit: 4 rule_id: 1069737, # hit: 2 rule_id: 1068478, # hit: 2 rule_id: 1068479, # hit: 1 rule_id: 1160178, # hit: 4 rule_id: 1160685, # hit: 3 rule_id: 1068119, # hit: 1 rule_id: 1069032, # hit: 7 rule_id: 1061382, # hit: 1 rule_id: 1061294, # hit: 5 rule_id: 1061174, # hit: 1 rule_id: 1068265, # hit: 10 rule_id: 1065522, # hit: 1 rule_id: 1063170, # hit: 3 rule_id:
or
daemon: bulkdatad[1786]: bulkdata_platform_get_parameter_paths: map_insert failed
Can anyone tell me what this means? its a system log error that i get like daily through my router where for some reason my PC and only my PC spikes to 2000ping back to 20 over and over every second for like an hour and i have no idea how to fix it.
(using AT&t stock modem)
dunno, like with any other debian server?
hey there! I have dockerized django and local postgrtes, but django cant connect to my db. I have added extra_hosts string but i still cant connect to db from container
Can someone tell me , where should I start with networking in python ? P.S. I know some basic like topology , etc so i don't need tutorial for this
get started with sockets id suggest
Hi, is anyone familiar with the matlab "matplotlib" library?
I'm plotting graphs for wifi singal strngth
but I have an issue with the code
if anyone knows matlab, then I can send the code and issue
Used matplotlib with numpy but it was some time ago ... lol matlab too
Post that question to Data Science and AI we are there lol
can u help me with that
im trying it from the previous 3 months
Well first off you need either a static ip address (preferred) or a dhcp reservation for whatever is hosting the server so that your local ip stays the same. Then you need to configure the port forwarding
which depends a lot on your interface, but you are basically just telling it what local ip to send traffic to when it sees traffic on a certain port
Hi, running a simple http server gives me the refused connection error and this suggestion: Allow Chrome to access the network in your firewall or antivirus settings. If it is already listed as a program allowed to access the network, try removing it from the list and adding it again. Is this the only problem there might be? Also, do the http.server modules automatically stop listening at a port once there's a keyboard interrupt in the terminal? If not, how can I killall?
Can anybody help me understand how I can edit byte data in an array. In particular, I would like to edit an ACK Packet in a TFTP transfer according to https://datatracker.ietf.org/doc/html/rfc1350/
The TFTP Protocol (Revision 2) (RFC )
Give me a book about networking pleqse
whichc port do i forward it to
it asks me internal and external port
and protocol
Hey @fathom plank!
It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
i'll send you personallyy
Hey nvm but can you send it to me too pleaseđ
I have been looking for some good books to get into networking
If i could manage to pipe the stdout of a subprocess to a socket. Would I manage to monitor the progress of that subprocess in realtime?
@sick ore
look into tail -f filename.txt
it will basically monitor filename.txt which i also assume could be a socket
and whenever new data is appended to this file, it will appear on the screen
so in one terminal try something like:
for i in $(seq 10); do echo hey > out.txt ; sleep 2; done
and while its running type this in another terminal:
tail -f out.txt
both have to be in the same directory ofc
I still need to get that data to the client
I have sanic doing a subprocess and want the output of that subprocess sent back to the client
so you want to pipe this output
into a socket?
is it a socket file or a remote connection?
remote connection I want all that data delivered back to the client
Well i'm working locally now
but eventually remote
so you could do it from 2 places, from the terminal itself when starting the sanic server from command line
and also inside of the actual code you wrote for your server
for the latter, something like this can work, this should be above everything in your code, just play around with it
import sys, socket, time, io
s = socket.socket()
s.connect(("localhost", 4444)) # your remote server location goes here
original_stdout = sys.stdout
# overwriting the built in write method
class file(io.TextIOWrapper):
def write(self, d, encoding=sys.getdefaultencoding()):
s.send(d.encode())
original_stdout.write(d)
super().write(d)
sys.stdout = file(open("/dev/null", 'a').detach())
# Main code goes here
# preferably run this in the end too
sys.stdout.close()
s.close()
this will redirect stdout to both localhost:4444 and also regular output at once
this should suffice unless logging library or similar is used under the hood by sanic

Sounds like the best bet is to use the asyncio subprocess, and then stream the stdout to an endpoint
@sick ore do you want the data to be both printed and also sent to a remote machine
or only sent to a remote machine
At this point I'll take which ever works
Ideally only sent to a remote machine but I cant be fussy at this stage
although maybe printed would offer a redundancy as well
đ¤
You forward the port you want to connect to externally
it depends on your application
your protocol will also depend on this
import asyncio
from sanic import Request, Sanic
app = Sanic(__name__)
@app.get("/")
async def handler(request: Request):
response = await request.respond()
cmd = "for nvar in {1..10};do echo $nvar;sleep 1s;done;"
proc = await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
while True:
line = await proc.stdout.readline()
await response.send(line)
if proc.stdout.at_eof():
break
app.run(port=9999, debug=True)
Do you mean something like this?
Looking for advice on being able to parse out packet information from a rerouted packet. I want to be able to pull out things like ip address, header information, mac information, etc etc... Would sockets be the correct route for this or is there something easier?
If it's on a small scale you could use something like wireshark
how do i send udp packets through the socket module with proxy?
Tysm good sir
please explain me coz im new to networking đ
i cant understand any of your words
I don't have enough information to help you
ok
like
what information u need
hey im new in this Community im enrolling into Diploma in computer science i wanna know what should i major in and can u all show a path to teach me to like free website to do pythan
if you just want to send this data to a remote machine without outputting it locally then just pipe the output into nc when you run the sanic server, replace ip and port with the ones you need
sanic my.app | nc 127.0.0.1 4444
urrr no
not the best channel for getting that sort of help, try in #career-advice
hi
BACK @prisma cobalt
okay good
go to the screen that showed you the external, internal port options
which port are you trying to forward (if you dont know then tell me what your purpose/application is)
@fathom plank
you talking abt this
in my code i set the port as 5050
okay the internal and external port should be 5050
the internal IP address should be your computers local IPv4 address
which you can find by running ipconfig in CMD
so you filled that out?
you can leave it as both
then add the rule
and your set
which rule?
i mean like
?do i have to add just click on the plus button
yeah
its called a port forwarding "rule"
ok
then clients should be able to connect through port 5050
i've tried the same thing u told me many time but it just dosent get connected
has the rule been added
then you should be able to connect, whats not working?
?
@prisma cobalt what should be the ip in my client when i am operating it on some other network
Your public ip address
how do i get that
Type into google âwhatâs my IP addressâ
nope
it connects when given the internal ip
but dosent when given the public ip
=/
Are you using port 5050?
yes
Show your code
import socket
HEADER = 64
PORT = 5050
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
SERVER = "127.0.0.1"
ADDR = (SERVER, PORT)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)
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)
print(client.recv(2048).decode(FORMAT))
while True:
msg = input()
if msg == DISCONNECT_MESSAGE:
break
send(msg)
The ip your using is wrong
put 127.0.0.1 for security purposes (u should understand)
Are you sure thatâs your local IP address there?
Whatâs your server code?
sending
import socket
import threading
HEADER = 64
PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(ADDR)
def handle_client(conn, addr):
print(f"[NEW CONNECTION] {addr} connected.")
connected = True
while connected:
msg_length = conn.recv(HEADER).decode(FORMAT)
if msg_length:
msg_length = int(msg_length)
msg = conn.recv(msg_length).decode(FORMAT)
if msg == DISCONNECT_MESSAGE:
connected = False
print(f"[{addr}] {msg}")
conn.send("Msg received".encode(FORMAT))
conn.close()
def start():
server.listen()
print(f"[LISTENING] Server is listening on {SERVER}")
while True:
conn, addr = server.accept()
thread = threading.Thread(target=handle_client, args=(conn, addr))
thread.start()
print(f"[ACTIVE CONNECTIONS] {threading.activeCount() - 1}")
print("[STARTING] server is starting...")
start()
Replace your server variable with â0.0.0.0â
Np đ
The ip â0.0.0.0â indicates it binds to all interfaces (to accept all connections) but the way you were doing it would have only allowed connections from your local network
oohh
noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
i forgot to remove 127.0.0.1 from client file and thats why it got connected
now it not connecting đ
@prisma cobalt any other gusses why its not working?
What's the problem?
umm
i want my python chat program to run over internet without me paying anything
i pot forwarded it
*port
dont mind but please read the above chats and you will underatnd whats going on
*understand
Your server can start at the address returned by socket.gethostbyname(socket.gethostname())
Your clients connect to the public IP address
So now your using your public IP address in the client and the address 0.0.0.0 in the server?
yes
It sounds stupid but sometime you have to manually save the port forwarding rule on your routers page, itâs caught me out before lol
Is this the server's code?
Yes
Try giving a positive number in server.listen
okay...
What's the code of the clients?
here
Don't connect them to "127.0.0.1"
no i wrote 127.0.0.1 for not reavealing my actual public ip
Okay
dont mind but ur dp is scary
Can you try this code in a local network and use 127.0.0.1 in order to see if it's the port forwarding?
They said that worked I think
Self drawn
ohhh
yes its the port forwarding
it works in a local network
Any option?
yes that happend
with me
2 years in the past
there is one small ok button
and if u press that the setting get saved
Is it possible for you to send a censored screenshot
of what?
Ports
Change the protocol to TCP
ok
It shouldnât matter
Does it work now?
:incoming_envelope: :ok_hand: applied mute to @fathom plank until <t:1640788481:f> (9 minutes and 58 seconds) (reason: burst rule: sent 8 messages in 10s).
đ
As you can no longer give feedback, try looking for a port forwarding tutorial online for your router type.
They say it doesnât work
The tutorials' solution?
And are they sure that they got the right IP address on the port forwarding rule?
I see they have sent a screenshot of an IPv4 address, and it seems as though they are on Windows, but is the address, then, prefixed with "Local IPv4 address:" or something like that?
what does the nc do actually? remember I still need a way of getting the output to the client đ
@fathom plank you should be able to type again now
yes
It's the server's IP address?
Is that machine running the server script?
ye
You're probably doing something wrong port forwarding
thats what i have been thinking for years now
umm
@steady horizon i am currently watching a tutorial and they said to include dmz and i cany get to figure out what should i put in host ip address
It can be one of three addresses. Your public IP address, your gateway (private) IP address or your server's (private) IP address
ok
can someone help whats wrong in this
did u put the correct indent?
try works like
try:
# error prone code
except some exception:
# handle exception
# or
finally:
# do something
Both except and finally are optional but you need to have at least on of them
why are except and finally highlighted
and how do you do that
!code @fathom plank
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.
They are highlighted because they are valid Python statement keywords
Does anyone know how long the expiration time of a dropbox api token is and how i get tokens that don't expire / break / whatever ?
How does aws Lambda talk to Ec2?
There is something I don't understand.
I have a little piece of Python code to grab some html from a forked repo on Github.com
headers = { "Host": "github.com",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0",
"Cookie": "..." }
requests.get("https://github.com/007arunwilson/react-native-fs", headers=headers).text
I am passing in my cookie from my browser which seems to trick Github into thinking I'm logged in but every so often I get "Failed to load latest commit information."
Does anyone have any ideas why this is happening and how I can get around it? I've tried adding all the headers passed in through my browser but it still seems to do this randomly. Also tried adding some time.sleep.
I have an amazing bot that can trigger your messages and send a message back.. the problem is when i do that the bot takes about 30 seconds to say the message back how can I fix this to normal time?
Port forwarding is for machines on the outside of your network trying to reach in, if you want it to work for going from inside your network to inside your network via the public IP, you would need to configure hairpin NAT, which not all routers support
I would instead recommend connecting using your local IP when inside your network and the public IP when outside your network
nc establishes a connection
to IP:PORT pair
so for example, if you just run:
nc example.com 80
it will connect to the server behind example.com on port 80 and it will hang there and let you specify the payload you want to send
now if you pipe an output of a program into nc:
sanic hello.app | nc 127.0.0.1 80
it will run hello.app webserver and redirect output to 127.0.0.1
it seems nc is for unix like hosts only though?
on port 80
it doesn't work on win 10
by unix like hosts do you mean socket files?
i believe there is netcat
on windows
sec
Ncat is a free, open-source Netcat replacement for Linux, Windows, OS X and more. TLS/SSL encryption, proxy support, IPv6, Lua scripting.
you can download it here
actually i am unsure about piping on windows
not all the machines on this cluster will be windows but some of them will so looking to deploy it easily
i believe you can enable bash on windows
which is why it would be great if I can just use regular python sockets and plug the client into it
or install https://gitforwindows.org/
We bring the awesome Git VCS to Windows
which provides linux like terminal
basically
so you were more looking for platform independent solution?
yeah
and the less things to install the better
time is literally money when working with clusters
I am having issues with socket, I try to connect my second device (which is on the same network) and it work connect. I have a feeling this might have something to do with the firewall. However I am not sure how to resolve the issue.
okay.......................................................
i'll try it with my neighbor's wifi
you should have said right away that you were using windows @sick ore
and don't want every cluster to install additional things
besides python
os shouldn't matter there are going to be some windows machines on the cluster
If I came here said I was building a distributed renderfarm nobody would answer
which is why I purposefully left it kinda general so I get everyones opinion
I never said I didn't want every machine on the cluster to have to install additional anything, less is better but its unreasonable to assume every machine I need to connect to has everything I'll worry about that when the time comes
the most blatant thing everyone would suggest you is to pipe the output of your server into nc
in which case os would matter
@sick ore
will you be using powershell
for each of the clusters
Its google compute cloud instances so no. They'll probably be ubuntu
I'd still want to use a platform independent solution if possible though
Because inevitably people are gonna be like "oh neat does it work on X"
Lesson learned: don't use message queues of any sort to build RPC. There's much more corner cases to handle than if you would do it using plain TCP/HTTP. It's not that hard to find/write load balancers for TCP/HTTP. Most importantly, if for some reason you don't need the remote call anymore, you just close connection (most likely you need a timeout), and all proxies/balancers in the middle can easily propagate this intent.
I tried using:
def text_from_url(url):
cookiejar = browser_cookie3.firefox(domain_name='github.com')
response = requests.get(url, cookies=cookiejar)
return response.text
But doesn't even seem to work. At least if I copy/paste in my cookie from the browser headers it will be logged in
@sick ore holy shit
i just went down such a rabbit hole
out of curiosity
okay it is possible to do inside of python after all
!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.pythondiscord.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 have a feeling that since Ubuntu moved to snap's Firefox's cookies.sqlite file has moved somewhere else
@sick ore
https://paste.pythondiscord.com/imulenamon.py - example sanic server
https://paste.pythondiscord.com/putitajatu.py - socket server on a remote machine that you want to deliver logs to
Okay it was because Ubuntu 21.10 moved to use snap for Firefox. Made a pull request https://github.com/borisbabic/browser_cookie3/pull/109
Anyway back to my original problem.. sometimes Github via requests.get() will give me a page with "Failed to load latest commit information." and it seems completely random
Hey uh
where did you find this anyway
Just wondering how you found it relatively quickly and I been bashing my head trying to find something
i have been bashing my head for maybe an hour
too
so basically
after pointlessly looking up ways to redirect stdout to a socket, something like sys.stdout = newval, which didn't work in this case, because instead of print() being used (in which case it would've worked) here the logging library was used by sanic to print out the output
i decided to take a look at the docs of sanic
and one of the parameters it takes when you initialize an app with app = Sanic() is logger config
it takes an object of this type logging.config.dictconfig so i tried to play around with it and eventually just gave up and looked up "logger into socket python"
on google
similar code to the one i posted was there

ah
anyways since it can't just take an actual logger object like the one i use in the first code here, but instead requires a logger config, in a dictionary format, i couldnt get anywhere with this
though @sick ore you should always look at the github issues
i found at least 6 questions there where people also had similar situations with sanic, which pointed me in the right direction
i keep getting errors saying the address im using is already in use! i'm trying to create a socket and bind it to localhost/192.168.1.x/127.0.0.1 on port 8080, it keeps saying it's in use, i use fuser and lsof to see what process is using it, none. i still use fuser and lsof to kill all processes running on port 8080, even though they didnt list any, it still aint working, sayin it's in use!
im getting mad!
Try seeing if a different port works for now
Do either of them with (when being bound to)
For sending data from an app, is just a normal is good, or should I create an api and use it to post?
what dou mean with 'is a normal' ? I would always use API, it allows you to use GET,POST,PATCH,PUT,DELETE with separate routes, params etc.
Are you on windows
Yes?
Hi everyone. I have a technical issue! I developed Client Server Socket connection Python program. My app is Client and we have cpp server that developed on a board. (As a controller). This server will send a simple string to my client app. In my app will check this string into some procedures that i donât need describe that here. But after getting string from the server, my program will send an ack from socket connection to cpp server. This ack is like s1 for opening door, and s2 for closing the door. This app worked (mean of worked is open/close door) on my mac and a simple windows system. our server is CentOS. My app is running on that. all procedures work very fine on that, even py app will send ack data base on the CentOS server. but door of traffic gate doesnât open or close. Anyone have idea for this issue?
sudo netstat -tlpn | grep 8080
nice thank you
so basically, say it says can't bind to port 8080, then with this command you can see what other program already uses and listens on that port
i used fuser and lsof to do this, but, when trying on 8080, it said nothin was running
yeah thats what i did
does it print gibberish
it prints nothin
well right now im not running my server but it still did nothing when it was running
just stick with
sudo netstat -tlpn
even without sorting by port
the output will be quite short
and you can easily distinguish which port is used by what program
so when i first started using sockets a while ago, i noticed that if i closed my script the address/port would be occupied for a bit longer, so i googled it and some tutorial said to use
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
and i've been doing so ever since, the docs are a bit MEH, can someone please explain what socket.setsockopt() does, what socket.SOL_SOCKET is, and what's the difference between socket.SO_REUSEADDR and socket.SO_REUSEPORT?
hi all, I would like to know if someone had the chance to work with GPON and Python. Thanks.
those are socket options. the first argument is the level, and the second and third are the option "name" and option value to set. More can be read here: https://linux.die.net/man/3/setsockopt
The setsockopt() function shall set the option specified by the option_name argument, at the protocol level specified by the level argument, to the value ...
thank you ill read that
that's the documentation for the C function setsockopt btw. it has the same signature, except the first argument int socket is skipped in your example, because you use it as a method of sock. So the int socket is implied. But basically: the python socket functions are just wrappers around the C versions with some extras.
I don't think the SO_REUSEADDR is actually needed on windows. It works quite differently there.
Hello, very specific question: I have a python code that sends a txt file to my dropbox using the dropbox api app i made, howver the token only lasts for 4hrs, how do i request a new OAuth2 token with app key and apps ecret as well as authorization_code? Does anyone maybe know ?
I've been trying to do this for 3 days now but always get some errors and wasn't able to find working code on github or stackoverflow
Problem solved.
!warn 504167455359369216 Please don't dump advertisements here. We are not an adboard, as per our #rules.
:incoming_envelope: :ok_hand: applied warning to @dusky raptor.
anyone can help me?
My recommendation is to debug if the ack is revieved on the server-side. If it is, then it's likely not a networking issue.
Is it normal to use one server for making a chat application?
I need to get a list of forks for a Github project showing ahead and behind stats as well as last commit date. I've written a Python script and everything works great except for the date.
For some reason during operation it will randomly return a page with an error stating "Failed to load latest commit information." and I cannot retrieve the date from the page although ahead and behind stats are fine every time. I've tried adding time.sleep() with various delays but it doesn't seem to make a difference.
Here's the script:
https://pastebin.com/7m3t2kVG
Usage Example:
python3 list-forks.py https://github.com/itinance/react-native-fs
Does anyone have any ideas why this is happening and/or a potential work around?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
have you tried just retrying the request if you get that response?
Yes, there is some commented out code that will retry if it gets that text. It doesn't seem to help
Have you tried printing out the url it's failing on and seeing if you get the same response in a browser?
Yes and it seems to randomly change and I get the same result using a similar bookmarklet in a browser
Sounds like either a bad url or a problem with github
Or maybe some type of rate limit?
If I go to the website manually it works fine. If it's a rate limit it seems to happen very soon and even if I make it wait 10 seconds between each request it does the same thing
If I go to https://github.com/itinance/react-native-fs/network/members and click on each one opening into a new tab it always shows the date
It's so weird.. I just added a 10 second wait between each request got this output:
https://github.com/itinance/react-native-fs (root)
https://github.com/007arunwilson/react-native-fs (-246 itinance:master)
https://github.com/1986webdeveloper/react-native-fs (-108 itinance:master)
https://github.com/2534290808/react-native-fs (-422 itinance:master)
https://github.com/386sx/react-native-fs (+1 -108 itinance:master)
https://github.com/3mpe/react-native-fs (-151 itinance:master)
https://github.com/4ian/react-native-fs (-654 itinance:master)
https://github.com/824420263/react-native-fs (-32 itinance:master)
https://github.com/a-koka/react-native-fs (-158 itinance:master)
https://github.com/abhilash0001/react-native-fs (-481 itinance:master)
Then changed back to 1 second then got this:
https://github.com/itinance/react-native-fs (root)
https://github.com/007arunwilson/react-native-fs (-246 itinance:master 2018-07-11)
https://github.com/1986webdeveloper/react-native-fs (-108 itinance:master 2019-07-26)
https://github.com/2534290808/react-native-fs (-422 itinance:master 2017-06-14)
https://github.com/386sx/react-native-fs (+1 -108 itinance:master 2019-09-13)
https://github.com/3mpe/react-native-fs (-151 itinance:master 2019-01-05)
https://github.com/4ian/react-native-fs (-654 itinance:master 2015-12-02)
https://github.com/824420263/react-native-fs (-32 itinance:master)
https://github.com/a-koka/react-native-fs (-158 itinance:master)
https://github.com/abhilash0001/react-native-fs (-481 itinance:master)
https://docs.github.com/en/rest/reference/repos#list-forks @mossy sluice ?
using the API >>> scraping
https://docs.github.com/en/rest/reference/commits#compare-two-commits to compare branches
@slender steeple according to https://stackoverflow.com/questions/54868988/how-to-determine-which-forks-on-github-are-ahead its too easy to trigger the rate limit
unless you're somehow doing more than 5k requests/hr (https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api#authentication), you should be fine
and theres already a python wrapper (https://github.com/PyGithub/PyGithub), so you dont need to manually format your API requests
Port 80 is a reserved port. Only apps that are running as root can use it, generally speaking. If you change the port to anything over 1024 you should be good. By convention, people use port 8080 for running a webserver as a non-profit user
Ping uses the ivmp protocol. If you want to ping from python without using the ping command line tool, you'll need to construct ICMP packets. This library seems like a pretty good option: https://pypi.org/project/icmplib/
thanks dude
Np :)
Do you have to port forward in order to connect devices across different networks using socket?
If your hosting a server on a home network itâs very likely you (the network owner) will have to manually configure port forwarding to allow incoming connections
Note: if your a client then itâs not needed, only the server has to
port forwarding is only relevant if there is NAT at some point in between the two networks
hi i made a vpn and m trying to hook up attack nonfictions it made in python but it wont let me screen it
how do i run python on a vps server ?
Your vps server is not much different from your home computer
Itâs just a computer in the cloud thatâs running operating system the way your personal computer would
What OS is it using?
hello all, anyone good with netmiko here ?
server.py```python
host = 'local host'
port = 5000
s = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
s.bind(('', port))
s.listen(100)
keepalive = True
connectedClients = []
def broadcast(message):
for x in connectedClients:
x.send(message)
while keepalive == True:
c, addr = s.accept()
if (c not in connectedClients):
connectedClients.append(c)
print("added user")
else:
print("didnt add user")
display client address
print("CONNECTION FROM:", str(addr))
send message to the client after
encoding into binary string
connData = list(addr)
connIdentifier = str(connData[1])
fullmessage = f"{connIdentifier} has joined the room."
encodedmessage = fullmessage.encode()
print(c)
c.send(encodedmessage)
threadedConns = []
def loopedMessages():
while True:
data = c.recv(1024).decode()
if (c not in threadedConns):
threading.Thread(target=loopedMessages, daemon=True).start()
threadedConns.append(c)
print("started thread for", c)
print(f"RECEIVED: {data}")
if not data:
break
broadcast(message=f"ADDTOCONSOLE {data}".encode())
threading.Thread(target=loopedMessages, daemon=True).start()
If there's only 1 client sending messages to the server, it works fine. But when there's multiple clients sending messages to the server, the server doesn't receive any message in console after all clients send a message at least once.
Example:
Client 1: 1
Client 2: 2
Client 1: 3
Client 2: 4
Only messages 1 and 2 would get sent.
Does anyone know what's the reason for this?
whats your client script?
global s
s = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
s.connect((f'{ip}', port))
msg = s.recv(1024)
connected = True
while connected == True:
while msg:
print('Received:' + msg.decode())
recMsg = msg.decode()
splitRecMsg = recMsg.split(" ")
if (splitRecMsg[0] == "ADDTOCONSOLE"):
splitRecMsg.remove("ADDTOCONSOLE")
recMsg = " ".join(splitRecMsg)
currentConsoleContent = dpg.get_value(item="conn_console")
newConsoleContent = f"""{currentConsoleContent}
{recMsg}"""
dpg.set_value(item="conn_console", value=newConsoleContent)
msg = s.recv(1024)
continue
sendMessage(sender=None, app_data=None, user_data=None, message=recMsg, author="SERVER")
msg = s.recv(1024)
So I want my raspberry pi to send data live to my desktop computer as fast as possible. How can I do this? Both devices are in the same house but out of Bluetooth range. I do have wifi at both devices location though
This probably isn't the best, efficient or easiest way but personally I'd install nextcloud (it's a self hosted google cloud) on a vm and then you can transfer files from any device on your network and it'd be much quicker as it's on your local network too
Alright thanks
Nah, needs to be done in python
if its not the best, most efficient and the easiest way then since neither of three boxes is ticked why suggest it then
@wheat hatch if both computers are on the same local network then dont complicate things and just use socket library, your choice will be between TCP and UDP packets and considering what kind of data you are sending you might opt for UDP which is generally quicker
otherwise
which will remove extra latency on TCP and match its speed to UDP's
or close to that
but depends on what kind of data and how frequently is it being sent
Very helpful, thank you
updated links*
It's better to have an option rather than have no solution, you were the first to send a solution in 6 hours. I intended on sending it as an alternative method as it can be useful to have it anyway.
I would've waited but wanted to give some sort of help even if it may not have been useful as it's still better than nothing
VM + Cloud
these words themselves imply only adding more latency
when his task is just merely sending data from one computer on his home wifi to another
The cloud isn't involved? it's self hosted
VM adds another layer at the very least
i just don't understand why complicate things
he should just write a simple solution first, make it as easy as possible and then dedicate his time to improving it
this will get him the best results
@wheat hatch generally you would want to pack data together into bigger chunks and send them
rather than many small individual chunks
the idea is to call "send" as little as possible:
https://stackoverflow.com/questions/23249222/how-to-speed-up-python-networking
if you approach sending data differently, at the right amounts, it can increase the speed by 10-30 or more times, based on example here
also if you happen to know some other languages like C, C++ or Go then you are better off writing a solution in those : )
It is fair enough but as I said I was sending it as an alternative as it was better than nothing
yeah it's fine, don't mention it lol
Perfect, thanks. One more thing, I would like to do more complicated things with networking and understand what exactly is happening. Do you have a resource that can teach me what things like TCP is and how it works?
besides many books and online resources you can find online or on reddit yourself
Here is two lectures i can personally recommend, which i used, while yes lectures are generally a longer approach than reading some quick sum up of the networking on some random website, at least it will be understandable. I actually wanted the material to be understandable and most importantly, rememberable. This instructor is exactly what i needed when i was starting out.
https://www.youtube.com/watch?v=kNKHM_isojI
https://www.youtube.com/watch?v=0Rb8AkTEASw
He has like 70 other networking lectures on his channel, while these 2 are the main ones, you can optionally also watch any other depending on your choosing, say you aren't too sure about how "ports" work or how "ip addresses" work then he has lectures dedicated to those
you can find many other courses online, there is tons of them with raw "theory"
once you understand (or better yet during the process of understanding) the way internet is roughly structured and at least a few core protocols that power the web
you should try actually writing some code related to networking
here is a good one for socket programming in C - http://beej.us/guide/bgnet/
you don't need to be a pro at C, the basics of that language are also explained as the author goes along throughout the material
Got it, thanks for the help
How to setup a Hotspot/shared network by cmd? Ive tried so much, and still the virtual wireless networkadapter says: ipv4: No Internet
Ipv6:No Internet
Dont need an answer anymore
hey
how to create a secure chat room any suggestion ?
I ended up moving over to the Github api with a personal access token and it works great đ
Hi
Aww thanks man
Hello
So, i have a minecraft server, and i made a python script to auto generate ip ranges of all non spanish talkers, im thinking to blacklist the IPs with IPSET, this could prevent bot attacks and pings? adding more protection to the server?, like prevent ICMP Flood, or bot attacks?
Also i only have spanish players
If you got the ip's, just load it in a firewall? What system are you on?
Does anyone have experience with grpc and envoy? Or other service discovery systems?
Looking to make a grpc microservice system, but haven't nailed down how the services are going to talk to each other. I'd like a central system for service registration and discovery, but haven't found much docs on it. So just wondering what's common setups
General question, not python related. I have two scripts using sockets to communicate. Server sends data, lets say with frequency of 100 fixed length msgs per second, client receives 1 msg per second. What happens when os socket buffer size is exceeded?
This is generally where the Idea of flow control comes in
in an ideal world, the server will stop sending packets until the client is ready to receive more data
in the case that the server doesnt behave
the OS will start discarding packets in most cases
Ok, so let's assume I have a case where most recent messages (that are not yet sent from server) are more important than those that are stuck in buffer - what should be correct thing to do in that situation? Decreasing or increasing system buffer size won't do much
Marking messages with some TTL flag would be ideal solution
the real solution is to rework your code so it doesn't throw 100 messages at a client that can only handle 1/100th of that.
What protocol do you use? TCP or UDP?
I have no code at the moment, I am doing research to see if it is doable in a reasonable way in sockets or not đ
Currently it is local Unix device, so probably neither one (not sure how socket implementation chosen protocol works in local envirnment over). But target solution would be over tcp
100 and much more messages per second is required, because it is realtime process that requires high frequency. Thus wondering id sockets approach is the correct choice. The most important thing, is that if for any reason client is behind with reading/receiving from the data source, more recent messages are more important that those that are delayed in the queue. So socket might not be good solution at all due to buffering.
Locally, shared memory would probably be a better choice
TCP is a stream protocol, so you can't "empty the send queue" of messages, because they can be arbitrarily split up.
Code on the client side has to take the stream and reassemble messages on their side, so if the concept of flushing existed, arbitrary parts of the stream would just go missing instead of specific messages. If you have a problem with a slow client, you can continually read from the socket to keep the read buffer empty (overwriting some state that contains the latest message)
if you do that, you have to secure access (read/write) to that state with a semaphore, so it's not overwritten as it's being read, at least if you do this concurrently.
Thanks for the insight. Just looking for the solution of the communication aspects, and sockets were the first thing that come to mind. It might not be the best choice after all.
If you have a problem with a slow client, continually read from the socket to keep the read buffer empty (overwriting some state that contains the latest message)
Forgive my ignorance - isn't the problem based on the fact that client, and thus reading, is slow? If it was possible to read fast enough, it would not be a problem in the first place. Right? Or am I missing something
Need to educate myself in using tcp with sockets, though
Use headers, a header is basically meta data about the actual message.
You can have a fixed header size n and each time receive n bytes, decode it and get the length of the actual message.
This allows the server to send as fast as it wants. Since the client can now receive read the data at its own pace.
Read header, read message, read header, read message, read header....
Reading each one will let you know the size of the next, since the header indicates the size of the message, and after reading a message you can expect a fixed size header.
The socket's stream effectively becomes sorta a queue, loosely speaking.
If the server sends many headers and messages and the client doesn't start processing them immediately no problem!
All the data will be sitting neatly and organized waiting to be consumed and each effective packet * will effecitvely point* to the next:
header | msg | header | msg | header | >
read fixed size > read x size > expect fixed size> read x size > expect this size again....
And if you reach the end, you can just wait.
Depending on how large the payloads are, you will probably still want to compenstate for premature returns by recv since it only receives reads up to what its argument specifies.
Again TCP is a stream based protocol there isn't an underlying notion of seperate messages, it's all a homogenous clump of data, thus you can send the header and the payload bundled up, send them seperately, read them seperately or whatever, unless you've got reason not to.
But with how you strucutre your program and the rules you define, you can basically overcome the drawbacks of a stream, while still reaping the benefits! Namely, in order delivery.
I know what I said doesn't solve your problem, but I hope it opens new doors, well because the below wouldn't work if you didn't implement something similar already.
You ultimately can't fully escape buffering, even in RTC protocols. After all TCP even if partially, is the base for many things.
With that said, I can think of two solutions, maybe. Use a different socket for urgent events, or as you suggested a TTL flag.
You could also do with some fine grained control over the sockets but the python wrapper doesn't offer a whole lot (I think?) and there are difference between linux and winodws. Anyway here's this for linux, perhaps it helps
https://linux.die.net/man/7/socket
i wanna find the urls of outgoing requests from my pc
https
how do i do it via python
so https traffic is encrypted, unlike http
so say you wanted to see what kind of url did your chrome browser just request (if https was used), if you were to try and use external program to "sniff" on the outgoing traffic, all you would see is gibberish
from which you can't make out the URL that was requested as its part of the encrypted data
so what you could do is to run a proxy server on your machine, then specify in chrome (for example) under the settings to forward all traffic through that proxy
and that proxy will be able to see the traffic, even if its HTTPS
look into burpsuite, it acts as a proxy and allows you to view and even modify HTTP/HTTPS traffic, but once again you will have to tweak the settings for pretty much every application (like chrome) that you want to intercept the traffic of
Thanks a lot for your comprehensive reply. It gave me a better overview on the problem. As for the reading header and then message, I think in my situation I can safely assume that messages will be fixed size (and if they are not, just pad them to the fixed size). At least for now until I need to handle different kind of messages.
If the server sends many headers and messages and the client doesn't start processing them immediately no problem!
All the data will be sitting neatly and organized waiting to be consumed
This is kind of edge case scenario that I want to analyze before I start working - maybe it is not a problem at all and I am overanalyzing. Assuming that it takes n time for data source to send data, and m for client to read data but g time to process that data, where n < g + m, does it mean the buffer will be gradually increasing in size and thus being unstable, approaching max buffer size? At that point it will make sense to read all the data from the buffer and just discard all messages that match some criteria (like expired message)
Let me know if above scenario is valid at all and not some absurdity, because maybe I don't understand this subject enough and I am making up some impossible situations
Probably sockets are just wrong tool for my usage and I should be using some kind of broadcast communication that emits single message (no queue/buffer)
hi. i currently making a parental control in python and i wanted to add as one of the features blocking use time of computer. Do anyone knows how to block use of computer using python? Thanks
this doesnt really relate to networking, try in a help channel (see #âď˝how-to-get-help) or even in #python-discussion
are smaller packets less likely to be dropped?
In essence, yes.
TCP employs a sliding window protocol for flow control purposes.
The gist of it is, the receiver will tell the sender how much data it is willing to buffer, the winodw size.
The sender will then be allowed to send up to that amount, and will have to wait to receive an acknowledgement back before it can send more data, and that too will contain a new, potentially different window size.
Basically, the receiver controls the flow of transmission.
(This doesn't rid you of the responsibility of coming up with your own set of rules to regulate the communication between the client and server, reliable delivery is not reliable reading)
This also ties into why send buffers are a thing, if the send buffer is full, further sends are put on hold and will block.
It's waiting for an ack, and when it receives it, the buffer will be emptied, sent and refilled.
But ofc normally sending shouldn't won't block.
(I think the effective maximum window / buffer size for TCP is 64 kilobytes since it's represented by 16 bits and because if you have an empty buffer, the window size will of course be the full buffer.
Idk what the default size actually is, but it can be changed with SO_RCVBUF)
At that point it will make sense to read all the data from the buffer and just discard all messages that match some criteria (like expired message)
So the problem wasn't reading the data in of itself after all?
Probably sockets are just wrong tool for my usage and I should be using some kind of broadcast communication that emits single message (no queue/buffer)
Sockets are sockets, there are many flavors of them, namely (datagram) UDP and (reliable stream) TCP.
I think UDP could be a candiate instead, it has this "fire and forget" philosophy, if the receival buffer is full, it'll drop addtional incoming packets instead of holding the sender hostage, it won't try to retransmit lost data, so less latency, therefore more real-time.
Also consider looking, into higher level streaming protocols such as RTP.
Yes.
Thanks a lot, I'm saving your message for future reference. Much appreciated!
when you send data via ethernet cable is it always a byte stream?
thanks to the osi model you never have to care how the physical medium works.
What data?
Can anyone help with exchange codes?
If anyone knows how I would go about setting up an smtp server in python pls dm me
Do you mean automating the setup of a smtp server in python? or writing your own smtp server?
why can't i do this request?:
requests.post(url, allow_redirects=False, data={
"l" : username,
"p" : password
})
nvm
Writing my own
how to determine the buff_size for recv when reading the client message ?
Send a fixed size message that contains the length of the payload.
But lets say, in chat application, how to pre determine the length ?
I just told you
a fixed size message like "5 " or "15 ".
You can always receive the expected n bytes, then extract the length of the actual message from it
Of course there are cleaner ways to compact bytes but that's the gist of it.
https://www.ietf.org/rfc/rfc2821.txt You need to implement this specification
this just gives me a syntax error. what am i doing wrong? ```py
r = requests.post(config["sync_check_url"], data = data)
except requests.ConnectionError:
await ctx.send("@fleet flume,@glad hill, Auth server is down. Please try again later.")```
I understand how smtp works I am just having trouble implementing it into code. I found this http://pymotw.com/2/smtpd/ but when I run it it says that smtpd is outdated and that I should use aiosmtp and asyncio
okay so you don't want to build it from scratch, you want to build off an existing implementation and add custom functionality?
and I would take the error at face value
use aiosmtp
Challenge Question
Ike uses requests to get information from the internet. He needs to request from multiple links. How do you change the code to request from multiple links.
r = requests.get(f'https://discord.com/api/v9/channels/{Channel ID}/messages', headers=headers)
jsonn = json.loads(r.text)
for value in jsonn:
print(value['author']['username'], value['content'])
I wanted to do something like
Channel_ID = 05913280, 0193587124, 09148534, 318493805
or
Channel_ID[[0183294],[1029492],[1209453],[1230498]]
Hi all,
I'm using:
the writer from - asyncio.start_server(...)
writer.write(message)
I'm sending data to a java application
The message is of format starts with the number of bytes the message is and then the rest of the message
Is there a limit to the message size write can send before it sends an EOF?
What is the fastest way to send a file on a local network?
I mean network protocol.
UDP but you won't know if the packet is recieved
hey, ive tried making a client and a server on two different computers on the same network, but when i try to connect to the server through the client i get a
"[WinError 10061] No connection could be made because the target machine actively refused it"
and i am not sure how to fix it
any ideas where to start?
which protocol are you using to connect ? A port needs to be open on the server to allow the incoming connection
this is the socket i use: self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
AF_INET just means ipv4, so it doesn't say the port number yet
i bind them
self.s.bind((self.IPV4, self.PORT))
for the server
for the client i dont bind it
do i need to bind the client?
ok, but what is PORT ? RDP for example uses 3389
65432
now we're getting somewhere đ does the server accept incoming connections on port 65432 ?
did you set it in the firewall settings ?
i just allowed it to use the private network
do i need to open a port on my firewall
?
yes
hmmm
most ports are closed by default
is there no way to automatically do it
does that sound safe to you ?
no...
exactly hihi
then how do games do that?
some games require you to open a port when installing for example
so if i want to make a game that connects to another computer i need to open a port for it to work?
most likely yes, but you would not put that game server on your own device, more likely on a cloud provider so your own device stays safe
Its a simple game
I was gonna make someone who wants to start a game holds the server
If i make a server on the cloud will it solve the port problen
Problem*
Also does lan communication require a port?
not really, they might have manuals how to set it up though
yes, computers always connect with servers (or services) through a port, even when you cannot see it
http://www.google.com is actually http://www.google.com:80
https://www.google.com is actually https://www.google.com:443
try https://www.google.com:50 and you'll see it won't work
So do i have by default open ports i can use?
I don't know, you can see that in the firewall đ
So is this a dead end for my over wifi game?
Without people opening ports themselves?
I think you're confusing client & server now, the client wants to connect to the server
So the server is the one who needs to have a port open for incoming traffic
outgoing (on the client) is often already open
Okay but it still means anyone who wants to host a game has to open a port
yes
Thank you for all your help Ewout
no problem !
But for the client to receive information from the server it needs an open port right?
@ember ledge
that part I'm not too sure about, I think it depends on the context
maybe there's a tutorial you can follow on the topic to make sure you're not missing anything ?
Ill search
well using windows firewall i added an inbound port of 65432 but a client wont connect
does it matter if i bind my server to my IPV4 or to "0.0.0.0" ?
Hello, I've written python/selenium bot and i want to run this code on some server. Do you know and recommend any?
My bot is checking if product is available on page
when i want to make a server socket, do i need to bind it to my ipv4 or do i need to bind it to "0.0.0.0"? whats the difference?
IDK if it's the correct place to ask but how do you actually find an IP and establish a bridge connection
I am sorry but I am really new to this
I have been trying to use the phue module but it needs the IP of the bulb but I want the code to fetch the IP on itself instead of getting it from user
can we hack without sending payloads
Can someone explain bit and bit rate to me like im 10 years old
i dont know about bitrate, but a bit is single 0/1 storage representing data, 8 bits are a byte
Either one works, "0.0.0.0" in the context of binding means "this socket is reachable through any ipv4 address". So you can connect to via the loopback interface "127.0.0.1" for example, or just the ip of the machine.
It's commonly a default fallback, and used when the server is being hosted on some third party service.
But it can be boild down to "If you don't need it, don't use it".
What do you plan on sending then?
i plan
well im trying to connect to discord gateway
oh wait
that was just indentation error
STUPID INDENTATION
is the bot supposed to be online after identifying ?
man why does no one disquses
i don't understand a thing, if you are using TLS on your TCP connection then TCP SYN is still sent or it just sends TLS hello? 
Is this a good place for API questions?
#web-development might be better
Thank you
Hello, does anyone know where I can find a demo of a small python project that walks you through CI/CD through Gitlab? I cannot find one for the life of me.
following code is executed in infinite loop (server socket code)
while True:
msg = client_socket.recv(1024).decode()
fmt_msg = f"msg received: {msg}"
print(fmt_msg)
when Ctrl+C performed on client socket. how to handle the KeyboardInterrupt on server side ? any suggestions
server side won't even know there was a KeyboardInterrupt on client side
so on server side, most likely a call for recv() or send() will raise some exception
because server will be trying to read from or write to the socket connection, but a socket connection doesn't exist anymore (since the client has terminated the program)
How can i proxy my program for my bot discord???
Hi guys
yo
Does anyone here happen to know a thing about 'WAN Optimization'?
@thorn stratus We have that URL filtered out since it typically comes off as kind of rude
better check your filter then
is TOR restricted to just HTTP or can it be any protocol?
you mean ACL 30 only?
both acl 10 and acl 30
for acl 30: It looks as if it was set in such a way that it blocks access from 192.168.30.0/24 to the 192.168.31.0/24 subnet, but instead of doing that on g0/0, it's doing it on g0/1. Which I think is wrong. If I'm interpreting it correctly.
yea i thought the same thats why im confused
yeah, it's a little bit confusing. You obviously want to catch the packets as fast as possible and don't want to waste time processing them before you drop them.
so as a general rule: block the packets on the interface the packets initially go in.
acl inbound is for packets that are sent from inside the network right?
for acl 10 it might make sense thought
let me check, I haven't used cisco routers for a very long time
ok, so it's quite clear:
When you apply an ACL "in", the router examines all traffic it RECEIVES on the interface against the ACL.
When you apply an ACL "out" on an interface the router examines any traffic attempting to leave that interface against the ACL.
so IN means - receiving, some the packets that are arriving. OUT means leaving.
alright thanks
so for ACL 10, as I said, it actually makes sense at first sight, if you consider what's being permited. If you were to apply the ACL on S0/1, then the packets might end up on the wrong interface, like g0/1
This has been a very productive python topic, in any case.
@stiff mirage yo i just noticed something
shouldnt access list 30 be placed at S0/1 as outbound?
since i want to deny from 192.168.30.128-192.168.30.254 access to other networks other than 192.168.31.0
but if i place it at G0/1 i deny that ip range to that network
You haven't come up with these answers yourself, right? Now I'm starting to wonder why it's splitting 192.168.0.0/24 into two subnets like that.
in the ACL 30
In any case, if 192.168.10.0/24 shouldn't be able to access 192.168.30.0/24 and only that, then it makes sense to place the ACL on G0/0. If you placed it on S0/1, then they're also not going to have access to 192.168.31.0/24, and you wouldn't want that.
No
so in this respect, g0/0 - outbound I suppose makes sense
what port? You mean interface?
Yh
(port can be a little bit misleading here, because you can refer to tcp/udp ports - although we're talking only about L3, so much is true đ )
S0/1 is the correct one
Alright
so how would you do it there then?
Same commands just change interface
Cuz
Or am i thinking this the wrong way đ¤
@stiff mirage it kinda makes sense because they are denying that ip range access to the dns network when they are suppossed to make it so its the only network they can access(possibly they accidently picked the wrong port since the command doesnt make sense if g0/1 is the correct port,while it would make sense if S0/1 is the correct port), if i place it on the s0/1 they wont be able to make it out to R2 but they will be able to access the dns network, right?
Hellllo!
Maybe I'll make use from this forum for the first time...
I need a little help with login into a web page with Scrapy
Anyone?
it's working well with requests but not at all with scrapy Request
Hey @normal mango!
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:
request = Request(
url=url,
method='POST',
dont_filter=True,
cookies=cookies,
headers=headers,
body=body,
)
I got request using https://michael-shub.github.io/curl2scrapy/
curl2scrapy tool. Translate cURL command to scrapy request in one click.
So you'd simply place acl 30 on s0/1 output, right?
if you did that, then you'd match only the traffic come from g0/0 or g0/1 and going out on s0/1. But if you're looking to block access from 192.168.10.0/24, which first hits (so inbound) s0/1, that doesn't make much sense. You don't want to block return traffic, you want to block traffic as soon as possible (without disturbing anything else)
i want a range of ips to access only the dns network, and the rest to access any network right?
i would accomplish that by putting it on s0/1 output wouldnt i?
wait let me make a sketch rq
acc lets focus this
so its easier to explain
i want half the ips from 128 to 254 of 192.168.30.0 to be able to access only 192.168.31.0
So: 192.168.10.10 and .11 should be denied access to 192.168.30.0/24 (G0/0)
The rest of the subnet 192.168.10.0/24 will have access 192.168.30.0/24
ok, so we're talking about b) only?
yea
Ok, now I understand the splitting of the subnet. I didn't know where that came from đ
ah its ok
it makes more sense tho right?
that they got the wrong port
because if it was placed on s0/1
the commands would be perfect, in my mind atleast
so 192.168.30.128 to .254 need to acces only to 192.168.31.0/24, right?
Right, so no restriction.
yea
so it would make sense
to deny the 128-254 to access r2
that would be accomplished by denying it on s0/1 outbound
Ok, so... everything looks correct actually now :))
I think you're actually right.
If you apply the ACL on G0/1 only, it means that .128-.254 can access any other network.
yea
the commands seem right if it was placed on s0/1
makes no sense on g0/1
they are doing the complete opposite of what they wanted lol
and indeed, s0/1 outbound.
alright thanks for the help
This works, because there aren't any other networks.
If R3 had yet another subnet connected to another interface of its, then applying the ACL on S0/1 wouldn't work, because .128-.254 would have access to that to. But this works, because there's no other network there than 192.168.31.0/24
yh
midterm exams for high school seniors lol
right from the ministry of education
the finest education đ
yea the solutions are from them
I would take that up with your teacher
if I were you
I would be curious to see what he says. Maybe there's something we're missing.
i dont think so
But it definitely seems a mistake.
instructions are pretty clear tbh
yeah
what they did doesnt match with the instruction whatsoever
But it would be nice to see what they answer đ
i messaged my teacher and he wont even answer lol i doubt they would answer
It's nice that you're doing this in high school. I only started it late during faculty when I took up CCNA.
Why do you doubt that? That's exactly what they're there for, to help you and explain what's going on, especially in these contexts.
well its too late anyway the exam is in 4 days lol nobody is going to check on the solutions etc
ight i have a math lesson, thanks for your help
Yeah, but it's worth understanding it afterwards too, just to make sure you're understanding it correctly.
you're welcome đ
hi
i have a question please
svp j'ai une question
esce possible d'enregistrer un objet dans une table de ma base de donnĂŠes sqlite?? si oui quelle sera le type Ă mettre lorsque je crĂŠe la table ???
Hey guys, How do I start a TCP server on global IP and not on local IP?
Why does cisco dictate that your switch IP be one less than the routerâs IP?
and why does cisco prefer you to statically assign an IP that is on the further end of an IP range
rather than the start
Hi! Quick question... would it be too taxing on the network and device to send curl requests every .5 sec when trying to monitor for changes? What would be a best practise when http requests is the only way to interact with the hardware?
could try a constant connection
a constant connection is more efficient than repeatedly polling through http requests just to check for changes in the xml output, hey?
What country are you from, I also have a ministry if education
almost every country has that?
what the fuck is an internet port lmao
If you mean that you want a local port to also be available publicly, port forwarding. Make sure you understand the security implications before you do this
If you don't want the port to be available locally and only from outside, you need a firewall rule
considering your pinging every .5 secs it would be better then making a http request closing and repeating
Does America have one?

Hey !
I'm trying to write a script for port scanning with python sockets ...!
I'm done with port scanning . But i want to detect the services name may be i can get service name using this func (socket.getservbyport()). but i'm not able to find their versions plus the OS detection using sockets.
Can i get this info using sockets.?
I've googled but didn't find any clue.
I'll be very grateful if you guys give me any clue.
Thank you
so getservbyport doesn't actually make any requests
to the remote server
instead all its doing is checking the local database, that might look something like this:
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
and then it just checks what service is usually run on this port, but this information is not retrieved from the server
its retrieved from common knowledge
whereas "versions" and "OS detection" actually require sending some data to the server and then processing the data returned back
have you looked into https://pypi.org/project/python-nmap/
Hi everyone, I'm really curious how the internet works, browsers and their protocols, how applications communicate, .. etc. I feel I'm ignorant about these things and missed out what people have been inventing since 1970 till now!
My question: for those who have little expertise please guide Me by sharing resources and what to learn first , what to learn after!
@woven vortex check out my answer from before
someone had similar question
Thanks so much, I wanna ask one more thing. That youtuber doesn't have orderd videos , how could I know what to learn first and what to learn next
really just focus on these 2 videos
they explain what is networking
and the general structure of the "messages" on the network
yes the rest of the videos arent ordered, but those 2 are the ones that matter the most
oh and that one
@woven vortex the order to go with is: networking, world wide web, OSI model
the other videos you don't even need to touch for now
Hello. I am really interested in the feild of WAN Optimization and I know that it is a very uncommon feild for people to work in but I am very invested in how I could improve my internet with maybe , code? Idk. Does anyone know any useful recourse about this feild?
Understandable,thanks so much
What's a "frame" In http 2? From what I read, it sounds like a http 2 packet
yeah got it. Thanks
yeahhhh more or less that
you have a HTTP2 stream, between the client and the server
and then on that stream messages are broadcast, a message can either be a headers frame or a data frame
multiple frames can go on the same connection, because there is a cool bit of tech called http2 server push where servers can include additional content that they think the client might request and saves a bunch of time instead of having the clients send out for it
Ohh i see
How do I make an IP logger and IP blocker (from my site) with flask?
Ping me please. Thanks.
hey guys does anyone know how i can transfer AWS route 53 registered domain to cloudflare
because when i try to point the nameservers towards cloudflare, it never detects it
thanks đ
I dont know flask but sure there are some logs which contains the get request from the client including requested Page and client ip address
Oh, so it works like that. I seeeeeeee. Thanks mate!
I have a question about checkSum in ICMP packets and how it's generated
I understand that it's purpose is to check the validity of a packet
but can I for example set it to whatever I want? I'm learning about ICMP packets and I'm curious how the checkSum is generated
I did reading and understand its function but not how to create it?
And let me know if I'm appracoching this wrong but I am creating ICMP packets using struct.Pack(type,code,checkSum)
obviously checkSum is set to 0
@visual raptor https://stackoverflow.com/a/20247802
you split up the icmp header into 16 bit words and then you sum them
the checksum is literally just a sum of the words in the header
Hi, why do we need to encode things before sending them around. I get the theory but why do we not need to do this when printing something for example? I mean the computer is always working with byte values so why does this conversion get done automatically for us when printing something but not when we want to send something over a socket? or am I completly on the wrong track...
So if the type is 8 we have to change it to 1000?
and then pass it we cannot just pass 8?
why does this conversion get done automatically for us when printing something
It would be incredibely incovenient, no?
Python has many many abstraction layers.
Yeah, why is it not getting done when sending something over a socket
Because ultimately, the data will have to be transmitted in either a cable or as waves.
It's near damn impossible to write a unviersal serialization tool for everything, so the task to get the object in the form of bytes and sending it, is left up to the developper.
Ah ok that makes sense
Why cant we encode for example dictionaries with the encdode method?
What would you be encoding exactly?
So for example if I would want to send a dictionary over a socket I would have to put it into a string first and then encode it
Yes
Why is that though? I mean in the end it needs to be converted into a bytes object somehow in order to work with it so why does the encode method not work?
I will answer your question not with words but with this.
https://github.com/python/cpython/blob/main/Objects/dictobject.c
This is the c implementation of the dict class.
This is is what a dict truly is
Now, how do you encode that?
Yeah, well I dont know but in the end it needs to be encoded somehow right?
You're merely encoding the strucutre and content of the dict.
A dict is much more than that, you aren't really encoding the object in of itself.
Oh Ic so much more the keys and the pairs?
I didn't understand that
More than encoding the dictionary, just the values and the keys get encoded?
More or less, the strucutre is then translated into and inferred from characters, like {} : , etc...
It's like translating the dict from one medium to another
A string representation of the relevant content.
Which can then be used to reconstruct the actual object back up
You don't want to send the hashing algorithm the dict uses, you don't want to send the method that sorts it.
Just the relevant data.
Wdym hasing algorithm?
Dicts are wrappers for a structure known as a hash table. The hashing algorithm is how they compute the location of a value given a key.
Ah ok yeah I think I heard of that before
So basically, you take the dict's content and turn into a string, and slap some curly braces on the sides.
'{ "hello" : 2, True : 4}'
Like so, this usually done by a parser in accordance with a format like JSON.
Then the string's characters are broken down into decimals representing unicode code points, which then also are broken down into byte(s)
Ahh, so thats how a dict would be encoded right?
Why is there no method in the dict class that does so?
Because not everything need be stuffed into one class.
Ah ok
The one thing to take away from this, is to seperate your perception of a dictionary, from that of the interpreter.
Data is meaningless unless interpreted.
And then there's pickle and marshall, but we don't talk about those.
Yeah thats true
Actually this goes for pretty much everything.
Yeah, thanks!
I see... i might be stuck with http requests though as that seems to be the only available way to interface with the camera... it's a foscam through cgi commands - just in case someone might know... thanks!
if im trying to make an application using wifi and it has a client mode and a server mode, i tried connecting the client to the server but the connection failed, i think its because the firewall blocked it, how do i let my apps talk to each other over wifi?
what operating system are you using
How do we send an ICMP packet I have created a socket as such: socket.socket(socket.AF_INET,socket.SOCK_RAW,socket.IPPROTO_ICMP) and was wondering how we could conncet to it as when I try then connceting to it using an IP it denays the requests and says that it needs a tuple not a string
windows
you can mimick how your sending your HTTP request payload
sock = ...
payload = {"d": "Some Command"}
sock.write(json.dumps(payload).encode())
then on the other side
data = server.recv(1024)
original_payload = json.loads(data)
...
Hello, do you guys have any YouTube tutorial to make my little python server communicate with a web page (so "connect" my python server to JavaScript) ?
If it helps, inbuilt into JavaScript are websockets and there's also a websocket python module you can use to communicate
Oh I'll look into that !
Anyone have recommendations for proxies that are fast and have a competitive price?
I'm to send a .png file using sockets by reading the original file and writing it into the server directory, every time the file has come out corrupted because it failed to decode it. Is there a way to decode png files, I can't find an easy answer on how png files are encoded online. Maybe there is an easier way to transfer files that I don't know about.
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.pythondiscord.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.
using socket.send()
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.pythondiscord.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.
you can remove confidential stuff
client code: https://paste.pythondiscord.com/hujahowofu.py screenshot.py: https://paste.pythondiscord.com/ixehavivan.py server code: https://paste.pythondiscord.com/ehituwucom.py you'll to install mss through pip install mss.
what topology is best for internet cafe
recv and send calls do not guarantee that all data has been read/sent. That's especially true for recv.
Not only that but reading arbitrary amounts of bytes without establishing an app layer protocol is not the greatest idea.
You can end up reading more data than you need to and end up with mixed and fragmented useless data.
Yes you can perhaps get away with it on your local machine because of the loopback interface, but once it's actually multiple machines communicating, things will get ugly.
i think this could be related to this
bytes(str(fileSize))
and bytes(str(scrnshtData))
scrnshtData is already of type bytes
when you convert it to str and then back into bytes
perhaps some data is being lost
so remove those conversions to string and see if it solves it
how can i get a requests authorization header
r = requests.get('<MY_URI>', headers={'Authorization': 'TOK:<MY_TOKEN>'})
hey. i am trying to reverse engineer a post request, where you can upload a profile picture. does someone know what type of request this is?? its uploading base64 somehow but why does it look so cracky?
its not base64, its binary data in the form of a png image, the reason why it looks like it does is because some binary numbers cannot be represented by actual characters
@deft phoenix https://stackoverflow.com/a/8660740
When I submit a simple form like this with a file attached:
<form enctype="multipart/form-data" action="http://localhost:3000/upload?upload_progress_id=12344" method="POST">
<input type="...
here is how a request of content type multipart/form-data
looks like
think of "boundary" as a separator
note how first parameter being sent is just a integer value for key MAX_FILE_SIZE
and second parameter is the actual file we want to send, with binary data inside
but the cool thing is that we can combine the two, regular data we want to pass as well as the actual binary file

