Okay.
In the previous lecture, we refactored the listener.
Now it is time to refactor the backdoor.
Okay.
And I mean by refactoring to create a class and put them into functions or methods.
Okay.
So let's create a class I'm going to name this class backdoor.
And here as you see this part is responsible for uh this.
So here we need to create a constructor.
So let's use init.
And we don't need this part here.
Let's use.
Uh okay.
Later we can use it.
Let me paste this here.
Now hit tab twice.
As you see here we have two argument.
One of them is port.
And also we have the other thing which is uh IP and port.
Okay.
This is the IP.
The other one is port.
So let's provide IP and port.
So perfect.
Now, instead of using this here, I need to just write IP and port.
Okay.
And also this one.
Now it is, uh, part of the class, so I need to hit a tab here.
So it became part of this class.
And also for this we need to create a function because this part is responsible for running the command.
Okay.
System command for receiving and sending command.
So let's create a function.
I'm going to name it run here paste it and hit tab twice.
And as you see some of these are not uh have some error.
Okay.
So that is because self keyboard.
The first thing is here the connection.
While we are using connection we need to add this self keyword here at the beginning because we are
using this self in other function as well.
And also we need to add a self keyword here.
Okay.
And also we have the self here right.
Now we need to add self dot connection there and also self dot execute system command.
And we have self dot connection.
Perfect.
Now it is good.
But still we need to create an instance from this.
Let me collapse this.
Let me before collapsing let me hit some.
Enter here.
Okay I do have enter now.
Okay.
So I'm going to create this object by the name of my backdoor.
So this is my backdoor is equal to.
Backdoor class.
And as you see it is asking for cheating because in constructor we add an IP and also a port.
So the IP is ten 024 because the color Kali Linux IP address is four and the port is going to be four,
four, four.
And now I'm going to go use the run method.
Okay.
Now I'm going to save this okay.
I did save that.
And now let's come back here into Kali machine.
Execute the listener.
Right now it is listening okay.
And let's come back here.
Try to run this program to see what is going to be happening.
So the connection is happened.
Okay, we got a connection.
Now let's execute the Dir command.
You see, it is working.
If I use ipconfig who am I?
And it is working.
Okay so we did not break the program.
Perfect.
Now the code.
It looks more beautiful okay.
In both sides.
Listener.
And also the other part.
So now that it is completed, it is time to go add some more functionality to the back door.
Okay.