Python Network Programming 10 - Multiple Client ( Socket Programming )

preview_player
Показать описание
In this section we are going to be taking our reverse shell program to the next level. For starters, Previously, we had one server and one client and we connected both of them using a connection object. But what if we wanted to connect to multiple clients? That is, what if we wanted to control more than one computer from our single server?

Right now if you want to have multiple clients you will have to create multiple servers.But that is going to be costly and not every feasible. I'll take the example of hacker again. Lets say the hacker wants to affect hundreds of computers. Will he make hundreds of servers? Obviously no.

-

Another example would be, lets say you are a system administrator and you need to have remote access to all computers in the lab or in workstation. In this case too our current reverse shell program won't work!

So In this video, We will add the functionality of handling all the clients from one single server python file and build the multiple client support system.

-

Before we get into that, let me explain it to out how it's going to work. Every time we accept a connection we get back two outputs. First is a connection object and second is the address list. Using the connection object we can send commands to another computer and the address list contains the information like port and IP address.

So what we are going to do is that we are going to create an empty list or you can call it an array of connection objects and address. And every time we connect to client we are going to append it or add it to that list.

Then we can loop through the list of clients connected to our server and choose the one that we want.

-

So we have write a program that two tasks at once.
1) The first task is to listen and accept connections from other clients and store them in a list
2) The second task is sending commands to an already connected client

But you must be thinking how can we do two tasks from the same program at the same time? This is achieved by a concept known as threading. You can think of threads as a multitasking support system. For example, I am talking to you right now and thinking at the same time. So one of my thread is handling my speaking abilities and the other thread is handling my thinking. In the same way the first thread is going to listen and accept connections from other clients and the second thread is going to handle  connection with an already connected client and send commands

Next Video - Handling Connections

#python
Рекомендации по теме
Комментарии
Автор

I was inspired to finally figure out how sockets work from this. Now I'm making a simple HTTP server using sockets. Fun to close the gap after making web servers for a few years.

dantheman
Автор

DUDE I LOVE YOUR CHANNEL SO MUCH! AND I LEARNED ALOT! KEEP IT UP! SUBBED

tanvorn
Автор

Hey sir your content is pretty much helpfull for me that is trying to engage in this field ... just go on brother big hug from brazil

roberto-vm
Автор

Really neatly explained video! I hope I can figure out how to make a proper client-server application from these tutorials :)

FooBarBash
Автор

awesome series of videos. please come up with more python videos.

umairgillani
Автор

great explanation sir, really learned many things from your videos

circastic
Автор

I wish you could put all the videos together and upload it for us. You really are good at explaining the network concept

leslievanelsie
Автор

list_connections function only shows last client....provide solution for this

soundaryas
Автор

How do you connect 2 different systems?
I have tried by connecting with ip address of my system . It didn't work well .

thamminenipushyamitra
Автор

Awesome videos. I have a couple of questions. When I run the the python scripts, I am able to run basic commands. I am able to make directories, but when I try to del directory the script freezes. Any suggestions? Also, if I am running in the Python 2.7, will I require the use of encode, decode, and end="" does not seem to work. Any suggestions would be awesome.

toddjones
Автор

How CAN i controll every client at the same time

hajime.
Автор

I have a question.
Let's say I have written a web server in python. When there 10 clients make a request to the server, will the server create 10 os threads ?
If not then please explain how python web server handle concurrency .

pratube
Автор

s.connect((host, port))
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond




what should i d

prasthambhmedia
Автор

Indian accent is more sexy then french

mmilerngruppe
Автор

I have one doubt about this video. How can we force the victim to run the client.py code?

beizhou
Автор

Python's GIL prevents multi threading. Fake threads

kx
Автор

this is copied code from buckey robbert

sportssquadofficial
Автор

[youtube] You have been rejected to upload more code

sportssquadofficial