WEBVTT - This file was automatically generated by VIMEO

0
00:00:05.400 --> 00:00:06.600
Hey and welcome back.

1
00:00:07.500 --> 00:00:10.400
So in this video we are going to see how you can

2
00:00:10.400 --> 00:00:13.500
 display the listening TCP and UDP

3
00:00:13.500 --> 00:00:16.400
 ports and the corresponding programs which

4
00:00:16.400 --> 00:00:17.600
 have been using the sports.

5
00:00:18.200 --> 00:00:21.900
Now this is a very very helpful command and

6
00:00:21.900 --> 00:00:24.800
 utility which is going to help you in all

7
00:00:24.800 --> 00:00:28.000
 the distributions, which is either Macos Linux

8
00:00:27.300 --> 00:00:28.900
 or Windows.

9
00:00:29.700 --> 00:00:32.900
Now with this you can identify that what

10
00:00:32.900 --> 00:00:35.700
 are your ports which services are

11
00:00:35.700 --> 00:00:38.800
 running on them if the connection state

12
00:00:38.800 --> 00:00:42.200
 is open closed or established and

13
00:00:41.200 --> 00:00:44.600
 what are the ongoing currently open

14
00:00:44.600 --> 00:00:45.900
 or closed ports?

15
00:00:46.700 --> 00:00:49.800
Alright, so let's quickly see how can you identify this

16
00:00:49.800 --> 00:00:52.400
 for this the command that we are going to use is

17
00:00:52.400 --> 00:00:55.700
 netstat. Now, I have already done

18
00:00:55.700 --> 00:00:59.100
 a setup between this OS which

19
00:00:58.100 --> 00:01:01.400
 is the Mac OS and I have been running.

20
00:01:02.200 --> 00:01:05.200
a Debian OS into my virtual machine

21
00:01:05.900 --> 00:01:06.800
as you can see over here.

22
00:01:07.700 --> 00:01:11.100
the IP address of this machine by

23
00:01:10.100 --> 00:01:13.400
 the command I have config can be

24
00:01:13.400 --> 00:01:18.100
 seen over here is 192 168 241.3

25
00:01:19.100 --> 00:01:23.200
And on this machine I have started a NC connection,

26
00:01:23.200 --> 00:01:26.800
 which is a netcat connection as you can see over here on port

27
00:01:26.800 --> 00:01:30.400
 number 44463. All

28
00:01:29.400 --> 00:01:32.300
 right. So let's come back to our

29
00:01:32.300 --> 00:01:35.900
 Mac OS and on this system, you can see I have

30
00:01:35.900 --> 00:01:38.300
 config and I'm trying to see

31
00:01:38.300 --> 00:01:41.900
 my IP address basically so on this system. Basically,

32
00:01:41.900 --> 00:01:44.900
 I'm establishing a connection to

33
00:01:44.900 --> 00:01:47.300
 the Linux Debian machine, which

34
00:01:47.300 --> 00:01:50.800
 we have seen currently using the command, which is NC the

35
00:01:50.800 --> 00:01:53.700
 IP address of the machine that we have seen, which

36
00:01:53.700 --> 00:01:56.500
 is exactly the same IP address that we

37
00:01:56.500 --> 00:01:59.200
 are connecting to and the port number on which the

38
00:01:59.200 --> 00:02:01.900
 connection has started as you can see over here.

39
00:02:03.300 --> 00:02:06.400
So this machine is listening on this port number

40
00:02:06.400 --> 00:02:09.600
 and we are trying to connect to that machine. Once we

41
00:02:09.600 --> 00:02:12.100
 are successfully connected you can see we got

42
00:02:12.100 --> 00:02:15.400
 a connect request from the IP address,

43
00:02:15.400 --> 00:02:16.300
 which is this.

44
00:02:17.700 --> 00:02:20.500
Using the port number five double one eight

45
00:02:20.500 --> 00:02:23.100
 four and you can see we I was able

46
00:02:23.100 --> 00:02:26.700
 to type a message which was we are connected now anything that

47
00:02:26.700 --> 00:02:30.100
 we type here on this terminal we're

48
00:02:29.100 --> 00:02:33.000
 able to see onto our next machine. For

