WEBVTT - This file was automatically generated by VIMEO

0
00:00:06.400 --> 00:00:09.800
So hello everyone in this video. We are

1
00:00:09.800 --> 00:00:13.000
 going to see how you can utilize nmamp libraries

2
00:00:12.300 --> 00:00:15.800
 to perform scans with the

3
00:00:15.800 --> 00:00:16.700
 help of python.

4
00:00:18.200 --> 00:00:21.100
So the first and the foremost thing that you have to

5
00:00:21.100 --> 00:00:23.700
 do is you need to install the

6
00:00:24.600 --> 00:00:27.600
Python and map Library so you need

7
00:00:27.600 --> 00:00:30.300
 to import the nmap module to your python script

8
00:00:30.300 --> 00:00:33.300
 and then you can start so for that you

9
00:00:33.300 --> 00:00:36.900
 just need to type this particular command, which is PIP install

10
00:00:36.900 --> 00:00:39.500
 python hyphen and map so I

11
00:00:39.500 --> 00:00:42.200
 will just open up my terminal and I will paste it over here.

12
00:00:44.300 --> 00:00:47.500
As you can see the requirement already satisfied which

13
00:00:47.500 --> 00:00:50.700
 means I have already installed this particular Library,

14
00:00:50.700 --> 00:00:53.600
 so we are good to go. I will just clear

15
00:00:53.600 --> 00:00:53.900
 my screen.

16
00:00:54.800 --> 00:00:55.000
and

17
00:00:56.200 --> 00:00:59.300
Now, let's quickly start Python and import the

18
00:00:59.300 --> 00:01:02.100
 nmap library. So for that I just need to

19
00:01:02.100 --> 00:01:02.700
 type python.

20
00:01:03.400 --> 00:01:06.100
And now I can import and map.

21
00:01:07.200 --> 00:01:09.100
After I have imported nmap.

22
00:01:11.200 --> 00:01:14.400
Then we can initialize the nmap port scanner

23
00:01:14.400 --> 00:01:17.600
 to scan our ports onto our local network.

24
00:01:18.900 --> 00:01:21.400
Okay. So first about what we are going to do is we

25
00:01:21.400 --> 00:01:23.000
 are going to initialize.

26
00:01:23.900 --> 00:01:26.700
Our variable so let's say NM scan.

27
00:01:27.500 --> 00:01:30.500
And which will initialize the port scanner

28
00:01:30.500 --> 00:01:31.100
 of nmap.

29
00:01:31.800 --> 00:01:32.900
Let's type it like this.

30
00:01:34.200 --> 00:01:34.600
alright

31
00:01:36.100 --> 00:01:37.400
I have written all the steps already.

32
00:01:38.400 --> 00:01:41.100
So that there are no mistakes while we are

33
00:01:41.100 --> 00:01:44.400
 executing our programs and no stack Trace errors.

34
00:01:45.600 --> 00:01:45.900
So now

35
00:01:47.700 --> 00:01:49.500
let's quickly scan.

36
00:01:50.300 --> 00:01:53.300
Our network from these particular ports.

37
00:01:54.200 --> 00:01:58.100
So this will return addition of the scan and it will get executed

38
00:01:57.100 --> 00:02:01.000
 on the local network that we are going to scan for

39
00:02:00.100 --> 00:02:04.000
 the port numbers between 21 to 443.

40
00:02:03.600 --> 00:02:05.700
 So let's just quickly.

41
00:02:06.500 --> 00:02:07.100
run this

42
00:02:07.900 --> 00:02:08.900
and wait

43
00:02:10.700 --> 00:02:11.400
for the output

44
00:02:16.100 --> 00:02:19.800
As you can see it has successfully executed and we

45
00:02:19.800 --> 00:02:22.500
 have also got the output over here.

46
00:02:23.400 --> 00:02:24.000
But then you can see.

47
00:02:26.900 --> 00:02:29.200
This is the Local Host which is scan.

48
00:02:30.200 --> 00:02:33.400
And it is identified that Port 80 it is

49
00:02:33.400 --> 00:02:37.000
 running on TCP is open and the product is simple HTTP

50
00:02:36.200 --> 00:02:40.000
 server because yes, we are running a HTTP server

51
00:02:39.900 --> 00:02:42.100
 using nmap as you can

52
00:02:42.100 --> 00:02:46.000
 see over here. Yep. So I have a

