Okay, now it is time to build this reverse connection.
So while creating a reverse connection, first we need to open a port on hacker machine and then create
a file, evil file, or any kind of file that try to connect to this hacker computer on that specific
port using its IP address.
So here we are going to use socket module.
And that is here it's a library.
You can come here Docs.python.org slash three libraries dot HTML.
So you will be able to find a lot of information about socket okay.
And you need to come here and take a look a quick look here okay.
And you will be able to go with this section.
If you're not trying to learn more than this course, then if you follow the course that will be okay.
Okay.
That would be okay too.
So let's come here.
Try to open a port.
Okay.
Any kind of port.
So this computer, listen to that specific port and other computer.
The victim will try to connect with us on that.
So here, for opening this port, we are going to use netcat.
So.
And that is very easy.
That program is called n c.
Here we use dash V for more details.
And I'm trying to listen on port.
For example it is going to be 444.
Hit enter.
Right now it is telling that listening on any 444.
That means on from any IPS.
I am listening on this port.
And now if I go back to Windows Machine, which is here, I created a file called reverse backdoor.
Here I try to connect first, try to build my program and then try to connect on that specific specific
port.
So I will be able to do that because on Kali Linux this port is open and listening.
Okay.
And here I installed this, um, this thing which is called VSCode on Windows Machine.
You can install this one or PyCharm or even any text editor that you like.
Okay.
So let's go and try to build that.
So here we need to first import the module that we are going to use okay.
So let's use import socket okay.
So this socket is already comes with Python.
And now we imported this.
It is time to build uh an object from this socket.
So I'm going to name this object connection.
So it is equal to socket dot Art socket.
And here inside these we have socket.
Dot AF in it.
If in it and also we have socket dot
um capital okay is o c k underscore I think it was rain that is here.
Okay.
You may ask where this come from.
Okay I don't know what what all this okay.
Again I'm going to tell you you can write in here and search for that.
You read this documentation okay.
We have this one change in version three.
Uh c that means no not that really.
We had if in it and that was here I don't know.
Let me search for that okay.
We have f underscore.
In it that is here.
Okay.
Appear.
Host and also port is used for if in it.
Address familiar.
Host is string presenting either a host name in internet domain and something like that.
And also you need to provide IP version four something like this.
So for that we are going to use.
This this two here.
Okay.
And the next thing is another function or another method that comes with socket.
We need to use that.
So now I have the object okay.
Connection dot connect is a method that we are going to use in here.
We need to provide two things okay.
One of them is the IP address for victim or for destination.
Sorry.
And also the next one is the port that is open and listening.
So the port which is listening right now is this one.
And the IP address is going to be IP address for Uh, Kali Linux.
Okay, so if I came right in here, you know that, uh, let me before that, let me write the IP.
It is 0 to 4.
I think this is, uh, the Mac, the IP address for Kali Linux machine.
So now I'm going to save this and.
So.
So right now you see still it is listening on this port.
Okay.
Let's come back here and try to run the program okay.
It is going to be Python reverse backdoor hit enter.
Nothing happened at all okay here.
But let's go back to this machine.
You see that uh, connect connection has been, uh, connected.
Okay.
It was for a while.
Okay.
And you see that connect to this computer.
From this computer.
You see, we built a very small connection here.
Okay.
When we didn't send or receive any data, but we were able to build the connection.
Okay.
So this is very important.
First we need to build the connection.
Okay.
Let me come right here.
First we need to have this connection.
And then while we have the connection we will be able to send and receive data on victim.
So now from from windows machine which is our victim.
Okay.
We have this program to send the connection.
So later we will be improving this to have this connection for a while for a lot of time, for the time
that we want.
And for now it's only for some time, for example, for half of a second, okay.
Or even less than that.
But we were able to build the connection.
So let's go and build this connection for a while and try to get data.
So.