WEBVTT

00:01.450 --> 00:08.500
Welcome to the video using and map scripts for automating network scanning in this video we will learn

00:08.500 --> 00:16.040
about NFC also known as the map scripting engine will find were these NSC scripts are located on our

00:16.040 --> 00:22.430
Kelly Linux machine and we'll run NSC scripts against targets in our environment.

00:22.460 --> 00:27.890
So far we have focused heavily on using end map to do an initial discovery of our networks.

00:27.890 --> 00:33.770
We've run both broad and very targeted scans depending on what we're looking for either to get a nice

00:33.800 --> 00:35.680
overview of what's on a network.

00:35.720 --> 00:41.480
If scanning it for the first time or doing more focused scans to find hosts that are just running a

00:41.480 --> 00:49.330
specific service like Web services on port 80 or 4:43 And we've also practiced exporting these results

00:49.330 --> 00:56.530
to several different formats such as X-amount and HTL now that we're getting good at the discovery phase

00:56.530 --> 01:02.930
of scanning the next logical step is to find potential vulnerabilities and misconfiguration on our hosts.

01:03.250 --> 01:10.960
And this is one area where the NSC or map scripting engine really shines if you head to the u r l shown

01:10.960 --> 01:16.210
on my screen here you can take a real deep dive into what the end maps scripting engine is all about

01:16.330 --> 01:17.320
and how to use it.

01:18.070 --> 01:23.050
For the purposes of this video I'm going to give you a high level overview and then dive into some helpful

01:23.050 --> 01:31.280
commands as well as some of my favorite scripts the maps scripting engine as the name implies is focused

01:31.280 --> 01:35.900
on scripts specifically the engine contains over 500 scripts.

01:35.900 --> 01:42.470
We can leverage and the first logical step is to find them let's use the locate command we've played

01:42.470 --> 01:48.710
with in previous videos to locate the scripts the scripts have an extension of NSC.

01:48.710 --> 01:55.280
So I'm just going to type locate space start in SC.

01:55.530 --> 02:03.330
It looks like the slash us are slash share slash and map slash scripts directory is the headquarters

02:03.330 --> 02:04.620
for these scripts.

02:04.740 --> 02:12.450
So let's go there and then I'm going to do an ls space task L to list all the files in the directory

02:13.700 --> 02:15.710
as we can see there's a ton of files here.

02:15.710 --> 02:24.260
So let's run LS space tech l again and this time pipe it to the more command so we can see one screen

02:24.260 --> 02:24.940
at a time.

02:27.170 --> 02:32.760
It appears there are all sorts of interesting looking scripts here ones having to do with DNS.

02:32.870 --> 02:36.330
F t p h TDP and more.

02:36.400 --> 02:39.910
But the big question is what to each of these scripts actually do.

02:41.210 --> 02:46.440
Well one thing we're going to pay close attention to is the naming convention of these scripts.

02:46.460 --> 02:52.510
Let's do an ls command for all files with the word brute.

02:52.660 --> 02:58.350
Now any script with the word bruit is for guessing authentication credentials of a remote server.

02:58.450 --> 03:06.110
We can see there are several protocols mentioned here like FGP HTP and S-M T.P..

03:06.150 --> 03:10.380
Another important category of scripts to check out are those containing the word Volm

03:13.270 --> 03:17.130
as these focus on specific known vulnerabilities.

03:17.130 --> 03:20.900
Now we're going to look at how to figure out what each of these scripts do in a moment.

03:21.060 --> 03:26.190
But in the case of these scripts with the word Volm it is helpful to know that many of the file names

03:26.430 --> 03:28.660
have CVP numbers attached to them.

03:29.340 --> 03:38.520
So if I want to know what this SMB vuln M-S 17 0 1 0 script was all about I could just look up the mess

03:38.520 --> 03:45.990
17 0 1 0 number and learn that it's associated with the patch that Microsoft put out for the eternal

