Hello everybody and welcome back.
And in the previous editorials we actually added some of the additional functions of Marshall such as
using a screenshot on Target's monitor.
Also uploading normally files downloading files from the Internet using a help command changing directory
and so on.
Now as we can see right here I just want to show you that in the shop options I also added the queue
commands since we didn't specify in the previous video.
So we have the queue command that will actually exit the reverse shell.
So make sure to add it right there so the users once they use for example your program your server know
what they need to specify in order to actually exit the shell.
So right now what we want to do is want to add another big option to our reverse shell which is the
key logger.
But before we actually implement the kill agree no backdoor itself.
Let's see how we can actually code one in a simple program using a library that in a python actually
has now that library is not installed in the clinics.
So we need to install it.
I already did but I will show you what you need to do.
So let us exit is what you need to do is type your pip install by input.
Now this will actually download it for you as you can see right here for me it says require a requirement
already satisfied by input library.
So I will just open my Python to interpreter so python and in order for us to actually import what we
need we just need to type your import by input not keyboard.
While we're using defined that keyboard Well basically because we want to make a key logger which would
capture all the keystrokes from the target machine.
So we use the dot keyboard available option or function in the PI input library.
Now we can write a simple but not really useful key logger in just a few functions so let me just show
you how we can do that in order for us to actually make that key logger let the sexually open a new
file we will use the same directory as this one.
So we don't actually make a multiple directories for this.
So let us nano key logger one dot pi since this is our prototype.
We will add our standard path path.
So user in Python and then we will import Python or by input not keyboard.
See that's the that we will use now.
Right here let the sexually set up a listener for our keyboard keystrokes so in order to do that you
need to specify this function so keyboard and then after that dot listener which will listen or basically
it will capture the keystrokes and it will process them in a certain function.
So we just type your on underscore press equals and then you need to specify the name of the function
that we will use.
So we will use process underscore keys you can name this function anything you want.
We didn't even code it yet.
It would be a simple function for these first Coryell or key logger.
But let us just for now on code the rest of this.
So the next thing we need to code is with keyboard underscore listener.
And then two dots then make sure to tap the next thing that could will use.
Which will we not join.
Now this.
Let me just type here so keyboard underscore listener not join.
And then two brackets this will basically perform a listening on our keyboard and now all we have to
do is call the function that will actually do something with those recorded keystrokes.
What we want to do in a key logger for known is just print those letters.
So let's actually code our function that we specify right here which is the process keys so make sure
to call it the same process keys and in that function what we want to actually input is the key itself.
So what this will do the listener will call that function and it will pass all the keys that were input
into that function and what we want to do with those keys is just print them print key.
So basically when someone types in this will listen for the incoming input on the keyboard then it will
send the key back to this function.
And what this function will do is it'll printed the key itself.
So let's see how this simple thing will work from now on.
So let us actually control all this.
LSC rage mode.
Class X on the key logger let the section run the key logger.
Keyboard listener not is not defined
Oh.
Make sure to actually call this the keyboard listener as well so keyboard underscore listener.
That's because I specify here listener and here use keyboard listener.
So in order for this to work you need to specify the same name for all of this.
Since this is the class that we used and actually deliver to the keyboard listener we use to listening
weekly by input library and right now all we want to do is control or save and then we want to actually
run this so key logger that wandered by and you can see if you just press your enter.
Nothing will really happen it will just run but if you start typing in your keyboard some random letters
you will see it will start printing them out.
What this means basically is that it actually records our keystrokes and just prints them at the same
time at the screen so you can see a SD.
Everything here is printed.
Now this you write here stands for unicode.
You will have to remove that as well and you can see right here if I just press here some some buttons
on my keyboard that are not letters you can see key tab key enter key space key backspace and so on.
So we will need to actually change this a little bit but for now on this is just the simple kg.
Let us see what we can actually do with it.
So just change it just a little bit so that so and our key logger one block by we have the process function.
This part right here we will not even change at all since this is the standard path that we need to
use in order to actually listen for keystrokes.
What we want to change is the process.
Case function so instead of actually printing the key let us not printed right here let us actually
write the key to the file.
Since if you for example think about it if you actually just use this function on our backdoor we do
not have anything basically for printing would not have any use of the reverse shell printing the keys
at the screen.
We want to write those keys into a function or into our file and then we can read from the file or send
the contents of the file to the server which can actually read the keystrokes.
Then of course after that we would need to delete the file itself.
So right now let us open a simple file so with the regular command with open and what we want to do
right here is called the file anything we want.
So let's call it.
He's the 60 or it's just quite a logger so we know what it is.
So kilogram up to 60 and we want to actually use right here not BW or not the.
We want to use.
We want to use a option which stands for append because if we use right option it will just rewrite
every every keystrokes before the current one.
So we want to actually add the key strong spot to another so we can actually get a full sentence in
that file or basically whatever the target has typed in their keyboard.
So let us call this as for example.
And then we want to write the keys to that file so we can see this function process.
We can get the key to we send the key to that function.
And right now we want to write the string of this key to that function.
Now let me just show you so thin dot right.
And we want to write the string of this key so let us say this and let's see how this follow if we just
go right here and we run our key logger wandered by.
You can see now even if I type it pages type here Hello World and presenter nothing will actually be
printed out as in the previous example of key logger as it has in the first example Kellogg or so let
us call this right now.
But if I just type your address here you can see we get a file called key logger not the extreme.
So let us get that file to see what is in that file so key logger dot DST and you can see here we have
hello world.
Now it is a little bit ugly since it has this new option right here on a before every letter.
So we will make sure to remove that in the next video from now on we actually saw how we can print out
the keystrokes into a file which is very useful for us.
So what would we want what we actually want to do at the end is actually have a file that will be a
hidden file and by hidden I mean it will also be for example in the AP data environment while we use
it we want to capture the keystrokes in that file of the target and then we want to send the keystrokes
back to our server and then at the end of the using the reverse shall we want to delete that file.
So basically months on specifies the queue option in our backdoor.
It would lead the file out of that directory.
So that would be about it for these introductory tutorial for the kilogram.
This will be a much simpler program than our backdoor so don't forget this will not be that long.
I hope this tutorial and I hope I see you in the next video by.