#networks
1 messages · Page 20 of 1
given the number of services they're hosting , and the amount of traffic , that cost sounds very worthy
most of the challenges I suppose are running inside 16.04 dockers
I actually have insight into this field at I was a core developer on the US DoD cyber training range
wow that's amazing @vernal surge
can u give me an insight into how we can bring down the overall costs while still maintaining performance and a bit of scalibility also
For realism, we had to expose things without docker, because docker does enough stripping of the kernel syscalls to make it different. Unless your point is to train on exploiting containers, it's not sufficient to run a container.
But if you are very targeted with your goals (like just trying to exploit nginx for example) then docker works just fine
no no sir , we're just planning for basic exploitation stuff
In any regard, don't run a container in this context without kata containers
It adds a VM layer to further isolate the container from the host
is it more complicated than docker?
Not really
because we just need something as basic as docker itself
is docker not effective in this regard?
or is it too much?
im really sorry for sounding so dumb sir
I'm saying, if you're going to be exploiting it, or having others exploit it, you need to plan for them inevitably breaking out of your playground and causing havoc lol
yah that anyways we have sandbox right to prevent any breaches
in dockerfile
we add permissions right
Yeah, user locking things helps
so kata containers basically add another layer of protection?
are they more feasible and effective than docker?
In this case, if you just want to use docker, you could probably get away with just using ECS and letting Amazon handle the backend security and scaling
are they more feasible and effective than docker?
@dusk sparrow yes, by a lot
ohh nicee
Ecs is pretty cheap too
The other clouds have something like it as well, but the names escape me
yah , if we use kata containers for all services , will it be less heavy on resources and overall cost?
No, kata does add overhead, so technically, is less cost effective, but far more secure. I've found the cost difference to be negligible though
I think we can handle security ourselves , just need cheaper alternatives and less overall technical overhead
But with kata, you will have to run on a VM instance, so your cost will be effectively static anyway
I think we can handle security ourselves , just need cheaper alternatives and less overall technical overhead
@dusk sparrow use ECS then
how is ecs better than ec2 or kubernetes sir?
The scaling is handled for you, so it's less technical overhead
im trying to set up vdi with hyper v, but when i try to connect, it just rdps me into the server and not one of the virtual machines, and the server gives this error
Error: NULL```
@dusk sparrow kubernetes isn't cheap, so it's probably out lol
The scaling is handled for you, so it's less technical overhead
@vernal surge can we tweak it to extract better performance?
Yes
You have a "task" that you set up that has all of those options
yah
Mix/Max replicas, min/max cpu/memory, etc...
@coarse epoch I've never had any luck with hyperv, so sorry, I can't help here
np
@coarse epoch also though, that's less networking and more #tools-and-devops
ty ill aks there
yah so , u suggested ecs , what about the others like ec2 etc?
Ec2 is fine, but you have to self manage everything, so more technical overhead
everything as in from scaling to tweaking ?
Yeah, literally everything
ohh , also , is ecs good for long term hosting , like for example I told right , the site that hosts exploitation stuff
in the end , what matters is the overall cost right
For a site, I would use Lambda+S3 or even just S3 if the site is purely static
That way is the most cost effective for sites
yah we're planning to have a portal for this purpose
so is S3 effective in that case?
Only if your site is static lol
If you have interactive elements (logins, etc...) You need lambda as well
Only for sites
hm yah
Lambda has no backend at all (that you can access) and S3 is just blob storage, so for your "challenges", that pattern is a non starter
I dont think our portal is going to be static , it would have login , scoreboard , and more stuff ig
Ok, so lambda+s3 for the site, ecs for the challenge hosts
hm yah
that sounds like it
thank u so much @vernal surge , I am really grateful to u for giving ur time for this discussion
All good, I've been down this road a few times lol
it is so delightful to get answers from a pro in the field , much appreciated sir
lol you are quite welcome
also , just one more thing , can ecs provide me with some kind of networking setup which can notify if services are down?
@dusk sparrow yeah, cloudwatch is actually good about that
is it a service offered along with the others?
yeah, everything i've mentioned is an AWS service
you don't really need to worry about that though so long as you have health checks set up
it can notify me whether my services are down?
if ECS sees a healthcheck fail, it'll just tear down that container and spin up a new one
waoh it does this automatically?
yeah
well ... it can 😄 but you have to configure it to do so (re: health checks lol)
👍
anyone wanna be my cisco packet tracer buddy trying to get into this stuff
Lol oh boy, I haven't heard that name in a while.
I'm glad to help you out @vital kraken, but I'm going to pass on running PT lol
Studying for the CCNA R/S?
@vernal surge ccna but i cant blame you on passing up on the pt lol
@vital kraken I have my CCIE, so I can probably help :)
@vernal surge honestly im kinda looking for someone to go through the course with ya know not trying to get carried through it just so we can help each other as we go along
@vital kraken I totally get that, but if you get stuck, I'm around :D
@vernal surge sounds great mind if i add you?
could you get a job in IT with just a CCNA?
what kind of arcitechture is being used with this protocol?(Python-Socketio)
https://python-socketio.readthedocs.io/en/latest/intro.html
and what is the baud rate/speed at this protocol?
@dim wadi I kinda doubt it, but look at job postings in your area and see what they are asking for
so, still making a proxy, i've made the main part and the echo-server (so the echo-client is the only part left), and i changed the ports so i could test it on the same pc, anyway, the connection itself works, the server talks to the echo server that talks to the main proxy server, but if i send any message from the server (which it should be able to handle, that's the point), it crashes both the proxy server and the echo-server, the only exception is the first message that i receive manually, and even then it cuts off the first letter
i'll send some pastebin for the code i guess
some of it may seem nonsense or confusing, like all of the numbers i save, those are just ID's that i read to see what i have to do, like 1 is register connection, 2 is new connection, 4 close connection, etcc
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.
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.
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.
(ping me if you can help me please)
Hi everyone
I have found a script made in python which download some videos from a site
but it needs some improvments
here is the script
Python Script to download coures from INE.com website for personal and educational use - Jayapraveen/INE-courses-downloader
For example: the download progress bar does not working
extracting real names from the site, does not working well
you cannot select more courses to download
only one at a time
also the script can be improved to download a playlist and not only a course
i am not that good in python and that's why i am posting here
I was helping the guy who made it
Jayapraveen
helping with testing and cookies
But for a period of time , the developer seems that it cannot be found
don't know what happening with him
im getting this error trying on the serer when i try to rdp into a virtualized desktop in hyper v
Remote Desktop Connection Broker Client failed to redirect the user ENTRUST\ja.
Get your IT guy to fix it
I had an idea to connect two laptops together, one acting as a 'database' of files/programs without network access but if the other one (the primary one) downloads something, it'll go through to the other. Sort of connecting the drives, but one drive has a cpu/mem attached. How would I go around doing this? I was thinking potentially thinking about doing this over specific ports and getting the database one to only search for traffic on those ports but any other opinions would be appreciated
@glass turtle the "without network access" make what you want to do essentially impossible (not actually impossible, but pretty close), so I assume you mean without internet access.
Ya I mean I don't want it constantly connected to the internet, just when it needs to be
How does it know when it needs to be on the internet
Does anybody here know if there is a way to get the source of a message sent with socket.sendto(message.encode(), ('<broadcast>', PORT))
Im working on something that's supposed to send and receives broadcasts at the same time and its quite annoying to get my own broadcasts.
as in get the ip your sending it from?
The IP and Port
i believe socket.getsockname() does that
I didn't bind the one im sending on:
broadcast_send = socket.socket( socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) broadcast_send.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) broadcast_send.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
So that gives me a OSError: [WinError 10022] An invalid argument was supplied
Why are you passing a 1 into that fucntion
lemme check the docs, iirc you don't need a 1 to set the option
guess I'm wrong
How does it know when it needs to be on the internet
I was assuming there's some sort of program to look for traffic on specific ports
@glass turtle yeah, you would write that :)
?
@glass turtle tbh, in order for a system to listen for traffic, it would have to be on the network at all times. And you can write your app to only listen on a specific port. But unless you wrote a custom ethernet/wireless driver that filtered everything at the kernel layer and only let your specific traffic pass, you are going to have to leave it on the network. You could use a firewall to limit exposure though.
would there be a way to cron a connection?
like only connect at a specific interval
You could cron firewall rules, and technically, yeah, you could cron up/down scripts
I just don't understand why you are doing this lol
like I want to have the 2 devices connected but I don't want the one I'm using for storage/extra computation constantly connected to my network
hi i need help with understanding what is the definition/connection of/between python-socektio and websocket
i found this quote->"Socket.IO is not an implementation of WebSocket, it is a different protocol that is implemented on top of HTTP and WebSocket both. A Socket.IO client can only connect to a Socket.IO server and viceversa. The WebSocket protocol is incompatible with Socket.IO."
not really sure if its corect...
i really would like for some explanation for python-socektio ,cause i thought socketio uses websockets...
@dreamy python it does use websockets, it says so. But it's a custom protocol built on top, so it does things differently than vanilla python websockets, and is therefore, incompatible.
ok so if im using python-socketio im actually using socketio protocol and not websocekts protocol?
and also what does it mean WSGI on sokcetio??
@glass turtle why don't you want it constantly connected to the network? If you don't want to accept connections, don't listen on any poets
If you want it only accessible by a certain computer, then use firewall rules, or put it on the same private network
@ember ledge here are the real experts, they can defenitely answer better than me 
@ember ledge Generally, you are behind a NAT, which is a way to let a bunch of devices in your home network share 1 public IP, by creating a private network and using ports to tell what goes to which computer. You need some way to have a public IP go to your computer. You can use port forwarding, certain VPNs, or host the server on the cloud if you can't port forward on your home network
Yeah, generally they will either give you a public IP or some ability to port forward
depending on the service
this one is great, the $3.50 one should do fine for low-traffic servers
pretty intuitive too, you can ssh from the console
@ember ledge no need to forward on cloud usually because you get an actual public IP
ok so if im using python-socketio im actually using socketio protocol and not websocekts protocol?
and also what does it mean WSGI on sokcetio??
@dreamy python
Somebody got an answer
WSGI is a interface standard for python webservers
WSGI is the foundation of most Python web frameworks, but there's a good chance you've never had to interact with it directly. In this talk we'll explore why it exists, how it works, and what the heck it's doing in your stack.
A great web framework abstracts away all the low-...
@dreamy python yeah, what @gloomy root said. WSGI is just the standard way for a web server to interface with a python web app. Some use Gunicorn or uWSGI, other use the Apache plugin directly, others the nginx plugin.
And ASGI is just the async version of WSGI
very different in terms of the interface itself tho
Personally i prefer the ASGI interface
just seems a bit cleaner and more consistent
Agreed
tho ngl in my recent tests
the who ASGI and WSGI style of breaking it up into chunks
has caused significant bottlenecks for me lol
tho i think its down to something not syncing up or something timing out
Yeah, I honestly don't use python for web anymore because of those pitfalls
atm Im using Go lang and Fasthttp to make a prod grade server that binds to python on a raw connection
Go ftw
on windows its about 2x the speed of the current systems but thats mostly because Uvloop doesnt work on windows
I user either Go or Rust depending on the task
But yeah, I'll loop python in for math things
tho Still about 40% performance increase on linux overall
also has the advantage of not depending on Nginx or apache to serve static files properly and protect the instances
😎
I still use nginx lol, but just as an AppFW for the most part now ... Or if I'm running multiple servers
What i'd like todo at some point with the system is let them be either independent of mergeable
So if you have a single server it works as normal but multiple servers for multiple domains merge into serving all domains and servers just directing the request to specific python workers
Sounds interesting, although nginx does that lol
yeah ik
Most of it is for fun / for my exam but always nice to add somethings that id find useful
that and i low key cba to setup nginx's proxying
For sure... It's really useful especially if your aren't allowed to use nginx or whatever for some reason
Writing proxies is why I learned go in the first place lol
I think Networking is what makes Go so good tbh
as well as the short compile times
Leveraging OS threads to their full potential makes Networking uber easy and scallable with go
Yup, it's a hyper-scale language by design
Although, it does break down for real time stuff (GC is bad for real time lol)
The only thing i'd like to see which would make Go insane would be better single threaded concurrency per os thread
the runtime manages maybe 2-4 goroutines to one os thread
but you could easily stack more onto them for non-blocking networking stuff
They are making some nice inroads there with the new linker though. I'm interested to see what comes of it
One of the reasons that made me like Tokio is the choice of setup for concurrency
single threaded scheduler for light weight io stuff
I like tokio, but damn it's complex lol
or threaded scheduler which can deal with more heavy stuff
tokio is fairly complex
tho its alot better than actix
actix's system is a bit of a blurr
I think the actor system could of been done a bit cleaner
Yeah, I never got actix to work as described
And there was just way too much rewriting of the STDLIB
Idk, I'll take a nominal performance hit for the safety guarantees. If I only cared about raw performance, I'd just use c lol
Actix is the most awful thing ever to compile
it has so many Weird things with it
Like installing GCC to windows is one thing
but its when it compiled in Debug mode fine
but then when in release it doesnt compile because of some weird error
just urg
too much effort
Hyper or Warp tho are pretty <3
I think ARP is networking, but idk.
Im trying to do an ARP request, and I got the error:
ImportError: cannot import name 'ArpRequest' from partially initialized module 'arprequest' (most likely due to a circular import) (c:\Users\path\to\python\file)
Here is the code im using:
from arprequest import ArpRequest
ar = ArpRequest('10.0.0.1', 'eth0')
ar.request()
anybody got a good alternative for the requests module?
i want to send about 100+ requests per second, tried threading while using requests but it didn't work as expected
You probably want async for that, try aiohttp
Noted
@left maple Did you name your file arprequest.py
@left maple sounds like you didn't supply enough arguments to initialize the object
I need some help with network setup
I'm not a network engineer and I have a business connection from my ISP with 2 IP address. I want to use the 1st IP for standard connection and I want to use the 2nd for hosting a small server. I have a Juniper EX3300 switch I can use but I'm not sure it is the right thing to put between my wifi router (for normal use), and the server. Does anyone know if this is sufficient. The wifi router has a firewall. The server I'm hosting I don't want a firewall as it is supposed to be a honeypot.
Also, I wanted to setup another server on a 3rd IP to be a VPN, but that is kind of getting ahead of myself at this point.
anyone used POAP? for configuring bare metal nexus devices?
How can I target a multicast for nodes on a VLAN? This code works for nodes on LAN.
import socket
PORT = 23333
def startRelayServer(players):
hostRecv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
hostRecv.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST or socket.SO_REUSEADDR, 1)
try:
hostRecv.bind(("", PORT))
except Exception as e:
print("Port has been occupied, please run the script before hosting the game.")
return
players = [player for player in players if player != ""]
socks = [socket.socket(socket.AF_INET, socket.SOCK_DGRAM) for i in players]
print("Relay server started, now host your game.")
while True:
for i in range(len(players)):
hostData, hostAddr = hostRecv.recvfrom(1024)
if len(hostData) > 0 and hostAddr[0] not in players:
socks[i].sendto(hostData, (players[i], PORT))
print(f"Broadcast package received, sending to {players[i]}.")
if __name__ == "__main__":
players = ["10.8.0.3", "10.8.0.4", ""] # Player IPs
startRelayServer(players)```
@left maple Did you name your file arprequest.py
@wraith grove yes its called arprequest.py
@left maple sounds like you didn't supply enough arguments to initialize the object
@vernal surge I copied the code straight from the docs lol
I would like to make a passthrough proxy, which I will use with proxychains, to pass all my browser traffic through. However I'm not sure how to forward the packets back out, and why I am unpacking ethernet frames on wifi
maybe kind of a stupid question that possibly doesnt even belong here but - how does a modern smartphone app, say on an iphone 10, communicate to a server (something that hosts the apps online interface)? what protocol does it use, what formats can it send its message in, what hardware converts it to an airborne message?
this is maybe a question that is better answered via redirection to a networking beginner resource and id truly appreciate that too!
!NOT AN EXPERT; MIGHT CONTAIN DANGEROUS HALF-KNOWLEDGE
@arctic barn most websites and afaik some apps as well communicate using a REST api (google that, if you plan to ever do something web related it will come in handy). A package of a messager app might contain:
-the type, could be POST if you want to post a message or PATCH if you want to edit your message. Lets go with the case of you posting a message
-the sender, you
-the recipient
-the message itself
-a token that authenticates you as the real user
protocol - depends on the app or website. many services use HTTP(S), but different programs use different protocols and ports - SMTP for example is for mail, but I am not sure if it is still used.
how hardware converts stuff - thats a completely different topic. I would refer to the OSI-7-Layer-Model. The principle is the following (this is all from what I remembered, some things might be wrong): They have a payload, your data you want to transfer. This payload gets wrapped with headers. Every Layer reads its header (which is always in front), decides what to do with it based on the header and then sends the package to the layer below it and removes the header that it read. This continues all the way until you are at the bottom layer which then sends the package to the specified server (DNS, another topic again). Once it has reached its destination, the package goes through the layers the other way around
thanks so much for taking the time to write this! i’ve heard of the REST api but never looked at in detail, so i certainly will, and i’ve never heard of the OSI model. i couldn’t have asked for a better response, tysm <3 <3
I do have a question as well tho, not sure if it is even possible to do it this way:
I have the following setup:
PC - Switch - Router
192.168.188.20 - 192.168.188.1 - 192.168.2.1
problem is - how do I directly connect to the router from my PC? I can only reach the switch, if I try to connect to the routers IP it gives me an ERR_CONNECTION_TIMED_OUT
I tried tracerouting to be sure I have the right IP;
1 <1 ms 1 ms <1 ms fritz.box [192.168.188.1]
2 1 ms <1 ms <1 ms 192.168.178.1
@left maple If you didn't figure it out, its because you are importing the file that is running
rename your file to something else and it will work
this might be a bit of a stupid question, but does anyone know how to port forward to a docker on a remote server? I know for local to remote I just ssh tunnel with -L XXXX:localhost:YYYY, but to access the docker is a lot more challenging. Would I have to go from:
docker -> remote -> local? or could i skip it and just go from
docker -> local? The reason why i need this is that i need to access a login page on the docker but there's no gui, so i want to port forward that login page onto my local computer.
oof
@tiny idol It seems like you aren't quite understanding what port forwarding does. Are you trying to access a page served from the docker?
Yes. But on the machine running the docker all it has is terminal. So I'm trying to forward it to my personal computer
I've done it before with forwarding jupyter notebook from my remote to my local so I'm hoping it's the same thing
My bad if I sound really ignorant about this.
how are you accessing the docker right now
You need to port forward so the router knows which computer to give incoming connections
if your docker isn't behind a router, then you don't need to port forward, just open a port in your firewall if you are running one
if it is, you need to port forward on the docker side, since you will be connecting to it
My docker is not behind a router. I'm accessing the docker through my remote machine right now. I think what it is, is that I've been working a lot with virtual machines, and all of a sudden my project requires the use of a docker and it's super confusing to understand.
I'm currently running docker stack deploy -c charts-docker-swarm-19.12.2.yml mongodb-charts for my docker.
It's supposed to open a web gui on localhost:80 but since my remote server doesn't have a browser, I can't do that.
I assumed that if I tunneled port 80 from my remote server onto my local server, i would be able to open the browser on my local,
but it's not loading so I'm assuming the networks for the docker and the remote are separate.
Here is the yml that helps the docker deploy
i've tried opening firewall ports with ufw on port 80 but it didn't work
How did you connect to the web gui
from the remote
are you typing localhost:80?
Just put the ip of the docker in your address bar
i believe it is localhost:80, but i have never made a connection because on my remote there's no gui.
which is the reason why i'm trying to port from the remote to my local so i can open it up on my own browser
i think it would make more sense if i put the ip of the docker into the browser, but i haven't been able to test it out.
I assume that 172.17.0.1:80 would open up the web gui instead, but how could i send that to my local machine?
@wraith grove i appreciate the help and the advice for what to look into. I do think my question is a bit out of place as it's more of a Docker question than a networking question. But some of the things you brought up were helpful! I was able to further pinpoint the problem with no resolution quite yet, but I'll be looking into a Docker community that might have more insight on the situation.
localhost just means the computer your on
if you are trying to access a remote computer, you use its ip
What are you confused on sending to your local machine
They are implementing at&t fiber in our neighborhood. there was a hole being digged right in front of our house and that's how it was figured out 😄
I want to make a wireshark-like packet sniffing proxy in python, ideally something I could append to proxychains.conf, and analyze my traffic in real time. I've done some searching around and found this: https://www.tutorialspoint.com/python_penetration_testing/python_penetration_testing_network_packet_sniffing.htm, however I'm not sure where the data is coming from
what's Encrypted SNI ?
I have a very general question about networking. Is it better to establish a socket tcp connection to your server then just send data over or to create an api for your server and instead send post request? What is the most common way and what's better in terms of performance?
hey question im making a chat app with sockets, but how can i make the difference if a client is sending a file or just a normal text message?
because now i get the issue that its saying invalid start byte at position 0
@north quarry If you are just streaming raw bytes over the network, you can't possibly know. When you are starting to switch back and forth between data types, it's best to structure your communications and/or use an RPC paradigm
@simple flax raw sockets are always going to be faster than having to marshal/unmarshal JSON/XML, but in terms of what is common, JSON 100% (so your typical RESTful app)
@simple flax 100% depends on what you are doing though
@vernal surge how could i bbest handle that?
@ember ledge is your server running on the same machine as your client?
no idea how to do that xd
so, you could wrap everything in JSON before you pass it over the socket with different fields for different data, that way, you code knows how to interpret what it's getting
not saying that is the best way to do this, but it's probably the easiest lol
its just a very basic program, with threading . just sending chat messages, but i want to be able to send a file maybe with pickling
need to finish this school assignment XD
ah, this is for an assignment? I've said too much then lol
Thanks for your response @vernal surge . Since using APIs are common is there any reason why companies dont use raw tcp connections if its faster (more safe??)
nothing wrong with a little over acheivement lol
@simple flax the reason most companies don't use just raw sockets is due to the complexity of parsing out an unknown data stream. In JSON, the format is well defined so server knows how to process the data regardless of who sends it (and it rejects anything that doesn't conform)
I see. But you can send jsons over raw sockets, no?
now, that being said, there are times when sockets/websockets are the best solution (mostly when you are the one that built the server/client and you know for sure what the data is going to look like)
yes, you can send json over sockets, but that may or may not be any more efficient that just using dedicated json libraries
again, it's all use case 😄
If you're writing a website then it might make more sense to use json but im writing a desktop app and I think it will be better to use sockets
that is honestly why gRPC is starting to really take off ... you get the performance of byte-stream communication, but the distributability of JSON
I see
It's just harder to store an api key on client side
If the client gets it then nothing stops him from spamming the api
not true exactly ... i NEVER write a public API that doesn't have rate limiting enabled 😄
Yeah rate limiting would work
most APIs you see now are just general messaging, so there is really no benefit to using a raw protocol. The only reason I see raw sockets in use right now is usually due to a custom protocol
but then again, my visability into the global use of sockets is limited lol (i'm just a lowly SRE lol)
but in my world of containers and kubernetes ... gRPC is king right now, with JSON a close second
Yeah right. And you don't have to worry about sending the json in an encrypted form, since if the api use ssl then everything would be encrypted, or am I wrong?
Would sniffing be a problem
right, i didn't even consider encryption, but yes. Just simply using TLS on your webserver guarentees encryption wereas, sockets, not so much lol
again, TLS is my default, so i don't even really think about it any more
Websocket is pretty popular along with gRPC
Few people do raw socket. Probably just games at this point
We have one thing that needs real time. It’s web socket
I seem to see WebRTC in use these days as well, but I know nothing about it
JSON is payload inside wss
WebRTC is voice/video
I’m sure you could do data but it’s not designed for that
right, A/V is the only thing i know that really need real time streaming right now, but again, my perview of the arena is limited lol
Like Google Meet is WebRTC for audio and video with wss for control
Got stuck helping messaging team
interesting ... as it seems that 98% of the questions in this particular channel are socket/websocket related ... i probably ought to bone up on them lol
or just defer to you Rabbit lol
Nah
I’m not good at details just high level
My default response would be stop using sockets
haha, same
If you need real time communication, websocket it
In fact, a lot of IoT devices use websocket
most iot don't even have readlink() 
i've not done anything IoT with websockets, usually just MQTT or something of that nature
RabbitMQ or pure AMQP?
Pure, Azure ServiceBus
gotcha, Azure is one of those things I just can't bring myself to learn. I still just have that deep seated hatred for Microsoft lol
@ember ledge i think you may have ignored my original question re: this. Where are you running your server vs where are you running your client. If they aren't on the same machine, "localhost" doesn't work
also, you need to make sure your firewall isn't actively blocking 8080
also, it's nice to meet you Ayyan Shahid @ember ledge lol
it was in your copy-paste 😄
but also, I can't help you if you don't answer my questions @ember ledge
So you don't want help? did you fix it or were you hoping for someone to magically be able to tell you what is wrong without any information?
j4ng5y, another example of "WHY SOCKETS, WHY?"
speaking of
would sending 2 WS responses compared to 1 WS response legitimately cause 90% performance loss?
How would I go about making a python proxy? I usually don't ask so vaugely, but I am entirely lost, all the search results are either shills, or using plug and play libraries. I'm trying to say pass some traffic to it on port x and unpack it with struct, similar to wireshark
you should probably start with reading up on some of the general concepts of proxies in general rather than directly with python
Tho python i wouldn't say lends it self directly to being used to make proxies its certainly possible but not without alot of low level socket work
would sending 2 WS responses compared to 1 WS response legitimately cause 90% performance loss?
@gloomy root I would think not, but I assume you are seeing as much
😅 Oh yeah, its dropping requests like flies and debugging between two languages is a nightmare
Here's what I have so far
#!/usr/bin/env python
import socket
import struct
import binascii
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x0800))
while True:
packet = s.recvfrom(2048) # takes buffer size
ethernet_header = packet[0][0:14]
eth_header = struct.unpack("!6s6s2s", ethernet_header)
print(f"Source: {binascii.hexlify(eth_header[1])} -> Destination: {binascii.hexlify(eth_header[0])}")
ipheader = packet[0][14:34]
ip_header = struct.unpack("!12s4s4s", ipheader)
print(f"Source Ip: {socket.inet_ntoa(ip_header[1])} -> Destination Ip: {socket.inet_ntoa(ip_header[2])}")
Ouch
One second, god awful formatiing
i hope thats not all one line 🤣
i can't even imagine trying to write a proxy in python ...
yeah i wouldnt say its as simple as others
That should be better
Thats Proxy.py's http folder
I saw that
there is alot
I was thinking something more lightweigt
I'm not looking for encyption etc
More of just a passthrough
"like wireshark"
just a learning thing? i was just thinking "why not use wireshare or tcpdump or something"
Well I got the idea from this video: https://www.youtube.com/watch?v=iApNzWZG-10&disable_polymer=true
Part 9: To analyse the game traffic, we are developing a simple proof of concept TCP network proxy. Then we can start to reverse engineer the protocol.
GitHub: https://github.com/LiveOverflow/PwnAdventure3/tree/master/tools/proxy
🌴 Playlist: https://www.youtube.com/playlist...
Didn't look all too complex
legit, when i do pentesting things, i always use Go for proxies and such
#!/usr/bin/env python
import socket
import struct
import binascii
s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x0800))
while True:
packet = s.recvfrom(2048) # takes buffer size
ethernet_header = packet[0][0:14]
eth_header = struct.unpack("!6s6s2s", ethernet_header)
print(f"Source: {binascii.hexlify(eth_header[1])} -> Destination: {binascii.hexlify(eth_header[0])}")
ipheader = packet[0][14:34]
ip_header = struct.unpack("!12s4s4s", ipheader)
print(f"Source Ip: {socket.inet_ntoa(ip_header[1])} -> Destination Ip: {socket.inet_ntoa(ip_header[2])}")
Code from before
Go or Rust
This just intercepts all traffic?
Hyper has a really nice and simple Proxy system inbuilt
Pretty sure the stdlib socket module doesnt have PF_PACKET as a thing
im running a threaded scan of the network but
i dont think my thread catches all the ones i want
because xxx.xxx.xxx.30 is online but wont show even though it should
this channel goes through weird trends lol
lol
i think its one of those areas where its alot more advanced than people think
the channel
i think its one of those areas where its alot more advanced than people think
@gloomy root Ahh, i'll just put localhost everywhere .... WHY U NO WORK?!
god i remember when i was originally using localhost over 127.0.0.1 and getting absolutely fucked by latency issues and wondering what was causing it
lolol
such a hair tearing moment
i'm super glad that I started my career as a network engineer ... can't tell you how many times that knowledge has saved my ass
how can i connect to a socket server with a dynamic ip
Pls halp
class Server(threading.Thread):
def __init__(self, host, port):
super().__init__()
self.connections = []
self.host = host
self.port = port
self.address = (host, port)
def run(self):
server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_sock.bind(self.address)
# max_of_5_clients
server_sock.listen(5)
print("[*] The Server is listening for connections...")
while True:
# Accept new connections
client_socket, sockname = server_sock.accept()
print(
f"[*] Accepted a connecction from {client_socket.getpeername()} to server on {client_socket.getsockname()}")
# Create new thread
server_socket = ServerSocket(client_socket, sockname, self)
class ServerSocket(threading.Thread):
def __init__(self, client_socket, sockname, server):
super().__init__()
self.client_socket = client_socket
self.sockname = sockname
self.server = server
def exit(self):
print(self.server.connections)
while True:
ipt = input(">")
if ipt == "!q":
print("[*] Closing all connections....")
try:
# I GET THE ATTRIBUTE ERROR RIGHT HERE....
for connection in self.server.connections:
connection.client_socket.close()
os._exit(0)
except AttributeError as e:
print(str(e))
can anyone help me why i get the following error
print(self.server.connections)
AttributeError: 'Server' object has no attribute 'server'
i dont get why is it saying this
because im passing the Server object
so it should be able to access the attribute
@ember ledge to didn't actually provide an IP address 😄
@faint cairn best way is to set up dynamic DNS and point to that rather than an IP address
Ok Thx
are you trying to connect to the bridge or the light?
just looking at this comment in the issues: https://github.com/studioimaginaire/phue/issues/121#issuecomment-466822487, looks like you are missing data as well
Is YDNS a good dynamic dns provider?
never heard of it
Can you recommend one for me?
Is it free tho?
no, but most of the trustworthy things aren't lol
😭 ok
so it should be able to access the attribute
@north quarry so, this is why I don't like assigning class arguments like you did it in init, i would normally do a function to do that assignment:
class ServerSocker(threading.Thread):
def __init__(self, client_socket, sockname, server):
super().__init__()
# define all class attributes
self.client_socket = None
self.sockname = None
self.server = None
self._parse_class_arguments(client_socket, sockname, server)
def _parse_class_arguments(self, client_socket, sockname, server):
# Doing it this way allows for you do to validations on the provided arguments, rather than expecting that they are correct
try:
# do things that validate your args are valid ... checking None probably isn't the only thing you want to do lol
if client_socket is not None:
self.client_socket = client_socket
else:
raise Exception("client_socket can't be None")
if sockname is not None:
self.sockname = sockname
else:
raise Exception("sockname can't be None")
if server is not None:
self.server = server
else:
raise Exception("server can't be None")
except Exception as e:
print(e)
...
Lol, you were so careful not to let us see your IP address too@ember ledge
Can you send a post outside of python to 192.168.1.104/api?
But also, not sure you actually addressed the username bit I was getting at earlier
Idk, I don't use hue's, but I think he mentions that in the GitHub comment
one example is b=Bridge("192.168.0.20","sew45dsre3435esdwe")
To find the username on a hue bridge on a local ethernet, open the https://discovery.meethue.com/ and write down the id.```
@ember ledge
Are you looking for support relating your Philips Hue products or Apps? Here you can find answers to the most frequently asked questions.
I forgot i left a print statement somewhere
No, you are trying to connect to a bridge. @ember ledge
The API in something else is going to be different
What is it even that you are trying to connect to then if these things are BT only?
I know what you want to do, but what is the 192.168.1.104 device you were trying to connect to
If not a bridge, what is it
... so it isn't bluetooth then?
Or it's both?
Bluetooth doesn't use ip addresses
can you send us a link of said light bulb
cuz this is getting confusing with very contradicting systems

