Okay, now you know how to add the location into this registry.
Okay.
And I want to show you one more thing.
And that is here into this top Python project.
At least right now you see that this is the evil file.
Okay.
This is the backdoor.
And whenever we don't, we don't have any kind of, uh, any kind of listener from Linux.
And I try to double click here and it is trying to execute, trying to run.
And it gives me this kind of error because there is no one to listen, okay.
No connection could be made.
So we need to handle this, uh, first.
And then we will be able to add other details to our program.
And that is right here.
Okay.
First you know how to handle this because we learned something about try and accept.
So first we need to put them into try arc.
Okay.
And then we use accept.
Okay.
Here we use except except and any kind of error like exception.
Okay.
Then let's call says dot exit.
So now if I save this and now if I go back here and try to execute the program once again, you will
see that.
Right now, if I wait for a while again I'm getting this error.
Maybe let me save this again.
Okay.
We have this dot Exit.
And also we have this layer.
Okay.
We have try and try it will come and try to connect to the program.
If that is not able to to connect then we call this dot exit.
So let's save it once again okay.
That is because this program and the other program this book is different because of that okay.
We need to package this once again.
So okay I will handle that later.
Sorry.
Uh, the next part is uh, to become persistent.
Okay.
What is that means?
That means whenever I, whenever the victim try to restart the computer, we need to have a copy of
our evil file, put them in a safe place so the victim do not suspect.
And the program run Uh, successfully and safely.
So for that, let's come here, create a method or a function.
And I am going to name this function, um.
Become persistent.
Persistent.
Okay.
So here we need to add self keyword.
And right here first we need to give the location of the evil file.
Okay.
And if you want to find a location to put your, uh file there let me go to Python.
Here we have OS.
Okay.
Dot e n v I r o n.
And in here, if I give, uh, app data.
And if I hit enter.
First, we need to import this.
Sorry.
Import OS.
And now when I hit enter, you see that it gives me the AppData location in, uh, right here.
So now I can use this OS environ and then update, uh, to get this location and then put my application
or my evil file right there.
So I will be able to use this here.
Very good.
Now okay.
We have become persistent.
And here let's use, uh, evil file.
Okay.
I'm going to name this, um, it will file location.
Okay.
So this evil file location is going to be equal to OS dot n, uh, environment.
And here I need to add that thing.
What was that?
That was app data.
And also I want to concatenate this or add rename this file.
I want to rename this file okay.
That I am going to have.
And let's name it as something that victim do not suspect.
And that is going to be for example let's name it Windows Explorer.
Okay.
So now we have the location of the evil file.
So when we have that then we need to copy this okay.
How can we uh copy this.
We can copy using something called let me first import that, uh, s h or sh uh, util.
Okay.
By using this, we can, uh, copy a file.
So let's use it.
It is, uh, dot copy file.
We have it here.
And here, because the file is an executable, uh, executable file.
So we need to add that here.
So executable.
That is here.
So since dot executable.
And then the next one is the location.
What is the location.
It is evil.
File location okay.
So now this will copy that.
The next one is to call to use subprocess dot call method.
And in here when we try to use the call method, you know how to how we can use the call method.
We were using the call method in somewhere.
So here we need to add the shell is equal to true.
And right here we need to add the path not not the path the command.
What is the command that is here okay.
So.
Up to here okay.
Now I copied that.
And then here I need to use single quote and paste this here.
So.
Now that I put this right in here, the next part is to give the file location after this.
Okay.
As you see that here we are adding the location of a file.
And also right here.
And also you see that we have a double quote here.
We need to handle that as well.
So how can we handle that.
Very easy okay.
We use double quote here and then use concatenation.
Then add your file location okay.
Let me give some space here.
And after you added this.
In here.
Again concatenate.
A single quote inside single quote.
Add a double quote okay now How this will work, I think perfectly.
And also.
Uh, this will come and execute this again.
But it will copy this in here in every time that the windows start.
But we need to handle that too.
Let's handle that by if condition, let's say if not at or is dot path okay.
If not OS dot path dot exists.
Okay.
We have the command here.
And then let's give the evil file location.
Um, where is that?
Okay.
That is here, let me copy this
Here.
If not, then I want to.
Execute that.
Okay.
And also we need to add white space at the beginning of that.
So now it is completed we need to call this become persistent in some place into this code.
Uh it is better to add that here into this constructor.
So let's do this.
Let's call this method here.
Okay.
Come on.
Okay.
Self dot become persistent.
We don't have any kind of argument or something.
So now let's save this and let's come back here.
Exit this CLS.
Let's go back to this top Python project.
Okay.
So let's again and let's use Pi installer.
Pi in this color.
And then we have reverse factor.
And the next option is one file.
And we have no answer.
Let's hit enter and see.
After this process is completed we will be able to execute the program and see that.
Okay.
Now you see that it is completed.
And let's come back here.
So let's.
Let's come back here and try to execute this and see if we get any kind of error or not.
Okay.
I don't get any kind of error.
And let me come to see.
Okay.
Here I'll also I don't have, uh, the listener.
Okay.
You see that the listener is not listening.
And now.
Okay.
Now, let's come back to this location here.
Let me reload this.
And you see that it is not added.
This dot x is on drive.
Mm.
There could be one problem, okay?
And that is this one that we have.
I named this test.
We have one thing by the name of test.
Let's name this update.
Okay.
And I'm going to save this.
And I have to show you one more thing here into this local drive C user.
And in exploit cheap.
You see the update is hidden by default.
I just right now it's hidden.
No nobody will come and see that here.
And if I open this into roaming you see that Windows Explorer is right here and nobody will suspect
at all.
And.
Uh, let's come to windows back here.
I want to.
Do one more thing here.
No console.
Okay.
I want to repackage this and want to add that into this location.
You see, right now we have one test.
And I want to add another thing by the name of update here.
Okay.
Let's see if there is a if we are able to do that or not.
But it is working okay.
You see that it is copied into the other location.
And it is also.
Going to be added here.
Okay.
There was a problem a very simple and small problem.
And that was here okay.
Whenever I was trying to package this, I used only one slash here for each of them.
Like this.
Okay.
And in windows you need to.
While you're using windows, you need to use two commands.
Okay, two slash because one of them is going to if you use one in here, it's not going to be called
or read as slash is because it is backslash is and it has a meaning here.
You need to use two slash for each of them while you're using windows okay.
And when I use this and I repackage this it solved the problem okay.
And you see that here.
And whenever, whenever I executed this.
And here right now you see that it is added okay into rooming windows Explorer dot exe.
And also if I came back to Windows Explorer dot exe here.
User exploit AppData roaming.
You see that here?
Okay.
So let's do one thing and I'm going to close everything here.
Okay.
Now everything is closed okay.
And I am going to come back here.
Let me rerun this.
And right now.
Let's, uh, reboot this system.
Um, update and restart.
I will not update that.
I'm going to power this off.
Okay?
Now that is off.
Okay, that system is off.
Let's come back here and rerun this program.
And also let me here execute my lesson.
Right now it is waiting for incoming connection.
And I'm waiting for this to start.
Okay.
Let's provide a password.
Now the system is loaded.
Let's go back to Kali Linux.
Okay?
Now you see that we got the connection.
And in windows system, you see, we have done nothing at all.
Okay, now I can use input command like dir.
And you see a lot of files here.
Okay.
Uh, that is a lot.
Okay.
You can read them like, uh, this is the a file.
all digital.
And also we have a lot of things like file and also folder.
Okay.
Like this.
This is a file.
And let's come back here.
Hit enter.
Um.
Okay.
This is all and everything now that we can do with them okay.
Uh.
Okay.
So perfect.
Now you have your back door that is working perfectly.
And also you have, uh, your system that is working.
Okay.
So thanks for watching.
And I will see you later.