53
00:02:45.300 --> 00:02:49.200
 run HTTP server and it is able to identify that.

54
00:02:50.200 --> 00:02:53.900
You can see over here. It is able to identify it is python simple

55
00:02:53.900 --> 00:02:54.900
 HTTP server.

56
00:02:56.100 --> 00:02:56.500
All right.

57
00:02:57.900 --> 00:02:59.600
Let's move ahead and now.

58
00:03:00.800 --> 00:03:03.200
You can use this particular command, which

59
00:03:03.200 --> 00:03:06.600
 is NM scan dot command line, which actually this

60
00:03:06.600 --> 00:03:09.100
 particular method will read the

61
00:03:09.100 --> 00:03:10.100
 scan method.

62
00:03:10.800 --> 00:03:13.500
Call and generate an equivalent command for

63
00:03:13.500 --> 00:03:16.200
 running on command line. So let us

64
00:03:16.200 --> 00:03:18.000
 see what this output gives us.

65
00:03:19.100 --> 00:03:22.700
So when I will hit enter you can see it will give me output something

66
00:03:22.700 --> 00:03:23.400
 like this.

67
00:03:24.500 --> 00:03:26.100
So this is the command that I'm going to run.

68
00:03:27.400 --> 00:03:31.400
So as you can see nmap, hyphen o x Port from

69
00:03:30.400 --> 00:03:33.400
 21 to 443. I'm going

70
00:03:33.400 --> 00:03:36.300
 to run this ports hyphen SV to show the

71
00:03:36.300 --> 00:03:39.300
 output in verbose mode and this is the loopback IP address.

72
00:03:40.600 --> 00:03:43.200
So this is the command which we can run onto the

73
00:03:43.200 --> 00:03:43.800
 command line.

74
00:03:45.300 --> 00:03:45.600
alright

75
00:03:46.500 --> 00:03:46.600
now

76
00:03:47.600 --> 00:03:50.900
for the scan that we have run we can use this particular.

77
00:03:52.300 --> 00:03:55.200
Method which is scan info. So let's see if you use this

78
00:03:55.200 --> 00:03:57.600
 then what output do we get?

79
00:03:58.700 --> 00:04:00.700
As you can see when we run this particular.

80
00:04:01.700 --> 00:04:05.300
Method you can see TCP services from

81
00:04:04.300 --> 00:04:07.400
 this particular port and the method

82
00:04:07.400 --> 00:04:09.600
 that was used was connect method.

83
00:04:10.900 --> 00:04:13.500
Now, let's see which are the hosts that we scanned.

84
00:04:14.300 --> 00:04:18.200
And there comes only one host that is our loopback Network,

85
00:04:17.200 --> 00:04:19.300
 which is our home network.

86
00:04:20.900 --> 00:04:23.100
Now, let's see. What is the host name?

87
00:04:23.900 --> 00:04:27.400
So the host name is localhost. If your

88
00:04:26.400 --> 00:04:29.200
 scanning any public network, it will

89
00:04:29.200 --> 00:04:32.200
 show the host name of that particular IP address.

90
00:04:33.900 --> 00:04:36.700
Now, let's see. What is the state of this particular host?

91
00:04:37.800 --> 00:04:39.500
As we are scanning our local machine.

92
00:04:40.300 --> 00:04:43.900
The loopback IP is up as you can see the host

93
00:04:43.900 --> 00:04:44.800
 status.

94
00:04:45.600 --> 00:04:46.900
The state is up.

95
00:04:48.400 --> 00:04:48.700
now

96
00:04:50.300 --> 00:04:50.400
Let's see.

97
00:04:51.800 --> 00:04:54.500
This particular method which is all protocols and

98
00:04:54.500 --> 00:04:57.100
 this method Returns the protocol for the

99
00:04:57.100 --> 00:04:58.800
 current Network being scanned.

100
00:04:59.400 --> 00:05:03.000
So let me just type this and welcome to know the protocol that

101
00:05:02.400 --> 00:05:06.600
 has been scanned for and it is TCP transmission

102
00:05:05.600 --> 00:05:08.100
 control protocol.

103
00:05:09.400 --> 00:05:10.900
The next one is the

104
00:05:11.800 --> 00:05:14.300
method which is Keys which will written

105
00:05:14.300 --> 00:05:17.600
 all the active ports available within the specified

106
00:05:17.600 --> 00:05:20.300
 range that we have given. So let's just