03:45.990 --> 03:47.220
blue exploit.

03:48.040 --> 03:53.700
And just as a side note I see this particular patch missing quite frequently on penetration tests.

03:53.740 --> 03:57.830
So it's a good one to check the network for early in your engagement.

03:57.840 --> 04:02.480
Also you had to scan a whole network for a particular vulnerability in just a bit.

04:02.480 --> 04:06.370
Now back to the question about figuring out what each specific script does.

04:06.560 --> 04:14.090
Let's first pick a script we want to know more about like this SMB tech OS task discovery what we can

04:14.090 --> 04:26.850
do is run and map with the tac tac script TAC help command followed by the name of the script.

04:26.910 --> 04:33.210
This tells us that the script attempts to determine the operating system computer name domain workgroup

04:33.720 --> 04:36.360
and current time over the SMB protocol.

04:37.240 --> 04:42.400
And we can read a few more comments here about what gotcha's we might run into as well as an additional

04:42.400 --> 04:50.600
help your el let's hit that site and will be taken to a page with much of the same content.

04:50.830 --> 04:56.890
But one thing that's really handy is we can see some example usage syntax in a sample of what the output

04:56.890 --> 04:57.850
will look like.

04:59.260 --> 05:02.990
So let's give this a shot against a known Windows host in my environment.

05:03.910 --> 05:17.670
I'm going to run and map space tac tac script space SMB TAC OS TAC discovery and NSC space TAC P for

05:17.700 --> 05:26.220
4 or 5 to specify just port 4 4 5 and then my target IP address and there we go it looks like Ive got

05:26.220 --> 05:32.940
a host called mini me in my environment with Windows 10 on it and its not joined to a domain its just

05:32.940 --> 05:35.750
sitting out here in a work group.

05:35.760 --> 05:40.620
Now if I wanted to run that same specific check against my whole environment I could just change the

05:40.620 --> 05:48.530
individual IP to be a whole subnet or if I had a list of hosts and subnets remember that we can call

05:48.530 --> 05:57.920
that with the space TAC I capital L and then our command space our text file with hosts in it.

06:00.630 --> 06:06.540
Let's take a look at the help file for another script such as banner down in SC and lets pop open the

06:06.690 --> 06:09.660
URL for the Associated help file.

06:09.710 --> 06:12.670
I want to call your attention to a few things here.

06:12.680 --> 06:20.060
One is that this script is categorized under discovery and safe remember how we were looking at scripts

06:20.060 --> 06:27.380
with names that contain the words bruit or vuln before well by navigating around in the NSC help area

06:27.560 --> 06:34.160
you can quickly bring up a category such as bruit and see all the scripts that fall into that category

06:34.850 --> 06:36.730
and then dive directly into the script.

06:36.770 --> 06:44.540
You want to know more about lets go back to our banner and see which we see categorized as Discovery

06:44.570 --> 06:47.870
and also described as safe.

06:47.890 --> 06:49.240
So what does that mean.

06:50.140 --> 06:57.580
I'm going to click NSC documentation and then I'm going to click into script categories here we can

06:57.580 --> 07:01.930
get a better high level understanding of what each script category means.

07:02.080 --> 07:08.350
And in the case of scripts Mark safe it appears that they shouldn't cause services to crash overwhelm

07:08.350 --> 07:13.240
the network or otherwise cause any serious disruption to the environment.

07:13.240 --> 07:19.180
Let's back up one more time to the page about the banner NSC script and I want to call your attention

07:19.180 --> 07:23.190
to an important section called script ARBs.

07:23.230 --> 07:28.690
These are the arguments you can pass to the unmap script to tune your scan even further.

07:28.850 --> 07:33.740
For example with bannered NSC it looks like we've got arguments called bannered Dom.

07:33.760 --> 07:41.000
Time out and banner dot ports that we can play with banner timeout specifies how long to wait for a

