WEBVTT

00:00:00.000 --> 00:00:04.840 align:middle line:90%


00:00:04.840 --> 00:00:08.228 align:middle line:90%
[MUSIC PLAYING]

00:00:08.228 --> 00:00:10.170 align:middle line:90%


00:00:10.170 --> 00:00:12.102 align:middle line:90%
Host Discovery with Nmap.

00:00:12.102 --> 00:00:14.310 align:middle line:84%
In this video, we're going
to be taking a look at how

00:00:14.310 --> 00:00:17.430 align:middle line:84%
to discover systems
or hosts on a network

00:00:17.430 --> 00:00:18.870 align:middle line:90%
that you are connected to.

00:00:18.870 --> 00:00:22.200 align:middle line:84%
So again, we're now going to
assume that you're performing

00:00:22.200 --> 00:00:24.060 align:middle line:84%
a pen test on an
internal network,

00:00:24.060 --> 00:00:28.410 align:middle line:84%
and your first order of business
is to discover all the devices

00:00:28.410 --> 00:00:29.400 align:middle line:90%
on that network.

00:00:29.400 --> 00:00:30.460 align:middle line:90%
How can this be done?

00:00:30.460 --> 00:00:32.575 align:middle line:84%
This can be done
through the use of Nmap.

00:00:32.575 --> 00:00:34.950 align:middle line:84%
More specifically, we're going
to be taking a look at how

00:00:34.950 --> 00:00:39.240 align:middle line:84%
to perform a ping sweep
or a ping scan with Nmap

00:00:39.240 --> 00:00:43.050 align:middle line:84%
in order to discover the active
or the hosts that are currently

00:00:43.050 --> 00:00:46.680 align:middle line:84%
on the target network that
you're currently connected to.

00:00:46.680 --> 00:00:49.830 align:middle line:84%
So I'll be demonstrating
this or I'll

00:00:49.830 --> 00:00:52.440 align:middle line:84%
be performing this on
my own local network

00:00:52.440 --> 00:00:54.720 align:middle line:84%
via my Kali Linux
virtual machine.

00:00:54.720 --> 00:00:57.540 align:middle line:84%
You can also do this on
your own local network just

00:00:57.540 --> 00:00:59.760 align:middle line:84%
to try and see if
you can discover

00:00:59.760 --> 00:01:03.060 align:middle line:84%
devices that are connected
to your local network.

00:01:03.060 --> 00:01:05.730 align:middle line:84%
And yeah, so I'm just going to
switch over to my Kali Linux

00:01:05.730 --> 00:01:07.410 align:middle line:90%
VM, and we can get started.

00:01:07.410 --> 00:01:11.220 align:middle line:90%


00:01:11.220 --> 00:01:14.000 align:middle line:84%
All right, so I'm currently
on my Kali Linux VM.

00:01:14.000 --> 00:01:17.810 align:middle line:84%
And my first objective is
to identify my current IP

00:01:17.810 --> 00:01:20.750 align:middle line:84%
address, which I can do by
typing in the command ip

00:01:20.750 --> 00:01:23.030 align:middle line:90%
a s or ipa a.

00:01:23.030 --> 00:01:26.090 align:middle line:84%
And you can see under the
interface, ethernet zero.

00:01:26.090 --> 00:01:28.050 align:middle line:84%
In your case, it
might be different.

00:01:28.050 --> 00:01:32.810 align:middle line:90%
My IP address is 192.168.2.190.

00:01:32.810 --> 00:01:37.310 align:middle line:84%
But this also provides me
with the subnet of the network

00:01:37.310 --> 00:01:38.840 align:middle line:90%
that I'm currently on.

00:01:38.840 --> 00:01:40.850 align:middle line:84%
And you can see it
also provides you

00:01:40.850 --> 00:01:43.680 align:middle line:84%
with the netmask of
the network here.

00:01:43.680 --> 00:01:49.280 align:middle line:84%
So we can perform an Nmap ping
scan on all of the IP addresses