okay
so Each bulb must be linked with the Hub to control
seems the Hub is what actually controls said light bulbs
So connecting to them individually is gonna be pointless
Develop Engaging Philips Hue App and Grow your Business as a Philips Hue Developer.
They lock the api docs 😔
means i gotta scroll through my emails
right
this is what we're gonna be referencing
I ain't signing up for that shit lol
low key BS that they make you sign up just to read the docs
Which means that the docs arent free. They cost my contact info. What stupid marketing firm made that suggestion ...
I hate it when companies gain significant market share
Anyway, no more rants, sorry
Hey @gloomy root!
It looks like you tried to attach file type(s) that we do not allow (.html). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .m4a.
Feel free to ask in #community-meta if you think this is a mistake.
Grr python
if you're gonna make me use a paste bin atleast give me enough space to paste it 😔
@vernal surge if you want a copy of the html 🤣
;) thank you lol
In terms of how its gonna work
seems you need to send the requests to the light's hub/bridge
which then controls the lights like that
python -> bridge -> individual lights
🤔 Alexa's API is completely diffrent from the lights themselves
Alexa can be a zigbee bridge
But yeah, now we are taking about interfacing with Alexa, which is a whole other rant lol
im pretty sure looking at this to control the ApI directly it forces you to get the hub
seems alexa has all the BT systems pre installed as a sort of partnership
The Bluetooth I'm sure allows the mobile app to communicate directly though, but I don't see any reference to that api
they're not very clear on these docs tho
So you would be reverse engineering it lol
not as bad as google tho
right
Do you have this 'bridge' thing?
apparently this is the needed
so probably using alexa's api is gonna be easier
and we can just bully Alexa into bullying hue
No way to use python then unless you reverse engineer the Bluetooth calls and then use a bluetooth library. But that will not be trivial.
i kinda want todo that now
probably go with rust
I mean, like @gloomy root said, it's possible to do some hacky things with the Alexa api, but there is no good, direct, library for you to use @ember ledge
I shall stick one of those in my shopping basket and document my adventures 🤣 for £14 its not too bad, not after spending £60 on a single maths book for school
Lol, I look forward to the write up
only small issue is i dont have a Bluetooth reciever or sender on my pc 🤔
Raspberry pi has a built in
It's what I do most of my hacky hardware stuff with lol
Because I don't care if it dies lol
Laptop on the other hand... I need that not to die lol
Paid way too much money for it
hey guys i get errno32 broken pipe and i'm not sure why, i'm making a proxy and after connecting everything, i send 1 message from the server to the echo server to the proxy (the first one is handled differently from the others) to register the server connection, but any other message i send from the server (as in: if i try after the first message) breaks the echo server and gives errno32 broken pipe
i'll send the code
Hey @undone gust!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Hey @undone gust!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
oh
https://paste.pythondiscord.com/nenohocuwi.py echo client
i fiddled with the ports to be able to run this on 1 pc for testing
what OS is this?
i doubt that will run on windows
want me to also send a random server and client program?
Windows is very picky
well i mean i made most of the program on windows
and switched to linux very recently
yes
CONSTANTS
_private_thing
avoiding_naming_colisions_
Classes
those are pretty much the standard naming conventions in python
ok
thanks
i knew about all of 'em but the constants
well umm, so should i also juts send a random client and server program? the proxy itself is made to not be picky (hence the echo server and client, they handle all the 'custom protocols' i made so that you dont have to implement them), but yeah it might save you time
a random line where it does a receive, i'll reproduce it now
oh wait i just got.. a different error?
it crashed on the very first message which is handled a bit differently
echo server's error:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "echo-server.py", line 57, in handle_proxy
msgid = int.from_bytes(proxy.recv(1), "little")
ConnectionResetError: [Errno 104] Connection reset by peer
^CException ignored in: <module 'threading' from '/usr/lib/python3.8/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 1388, in _shutdown
lock.acquire()
KeyboardInterrupt:
main proxy's error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "proxy.py", line 139, in handle_conn
handle_pack(conn)
File "proxy.py", line 82, in handle_pack
log.info("Registering conn: %d", CONNIDS[conn])
KeyError: <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
huh, his isn't what i got before
OH WAIT, i remeber! afte some changes i stopped getting broken pipe and got this instead, but broken pipe occured on the second message and this occurs on the first one, so if this was fixed i'd also have to deal with the other one
you appear to be trying to hash the entire socket object
what does hashing mean
turning it into random numbers would be the simplest method to describe it
but dw about that for now
encoding?
I would assign the conn_ids to have string keys not entire objects
connid's should be a number
like the first client that connects gets 1, the second 2, etc
well in that error conn is the socket itself
and you're trying to index CONNIDS with conn itself
yeah cause i have a list where conn is the key and connid is the vale
in CONNIDS, the key is the connection itself, and the connid is the value
is that wrong?
i wouldnt say its advisable
is it just because it's long, or because of it being a conn itself
because if it's the second choice i could just str(conn) and use that instead right
it just seems like a awkward system for the sake of getting a number
well that number is quite important
i don't have any other ideas, the connection is reliable because i always have it while i receive, if i didn't use that then idk
i could store the connid on the echo server/client and send it directly? does that sound good?
like instead of deriving the connid by the connection, i just send the connid, i had thought of that but... that lets people fake their connection and tamper with other's connection
but couldnt you use a incremental counter rather than that
i do use it
i assign the connid in the main proxy thingie, all of this is just to derive it so that i can send it to the server
like i assign every connection its connid and every one is 1 bigger than the one before, starting at 0, so incremental
:<
yeahh i think this project was a bit out of my reach, but i tried anyway, and made a cluster fuck
well most of it worked, so that's nice
but i think it would be simpler to make a class and give the class it's id so it knows what connection it is
to do that wouldn't i have to rewrite the entire thing
also i'd have to find a way to call every class i create differently which i'm not sure how to do
How to send email only with standard library ? Without using smtplib or any other libs
I'm not sure if this is the correct channel, but I need to create something like TeamViewer that will, when the button from the phone, include the following videos on YouTube (I want to know which libraries can make the process easier)
anyone that can help me why i get an AttributeError
# both classes are in own files!
class ServerSocket(threading.Thread):
def __init__(self, client_socket, sockname, server):
super().__init__()
self.client_socket = client_socket
self.sockname = sockname
self.server = server
def exit(self):
while True:
ipt = input(">")
if ipt == "!q":
print("[*] Closing all connections....")
try:
# THIS THE LOCATION THAT CAUSES THE ERROR
for connection in self.server.connections:
connection.client_socket.close()
os._exit(0)
except AttributeError as e:
print(str(e))
class Server(threading.Thread):
def __init__(self, host, port):
super().__init__()
self.connections = []
self.host = host
self.port = port
self.address = (host, port)
def run(self):
server_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_sock.bind(self.address)
# max_of_5_clients
server_sock.listen(5)
print("[*] The Server is listening for connections...")
while True:
# Accept new connections
client_socket, sockname = server_sock.accept()
print(
f"[*] Accepted a connecction from {client_socket.getpeername()} to server on {client_socket.getsockname()}")
# Create new thread
# Here im passing self ( this is the Server class)
server_socket = ServerSocket(client_socket, sockname, self)
# start new thread
server_socket.start()
# add thread to active connections
self.connections.append(server_socket)
print(f"[*] Ready to receive messages from: {client_socket.getpeername()}")
AttributeError: 'Server' object has no attribute 'server'```
Hi in Which layer of osi model operates socketio protocol?(i read that websocket is on 7 layer)Im trying to understand the flow cause socketio is on the top he uses beneath him websocket which uses http/TCP protocol right??
Websockets are built ontop of a upgraded HTTP GET request, which intern is built off the TCP protocol
Ok so actually inside TCP we have Http and websocket protocols? And what with socketio??
Well SocketIO is just a wrapper for certain protocols from just HTTP sockets to Websockets
the general order is:
Websockets
|
HTTP
|
TCP```
Socket IO is just built ontop of the HTP and Websocket systems to provider a easier wrapper for them
its not its own set of protocols or anything special like that
@gloomy root ok so actually socektio protocol contain this flow chart u showed?
what?
SocketIO is just a wrapper
Especially Python's SocketIO module
all it does is wrap existing modules for use
When you make a standard SocketIO server it defaults to the HTTP protocol which is built on top of the TCP protocol
If you make it create a Websocket server it would make a HTTP server that then Upgrades the connection to a Websocket providing the relevant headers are provided
@gloomy root so actually socketio isnt protocol? its just a lib?
@dreamy python yes its just a lib
@gloomy root ok fine cause according to this link
https://python-socketio.readthedocs.io/en/latest/intro.html
they used the term protocol so its confused me..so actually when im using socketio lib im executing the 3 protocols u said websocketos(OSI layer 7) and http and TCP which on(layer5??)??
On the Network its not its own protocol
It is its own system in terms of the event based system but Websockets and HTTP are their own protocol individually
Ig? you could call it its own protocol because used across networks with Js etc... but i dont think its entirely valid to call it that
@gloomy root ok but still what do u mean when ur saying "On the Network its not its own protocol" its protocol or not?
and can u confirm/correct me if im wrong about "so actually when im using socketio lib im executing the 3 protocols u said websocketos(OSI layer 7) and http and TCP which on(layer5??)??"
I would use the term executing 3 protocols
They're all built ontop of each others rather than 1 executing the other executing the other etc...
ok so what is located on the toppest? and what is the corrsponding layer to him?
TCP - Layer 4
HTTP - Layer 7
Websocket - Layer 7
SocketIO - Not a OSI Layer
ok now im starting to understand it thanks so actually socketio lib is gathering all those 3 protocoles together
so when there is relation between client to server
the server is sending req' to client ->Http protocol is initated to start the connection and after that the Websokcet is cont' to take the connec' open untill it being closed from server/client and transformation of data/connection is being executed with TCP protocol?
if im wrong please fix me ...thanks
and in conclusion its wrong to say socketio is protocol the right term is lib?(cause on the link i send u they saidWhat is Socket.IO?¶ Socket.IO is a transport protocol that enables real-time bidirectional event-based communication between clients (typically, though not always, web browsers) and a server. The official implementations of the client and server components are written in JavaScript. This package provides Python implementations of both, each with standard and asyncio variants.)
technically? yes
but SocketIO isnt always websockets
its most common system is just built on HTTP alone not using Websockets
can u please explain the flow of things between the protocols??(like whats happening behined the scens of establishing connection between client and server
Its mostly just abstractions between layers
i got this pic' which im trying to explain according to her but still little bit thougher
In the Same way a High level programming language is a higher level abstraction of a low level language e.g Assembly
In that example
It seems the Client will need to send a GET HTTP requests
Which is then put through a Upgrade system built into HTTP via Headers creating a 3 way handshake
Thats basically how a Websocket works
@gloomy root ok but in the handshake which parameters are being settled? and also where we see on this example the TCP protocol?(only when sending data right?)
Everything is HTTP
I really would worry yourself with TCP
TCP is the Raw protocol that HTTP is a higher level abstraction of in reality
So everything HTTP/1.1 and HTTP/2 is TCP
technically everything HTTP/3 is UDP with TCP verification of packets.
HTTP/3 is a very new system tho which i wouldnt worry about
i know generaly TCP role is to ensure safer way to send data without loosing it this is wrong??(according to ur answer what is the role of HTTP protocol?)
ok according to what u said "in the handshake which parameters are being settled??"
HTTP is just a protocol built on top of TCP to make transfer easier across the w3
https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol the definition of HTTP and how it works <---
@gloomy root ok i see and about the handshake para'
im asking it cause ive been told that when im using socketio lib i cant know the rate/speed of data transfering right/wrong? (its being settled by the network)
you cant really do that for any lib
SocketIO regardless
It just depends on too many things
The server Network speed, The client network speed, how fast the server can write to the socket etc...
you cant really do that for any lib
@gloomy root i dont understand what i cant do for any lib ? i didnt understand on what ur talking about?
and what is being settled on the handshake (main things)
You cant know the rate/speed of data transfer
tho that question doesnt make much sense anyway
@gloomy root ok fine i asked that cause i know that on handshke process
both sides decides about rate/speed which they gonna talk
so because of that i asked about whats mainly happening /being decided on handshake??
well that depends on the protocol
@gloomy root ok so i guess in my case its related to http?if u can explain some of features/parameters which being settled..
@gloomy root ??
A HTTP upgrade is pretty much just sending a response back with a Upgrade header, checking the responding headers and then passing it off
@gloomy root ok so i guess in my case its related to http?if u can explain some of features/parameters which being settled..
@dreamy python
Can u please answer my questions straightforward cause i didnt understand ur answer
I mean i just did
The whole point of HTTP is to be simple
Its not a overly complicated system,
Ok but still u didnt give me simple straightforward answer about my questions
I mean to handshake
Idk how else you want me to describe the fact its just sending back another response with some diffrent headers
Features/parameters.. which mainly being settled...
There isnt any
Between client and server
So why its called handshake (http upgrade)?
Not really any main reason
its just adding a extra step between before communication
that is litterally it for upgrading headers
I know generally it should be settle some parameters beterrb both sides ...but according to what ut saying its not doiing it ..so actually what it does?(exceot of headers)
its litterally Just headers
its only purpose is switching protocols
E.g from HTTP to a Websocket connection
U mean like client sends request for moving to websocket from http, so first he sends request for http connection to server and server sends to client ack and then moving to websocket??
I mean i can only tell you what the link i sent above will tell you
Client: "Id like todo this and Upgrade our connection"
Server: "Okay upgrade you want to upgrade to xyz"
Client: "Yes okay heres the relevant details"
Conection upgraded
Obviously this is massively simplified
Ok u illustrated this very good and simple,cause i really got confused cause i read about http and thought it should act differently because of handshake...
Are there any clever python tools to test networks? Like we have tcpplay tool kit and tcpdump or wireshark for recording
Guys do you know where to start learning Python Networking? Some tips on YouTube tutorials and articles are welcome. Thanks for tips
networking what
Hello , I've been trying to setup kubernetes on my ubuntu 20.04 machine , but inspite of installing kind and kubectl ,and moving them to /usr/local/bin ,I'm unable to run kind create cluster , as it simply says ./kind: 1: Not: not found, github issues told to install kubectl but that doesnt fix the problem either , anyone has any insight into the issue?
another thing I noticed is that , running xxd on the kind binary just gave a single line of 00000000: 4e6f 7420 466f 756e 64 Not Found
Here's how I installed kind sh curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.8.1/kind-$(uname)-amd64 chmod +x ./kind sudo mv ./kind /usr/local/bin/kind
Would anyone in this channel be able to tell me why I keep getting Ether / ARP who has ?? says ?? from this code ``` #!/usr/bin/env python3
import scapy.all as scapy
def scan(ip):
arp_request = scapy.ARP(pdst=ip)
broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_request_broadcast = broadcast/arp_request
print(arp_request_broadcast.summary())
scan("10.0.0.1/24")
Hi everyone,
is anyone familiar with nOBEX ?
import socket
client_socket = socket.socket()
port = 5000
client_socket.connect(('127.0.0.1',port))
recv_msg = client_socket.recv(8192)
print (recv_msg)
send_msg = input("Enter your user name(prefix with #):")
send_msg = send_msg.encode()
client_socket.send(send_msg)
while True:
recv_msg = client_socket.recv(8192)
print (recv_msg)
send_msg = input("Send your message in format [@user:message] ")
send_msg = send_msg.encode()
if send_msg == 'exit':
break;
else:
client_socket.send(send_msg)
client_socket.close()
What do u think is wrong here in this client
???
to much magic dust
you havent actually told us an error
the thing which stands out the most is the fact you:
a - close the socket on the first message
b - compare bytes to a string
c - 🤷♂️
I'm looking to write a simple networking server (for a machine to machine related project which will at most need to handle 100 concurrent connections) and was wondering if I should roll out my own server using sockets and threading or if I should just use asyncio.create_server instead
Hi, how would I make a query to a graphQL endpoint via aiohttp ClientSession?
@crystal estuary use their documentation to craft the query, otherwise, it's pretty well the same as any other HTTP based API endpoint
@ember ledge define "networking server" ... what is it your app is doing? i'm not sure whether or not to suggest a web server library or web sockets, or 🤷 lol
Deadlocks + Network = A really bad time
6 Hours of debugging later, the network finally doesnt lock up on high loads
@vernal surge the server is going to have other clients connect to it and serve as a hub for other clients to send json like data structures to one another.
@gloomy root you are doing something very long if you are getting deadlocks lolol
@ember ledge A simple web server works just fine though ... fastapi would but quite alright
Go lang + RwLocks + Nested Maps with channels apparently = Big oof
rwlocks? not just builtin mutexes?
Well I could use mutexes but that would be inefficent
the system is 90% read over write
ah, gotcha
I want the clients to always be connected to the server so they can listen for specific data being sent by the server, I also thought that FastAPI was only meant to be used for HTTP related server networking
@ember ledge well... when passing json objects around, that process is typical not an instantanious thing. Your clients would request from the server "did anything come for me" and the server would deliver. But if you need something more realtime, yeah, websockets would probably work just fine. All of this being said, I have no idea what you are actually doing ... but it sounds like you already have you mind made up, so carry on.
what is it you are building @gloomy root ?
@ember ledge Use WebSockets if Server needs to signal to client in real time
@vernal surge My experimental build of https://github.com/Project-Dream-Weaver/Sandman
Specifically working on some sharding system between the workers to test if it has any different on load balancing / efficiency or not
Hello!
I have a List of Links, right
And I just need this part of the Link:
google.com/THISPART
How would you get that part?
think this might be suited in one of the help channels, but if the link only has one / then you could do: link.split('/')[-1] (might even work with multiple /s). Or use regex.
i mean if you know its always gonna be https://www.google.com/ you can just use strip
you can also use urllib.parse
In [1]: from urllib.parse import urlparse
In [2]: d=urlparse('https://google.com/path')
In [3]: d
Out[3]: ParseResult(scheme='https', netloc='google.com', path='/path', params='', query='', fragment='')
In [4]: d.path
Out[4]: '/path'
it's probably more robust than anything we'd suggest here, but it does require a fully qualified URL (which means it needs the protocol at the beginning)
Guys do you know how to take api from mobile app
Guys do you know how to take api from mobile app
if it's public, google it, if it's not, you won't be able to, and besides i'm pretty sure it'd be illegal
basically, google it. @kindred ferry
I have but still dont know
how to find out all the information about the network?(I mean, which ones are closed, which ones are open, etc.)local network
like all about router, provider
What specifically do you want to know
are you talking about like network scanning?
I would recommend not helping people pentest networks @thorn stratus
Kinda like showing random people on the internet how to break into appartments
Yes, but can easily be abused. It is not illegal breaking down a door, if it is your own door. But with that knowledge you can easily break down other people's doors as well.
Prepare yourself for a stupid question; can you just link between pages like you would if you where viewing the page in a browser (with flask)
If not are there any suggestions for something like flask but with that ability?
@wanton egret wdym
like in normal html you can just use href="test.html" but in all the flask examples I've seen you need href="{{ url_for('test') }}"
is the href="{{ url_for('test') }}" needed?
i already have the webpage and it uses href="test.html" i don't want to change the pages because that would take 2 long
i also dont want to add @app.route() for all of them
If you want to use templates, you need a route. If you just want a static html page which talks to a flask API, you could just have static files.
I'm creating a desktop application and one of the features is to send a friend request. Now lets say two clients are open and client A sends a friend request to client B, Whats the best way to show on client B that he got a request. Do I create a socket on client B which constantly pings the server for friend requests or use websockets?
First time client B opens it's no problem since it will send an api request which checks if there are any friend request.
I'm thinking of an event driven solution but not sure how to accomplish this
There is also eventstream, but of you end up wanting more updates, websockets are probably a good choice
Is it better to ask here or in async about something Twisted related?
i imagine it depends on the question.
My question would be that: Is there a good solution to create a task.LoopingCall and change/modify the time inside the passed function. or is that not possible?
like starting the call with something like
loop = task.LoopingCall(myfunc)
loop.start(30.0)
first run will be after 30 seconds, and the next run for example 45.0 secs
can I just accomplish that with the deferred it returns?
The most common way to do that in general is just to "recursively" schedule yourself once you are done with the bigger number
I see. I guess LoopingCall isnt the way to go then.
Probably not, unless twisted has task local variables or sth
I guess I'll just go with callLater
Thanks for your help though
A bit of a hacky solution would be to use LoopingCall but inside myfunc I could use a random sleep
but that sounds ugly I think
I'm using the Python sockets library. I know how to send a signal from the server to the client, but the client is just waiting for the server to respond, because they sent a request first. How do I make it so that the server can send a signal whenever it wants, without the client sending a request for this signal, and create a function that will handle the signal when it's received on the client side?
Example:
Server:
conn.send("Execute Order 66".encode(FORMAT))
Client:
client.recv(2048).decode(FORMAT) #calls a function with an argument that is the message received
def messageReceived(msg):
if msg == "Execute Order 66":
killJedi()
(I don't want the client constantly sending a request to the server every second checking if there's any data it should know)
How do I get the program to check if there is wifi on the device
@ember ledge specifically wifi? Or just connectivity?
like if theres connaction
@ember ledge you could just do a simple http GET to Google or someone. If that errors, then you know you don't have any connectivity lol
ig
Otherwise, you would need to interface with the OS network provider (and on Linux, there are a number of those possible lol) to query if a connection is present.
hmm
Or if you only care about local connectivity, you could just ping the router
Pc on the same network or not?
different
What are you doing exactly? If you are building a client server thing, then just have an endpoint on your server that the client can touch to verify connectivity.
A program that pings to a website for an api but like it had more than one
So I was thinking I can make a function
that is called in the function for the api
make it easier to call when I need it
The call to the API is either going to fail or not
yeah thats tru
Just wrap in a try/except and, if it excepts, you can write some retry logic or not, whatever lol
yeah Ill just do that then
I tend to write retries with backoffs, first retry in 10 seconds, then 30, then 60 and bail if the third retry fails
Yeah, that's pretty typical
yeah thx for the help
Np
It's really hard not to over engineer, but try not to do extra work if you don't have to :)
E2EE?
idk what that means
End to end encryption?
Ok, are you doing sync or async cryptography
I've gotten my http proxy working but I need it to also have https capabilities or ill keep getting permanent move address errors
I dont know I've just been winging it for about 2 hours
You are trying to intercept https?
Im trying to make an https server and client
Remind me why you are doing this, because we are getting dangerously close to MITM territory lol
But Why?
I just wanted to make a proxy
errr, ok
To say I could
Ok, so yeah, a mitm
👍
Man in the middle
I'm not trying to eaves drop i just started it so I wanna finish it fully working
General flow is this:
- Client wants to go to a secure site via proxy
- Proxy sees the request, and generates a self (or local CA) signed certificate for the requested site.
- Proxy makes the request on behalf of the client
- Secure server responds like normal, but to the proxy, not the client
- Proxy reads and rewrites that response with the proxy cert
- Proxy responds to the client on behalf of the secure server
And mind you, this has to happen in both directions, in real time
And if you don't have a local CA that the client trusts, it won't work anymore because browsers all but block SSCs
Thats how Feynman teaches and you just made understanding this alot easier for me
Glad I could help lol
Thanks dude im gonna go back to figuring it out
Doing this is like living a lie, the hardest part is keeping track of the lies (sessions/certs/keys)
How can i check if my router supports IPv6??
If it supports it, it'll have assigned you one
If you're on windows, open a command prompt and type ipconfig /all, if you have a link local IPv6 address, your router supports it
hey
do anybody works with heroku?
it works normally at the start, later it got an r10 error
couldnt bind to port
My best guess is that you don't have an env var named $PORT, or you aren't making it being evaluated by the shell
The error message says that you want to bind to a port named literally $PORT, but it ports are only numbers, not words
Interesting write up from CloudFlare about CenturyLink stuff and a bit about BGP https://blog.cloudflare.com/analysis-of-todays-centurylink-level-3-outage/
client
import socket
import time
import os
import sys
import threading
import subprocess
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = socket.gethostname()
PORT = 8888
def connect():
try:
server.connect((HOST, PORT))
messages()
except (ConnectionRefusedError, TimeoutError):
print("reconnecting, please wait...")
time.sleep(0.1)
connect()
def send():
while True:
message = input(">>> ")
server.send(message.encode())
def messages():
while True:
threading.Thread(target=send).start()
connect()
server
import socket
import threading
import time
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
host = socket.gethostname()
server.bind((host, 8888))
server.listen(30)
print("The server has been launched succesfully!")
while True:
conn, addr = server.accept()
print(str(addr[0]) + " has connected succesfully!")
command = conn.recv(1024).decode()
print(command)
in the server i receive one message
instead of tons
Hello,
I am searching for a Handful of People which would be helping in a medium sized Project.
If you would be interessed in joining, DM me.
The current Project is kind of part of Networking.
Regards,
ErrorCauser
I love how diplomatic Cloudflare was being
So why did it take more than four hours to resolve? It took 4 hours to resolve because cost cutting
They are a very sophisticated network operator with a world class Network Operations Center (NOC) With all cuts I've seen in NOCs, cough bullshit cough their NOC assuming it wasn't outsourced to lowest possible bidder was likely staffed with Tier 1 people who couldn't resolve it and customers have ability to do flowspec changes because ISPs don't want to keep proper staff on hand to resolve this.
Hahahaha yeah I think they are trying to criticise while maintaining access to the network
customers doing flowspec changes sounds like a great idea /s, does that actually happen?
I think that other CloudFlare outage was amusing
Routing all traffic through Atlanta
and then the trending hashtag was that discord was down, not cloudflare, hahaha
Joe, we had ability to do that at last job. All the budget cuts mean we couldn’t get anyone with a brain on the phone so that was their solution
Sheesh
Just like Devs are QA isn’t DevOps! But CheapDev!
ISP is one of those there is limit to amount of business available so after that, only way to increase profits is cut expenses
And clouds have been hurting ISP business since big money is in datacenter transit and more companies are shutting down data centers
Do the robots.txt restrictions for web scraping (such as crawl delay), apply to the robots.txt file itself?
has anyone tried sending udp packets via netcat command in terminal? after opening a client, and sending something, it just exits
// client
nc -u localhost <port>
// server
nc -u -l <port>
kolx why would it not exit
plasma, generally not, robots.txt is considered open to web crawlers because it's for them
@restive blaze check the gif at the bottom:
https://help.ubidots.com/en/articles/937233-sending-tcp-udp-packets-using-netcat
What is Netcat? And, how to use it to send TCP/UDP packets to a remote server
@vernal stirrup change the server command to nc -u -l localhost 8080
that worked for me just now locally on mac, stopped the client exit
hello, im new to socket programming in python and im trying to create a simple chat. the problem is that i dont know how to make it possible to run the listening loop while waiting for the user input at the same time. this is why i reached up to this point so far, and im looking for ways to fix it.
import socket
class User:
def __init__(self, username):
self.username = username
def set_server(self, host, port, size, time, run=True):
while run:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)
s.bind((host,port))
s.listen(time)
client, address = s.accept()
data = client.recv(size)
if data:
message = '[' + address[0] + ' - ' + data.decode() # username comes in data example: user123]: some data
print('{}'.format(message))
s.close()
def set_client(self, host, port, message):
s = socket.socket(socket.AF_INET, socket.STREAM)
s.connect((host,port))
data = self.username.encode() + b']: ' + message.encode()
try:
s.sendall(data)
except Exception as e:
print('SOCKET ERROR:',e)
finally:
s.close()
#### TEST###########
if __name__ == '__main__':
server_running = True
username = input('Username~# ')
user = User(username)
host = input('Host~# ')
port = int(input('Port~# '))
message = input('['+username+']: ')
user.set_server('', 37554, 512, 5, server_running)
if message:
server_running = False
user.set_client(host,port,message)
message = None
server_running = True```
I would highly advise learning classes and general string formatting before jumping into socket ignore that, phone made it look like you were doing weird stuff
hello, im new to socket programming in python and im trying to create a simple chat. the problem is that i dont know how to make it possible to run the listening loop while waiting for the user input at the same time. this is why i reached up to this point so far, and im looking for ways to fix it.
import socket class User: def __init__(self, username): self.username = username def set_server(self, host, port, size, time, run=True): while run: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) s.bind((host,port)) s.listen(time) client, address = s.accept() data = client.recv(size) if data: message = '[' + address[0] + ' - ' + data.decode() # username comes in data example: user123]: some data print('{}'.format(message)) s.close() def set_client(self, host, port, message): s = socket.socket(socket.AF_INET, socket.STREAM) s.connect((host,port)) data = self.username.encode() + b']: ' + message.encode() try: s.sendall(data) except Exception as e: print('SOCKET ERROR:',e) finally: s.close() #### TEST########### if __name__ == '__main__': server_running = True username = input('Username~# ') user = User(username) host = input('Host~# ') port = int(input('Port~# ')) message = input('['+username+']: ') user.set_server('', 37554, 512, 5, server_running) if message: server_running = False user.set_client(host,port,message) message = None server_running = True```
@spare ferry bro TBH whatbyou are asking it can be just fixed with using threads
If you don't know what is that
You may search google cause explaining it here will be a headache
👍
I would highly advise learning classes and general string formatting before jumping into socketignore that, phone made it look like you were doing weird stuff
@gloomy root damn u scared me for a sec
@spare ferry bro TBH whatbyou are asking it can be just fixed with using threads
@empty solstice alright ty
No problemo
Where asyncio would be better
again, i feel the need to ask why peoples first jump into networking is raw sockets
my first was scapy actualyl
lol
and i dont see what bad in learning sockets first?
not that it's bad ... but there is usually a reason to go down to that level, generally it's not the thing you start with. I've been doing the software development thing for a bit and i can count on one hand the number of times I've actually had to use sockets in the past 5 years
for context ... 5 years is not the length of my career either lol
well, i want to get into pentesting, i guess it would be handy
Pentesting == running vuln scans and writing reports, it's not nearly as fun as it sounds 😄
very rarely does a company want you do develop APT level exploits against their network
and fwiw, I HAVE done professional pentesting, and python was not the language I used 😄
not to kill the dream here, but just being real
Pentesting == running vuln scans and writing reports, it's not nearly as fun as it sounds 😄
im fine with doing pentesting at home instead of playing video games, as a job im not worried rn because im about to get recurited in few months for about 3 years, probably something simple like network administrator or something
and fwiw, I HAVE done professional pentesting, and python was not the language I used 😄
what was the language you used then? i mean, a lot of pentesters in my country use python
It use to be Ruby (because metasploit), but I usually found myself writing C
now, I tend to use Rust/Go
C\C++\Rust\Go beacuse of the ability to compile and run anywhere
python needs an interpreter, and most of my targets didn't have one
what were you doing with C? like what kind of stuff
i learned some C basics, but i think that python is better in terms of pentesting networks compared to C, fix me if im wrong. were you doing other things with C tho?
and the pyinstallers of the world make life as a pentester a living hel
pyinstaller in the real world is a bit of a joke
they wrap an interpreter in
A) Lack of Efficiency of storage
B) Lack of Speed
C) No active multi os support
D) Dependency hell
E) Can still require external deps be packaged with it
but re: "why C", python abstracts away too much of the low level stuff you need for certain exploits
I agree, it's not a great tool for doing network level stuff due to the verbosity
that is where I use Go now ... and Rust is now my low level tool
Rust is great because you get the safety of high level languages but equally are able to still do unsafe low level things
I'm working on a generic proxy for rust though, so I can stick to one language
Are you doing it with raw sockets or something like hyper?
raw, specifically, I'm targeting one particular ether card for a particular engagement, but when I get done, i'll probably use something a little higher level to be more consistent with the ecosystem
Async or going with the std lib?
stdlib
fairs
trying to not use any deps right now
the only thing i have against the std lib with networking is some hard coded things that have been left out of docs and havent been updated
like SO_REUSEADDR only being enabled on Linux even tho Windows now supports it
sounds like a good pull request lol
and you have no way of manually overriding or controlling it which is a pain
i was planning todo either a issue or pr for the docs but going back to school in 2 days so gotta deal with that
ahh, the good ole' days lol
Really just hoping i can drop maths and go with a Btec course instead
i've been considering going back for a degree, probably CS, because algo shit is dumb and i need to learn it lol
the lockdown period has pretty much nuked my chances of passing lol
yeah, the lockdown period, i thought it wasn't going to affect me as much as it has (considering that I was already 100% remote before the pandemic), but surprisingly, i've seen a decrease in my ability to concentrate
Its a nightmare for school because there is no escape from the work
before you'd go to school get back home and you could relax a bit
but just massive stress now
I've seen python used for websploits
yeah, not that i've not used python, but it's rarely the best tool in my use case
Hey, I'm trying to send a post request to a webhook, but have some errors using this code:
def __init__(self,hook):
self.hook = "https://discordapp.com/api/webhooks/"+hook
self.template = '{"content":"$content"}'
self.type = {'Content-Type':'application/json'}
def Send(self,messages):
count = 0
for message in messages:
count += 1
content = self.template.replace("$content",message)
content = content.encode('utf-8')
result = requests.post(self.hook, data=content, headers=self.type)
print("Encoding is: " + str(result.encoding))
try:
result.raise_for_status()
except requests.exceptions.HTTPError as err:
print(err)
else:
print("Message sent successfully, code {}.".format(result.status_code))
if len(messages) > count : time.sleep(1.5)
2 messages should be sent, but I get an error with the second one:
Encoding is: utf-8
Message sent successfully, code 204.
Encoding is: None
400 Client Error: Bad Request for url: SOME URL
Can't do post requests on webhooks
The initial request must be a Get request that is then upgraded to the ws protocol
Ignore all of the above I can't read on mobiles it seems
Is this a discord webhooks by any chance
Yes
I edited the message above to include the header too
I do have some unicode characters in the messages too
I have ssh script using paramiko, on my mac it run without issue when i try to run on windows its gives socket error.
and i am using multiple commands.
for ipp in ips:
ip = ipp.strip()
print(ip)
port = 22
username = 'admin'
# password='AeGEBUx66m_1ND'
cmd = 'interface wireless set scan-list=5150-5250,5725-5875 number=wlan1-gateway'
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(ip, port, username, timeout=5, password='broot')
ssh.exec_command(cmd)
stdin, stdout, stderr = ssh.exec_command(
'interface wireless scan number=wlan1-gateway background=yes duration=15')
ftoutlines = stdout.readlines()
resp = ''.join(ftoutlines)
str1 = 'Online'
status = 'Done'
ssh.close()
except socket.error:
str1 = str("Offline")
# df.loc[ip] = [ip, str1, "Offline"]
status = 'Offline'
Frequency = 'Offline'
except AuthenticationException:
try:
ssh.connect(ip, port, username, password='bsroot')
ssh.exec_command(cmd)
stdin, stdout, stderr = ssh.exec_command(
'interface wireless scan number=wlan1-gateway background=yes duration=15')
ftoutlines = stdout.readlines()
resp = ''.join(ftoutlines)
# outlines.reverse()
# print(resp)
str1 = 'Online'
status = 'Done'
ssh.close()
Error on windows -
(10054)
@gloomy root I solved the issue. When converting to utf-8, it converted some tabs as the \t character which seems to have been the error
I have ssh script using paramiko, on my mac it run without issue when i try to run on windows its gives socket error.
and i am using multiple commands.
for ipp in ips: ip = ipp.strip() print(ip) port = 22 username = 'admin' # password='AeGEBUx66m_1ND' cmd = 'interface wireless set scan-list=5150-5250,5725-5875 number=wlan1-gateway' ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) try: ssh.connect(ip, port, username, timeout=5, password='broot') ssh.exec_command(cmd) stdin, stdout, stderr = ssh.exec_command( 'interface wireless scan number=wlan1-gateway background=yes duration=15') ftoutlines = stdout.readlines() resp = ''.join(ftoutlines) str1 = 'Online' status = 'Done' ssh.close() except socket.error: str1 = str("Offline") # df.loc[ip] = [ip, str1, "Offline"] status = 'Offline' Frequency = 'Offline' except AuthenticationException: try: ssh.connect(ip, port, username, password='bsroot') ssh.exec_command(cmd) stdin, stdout, stderr = ssh.exec_command( 'interface wireless scan number=wlan1-gateway background=yes duration=15') ftoutlines = stdout.readlines() resp = ''.join(ftoutlines) # outlines.reverse() # print(resp) str1 = 'Online' status = 'Done' ssh.close()
@thorny breachThis is fixed, Thanks
Hello , I've been trying to use kubernetes to manage my containerized applications , but while hosting a service, when I try to port forward , it always errors out saying unable to forward port because pod is not running. Current status=Pending. I've tried looking into github issues regarding the error , and all they suggest is to look into docker logs, but I dont see any errors in the logs too. Can someone give me an insight into this?
@dusk sparrow how/where are you running k8s?
Ok, still didn't answer my question :D
I mean , I dont want u to spend ur time in going through that , but Im kind of stuck with the port forwarding 😅
Ok, still didn't answer my question :D
oh sorry , let me be more precise
I was using k8s on my ubuntu 18.04 virtual machine
Obviously, you went the k8s route, but which way
should I also paste the steps I used ?
Sure
first , I did , kind create cluster
My first guess is that your VM is under resourced and won't run KIND well
ok , so low on RAM u mean?
I assume the VM is because you are on windows?
well actually , I had trouble getting kind run on my local ubuntu 20.04 ,so I switched to vm
Yuck lol
My first guess is that your VM is under resourced and won't run KIND well
well , one of my peers also encountered the same issue on their local machine
Why not just use minikube or microk8s
oh okay
In Ubuntu, use microk8s
how much resource is required for running k8s smoothly without any resource related issues?
Uh, that's a hard question because it depends on your workload
lets say I have 4 very basic applications which have to be accessed with just a simple netcat
is k8s resource intensive?
Ok, it depends what your manifests look like
yah
It doesn't have to be super resource intensive, but it can get that way in a hurry if you don't use limits
okay , I see
But generally speaking, for a testing, single node cluster, I wouldn't try to run anything of note without 8GB of RAM and at least at minimum an i7 (or equivalent)
You can get by with less, but you will be OOMing pods all over the place
8 gb ram is kind of okayish , but i7 is luxury for sure
we plan to deploy kubernetes on a bare metal vm and host applications all year long
do u suggest to have vm scaled to have 8 gb ram and i7 core?
storage as in ?
Pod/container storage
Bare metal kubernetes isn't exactly easy FWIW
yah right
I assume you want to be able to give the pods a place to store data xD
the thing is , we already have creds for a cloud service called Hetzner , so we plan to deploy k8s on the instance so that it can monitor all services without having to use another service like aws to do that
What instance, thought you said it was bare metal
well , I dont think so , we plan to deploy k8s there