Okay, now that we know how to, uh, create our reverse factor.
Okay, now we have our reverse factor here, and it is time to create another program, which is very
cool and very famous.
A lot of people know what is it or what it is, and that is called Trojan.
Okay.
So now let's go and create a very simple Trojan, okay.
That whenever the victim click on that.
So, uh, that looks like a very normal, uh, file.
And we will be able to execute our code in the background.
So you see, I have, I have these, uh, for example, reverse factor here.
Okay.
I want to create a Trojan to, for For example, that looks like a normal picture.
Whenever they click, it will open a picture, and in background I want to execute reverse backdoor
and I connect using Kali Linux okay.
And listener to that computer.
And I must be able to move inside folders, download and upload data into this system.
So this is the windows system okay.
In here.
Let me show you something.
Right now in this system I installed Xampp.
It is a web server okay.
And in the docs folder here I put a file called picture okay or PC.
This is a normal file right now.
You see this is just an image okay.
And also I must put my reverse factor in here as well.
Uh, for you or for others, uh, they can put them in their color Linux if they have installed the
Xampp or any web server.
If they have, they could upload their file there and then when they open a picture, they must be able
to download the file from a server.
Okay, so for me I put this in this computer to just test this okay.
I don't have the Xampp installed in my Kali Linux.
So because of that I am using this windows uh as a target.
And also I put the evil file right here to download it here okay.
And execute this.
So first we need to have a reverse.
It looks like the reverse factor is deleted okay.
By maybe by firewall or something.
So we need to go to cmd.
Okay Siri desktop and Python project and re.
Okay.
Now if I use dir you see we have a reverse factor.py.
Uh here I want to use I installer and then one file no console hit enter.
That's not really sorry something happened.
And here I need to use or add reverse factor as well.
So this will package the reverse factor okay.
After the reverse factor is completed.
As you see now it is completed.
And here you see that the file is here.
And I want this to copy okay.
That is here.
Let's use Ctrl C or just copy this from here.
I want to put this into Xampp.
Which the docs reverse factor listed here.
Right now it is here.
Okay.
Perfect.
Now in here I created a file called download Execute and Report.
So in here I am going to create this file to looks like a picture.
Whenever they click over this file it must be just a picture okay.
It must show a picture.
And in background we must be able to execute our reverse factor.
And like that okay.
So to start this I need to import some module okay I will start I will start working a little faster.
The first one is going to be requests.
And if you don't have it you need to install this request pip install requests, it will be installed
in your system.
The next one is a subprocess.
And also we need OS and we need another thing that is called temp file.
Perfect.
So here I need to create a method for doing the download stuff.
Okay so download here I need to give the URL as argument.
And in here let's get create a variable.
Name it get response.
And it is equal to.
We have the request okay dot get.
And in here you need to give the URL.
Now that we have this I'm going to create another variable.
I'm going to name this file name.
It is equal to.
If you want to get the file name you need to use URL.
Let's split.
And I'm going to split this with a slash.
And then remove this.
Okay.
This will give me the file name.
And here let's use with open.
Uh.
File name okay.
Uh I want to open this as w b means write as binary okay.
As out file.
So now we have the out file.
Okay.
Out file.
Dot write method will write into this file.
And I'm going to use something called get response that is here.
Okay.
We already have it here by using get method.
And then we're giving the URL to this.
And in here I am going to use content.
So this will download the file for me.
And I don't care about this.
How does it work?
Or something or anything?
Now I do this like this.
I move to the second part, and the second part is to get the temp directory.
So let's create temp directory.
So it is equal to temp file dot get temp dir.
And here we need to use to change the directory to this location.
So we use OS dot Chdir means change directory to temp directory.
Okay.
So the next one is to call this method which is the download method.
And in here we need to give the location of that image and also that evil file.
Okay, uh, that is inside the server.
So here, let me open my server.
Okay.
It is for me.
Xampp control panel.
Okay, let's start Apache and also MySQL.
And then open Chrome here.
To get the URL or the link for the file for evil file that we put it on our server.
So here let's use localhost.
And then reverse factor.
When I use localhost reverse factor it shows picture.
And also this uh reverse factor dot exe Five.
Okay, if I click on this, it will show me this image.
Now I'm going to copy this URL from here.
And then I am going to use it here.
Okay.
So now I have this.
It is the URL or the link that comes here.
And it will download this file.
And after it is downloaded we need to open this.
Okay.
So for doing that we use subprocess dot e p open.
And then we give the name of the file dot jpg which is pick dot jpg.
And.
Also here we need to give that shell is equal to.
True.
The same thing needs to be happened with the zip file.
Okay so I copy this And paste it here.
So just change this file to reverse.
Factor dot x.
And also the same thing with this.
And this the first one will download that image and show the image.
The second one will download and try to execute this one.
But here we are not going to use Popen because we need to call this okay.
So we use call method here.
And after that is finished we need to do two more things here okay.
And that is to remove the image and also to remove that evil file.
So we use OS dot remove.
Uh Peak dot jpg.
And also reverse factor.
A to Z.
So now I am going to save this.
Uh it is in this location okay.
Right here.
Let me.
Come back this dir hit enter download execute and report dot p y.
We have it here.
Okay.
Let's use pi installer.
Uh, one file.
And also we need to use no console.
And we have the download execute and report.
Hit enter.
And after this is complete.
Uh, we need to.
Come to this holy machine and listen from here.
Okay.
Python listener.py.
Right now we are listening from here.
Okay.
And the Trojan is about to be complete.
So right now this is a Trojan.
Okay.
That it looks like an image.
Whenever we double click on this file that will be generated here.
Okay.
Into here exe file.
When we double click on this file we will be able to see this image.
Okay.
And in background we will be able to run this program that is called reverse factor dot exe.
And we will be able to connect from Kali Linux to this machine.
Let's see.
Download execute and report.
It is not yet completed.
Okay.
Now it is completed.
And let me come right in here.
And this top.
Okay.
Now, you see, we have this.
I'm going to double click this.
And wait just a moment.
You see, I only see this image and nothing dangerous.
Anything else?
Okay, so let's come back here.
Right now you see that it has also got connected and got a connection from this.
Okay.
IP also changed.
No problem.
Let's use the I r and you see a lot of image here a lot of files and folders here.
If I come back here enter this dir okay I see a few folders.
If I came back again if I use dir.
You see now we are able to, to okay, to use to city to come back and go inside.
For example, I'm going to go to inside this folder.
So I use city roaming.
Hit enter.
Now if I use city sorry if I use dir.
You see that we have all this Adobe and also we have code.
We have these files and folders.
So now from here I will be able to.
And also you see we have window explorer windows explorer dot exe as that was one of our file.
You know that now I'm able to download this file or I can upload another backdoor or another evil file
to this.
So now it is working and it is a Trojan.
So very simple Trojan.
And thanks for watching and I will see you in the next lecture.