00:01:49.280 --> 00:01:51.510 align:middle line:90%
within this particular subnet.

00:01:51.510 --> 00:01:55.100 align:middle line:84%
So before we do that,
I'm just going to open up

00:01:55.100 --> 00:01:57.110 align:middle line:90%
the manpages for Nmap.

00:01:57.110 --> 00:01:58.760 align:middle line:84%
If you're not
familiar with Nmap,

00:01:58.760 --> 00:02:00.830 align:middle line:90%
Nmap stands for Network Mapper.

00:02:00.830 --> 00:02:03.980 align:middle line:84%
It is an open source tool
used for network exploration

00:02:03.980 --> 00:02:05.840 align:middle line:90%
and security auditing.

00:02:05.840 --> 00:02:08.720 align:middle line:84%
And it was designed to
rapidly scan large networks.

00:02:08.720 --> 00:02:11.390 align:middle line:84%
And it really is
the Swiss Army knife

00:02:11.390 --> 00:02:14.330 align:middle line:84%
when it comes down
to identifying

00:02:14.330 --> 00:02:17.840 align:middle line:84%
devices or hosts on a network,
performing port scans.

00:02:17.840 --> 00:02:19.940 align:middle line:84%
Also performing
service enumeration,

00:02:19.940 --> 00:02:21.060 align:middle line:90%
et cetera, et cetera.

00:02:21.060 --> 00:02:24.050 align:middle line:84%
So the option we are
looking for right now

00:02:24.050 --> 00:02:26.420 align:middle line:84%
or that we're going to be
using is the sn option.

00:02:26.420 --> 00:02:28.610 align:middle line:84%
Let me see if I
can find it here.

00:02:28.610 --> 00:02:32.310 align:middle line:84%
The sn option is the
no port scan option.

00:02:32.310 --> 00:02:35.450 align:middle line:84%
So this option tells Nmap
not to perform a port scan.

00:02:35.450 --> 00:02:40.220 align:middle line:84%
Because remember, we're trying
to identify the list of systems

00:02:40.220 --> 00:02:43.610 align:middle line:84%
on this network before we
start individually targeting

00:02:43.610 --> 00:02:46.470 align:middle line:84%
them or performing
a port scan on them.

00:02:46.470 --> 00:02:50.030 align:middle line:84%
So this will only print out the
available hosts that responded

00:02:50.030 --> 00:02:51.770 align:middle line:90%
to the host discovery probes.

00:02:51.770 --> 00:02:54.860 align:middle line:84%
And this is an often
known or often referred

00:02:54.860 --> 00:02:58.310 align:middle line:84%
to as a ping scan
or a ping sweep.

00:02:58.310 --> 00:03:02.540 align:middle line:84%
The way this works is it'll
essentially-- the sn option

00:03:02.540 --> 00:03:06.710 align:middle line:84%
consists of an ICMP
echo request, a TCP SYN.

00:03:06.710 --> 00:03:08.975 align:middle line:84%
A SYN packet is
sent to port 443.

00:03:08.975 --> 00:03:13.520 align:middle line:84%
A TCP ACK packet
is sent to port 80.

00:03:13.520 --> 00:03:18.350 align:middle line:84%
And an ICMP timestamp
request by default.

00:03:18.350 --> 00:03:20.270 align:middle line:84%
When executed by an
unprivileged user,

00:03:20.270 --> 00:03:23.090 align:middle line:84%
only SYN packets are sent
using the connect call.

00:03:23.090 --> 00:03:27.860 align:middle line:84%
So we need to run this
with the sudo command,

00:03:27.860 --> 00:03:29.900 align:middle line:84%
because it requires
root privileges.

00:03:29.900 --> 00:03:33.500 align:middle line:84%
So in order to do this, I'm
going to say sudo nmap and sn.

00:03:33.500 --> 00:03:36.870 align:middle line:84%
And based on your own network,
you need to specify the subnet.

00:03:36.870 --> 00:03:43.040 align:middle line:84%
So in my case, the
subnet is 192.168.2.0/24.

