Hello everybody and welcome back.
And in the previous video we saw that we successfully created a simple python server that was able to
actually receive and accept the connection from our different terminal.
We were able to net cat on our local host on the specified port in the program and it actually printed
out that the target was connected.
So what we want to do right now is actually do something like this.
So let us see this.
So how guess it pops.
I didn't not want to.
I wanted to open till X so let's open till X so we can split screen like this and run two programs Yeah
I can post a terminal once I run 10x so let me just open it once again I can lower this and large this
and put it like this.
Well let me just see
let me just see if I can change a color since the you are white one is actually a little bit too bright
but it seems that we can.
So we will actually close this oil just run two terminals instead.
So let us enlarge this like this and let's use another terminal.
So in your window we want to enlarge this one as well.
So zoom in so many and let us get right to work.
So this one as well a little bit.
OK.
So right here I will open up our silver loops.
Let me just find out where it is.
So see the python program.
See the reverse eclipse reverse nano server.
Don't be white.
Here we have our server.
And here we have the another terminal.
We will code our client or our reverse shell.
So we need to open up our server so we can see the different functions in the correspondent function.
We will write in our client for these functions in server.
So let this actually go through these same directories so reverse.
Here we have the server.
And right now we want to make the reverse P Y or we can call it the reverse shall be white.
So we start off with the same hashtag exclamation mark an end user in Python.
So this is something that you always need to include.
And we also have to import Sorkin as well right here.
So this is the standard beginning part right now what we want to do is we actually want to connect to
our server that be white.
Let's see how we can do that.
So with this picture right here we can see that in the previous video we coded some of these functions.
We still didn't get the send receive function but we will code that one as well.
So for now on what we want to do is actually create the client.
So what we have to specify is the same as in the server so we have to create a socket and then all we
have to do is perform a connect function in order for our client to connect to our server.
So this is a rather shorter example of code than in the previous video.
So it will be rather simple we can write it in two or three lines.
So let us do that.
What we want to specify right now is the same as here.
So we want to specify the socket in my case let's call it right here SOC so we can actually differentiated.
So we don't call it in both programs s but it doesn't really matter.
I would call it SOC right here.
So OK.
Equals socket dot socket socket dot f underscore on it and then comma socket dot socket stream.
As you said in the previous video this just basically usage for IP before address and also the DCP connection
for our server.
Right now all we have to do is reform the Connect function to our server.
So let us do that with the function SOC not connect and win the Connect function we have to specify
where we want to connect right now as we can see that we bind in the port 120 bind the IP before address
of local host port.
Five four three two one we will have to specify the same IP before I address and same local port in
order to connect to our program or to our server.
So let us go that's open double parentheses same as in the bind command in our server and here specify
same thing.
So 127 of 0 0 1 close the double quotes comma and then five four three two one then close the double
parentheses as we can see right here the local port is not a string and the IP before address is put
in double quotes so make sure to not switch those up otherwise it won't work.
And what we want to do right then we want to actually print that we successfully connect it so print
connection established to server.
This is just for us.
So we know that everything went good.
And after that we want to close the socket so soccer up close and we want to close the connection.
So this is how this should go.
Basically we're on the server first.
It starts listening for incoming connections.
It prints out this line right here and then we run the reverse Sheldon P Y which will perform our connect
function on our server.
And basically what it will do after that.
This target or D server will actually print Target connected and the reverse Shell will print connection
establish the server and both will close the connection.
So that is how it should go.
So let us say this.
So control over to save enter.
Control X plugs it let's make it an executable CCH note plus X reverse the underscore shall be y and
let's run the server first.
So we run it with server P why we get the string listening for income and connections.
And here we run the reverse shall that be like as we can see everything went perfect listening for incoming
connections then we ran the remote shell connection established to the server target connected and we
close the connection on both programs.
So this simple two programs work.
Now what we want to do in the next video is actually establish a longer connection where we can actually
send some stuff to the other target.
So we will see how we can actually do that in the next video.
So now we successfully created a simple reverse shell and the simple server that only performs the connection
function and that will be about it for this video or pursuing the next one.
And take care by.