Hi and welcome back to section 1 net get
introduction.
In this video, we will explore base cooperations
with netcat in some different situations.
Netcat is a network program designing to
read and write data across connections and following
this principle. We can enumerate scenarios in
that netcat is able to be used
like simple short interface Parts scanning
transferring the files.
burner grabbing
redirecting ports and traffic
for a simple shot interface that can be
used on the same computer or on
different computers.
For pot scanning netcat is not the best optional
way before this operation.
For example netmap is the best tool for
this Mission, but netcat can be used for basic
Port scanning.
For transferring files. Netcat has the ability
to both pool and push files.
in binary grabbing
is a enumeration technique which is designed to
determine the brain version operating system
or other relevant information about
a particular service or application.
Redirecting ports and traffic is very useful. If
you want to obscure the source of an attack.
The idea here is to run netcat through a
middleman so that the attack appears to
be coming from the middleman and not the
original Source these reduction of traffic
is called a relay.
In a simple shock interface. We will
simulate a simple shot communication from one
side. We will run netcat in several
mode when I open door 1 2 3
4 5
And on the other side, we will run
a netcat instance to connect minister.
After the conditions done. Both Siders are
able to exchange text as a shot
server.
So in a server we will run Isis mean netcat.
So in this example unit cakes netcat is
running.
in the Mina L option
for listen
using a p option for
open or specific door.
So in this instance here netcat is able and
running in a server mode.
And it is extends here. We will start netget as
a client.
So the connection is done. So now we
have a link between these two these two
instance of that cat. So for example
in one side you say
and can see the text are exchanging from
one side to another.
So the connection is done.
And remembering that all connections using netcat
are unacrypted and we so
you will see in the future in the next session another to
call cryptkat that incorporate
and keep it toners and makes the
connection more safe.
import scanning some options used
for this operation are
-w or networking activity timeout Dash
Z or get the
status board - I or set
a delay interval between Port scanning and that's
n or prevents DNS lookup
choose a cute apart scanning. We will get help from service that
are running in our Linux environment. A service
is an application that runs in the background waiting
for someone or something to use
it.
And Linux in Microsoft Windows has a lot of services press
started.
Come for example SSH or in Apache
2 web server in our
example here. We're going to use the Apache HTTP
server.
First we will get its status.
So we are starting check the
status of the apesh HTTP server.
So we get this this comment.
And this moment the service is not
running.
So we will start.
And check
his status again.
Okay, now the status of active that's
mean that the server is running.
and in the another
Terminal here. We will start a pot
scanning. So you start a net get
in a client mode to try to connect
or try to verify if the if
a specific Port is running or
is is open actually.
So let's
next let's see is
so new in this in this terminal here.
restart our netcat We Run The netcat
In localhost, that's mean the same machine
that we are working here and in a specific
Port 80.
in the result of netcat was the
this port is open, which is open.
We can use.
Another combination of options are
available in available in netcat to make
a port scanning.
And using a range of ports.
So this is an example here. We are using our double v
option. That's mean that we we're going more
details about any step that netcat is
is operating.
We are using a dash. I
let's mean that we are setting a delay
interval between the scanning for each port.
And we are using to option Z
- Z for the status for
a for each door.
And for our range we are using we are
going
the beginning is to
the minimum value of the port
the like the minimal index and the
the final Port the
high option is the
the high part that's mean
that they our range our range of ports. You
start going for the the downpours and
going to the airport.
So the operation here is the dead cat
will run this range and we
will review return our
result for each port.
in the in the the range so
Now we can see that some ports are refused. That means
that it's open. There are closed and some
parts are open. So the server here is
open.
If we will try another thing is to stop the
service and run again, the the parts
scanning.
So you use this service here?
Okay, so that's mean that the service of up Apache to
is stop.
They status prove the the common stop.
So the service is not available anymore.
and
we'll check again if the door the open the
door is open.
So the door is refusing.
Let's mean the netcat is able to verify a specific
port or a port range.
to check the head surface
For transferring file sample, we will start by creating
a cutting her face to produce a file.
And use it in this example like before
let's start a shot interface, but
now we need a little difference. We we will
log all the text Exchange in a log file
when the command
so
this we are creating Isis of netcat
in a seven mode, but deliver difference is
that we are passing the option.
Dash oh
and we will specify a name of a file
to reach to log all the the text
Exchange.
in this communication
and for our example here, we will use a
damp got X fire.
Okay.
And now the server is ready to to connect
with any to any server
in the side in the client mode.
In the client side, we start a
sense of netcat and connecting. I mean
this server.
in a port 1 2 3 4 5
Okay. So now we have the the connection and let's
start to exchange some text.
Okay, so we finished the connection.
The file it's here. The
file is is created.
And let's let take a look of the
content of this file using the option kit
to get the information. So the
information here.
We have in the left side. We have extra decimal
for every character Exchange in
the in the communication.
So in the left, we have the the X information
xlax information in the in the right.
We have the text information. So we log
all the conversation here.
Okay, so now let's run
again. Netcat.
And we will pass.
this file
to this from the server to the client. So let's
start.
Sorry mode not get so.
So the difference here is that we are passing.
The file to the connection the
common here means that we
are creating server mode. Let
net get and now we are passing the
file.
To the client who who connects
the server we receive this file
as as a result.
And in the client mode, we are creating an
instance of Netcare in
this common here.
Okay, so we are using the W number two,
that's me that we are setting a timeout for the
communication.
and as a result of this
of this call a communication of
Disconnect, we are creating a new file so
we have to specify
the name of this new file
like this, so this comment means
that
the connection when when the connection is done.
The the content the object
the content that that we are receiving way that
we are receiving we will put in this
new fire here.
Okay, so let me start the server this
and let me
start the client.
So the connection is done. It's okay.
Let me interrupt the
the connection and let me list the files
so we have the copy.
X file here. So let take a
look of his content.
with a common cat
and the content is the same. So that's mean that the file
was transferred from one point to
another Point another another.
Another check that we can see that you
can use for to verify if the file
is the the original file.
We can use a command line.
Md5 sun to check the hash of the file.
This means these two will compute compute and
check the md5 hash file. This is
a 128 beat Jackson and we
use it to verify the Integrity of
the file.
So in this property here, we are
using the command md5 Sun.
and the name of the file dump
what act so we have the in the
left the hash the hash information?
And in the right the name of the
file.
And we will do the same for the new the new fire that we
we created.
md5 Sun
copy X and we can check the the hash of
the both side files are
the same. So that means that the is the
same file the Integrity is okay
and our example here for the
exchange of the file.
It's okay.
Bonnie grabbing it's enumeration technique, which
is designed to determine the brain version
operating system or other
relevant information about a particular
service or application.
The idea here is to look if there is any vulnerability
associated with a particular version
of some Services system or component.
In our example, we are running netcat on
client mode and we are looking for a SSH
service running in the
port 22.
In this example, it's possible to check the ip+port
when kind of services running
in this Sport and
which version of this service?
So let's start.
In check if the S is
SSH service is running or
not.
So we are using the common.
so
Service SSH status to
get the information if there is
the service is always running or not.
So the service for the SSH is
not running.
So it's okay. So let's start this service.
when the common
start
and check again if this service is running now
or not.
Great. So the service is running and this
okay for continuity test.
So let's start the sh SSH.
So we are starting the subsid the protocol here.
It's okay. The the program is it's
running.
And let in the other in India
and other terminal let's check.
The situation of these of this port so
let's start a netcat in the
client mode.
So now we can check that the port 22
is open and which service
is associated with this services.
Is SSH?
And we can verify which version
of open SSH is running.
So all this is all this information is very interesting interesting
to get into aim
to search if there is any vulnerability.
Associated with this combination of board the
services and the
the version of service that
is running.
redirecting ports and traffic
using netcat for redirect reports and
traffic is an option available to simulate and
attack call it a middleman attack
when they attack appears to
be coming from one node.
But the original node is another one.
Multiple had directs can be done.
One popular name for this kind of redirection of traffic
is called a relay.
So in this example here we are using three different
terminals.
And we are using a Linux environment and Microsoft
Windows environment.
And we are using three different kind of terminal. So
we call it Terminal 3 here Terminal 2
here and Terminal 1 here.
So
in the terminal 3
We are simulating a connection. So
let's start server mode
here and that get several mode.
using the option
So in the terminal 3 we are using we
are running access of that cat in server
mode.
And we will listen the part 5.
4321
in Terminal 2
We will again running
a netcat in
the server mode.
but when a little different
here
so at this moment, I'm running not getting
sense in server mode and listen for
listen to another Port one, two, three,
four five.
Okay.
and the result of this connection
I will use the pipe operator here.
That's mean that there is the result of
this connection will be I put
to another command and this common is a
is a common is a netcat running
in a client mode connecting to
the terminal 3.
Okay, so the Terminal 2.
I have I I run a netcat in
a server mode and the input of
this connection will be the result of
this connection will be I put to another instance
of netcat, but when
a connection to a terminal 3
Okay, and in the terminal 1 here?
So I'm I'm running as I said,
I'm running a Linux environment and our Windows environment.
They are in the same. They are different machines, but
they are in the same network.
In the terminal one here will be
my my first
my start point of
command.
For this and links between
notes between netcat instance. So
will be
a netcat
now is a kind of fresh off netcat. So I will use
the IP of these machine here
running Linux.
So we'll be.
Like this, this is my IP for the
machine running my Linux environment
here.
And now I'll use a port this
port you want to for five. So that's mean
that the the net get here is the
distance running in my Microsoft Windows here.
We'll connect.
this netcat here in Terminal 2
in the Linux environment
in the port
so that's mean that now I have a connection from Terminal
1 to Terminal 2 and a
redirecting to another
terminal Terminal 3 in another instance
of netcat here
so at this moment if I type type a
messenger from this terminal here like
In Terminal 1 the terminal 3. We
receive this command that means
that the term the the information here.
in the terminal 1
press through the terminal 2 and
arrived the terminal 3. So these are
example of Resurrection head
directing port and Resurrection traffic.
in this video
we saw different operations with netcat
and we did some combinations to understand more
about the possibilities that we can do with this
fantastic to
In the next session, we will take a look at the basic
Network fundamentals. That is so important
for cyber security and penetration testing.