hello everyone and welcome to this video
in this video going to be looking at how
to create a reverse shell
with netcat or how to initialize one at
least
all right so you might be a little bit
confused and you might be wondering
what exactly is a reverse shell well a
reverse shell to be quite frank is
probably one of the most
important things that you need to know
how to do as or how to initialize as a
penetration tester
and essentially what it is is connecting
to a remote computer and redirecting the
input and output
of the of the shell on that computer so
that it can be remote
it can be accessed remotely what do i
mean by this let's say
for example as i'll show you in a few
seconds let's say i wanted to access
my kali terminal from my windows command
prompt
how would i go about doing this and this
is where netcat really shows its
brilliance when it comes down to
transferring data between
client and server so in this case or in
this scenario i
want to access the the my kali linux
terminal
or my kali linux system from my windows
operating system and that's where we use
a reverse shell so a reversal is simply
redirecting the input and output
that is going to be yeah that is going
to be sent uh or inputted here and it's
going to redirect it to the windows
command prompt
so that i can then uh remotely access
the
uh the kali terminal all right so to do
this
we need to understand a few things uh
the reverse shell
or the concept of a reversal is very
simple
the uh we have the client and the server
like
always and the outbound connection is
from the client to the server so
essentially
what's going to happen is that the
windows operating system is going to be
the server
and the kali operating system is going
to be the client and you might be a
little bit confused and that's because
we want the outbound connection we want
kali to have an outbound connection
rather than
rather than windows being the client and
kali bin being the
um the server uh for the purpose
of uh of the firewall i'll explain in a
few seconds we want
essentially uh the kali operating system
to connect
to the windows operating system so again
windows will be the server
and cali will be the client so you might
be saying well why is this happening why
are we using an outbound connection
from the target system why are we you
know using an outbound connection well
that's because
when it comes down to firewalls we
cannot have a connection
an inbound connection from an operating
system requesting
you know to connect to an essential
system service like the terminal
it's going to alert the firewall and the
connection will be blocked
as you probably would have guessed so
it's always better to have
the shell going uh outbound and the data
being redirected
to the server and again that does not uh
you know show up or come up as
suspicious traffic because all the
traffic is outbound
all right and that's the beauty of a
reverse shell so what we're going to do
is i'm going to set up the server on
windows
so it's really very simple and before we
actually do that
let me just explain what we'll be using
so i'm just going to open up the help
menu in
the kali os all right so we are going to
be using the e command i'm going to be
using the e command here and i'll
explain what it is
the e command is used to execute the
given command in this case we need to
specify
the terminal all backs as you can see
you have your bin
uh shell or your bin bash i'll be using
the bin
bash uh just to show you uh that it does
indeed work
and uh we'll be looking at that in right
in a second so i'll show you the syntax
so setting up the server is very very
simple i'm just going to open up my
command prompt once more
and i'm going to type in nc and nvlp
we're setting up the server just as you
would
and i'm going to set the port as simply
port one two three
four okay and once i hit enter
uh this is not going to listen for
connections on that as you can see it's
going to tell you that so listening on
any
uh one two three four and it's gonna
this is going to be on
this on the windows local ip
all right so again to find out your
local ip if you are
following my example you can simply type
in ipconfig and look for your
uh your network adapter in my case it is
the ethernet adapter
and my local ip is 192.168.1.102
all right so now that i know that i can
now go to the client side which is kali
and what i want to do now is i want to
now connect to the server but
in this case i want to bind a shell a
reverse shell
but of course this is outbound so there
will be a difference
and in this case this the client is the
one that is going to
be executing uh is going to be executing
the
uh the bash or the shell so
net cat and nv i'm pretty sure you know
that syntax is we're now connecting to
the server so 192.168.1.102
uh and uh we now need to specify the
portport one two three four and we need
to say we are executing
and we specify what we want to execute
in this case we want a terminal
instance or a shell instance on the
windows command prompt so i'm going to
type in bin
bash and i'm going to hit enter and it's
going to connect to
the server right over here and now if we
finally go back to the windows
command prompt you can see that it's
going to connect and it's not going to
give you any more information
but watch this this is the magical bit
if i type in ls
you can see that it displays the data
that is on my kali operating system that
means that we have a terminal session
uh that on our windows command prompt
essentially what's what's happened here
is we have been able to connect remotely
to the kali os and we're able to
operate it from the command prompt so
for example i can run the script data
dot sh and hit enter and you can see
it's going to execute the script that we
had created in the previous videos so
this was sent over netcat
and i can as also display the date the
contents of the data.sh file
so data.sh and i'm going to hit enter
and as you can see it's going to display
the script that we created
in the previous video and you can also
run linux commands right over here so
i can change my directory and if i list
the files in there i'm now in my
uh in my home directory so again i can
go a step back
and go you know into the uh the file
system here and again i can change my
directory into the root directory
list the file same thing and let's go
back to the desktop
and we now have a reverse shell when
we're able to remotely uh
control the kali operating system
through the shell
all right pretty awesome right and yeah
that's pretty much what i wanted to show
you in this video
uh really how to set up a reverse shell
and of course you can do this in both
instances if you wanted the windows
command prompt
on your kali terminal you can do that as
well you simply need to reverse the
process
it's as simple as that alright so that's
going to be it for this video
and i'll be seeing you in the next video