Hello everybody and welcome back.
And let us continue with our meterpreter session.
So in the previous video we were able to deliver the payload to the victim PC, which is my
Windows 10 PC, and we were also able to run that and connect back to our PC.
So right now we have a meterpreter session opened.
Now let us see what we can do with some of the basic commands that we can get from the help command.
Later on we will run some modules, but for now let us see what we have currently.
So just type here help, and let us see what does it offer us.
So, let's start from the beginning.
So here it is. We can background the session.
Now this is also an important command. For example, there are two commands.
One of them will exit you out of the session and you will not be able to connect back, and one of them will
just put the session in the background.
Now if you type here exit, this will exit the meterpreter session and you will not be able to connect
back to the victim PC. But if you just type here background, it will prompt you with your Metasploit command
line, once again, and it will not close the session. As we can see, it will only put it in the background. So
if I just clear the screen and just type here sessions
once again, you will see that we still have the session open. And whenever we want we can just go sessions -i,
and the ID of the session which is 1, and then we enter the Meterpreter once again.
So that is also something that you should know.
Let us see what else does it give us that is useful.
So, for example, let me just see right here. There is the command, terminate the meterpreter session which
is exit. Get the session ID, machine ID,
you can just run that. Migrate, pivot. Now, basically, machine ID, if you just type it right here.
So machine_id is basically nothing really useful to us. But, there is an option for some
reason for that.
This is basically a session.
So we saw how we can run that, run, use.
So these are commands that are not really for the meterpreter itself.
These are basically some of the Metasploit commands.
What we are most interested in are these commands right here.
So as we can see, this is basically the same commands, almost, as in Linux. So we can navigate
through the victim PC with these commands. We can upload files, we can download files, we can copy the
files, we can run other files. We can also, for example, run notepad from our meterpreter shell. Not really
something useful but it is something we can do. We can list the working directory, we can change directory,
we can...
so let's do some of that.
So dir, if you just type dir which is the command for the Windows command prompt in order to
list all of the files in the current directory, we will see the files from my desktop. If I type
in pwd, I am currently in my desktop folder,
since the file that we ran is on my desktop. And if I list all of the files, I will see all of these files
right here. As we can see, these are the same files. Now
the dir command, you can use that one or you can use ls. Now it is the same. One of them is for Windows,
as a Windows command, so dir is used in command prompt in Windows, and ls is used in Linux. The meterpreter
session gives us both options to use. Now, you can change directory, as I show
you. If I type pwd, I am currently in my desktop directory. And if I go one directory back, you will see
that I am not really anymore in the desktop directory.
If I type here dir once again, you will see other files right here.
So, what we want to do is basically cd back to our desktop, pwd, and ls. So, we have these files right
here.
Now if I wanted to I could, for example, download any of these files with the download command.
So let's see if there is anything we can do. Well, there really isn't, but what we can do is make a directory.
So mkdir,
and if I show you the desktop, first of all, you will see that there is no test directory right here.
But if I just type here mkdir test, creating directory test, and if I go right down here, you
will see that now we successfully created a folder called test. And now if we want to we can change
our directory to that folder. pwd, and we can see that we are now in the test directory. So we can also
create folders, download folders, create files, and so on and so on.
If you wanted to you could also cat a file which is useful,
for example, if our victim has some file where it stores some information, or something like that. You can
cat it and read the contents of that file. But let us see what else we can do instead of actually navigating
through the system, since that is what we already know. Or, basically, if you do not know, you can
just read all of these commands. So cd, change directory. Cp and upload, download, which is
a useful command. So upload, upload a file or directory. You will need to specify which file or directory
you want to upload, and download
you will need to specify which directory you want to download.
So let's see what we have right here, which are the networking commands.
So what we want to do is we can actually change, or not change, we can actually check the ipconfig,
netstat.
So basically anything that we ran in our terminal in Linux we can also check in Windows. So let us
see if I just type here
ifconfig, as I showed you before it will give us our IP address. Now both in the meterpreter,
both commands ifconfig and ipconfig will work.
So if I just type here ipconfig it will print out the same output. Basically, it is the same as with the
dir and ls commands.
So the meterpreter shell supports both Linux and Windows terms.
If you just type arp it will print out the arp cache. And if you just type here netstat, for example,
-nr, it will give us the netstat connections and all the processes running. So let me just see
right here...as we can see all of the established connections, which there is a lot of them.
And here is our file.
So this has established connection to us. As we can see right here, our Windows 10 machine connected to
the 192.168.1.4 on Port 4444, which is our Kali Linux machine.
So if you just type here help in order to see some of the other commands. So we checked these ones, we checked
these ones,
we checked these ones, so basically you can check all of the other networking commands as well. As we can see
route, view and modify the routing table, which could be interesting.
Forward, forward the local port to a remote server which you can use in order to create basically a
port forwarding rule on the Windows 10 machine, which basically could allow you to connect more easily
next time. But we will not be needing that at the moment.
What we want to do is basically check out the lower options as well.
So here, as we can see, the shut down, reboot command, which will restart the victim
PC. The shutdown command will shut down the victim PC. Now I will not be running any of those two commands
since if I shut down my Windows 10 PC, I also shut down the recording and my Kali Linux machine, which would
make zero sense.
So, really no point in doing that.
I will show you those commands once we attack the Windows 7 with Eternal Blue, but from now on let us
see some of the other commands. So let's, for example, check out the ps which is the command to list
all the running process, which could be useful. So we can just type here ps and it will give us all the
process currently running in the machine,
so Windows 10 machine. Let me just zoom out a little bit so it gets a better print out, so we can see
our process is right here.
So here it is. Pardon me, not the nvidia container,
this one. So this is the process of our shell.
For example, if our victim notices something fishy, they can actually find out the process and they can
close the process with task managers.
For example, if they just open task manager, and see that they ran a file called shell.exe, they
will most likely try to close it, which really they cannot do
while the process is running. Let me just show you.
If I just lower this and lower the task manager, if I click right here and click on the delete button, you
will see the action can't be completed because the file is open in shell.exe.
Now most of the people that are not interested in technology, and that do not know much about computers, won't
really know how to close this. But those who have a little bit of knowledge can just go to the
task manager and just find the shell.exe,
here it is, right click and then end task. But we will not do it, yet. So
I will show you in the next videos how you can actually, let me just make this larger,
how you can actually create persistence and copy the file itself into a new directory, in order for you
to have full time access to this PC.
So every time it boots up, every time it connects to the Internet, you will get a connection back.
So that is one of the most useful things
that we will also show right here.
But for now on, let us see what else we can run.
So help command, we go right here.
There are a bunch of these other options that you can use if you want to. You can check what they do
such as, for example, clear event log.
Now we need to have administrative privileges for this, which I will also show you how you can get administrative
privileges on any Windows machine.
You can drop token, execute a command, get environment. So also you can, which could be useful,
entry to shell.
So, basically, once you type here shell, it will basically just open up a command prompt for the victim
PC. As we can see, now it is the same as if we were to run the command prompt.
It looks exactly the same.
The output of the command is the same.
Basically, not really much use of this, but if you simply find it easier to use a command prompt than the
meterpreter shell, you can do that as well.
In order to exit the shell you just type here exit.
This will only exit the shell itself.
It will not exit the meterpreter shell, so don't type here exit twice or you will be exiting the meterpreter
shell.
So let's see what else we can do.
There are a bunch of these options for the, let just find it right here.
You can terminate the processes.
You can filter process by name, so basically you can run anything you want.
Now the user interface commands, which are down here,
we will cover in the next video, such as, for example, recording microphone, screenshotting, starting a
keylogger, and these other commands that could be actually very interesting to us.
So I will see you in the part two of this tutorial where we will cover the basic meterpreter commands.
So I hope you enjoyed this video and I hope I see you in the next one.
Bye!