The second part of the Nmap Tutorial Series: Nmap Host Discovery.
⮘-=[Subscribe]=-⮚
↬ https://www.youtube.com/c/ceos3ctutorials?sub_confirmation=1
⮘-=[Support Me]=-⮚
↬ Patreon: https://www.patreon.com/ceos3c
↬ Paypal: https://www.paypal.me/ceos3c
↬ Shop on Amazon with this link: https://amzn.to/2S6to7w
↬ pfSense Starter Guide: https://amzn.to/2RbRem2
⮘-=[Social]=-⮚
↬ Website: https://www.ceos3c.com
↬ Instagram: https://www.instagram.com/daily.linux.tips
↬ Twitter: https://www.twitter.com/ceos3c
↬ Facebook: https://www.facebook.com/ceos3c
⮘-=[Affiliate]=-⮚
Show More Show Less View Video Transcript
0:00
Welcome back to a new video guys. Today we are going to tackle the second part of the nMap tutorial series which has the topic of nMap host discovery
0:10
So now that you have a basic understanding of what nMap is and its basic commands that we have covered in the last video, we can dig a bit further and start to talk about the nMap host discovery options
0:21
When you start working for a client and you are presented with a new network, one of the
0:26
first things you want to do is to reduce the list of devices or IPs in the network into
0:32
a list that only contains devices that are interesting for further investigation
0:37
Gladly we have Nmap Host Discovery to help us with this. In this video we will go through all of the Nmap Host Discovery options and I explain to
0:45
you what each option does. Before we get started, a quick info on how you are able to support me
0:51
Because it's taking a lot of time for me to produce these videos for free
0:55
And I would highly appreciate any support for you So I have set up a Patreon page where I already have two patrons as of now
1:03
So this is pretty nice, but more would be better I put the link in the video in the upper right corner
1:10
And also you help me out by subscribing to my channel of course
1:14
and by liking the videos that you actually enjoy watching. Thanks guys, let's get started with the content
1:20
So there are plenty of nmap host discovery options. I have a list of all of them put together on the website in the written article
1:27
which I will link in the description below as well as in the upper right corner of the screen
1:31
And you can check out the whole list and just try out all of the commands by yourself
1:35
The first scan we want to look at is a so-called list scan
1:39
and the list scan lists each host of the network without sending any packets to the hosts themselves
1:44
so this command sometimes works sometimes it doesn't for me um that's at least my experience
1:50
i had with it but let's look at the command first it's nmap tag sl and then the ip range you want
1:57
to scan so we're gonna i know that i have this network here and i'm just simply gonna scan one
2:03
till 10 because that's most likely where my IP addresses in this segment are right now. I know
2:11
that I have 50.7 I think and the basic pentesting 2 VM that I have running in the background has
2:17
50.8 if I'm not wrong. So let's quickly check what this returns but as you can see sometimes
2:24
it does not work for me and this says 10 IP addresses and zero hosts are up but this can
2:31
also mean that it was simply blocked by the machine because as far as i know this is a not
2:37
an intrusive or not aggressive method to scan so i'm not sure how accurate the results are
2:43
next one on the list is the no port scan no port scan option simply means that you don't
2:50
run a port scan after host discovery is done it only prints out the available hosts that responded
2:57
to the discovery probes. You can also call this a ping scan, basically
3:02
According to nmap.org, this is one step more intrusive than the previous list scan
3:07
It could be called light reconnaissance because it is not attracting too much attention
3:12
So this is a good scan to run, which is nmap.tag sn19216850
3:18
And let's see if this is actually the IP address of the basic pen testing VM
3:24
Let's see if we get some results here. and it basically should only report that the host is either up or down
3:35
and there we go one host up it found the host so this works and this you can also run against a
3:44
larger number of ip addresses at the same time it will just take a little bit longer
3:48
but this is the no port scan a good method if you want to do some light reconnaissance
3:53
Next on the list is the no ping scan and the no ping scan skips the complete Nmap discovery process basically
4:00
And Nmap directly starts to run its default port scans which is scan for the thousand most used ports
4:08
Let's try that on the IP Nmap tag PN and then 192.168.50.8
4:17
and now we should actually get some results of potentially open ports on this basic pentesting
4:23
two virtual machine see what it does for us here and there we go it also took around 16 seconds and
4:33
we can see that 999 ports are closed and only port 8081 is open so this is probably this means this
4:44
is not the basic pentesting vm i know the service it's running on parrot and that means probably 0.7
4:51
will be our basic pentesting vm let's run it against this again and see if the results are
4:57
different and the results should be there in a second there we go and this is also not the vm
5:09
Let's try 50.9 and I'm sure this will be the correct VM
5:15
And there we go, finally. This is the basic Pentastic VM. You can see TCP port 21, 22 and 80 is open
5:23
which is FTP SSH and HTTP So you can see that the PN command found a few open ports on this machine Alright next on the list is the so TCP SYN scan
5:37
And this scanning option sends an empty TCP packet with the SYN flag attached to it
5:43
It defaults to port 80. The SYN flag tells the remote system that you are attempting to connect to it, basically
5:50
If the port appears to be open, the target host will start the second step of the three-way TCP handshake
5:55
by responding with a sin-egg-tcp package. This is especially useful for certain systems that block ICMP ping requests
6:03
You can also change the default port 80 to something, whatever other port you like, like 2225, and so on and so forth
6:10
To do this scan, we can simply run nmap-tag-ps22. That's the sin scan with..
6:19
Oh, actually, let's run it first as a default. so that's admap tag ps 192 168 50 and we now know that 0.9 is our basic pentesting vm and let's see
6:32
what the results are of this scan and we can see it was also successful returned the open ports to
6:38
us it run the sin scan against port 80 per default and if you want to run it against any other port
6:45
You can just use the tag ps command and you just simply put whatever other port you want to use right after the ps and then run it again
6:56
Let's see if we get a result on port 443. I'm not sure it's going to work if the port is actually closed
7:03
Let's see and wait for the result. It did also work, so we can see that we also got the correct results here
7:11
alright so next on the list is the TCP ECG ping and this method
7:16
is useful for networks that block ICMP requests as well same as the SYN scan and it
7:22
discovers hosts by responding to non-existing TCP connections to provoke a response from a target
7:28
and if it found a or if it did found a target
7:32
to be up and running then it runs a default port scan against it
7:38
so it scans for the most used 1000 ports again and the command is nmap tag PA 19216850.9 and let's see what the results of this
7:51
is. Also was successful and we got the results back of the open port same like with the previous
7:58
scans. One thing I want to mention here is that this might only work because now we don't have a
8:06
firewall running behind or in front of the clients so if there is a firewall in play the results
8:12
may vary and there might be blocked those requests might be blocked on a firewall so
8:20
it's not certain that it will work on the actual network because here as i said we just have a
8:25
switch in between those two virtual machines basically without any firewalling going on in
8:31
the background okay next is the udp scan and udp ping sends udp packets to get a response from a
8:38
target most networks and firewalls will block udp requests per default or if they are not properly
8:43
configured that is although it is worth a try anyway and if you are not logged in as root you
8:50
need to add the sudo prefix to the command let's just try that without the sudo prefix and see
8:56
what's happened. If you run Kali on root you don't need to add sudo as a
9:00
prefix. You should not run Kali as root if you're a beginner by the way. And let's
9:06
put 0.9 here. It's techpu and now we will get the warning that we cannot
9:11
run it without root. So we put sudo in front of it. We enter our sudo password
9:16
and then the scan will run. By the way if you want to know, if you're a beginner
9:20
and you want to know how to configure Kali Linux properly check out my first
9:24
things to do or top things to do after installing Kali Linux video and or
9:29
article I will link it in the upper right corner and in the description below as well okay there we go now we see that the scan indeed returned something in it
9:39
also returned the Mac address interestingly of the virtual box virtual Nick adapter here this is cool good information right there and also
9:49
returned the open ports. Same like all the other scans did so far. Next on the list is the SCTP
9:57
init ping scan and the SCTP, which means translated stream control transmission protocol
10:03
And you don't need to remember this. I did not remember this. I have it written down here
10:10
Mostly used to discover VoIP services, so voice over IP, IP telephony and stuff like this. You can
10:16
also change the default port by using the same command like in the other commands when you change
10:21
the port. I will show you that in a second. Any command is nmap tag py 192 168 50.ip of d. And we
10:31
also need sudo for that as it seems. So it's sudo nmap tag py and then the ip address. And this is
10:39
very useful to discover VoIP based systems. There are so many VoIP systems out there now in the
10:46
corporate world that are vulnerable to attacks because people are not updating their devices
10:52
Devices are poorly configured and poorly secured so this is a really good scan to discover possible vulnerabilities Okay next on the list and if you want to by the way if you want to change the port again just use this command and you can also separate them with comma and
11:11
with comma and scan for different ports at the same time okay next is the icmp echo ping and you
11:19
should know what icmp is the sensor default icmp ping to a target and checks if it replies usually
11:25
most networks most routers even windows 10 with the windows firewall running will block
11:31
icmp requests per default so this is not it has very low chance of succeeding
11:37
and it's 192.168.50.9 so the command is nmap tech pe and let's quickly run it
11:48
and it says again you are not root as you can see here so we better be root so we
11:55
put sudo in front of the command and interestingly if we don't use sudo it
12:02
uses a tcp ping scan rather than icmp interesting too and there we go we get the results back as well with this command next on the
12:19
is the ICMP timestamp ping. And what this does is most systems, again
12:27
are configured to block those requests as well. But it is possible that even if they don't allow ICMP echo scans or echo pings
12:38
they will still allow ICMP timestamping. So this is maybe an option you should try
12:44
Sometimes it's worth it to do that. sudo nmap tag pp and the ip address of our target or target list whatever you want to scan
12:53
let's see what the results of this are and of course if the if the tcmp or icmp echo ping worked
13:01
this most likely will work as well there we go as expected returned the results of the scan
13:08
correctly good the next thing is a ICMP address mask ping and this address
13:15
mask ping also uses an alternative ICMP request to provoke a response from a
13:20
target another option to possibly bypass a firewall that is blocking default ICMP
13:26
requests let's see what this command looks like we also put sudo in front of
13:30
it and map tag pm 192 168 50.9 and let's see probably i suspect that we will get the correct
13:41
results back as well highly recommend you check out the written article as well because it gives you
13:45
a list of all these commands and you don't need to remember them or write them down or whatever
13:50
good as expected the result is here as well and next on the list is the ip protocol ping and the
13:57
IP protocol ping allows you to send packets with specified protocols to the target
14:03
However, if you do not have or if you do not specify any particular protocol, the default
14:10
protocols ICMP, IGMP and IP in IP will be used to scan
14:18
And I will show you how to specify a protocol in a second. the command is sudo nmap tag po and then the ip address of the target 50.9 and we wait for the
14:29
results quickly there we go there are the results and those protocol numbers are basically specified
14:37
on a website where you can look up all of them let me quickly pull that up and i will put the
14:43
so basically there are protocol numbers from one from zero till all the way down to 255 and
14:50
And all of those protocol numbers are addressing a different protocol. I will leave the link in the description below, you can check that out
14:58
But however, if you want to change the protocol, then you simply again run tag PO and then
15:05
you put the protocol number behind it, like 1 or 5 or 5 and 6, whatever you want
15:12
You get the idea. This is pretty useful, but it's also pretty advanced and I don't think it's very often
15:19
used in the real world. At least I didn't use it very often
15:23
All right. Next on the list is the ARP ping. And the ARP ping, this is basically the fastest method of discovering hosts on a network as of now
15:33
The biggest advantage is that ARP requests can't be blocked by hosts on a network
15:38
no matter if there is a firewall involved or not. But you have to have access to the local network
15:45
So your pen testing machine needs to be inside of the local network for this to work
15:51
And the command is sudo nmap tag pr and then the IP address of the machine
15:58
And 0.9. Let's see what the results of the scan are. There we go
16:06
Now because we don't have many different hosts that we scan against, you cannot really see the difference in speed very much
16:14
but if you scan against more targets and you use a scan that is generally faster
16:19
then you will definitely see a difference there. Alright, next is the traceroute command that should be familiar actually to you
16:28
If you spend any time with networking before you probably know the traceroute command And what this does is it traces a route to the designated target
16:40
And I have an example of this on my website as well. You can check it out there
16:44
So we run sudo nmap tagtag trace route 19216850.9. And the route that was wrong, misspelled here
16:55
the route should be pretty clear because it just goes over the virtual switch within the
17:01
virtual box host only network let's give this a few seconds and as i said of course the route is
17:07
fairly short with just one hop and it's residing in the same network connected to the same switch
17:15
so there is nothing going on here but if you trace route if you use this against the google
17:20
DNS server or any website you have legal access to, try some hackney site that is legal to scan
17:28
against, then you will probably see a route where this traces the route to all the different hops
17:34
and there can be a lot of hops in between one target and the other one. The next scan on the
17:38
list is the so-called force reverse DNS resolution. Normally Nmap would only do reverse DNS lookups
17:46
for hosts that are online with using the tech art tag you can enforce this and lmap will try to
17:53
resolve dns names of all the specified ip addresses that you're scanning against but be aware the tech
18:00
r option will decrease your scan performance tremendously so making your scan much longer
18:06
we can run the scan by using nmap tech r192 168 50.9 and let's see what the results are and let's
18:14
how long it takes. It also took the same amount of time in this example but that's simply because we
18:20
are directly connected to a switch as I said and the results will be surely different on a real
18:26
network with a router between devices and stuff like this. So you can just try that out in your
18:32
own network. And this brings us to the next command and we are almost done with all of the
18:38
commands now this means disable the reverse DNS resolution and as I
18:44
mentioned in the previous force reverse DNS resolution command per default DNS
18:49
resolution is only used against hosts that appear online you can you can
18:53
disable DNS resolution altogether if you do not need it this will increase
18:58
your scan performance and decrease your scan time tremendously so as you remember
19:03
Remember, probably the last scan took about 16 seconds. And now if we use the TAC N options, which stands for disable reverse DNS resolution
19:12
the results should be much faster. And there you go. Instead of 16 seconds like the previous scan, it only took us 0.07 seconds
19:21
So if you don't need DNS resolution, just leave it out and your scans will be completed much, much faster
19:28
Then we have two more options and last before the last option or the almost last option is
19:38
the alternative DNS lookup method which basically lets you specify different DNS server
19:45
This is not very often used in the field but basically this tells nmap to use the host
19:54
systems dns server for dns lookup this scan slows down your scan time probably even more
20:01
than the normal reverse dns lookup but just basically recognize that this option exists
20:08
and it's mmap tag tag system tag dns 192168 50.9 and in this case it was pretty fast
20:15
but it can take much longer because we know we use the dns server that is in the system which is
20:22
local basically so very fast all right then you can manually specify dns servers this is the last
20:29
command what we look at and as it says manually specify dns servers it's clear what it does
20:35
and you just put their tech tag dns tag servers and then you could put their google for dns
20:43
resolution for example or if there are more more dns servers on the local network you can switch
20:49
between them and have a look if the resolution would be correct or not. This being said this
20:55
should give you a good idea of how anMap host discovery works and what kind of commands you
21:00
can work with. In the next part of the series we will look at some more advanced scanning techniques
21:05
and make sure if you liked this video guys please give it a thumbs up, subscribe to my channel
21:13
hit the notification bell. If you like, if you have the resources I'd highly appreciate a
21:19
donation through either patreon or paypal all the links are down in the description below you can
21:25
find all the links to all the support channels in the description below i would be highly appreciative
21:32
for that looking forward to see you back in the next video guys and keep practicing nmap i hope
21:39
you like the series let me know if you did in the comments below have a good day have a good week
21:43
see you in the next video
#Hacking & Cracking
#Networking
#Network Monitoring & Management