00:03:43.040 --> 00:03:45.392 align:middle line:90%
Solid enter.

00:03:45.392 --> 00:03:46.850 align:middle line:84%
This will take a
couple of seconds.

00:03:46.850 --> 00:03:47.392 align:middle line:90%
There we are.

00:03:47.392 --> 00:03:50.810 align:middle line:84%
So it's discovered three
devices on my local network.

00:03:50.810 --> 00:03:54.110 align:middle line:84%
So firstly, we have my
router or my default gateway.

00:03:54.110 --> 00:03:56.990 align:middle line:84%
So you can see that this is
the IP address of my router.

00:03:56.990 --> 00:03:58.340 align:middle line:90%
It's a Xiaomi router.

00:03:58.340 --> 00:04:00.362 align:middle line:84%
It also provides me
with the MAC address.

00:04:00.362 --> 00:04:01.820 align:middle line:84%
In this case, it
doesn't provide me

00:04:01.820 --> 00:04:03.278 align:middle line:84%
with the MAC address
of the router,

00:04:03.278 --> 00:04:07.370 align:middle line:84%
but it actually resolves the
name to the manufacturer.

00:04:07.370 --> 00:04:09.200 align:middle line:90%
And then we have--

00:04:09.200 --> 00:04:11.150 align:middle line:90%
yeah, it actually provides it--

00:04:11.150 --> 00:04:12.780 align:middle line:90%
it actually provides that here.

00:04:12.780 --> 00:04:13.920 align:middle line:90%
So Xiaomi Electronics.

00:04:13.920 --> 00:04:15.560 align:middle line:90%
So that's the MAC address there.

00:04:15.560 --> 00:04:17.570 align:middle line:84%
We then have the second
system, which has

00:04:17.570 --> 00:04:21.740 align:middle line:90%
an IP address of 192.168.2.2.

00:04:21.740 --> 00:04:27.020 align:middle line:84%
And the MAC address tells
us that the motherboard

00:04:27.020 --> 00:04:29.630 align:middle line:84%
is essentially
manufactured by ASRock.

00:04:29.630 --> 00:04:31.550 align:middle line:90%
This is my Windows workstation.

00:04:31.550 --> 00:04:34.310 align:middle line:84%
And then this is the IP
address of the Kali Linux

00:04:34.310 --> 00:04:36.390 align:middle line:90%
system or my Kali Linux system.

00:04:36.390 --> 00:04:39.740 align:middle line:90%
So it scanned 256 IP addresses.

00:04:39.740 --> 00:04:42.290 align:middle line:90%
And only three devices are up.

00:04:42.290 --> 00:04:44.797 align:middle line:84%
So as a penetration
tester, this is something

00:04:44.797 --> 00:04:46.130 align:middle line:90%
that you should always be doing.

00:04:46.130 --> 00:04:50.180 align:middle line:84%
You should always try and
discover devices on the network

00:04:50.180 --> 00:04:51.680 align:middle line:90%
that you're targeting.

00:04:51.680 --> 00:04:53.900 align:middle line:84%
You can then copy
all of these IPs.

00:04:53.900 --> 00:04:56.000 align:middle line:84%
And you can then move on
to the next phase, which

00:04:56.000 --> 00:04:58.460 align:middle line:84%
is performing a port
scan on each of them

00:04:58.460 --> 00:05:02.480 align:middle line:84%
in order to identify services
running on the target.

00:05:02.480 --> 00:05:05.660 align:middle line:84%
And then of course, you can
move on to exploitation.

00:05:05.660 --> 00:05:08.630 align:middle line:84%
Now when performing
host discovery,

00:05:08.630 --> 00:05:11.240 align:middle line:84%
you can also perform
a host discovery using

00:05:11.240 --> 00:05:12.860 align:middle line:90%
a tool called netdiscover.

00:05:12.860 --> 00:05:15.450 align:middle line:84%
So by just typing
netdiscover here,