49
00:02:32.200 --> 00:02:35.200
 example, let's see this works.

50
00:02:35.700 --> 00:02:38.200
And let's go inside and see it works.

51
00:02:39.200 --> 00:02:43.500
As we can see that both these machines are connected and they

52
00:02:42.500 --> 00:02:45.300
 are able to communicate with each other.

53
00:02:46.600 --> 00:02:49.600
Alright, let's come back to netstat now. So

54
00:02:49.600 --> 00:02:52.200
 we are going to see the connections that have been

55
00:02:52.200 --> 00:02:55.400
 opened in this computer and to see if they are

56
00:02:55.400 --> 00:02:59.000
 communicating with any other host or service. And

57
00:02:58.400 --> 00:03:01.800
 what is the state? Is it established

58
00:03:01.800 --> 00:03:04.400
 open or closed for that? You can see over

59
00:03:04.400 --> 00:03:08.100
 here. I have typed the command which is netstat. And

60
00:03:08.100 --> 00:03:11.300
 this is the output. Let me just scroll up

61
00:03:11.300 --> 00:03:13.400
 and here we go.

62
00:03:14.100 --> 00:03:17.600
You can see netstat hyphen a to see all the

63
00:03:17.600 --> 00:03:21.300
 connection requests including TCP ureb.

64
00:03:21.300 --> 00:03:23.700
 And now if you notice over here.

65
00:03:24.500 --> 00:03:28.000
This is the connection that we have successfully

66
00:03:27.000 --> 00:03:28.900
 established.

67
00:03:29.900 --> 00:03:33.900
And you can see the IP address which is 192.168 241

68
00:03:32.900 --> 00:03:35.300
 dot one which is

69
00:03:35.300 --> 00:03:39.000
 this machine which you can see over here and the

70
00:03:38.400 --> 00:03:42.800
 port of this machine which is 51184, which

71
00:03:42.800 --> 00:03:45.700
 is been used. This is the foreign

72
00:03:45.700 --> 00:03:48.700
 address the remote machine to whom

73
00:03:48.700 --> 00:03:51.900
 which we are connected on the port number four four six

74
00:03:51.900 --> 00:03:54.400
 three. So this is the local address as you

75
00:03:54.400 --> 00:03:58.100
 can see over here. This is the foreign address to whom we

76
00:03:57.100 --> 00:04:00.800
 are connected on this specific port and

77
00:04:00.800 --> 00:04:03.700
 we can confirm from here. This is the same port

78
00:04:03.700 --> 00:04:06.500
 and this is the local machine through

79
00:04:06.500 --> 00:04:09.600
 which we have got the connection from this port number and we

80
00:04:09.600 --> 00:04:12.300
 can verify this using the next step command.

81
00:04:13.100 --> 00:04:16.900
Now you can see over here. The state is established which

82
00:04:16.900 --> 00:04:20.000
 means both the machines are currently

83
00:04:19.600 --> 00:04:22.600
 in a established state and

84
00:04:22.600 --> 00:04:24.400
 are communicating with each other.

85
00:04:25.300 --> 00:04:28.800
So this is it for this video? I hope you guys understood you

86
00:04:28.800 --> 00:04:31.600
 can also see there are plenty of other services which

87
00:04:31.600 --> 00:04:34.900
 have been running in the background. Now, most of

88
00:04:34.900 --> 00:04:37.600
 this services are being run by the system

89
00:04:37.600 --> 00:04:40.600
 commands in which they try to frequently get

90
00:04:40.600 --> 00:04:43.900
 connected to the servers for security

91
00:04:43.900 --> 00:04:46.600
 patches or updates Etc or in

92
00:04:46.600 --> 00:04:50.400
 case if you're running any system level applications or

93
00:04:50.400 --> 00:04:53.700
 NTS and background they all so frequently connect to

94
00:04:53.700 --> 00:04:55.400
 their service for frequent updates.

95
00:04:56.200 --> 00:04:59.500
So this is it for this video? I hope you guys understood in

96
00:04:59.500 --> 00:05:02.400
 case you have any doubts or queries you can you can

97
00:05:02.400 --> 00:05:04.500
 always ask it into the Q&A. Thank you.