07:41.000 --> 07:45.790
banner response and banner ports specifies which ports to grab.

07:47.580 --> 07:53.040
Let's test this out on a host on my network that I know has a bunch of ports open.

07:53.070 --> 08:01.140
First let's look at a normal and map scan of the host and it looks like we've got ports 21 22 23 eighty

08:01.740 --> 08:14.380
three 3 0 6 and 8 0 2 2 open all run and map space tech tech script space bannered NSC space tech tech

08:14.470 --> 08:25.210
script tech args space banner dot Portes equals 21 and then the IP address that will enumerate just

08:25.270 --> 08:32.330
the banner and we can see the banner says FTB server ready now.

08:32.330 --> 08:38.810
Notice that while only the banner was pulled from Port 21 and maps still did a scan of the default ports

08:38.960 --> 08:41.220
and returned to their state.

08:41.420 --> 08:46.610
I found that sometimes you need to mix and match arguments with standard and map flags to get just the

08:46.610 --> 08:47.590
result you want.

08:48.620 --> 08:54.800
For example I'm going to get rid of the script ARBs here and just use tac.

08:54.850 --> 08:57.140
P. 21.

08:57.190 --> 09:02.420
That way I will only get the ban or grab from port 21 without any other scanning overhead.

09:03.400 --> 09:09.400
Or as we've done in the past we can use a comma separated list of ports to just pull those port banners

09:10.240 --> 09:18.900
like tack P 21 comma 22 come to 80 and of course we can open that scan up a little wider and do a sweep

09:18.900 --> 09:26.240
for those FGP servers across an entire subnet because this input showed a lot of closed ports.

09:26.360 --> 09:33.200
Let's narrow things down a bit more by adding the tac tac open flag which will only turn up results

09:33.350 --> 09:34.930
that contain open ports.

09:35.740 --> 09:40.310
Now I wanted to close this video on something we talked about a little earlier in this video.

09:40.450 --> 09:49.330
I mentioned the SNB vuln M-S 17 0 1 0 script which checks if the host is patched for the popular eternal

09:49.330 --> 09:50.440
blue exploit.

09:51.350 --> 09:57.320
One of the first questions I had when first testing for a vulnerability using nmap is Can I just do

09:57.410 --> 10:02.890
all the various SMB related vulnerability checks against all my hosts at one time.

10:03.820 --> 10:09.400
The answer is yes but I want to warn you to proceed with extreme caution because while this type of

10:09.400 --> 10:12.470
scan is possible I wouldn't recommend it.

10:13.280 --> 10:19.670
The reason goes back to the map scripting engine help area remember how we were able to click a category

10:19.670 --> 10:23.650
such as vuln and then read about each script in that category.

10:24.420 --> 10:28.650
Well if you read through the scripts in this category you will see that several of them mentioned adverse

10:28.650 --> 10:33.010
side effects such as crashing services if the host is vulnerable.

10:34.010 --> 10:39.680
If you understand the risks and still want to check against an entire category of vulnerabilities you

10:39.680 --> 10:42.660
can do so with wild cards in your end map command.

10:43.780 --> 10:50.530
For example to check my Mini-Me host against all POSIX and still want to check this I can use the syntax

10:50.620 --> 11:04.350
of and map space tech tech script space SMB tech Volm TAC star and we put that in quotes space P for

11:04.370 --> 11:10.900
4 or 5 space my target or targets.

11:11.010 --> 11:16.530
The bottom line is you're going to want to read up on an experiment with the various A.E. scripts and

11:16.530 --> 11:22.060
how they can be leveraged with standard and map flags to get the exact result you're looking for.

11:22.760 --> 11:27.560
Hopefully by now you're getting some creative ideas on how to string a bunch of commands and scripts

11:27.560 --> 11:32.290
together to squeeze the most value possible out of each one of your scans.

11:33.870 --> 11:37.710
In our next video we will start diving into Sparta and eyewitness.