107
00:05:20.300 --> 00:05:23.600
 run this and hit enter and you can see two ports

108
00:05:23.600 --> 00:05:26.800
 are open one is 80 which we have deliberately opened

109
00:05:26.800 --> 00:05:29.300
 by Python and one more Port which is

110
00:05:29.300 --> 00:05:32.900
 88, which is also running as open.

111
00:05:36.200 --> 00:05:36.600
All right.

112
00:05:37.700 --> 00:05:37.900
let's

113
00:05:38.900 --> 00:05:39.000
see

114
00:05:40.000 --> 00:05:40.300
further

115
00:05:41.400 --> 00:05:45.000
now let us ask that the port

116
00:05:44.300 --> 00:05:45.800
 80 is

117
00:05:47.100 --> 00:05:48.800
running on TCP or not

118
00:05:49.700 --> 00:05:52.400
So, let's see it. Is it running on TCP? Yes.

119
00:05:52.400 --> 00:05:55.300
 It is running on TCP in case we were scanning

120
00:05:55.300 --> 00:05:59.200
 Port 53, which is the UDP port for DNS.

121
00:05:58.200 --> 00:06:01.800
 Then it would have shown false over

122
00:06:01.800 --> 00:06:02.100
 here.

123
00:06:03.500 --> 00:06:04.000
Okay, so

124
00:06:05.600 --> 00:06:08.000
let us scan for UDP this time.

125
00:06:08.800 --> 00:06:09.700
Let's type here.

126
00:06:10.900 --> 00:06:11.500
53

127
00:06:12.400 --> 00:06:15.900
And you can see false. Alright because DRS

128
00:06:15.900 --> 00:06:18.400
 server runs on a UDP

129
00:06:18.400 --> 00:06:18.500
 port.

130
00:06:20.300 --> 00:06:20.600
now

131
00:06:23.200 --> 00:06:24.700
Let us see the details about.

132
00:06:25.800 --> 00:06:27.000
The Local Host

133
00:06:28.600 --> 00:06:31.200
The protocol the port number and we are going to

134
00:06:31.200 --> 00:06:34.300
 see the scan details something like this. So, let

135
00:06:34.300 --> 00:06:35.300
 me just paste it over here.

136
00:06:36.200 --> 00:06:40.500
And you can see the details wherein we get the product. This

137
00:06:39.500 --> 00:06:42.700
 is the details from the SV, which

138
00:06:42.700 --> 00:06:45.100
 is the service version detection which happened ago.

139
00:06:45.600 --> 00:06:46.500
We have done it over here.

140
00:06:47.500 --> 00:06:50.900
And you can see simple HTTP server. The state is open. The

141
00:06:50.900 --> 00:06:54.100
 version is 0.6 name is httpconf.

142
00:06:54.700 --> 00:06:57.300
As you can see extra information we have got which

143
00:06:57.300 --> 00:07:00.300
 is running a python server reason a synac

144
00:07:00.300 --> 00:07:00.700
 was sent.

145
00:07:01.400 --> 00:07:05.100
And you can see CPE it is saying simple HTTP server

146
00:07:04.100 --> 00:07:06.700
 0.6.

147
00:07:08.400 --> 00:07:09.400
Alright, so

148
00:07:10.900 --> 00:07:13.000
this was how we can scan.

149
00:07:14.600 --> 00:07:16.100
using nmap

150
00:07:16.700 --> 00:07:18.100
python Library

151
00:07:18.900 --> 00:07:20.000
Let us see the last one.

152
00:07:22.800 --> 00:07:25.300
And hit enter and you can see we get the

153
00:07:25.300 --> 00:07:27.200
 exact same output.

154
00:07:28.400 --> 00:07:30.600
Because both of them are exactly the same.

155
00:07:31.500 --> 00:07:35.000
So I hope you guys understood how you can use the nmap library

156
00:07:34.400 --> 00:07:38.100
 for Python and perform the

157
00:07:37.100 --> 00:07:41.600
 same scans without even going into nmap

158
00:07:40.600 --> 00:07:43.700
 or running the GUI version just

159
00:07:43.700 --> 00:07:46.200
 directly from the python. You can import the

160
00:07:46.200 --> 00:07:48.700
 and map and you can start scanning.

161
00:07:49.600 --> 00:07:51.900
I hope everyone of you understood. Thank you.