00:05:15.450 --> 00:05:16.950 align:middle line:84%
it doesn't look
like it's installed.

00:05:16.950 --> 00:05:18.325 align:middle line:84%
So I'll need to
get it installed.

00:05:18.325 --> 00:05:22.580 align:middle line:84%
So sudo apt-get
install netdiscover.

00:05:22.580 --> 00:05:25.100 align:middle line:84%
And I'll just use the y
option to get it installed.

00:05:25.100 --> 00:05:29.390 align:middle line:84%
Netdiscover works by sending
ARP requests, which essentially

00:05:29.390 --> 00:05:36.240 align:middle line:84%
resolve MAC addresses to IP
addresses and vice versa.

00:05:36.240 --> 00:05:37.870 align:middle line:90%
Or vice versa, if you will.

00:05:37.870 --> 00:05:40.830 align:middle line:90%
So we can use netdiscover.

00:05:40.830 --> 00:05:43.050 align:middle line:84%
And we can specify
the interface.

00:05:43.050 --> 00:05:44.310 align:middle line:90%
So ethernet zero.

00:05:44.310 --> 00:05:51.570 align:middle line:84%
And then the network range or
the subnet, so 192.168.2.0/24.

00:05:51.570 --> 00:05:53.760 align:middle line:84%
In this case, it looks
like that's not working.

00:05:53.760 --> 00:05:55.080 align:middle line:90%
Do we need to run it with sudo?

00:05:55.080 --> 00:05:55.740 align:middle line:90%
There we are.

00:05:55.740 --> 00:05:57.480 align:middle line:90%
So now it's working.

00:05:57.480 --> 00:05:59.970 align:middle line:84%
You can see now it's going
to discover-- it essentially

00:05:59.970 --> 00:06:01.680 align:middle line:84%
discovers the same
devices we were

00:06:01.680 --> 00:06:04.440 align:middle line:90%
able to discover with Nmap.

00:06:04.440 --> 00:06:06.450 align:middle line:84%
This is just another
tool that you can use.

00:06:06.450 --> 00:06:10.530 align:middle line:84%
But the technique that
is used to discover

00:06:10.530 --> 00:06:14.730 align:middle line:84%
devices that are currently
on the local network

00:06:14.730 --> 00:06:15.570 align:middle line:90%
are different.

00:06:15.570 --> 00:06:19.290 align:middle line:84%
In this case, netdiscover
utilizes ARP requests.

00:06:19.290 --> 00:06:21.690 align:middle line:90%
So fairly simple to understand.

00:06:21.690 --> 00:06:24.370 align:middle line:90%


00:06:24.370 --> 00:06:24.870 align:middle line:90%
All right.

00:06:24.870 --> 00:06:27.810 align:middle line:84%
So that concludes the
practical demonstration side

00:06:27.810 --> 00:06:30.430 align:middle line:90%
of this video.

00:06:30.430 --> 00:06:35.070 align:middle line:84%
OK, so now that we've identified
the IP addresses of systems

00:06:35.070 --> 00:06:37.200 align:middle line:84%
on a local network,
we can now move on

00:06:37.200 --> 00:06:40.290 align:middle line:84%
to performing port
scanning with Nmap.

00:06:40.290 --> 00:06:41.790 align:middle line:84%
So we're going to
take a look at how

00:06:41.790 --> 00:06:45.420 align:middle line:84%
to use Nmap to identify open
ports and the services that are

00:06:45.420 --> 00:06:48.660 align:middle line:90%
running on these open ports.

00:06:48.660 --> 00:06:52.200 align:middle line:84%
And we'll also be taking a look
at the different types of Nmap

00:06:52.200 --> 00:06:54.570 align:middle line:84%
scans that can be run
based on the target

00:06:54.570 --> 00:06:57.910 align:middle line:84%
that you're trying to
perform the port scan on.

00:06:57.910 --> 00:07:01.500 align:middle line:84%
So I'll be seeing you
in the next video.

00:07:01.500 --> 00:07:02.000 align:middle line:90%