Hello everybody and welcome back.
And right now let us see how we can implement our key logger in our back door.
Now in order for us to do that we need to actually specify the key logger in one function so we don't
actually code too much in our back door.
So what we want to do is actually code in our key logger program a function that will call all other
functions.
So if I open my KG pi let me just remove the kg at the 60 and then key logger the pie right here.
We can see that this part right here which is with Kid Baldesarra actually calls the report function
and then the It also calls the keyboard listener at the joint function with actual reasons for our keys
right here.
We also have the en processed keys right here.
So what we want to do is actually make a function that will perform this code right here.
And once we make that function what we will do is basically just call that function from our backdoor
once we import our key logger in our backdoor so just type here for example def and then let's call
it start which is why.
Which is the function that will actually start.
Our key logger in our backdoor so we don't specify anything in that function we just place this code
right here in that function.
Now in our case right now we do not want to call this function anywhere in the key logger code since
we will not run this program will just import this program as a library into our backdoor.
And then we will use available functions from this program in our backdoor.
What we will specify is the program name.
And then dot start.
And this will perform this code right here which will perform these two functions.
So let us see what else we need to change right here in order for this to actually work.
So
we have the file right here so let me just specify it right here.
Now the next thing we want to do is actually hide this key logger that the axes since if we run our
backdoor on desktop.
This key logger that the 60 folder or file will actually be saved somewhere on our desktop.
So what we want to do is actually open this key logger in a different path.
So path can the path will actually be a variable that we specify right here.
So we can use the global path or we can actually code it right here it doesn't even matter.
Path equals.
And then in order to specify the path to the DPP data the same as in our backdoor we need to you import
os right here in order to find the actual the actual ERP data environment.
So what we need to do is use the function called always environments or path will be always thought
environ AP data which is the same that we use in our backdoor which would basically save our key logger
that the extra at the same folder.
And we need the name in order to name it and let's call it key logger not the AKC we'd specify this
in between these double quotes.
So this will be our path.
That is where we will save our key logger.
And all we need to do right here is use our global path variables so global path and specify it right
here.
This will open that path every time for the appending and then from our backdoor we can actually open
that path as well and read from that follow Senate contest back to us.
So I believe this should be it right now for our key logger.
Now before I do anything let me just specify this to me for example 10 seconds you can put this here
any number you want.
Basically this is just seconds at where at which point it will write the the contents of the pile for
us so let us actually see how this will work in our backdoor so control or to save.
And right now we need to make sure first of all that our key logger the PVI program is insane directories
everywhere shall not be wide.
Since we will not be able to import it if it is not right now if I just go here now reverse shoulder
why I will go right here and import my key logger.
Now I also need to import threading since I will be running our key logger on a separate thread so we
can actually continue to run our program while our key logger is actually running.
So what I want to do right now is basically go to my ls if statement and let's say the command we use
the same command or not same overly or something different so let us go first of all whoever else if
statement let's go all the way down after the check for the administrator privileges that is code another
all safe.
So else if command and then for example first twelve letters equal to key log start if our user types
this.
Basically what this will do is it will actually let us see what this will do.
So it will
start our key logger.
So in order for us to do that let us just type here the one which was set for thread 1 and what we want
to do is actually specify the function that we want to use and the function that we want to use is basically
our key logger dot start function.
So T1 equals threading not threat.
This is the syntax for using a thread on a separate function and invariant specify the target and the
target is basically the function that you want to run as a separate thread and our function will be
a key logger that start I believe that is how we named it.
So all we have to do right now is actually start that function or part of start of the thread.
Right now we actually started a separate thread which will actually open and we call the keystrokes
and target P.C. so we imported the threading we ported the key logger
and everything should be good to go right now I believe all we have to do is also code the server side
of the code.
So let me just check once again we start our queue logger.
Let me save this and then the key logger so I can see if everything is well then the key logger will
go to the start function right here it will go to the report it will open a file at that path it will
open this file right here which we need to code and specify in our reverse shell as well so we can actually
delete it once because the reverse shell and that is basically it I believe.
So let us actually go right here back to our reverse shell and once the user specifies for example
let me just find it specifies Q Before we actually break for Lee out the program we need to type here.
Try deleting so all that remove
the path which was specified right here so path will equal this.
Let me just find this part right here.
Location key logger path score path equals or basically just equals this so paste this path right here.
Then we want to delete this key logger path will be this part right here.
Then we want to actually delete that part in our key logger after we specify the Q options so delete
key logger path
and that's about it.
Except not really sure if you could continue with work.
It should work.
So accept continue and then break out of the program.
So it will try to remove this key logger path or basic level key logger about the Steve from the roaming
folder.
Now if it can delete that path that means that we didn't even start our key logger with our reverse
shell so it will just continue and break out of the loop and basically closed the program.
So all we have to do right now is code another elusive statement which will basically.
With this we only started the key logger and now let's see what we actually have to do in order to get.
Basically in order to read what the key logger has said so we will use something as similar as in the
methods points or key logger dump which has eleven letters I believe equals equals to keep a log the
score dump that we just count one two three six seven eight nine ten eleven So if this if the command
equals two key log dump what we want to do is open basically so fin equals open
all let's call it just have fun.
So event equals open the key logger path.
So we want to open that for reading then basically we want to reliable send underscore send the offender
out read which will send the contents of our of our keystrokes that persuaded two key logger that the
file.
So this might actually work or it might have a bunch of the errors.
I'm not really sure so we will have to check that out what we did.
Code is to remove the key logger so we will first of all see if everything goes well.
So all we have to do right now is actually code the same path read here or same comments right here
in our in our server side of the code.
So let us say this and then onto the server.
The P Y right here.
And let's see what actually has to happen once we type here.
Key log stop start.
And once we type your key log that or underscore dump.
If I just go right here we will code something like Same like this.
So for the clock start since we don't receive anything for the kill OK stop comment let us code the
same the same thing so else if command and first four letters equal to key log on the score start all
we want to do is continue with the program so we don't get actually bugged out at this right here.
So we will try to receive and with the key logs start option we don't receive anything from ours.
Reverse show.
So it will actually crash our program.
So we want to quote a statement right here which if we specify a key log start it will continue and
it will go back to this shell right here where we can input our next command.
And for the key logger else if command first eleven equals equals key log on the score dump groups that
we just closed this.
We want to reliable or actually we do not even need this part right here since we will actually do it
with this command which is for any other statement right here.
So we do not need to know to code anything for the key log dump let us delete this we don't need it.
So this should be good I believe.
Let us try to compile our reverse shall not let us first double check it once again.
So let we just zoom out since it is easier to navigate through code.
Once the code is in lesser format so let me just see.
We delete the path which is good if it doesn't exist.
We continue with this and then we break out of the program then what we want to do is actually let me
find where the key lock start is.
So here it is.
We start the thread for our key logger that start and we read the contents from that file for key logger
that the underscore dump so let's see if this will work.
So let us just actually compile this with the wine or root wine grape seed Python simpleminded before
scripts by installer.
So let's just use here for example just the reverse shell and then one file.
We do not need the image for now on we will do a full test of our back door later on console.
Now let's see if this will compile well enough.
So what this should do.
Is once you specify the key lock start we don't get anything received back but we should have the key
logger in our AP data roaming folder and everything we type there it should be printed out in the key
logger data folder so we will see how that will work for now let me just plug in my view as we drive
let us go to the device's import our year be dry right here then I want to go to this right here more
my reverse shout to the media route and then carry alive
then once it finishes I can actually unplug my USP drive and run our shell.
Now I'm not really sure why does it take so long to copy the file
it we import it.
So we did imported places computer Calvert live so it can load the cattle alive for some reason now
on let's wait for a few seconds for this.
Maybe it will work out if it doesn't we'll have to compile it once again.
So let me just check this out.
Why doesn't it work.
So we can't even close these programs so let me just close it like this.
Let's see if I go to media
right here.
Zoom in this a little bit.
Will remove this reverse shell so I will go to the root python programs reverse and novel compile my
program once again.
But I need to delete this build delete the reverse shells pack letters from the same format for compiling
our reverse shell.
Now let us try to copy it.
Once again power Kelly will be drive not pretty sure why it doesn't work.
So it completed successfully.
We go to this where our reversal is and we move the reversal to media route Ruth Kelly life OK so it
corporate IT GOOD RIGHT NOW LET US unplug the U.S. B drive so we can use it on our windows that machine.
All I want to do right now is run my server cannot assign requested IP address.
This could be a problem or a problem.
So we might actually need to compile it once again since our IP address is not not no longer the dot
one of nine as in the previous video.
It is actually not one but seven.
So make sure to check that before you actually compile the program your IP address if it is not static
could have changed.
So what we need to do right now is do the same is in the reverse shell as well.
So let me just delete all of these files from the previous compilation so let me just nano remote shell
and change my IP address once again now sorry about this.
Since we compile it three times I thought I had the same IP address but I apparently didn't have it.
So I will need to compile it once again plug in my USP drive.
And right now everything should be good to go and we should be able to run the program finally or we
will get another error and we will need two things to fix something else.
But that is the part of the coding that is why this is actually the advance section since we actually
code ourselves and not use tools from other people.
So let us move the reverse shell to media.
Ruth Kelly live it.
Copy the program.
We clear this from the server.
Listening for income in connection so we specify the good IP address which is our IP address.
And right now all we want to do is run the reverse shell that you see we get failed to execute reverse
shell.
So not really sure.
Why do we get that.
That means something is wrong with our reverse shell in our code.
So let us see where is our mistake.
So this part right here.
I can just find it.
This part right here where we continue should be actually good key logger part path.
So everything should be good to go.
Key logger path equals is environ a BP data plus key logger that extend this path right here should
also be good.
So let me just find what else we coded which doesn't really work.
Now it could be this path right here that we need to specify something differently.
So let's see what we actually need to specify.
So let me just go right here.
Sometimes the order of the libraries could be a problem.
So let me just try to put to import threading first and then import the keel over.
Now this might not have anything to do with us but it is always a good thing to try we tried to connect
to the good IP address.
OK then we specify everything right here.
Key logger start the one threading the thread.
Then we use the function key logger about start.
So let this code a simple program that will actually
import key logger
so key error a BP data.
So why is this a key error path equals or is environ plus key logger that the XY
so we need to run this in vendor's system so let me just see right here we imported the OS we import
the threading
we use the key logger but start to use this function right here.
So everything should be good to go.
So let's do something like this.
We will just test out the key logger for a second.
So now no test that P why we use user in Python we import or a key logger can import threading.
Import os import py input and what we want to do right now is actually only run this so key logger that
start
let us see if I compile this.
So let me first remove this right here.
If I compile the program which is testable by so let me just find the same recommended before for the
compilation and I will compile instead of diverse show I will compile test of pipe which will actually
perform a test just on our key logger and we will see if it actually is something that is wrong with
the key logger itself or is it something that's wrong with the backdoor.
Now this is how you can check if your program is working.
So as you go right here.
We go to the test remove test to be acceding to media road kill alive.
We unplug the U.S. a drone.
Let us now run the test to see
so actually something is wrong with the key logger itself.
So let us see what is actually wrong.
So nano tester by perhaps nanoscale logger that by so let's see what we need to import in order for
this to actually work.
So what I will have to do is actually check out this error in the by myself and then so we don't waste
time I will tell you what the error was in the next video.
So hope you enjoyed this and I hope I see you in the next one where we will actually see what is wrong
with our program.
But.