1 00:00:01,080 --> 00:00:02,610 Hey and welcome back. 2 00:00:02,850 --> 00:00:10,980 So in this video, we're going to see how you can display the listing, TCP and UDP ports and the corresponding 3 00:00:10,980 --> 00:00:13,260 programs, which I've been using the spots. 4 00:00:13,650 --> 00:00:21,120 Now, this is a very, very helpful command and utility, which is going to help you in all the distributions, 5 00:00:21,120 --> 00:00:24,720 which is either Mac OS Linux or Windows. 6 00:00:25,080 --> 00:00:32,550 Now with this, you can identify that what are your ports, which services are running on them? 7 00:00:32,580 --> 00:00:40,440 If the connection state is open, closed or established, and what are the ongoing currently open or 8 00:00:40,440 --> 00:00:41,550 closed ports? 9 00:00:42,210 --> 00:00:42,840 All right. 10 00:00:42,840 --> 00:00:45,630 So let's quickly see, how can you identify this? 11 00:00:45,870 --> 00:00:49,020 For this, the command that we are going to use is net start. 12 00:00:49,230 --> 00:00:58,860 Now, I have already done a setup between this OS, which is the Mac OS and I have been running Debian 13 00:00:58,860 --> 00:01:01,050 OS into my virtual machine. 14 00:01:01,410 --> 00:01:09,450 As you can see over here, the IP address of this machine by the command I have config can be seen over 15 00:01:09,450 --> 00:01:13,950 here is 192 168 to 41.3. 16 00:01:14,520 --> 00:01:21,120 And on this machine I have started a NC connection which is a net cat connection as you can see over 17 00:01:21,120 --> 00:01:25,230 here on port number four, four, four, six three. 18 00:01:25,560 --> 00:01:28,650 All right, so let's come back to our Mac OS. 19 00:01:28,650 --> 00:01:35,460 And on this system you can see I have config and I'm trying to see my IP address basically. 20 00:01:35,460 --> 00:01:43,170 So on this system, basically I'm establishing a connection to the Linux Debian machine, which we have 21 00:01:43,170 --> 00:01:48,900 seen currently using the command, which is and see the IP address of the machine that we have seen, 22 00:01:48,900 --> 00:01:55,350 which is exactly the same IP address that we are connecting to and the port number on which the connection 23 00:01:55,350 --> 00:01:56,530 has started. 24 00:01:56,550 --> 00:02:03,570 As you can see over here, so this machine is listening on this port number and we are trying to connect 25 00:02:03,570 --> 00:02:06,360 to that machine once we are successfully connected. 26 00:02:06,360 --> 00:02:16,410 You can see we got a connect request from the IP address, which is this using the port number 51184. 27 00:02:16,500 --> 00:02:21,600 And you can see we I was able to type a message which was we are connected now. 28 00:02:21,600 --> 00:02:28,200 Anything that we type here on this terminal, we are able to see onto our next machine. 29 00:02:28,200 --> 00:02:36,420 For example, let's see this works and let's go inside and see it works as we can see that both these 30 00:02:36,420 --> 00:02:41,100 machines are connected and they are able to communicate with each other. 31 00:02:42,090 --> 00:02:42,750 All right. 32 00:02:42,750 --> 00:02:44,760 Let's come back to net stat now. 33 00:02:44,760 --> 00:02:50,760 So we are going to see the connections that have been opened into this computer and to see if they are 34 00:02:50,760 --> 00:02:54,150 communicating with any other host or service. 35 00:02:54,150 --> 00:02:56,210 And what is the state? 36 00:02:56,220 --> 00:02:59,220 Is it established, open or closed for that? 37 00:02:59,220 --> 00:03:04,890 You can see over here I have typed the command which is net set and this is the output. 38 00:03:05,010 --> 00:03:09,060 Let me just scroll up and here we go. 39 00:03:09,630 --> 00:03:16,710 You can see net stat hyphen A to see all the connection requests including TCP, UDP. 40 00:03:17,010 --> 00:03:24,660 And now if you notice over here, this is the connection that we have successfully established. 41 00:03:25,350 --> 00:03:32,490 And you can see the IP address, which is 192 168 to 41.1, which is this machine which you can see 42 00:03:32,490 --> 00:03:33,150 over here. 43 00:03:33,270 --> 00:03:39,450 And the port of this machine, which is 51184, which is being used. 44 00:03:39,480 --> 00:03:46,290 This is the foreign address, the remote machine to whom which we are connected on the port number four, 45 00:03:46,290 --> 00:03:47,730 four, four, six three. 46 00:03:47,910 --> 00:03:50,700 So this is the local address, as you can see over here. 47 00:03:50,700 --> 00:03:55,800 This is the foreign address to whom we are connected on this specific port. 48 00:03:55,950 --> 00:04:02,520 And we can confirm from here this is the same port and this is the local machine through which we have 49 00:04:02,520 --> 00:04:07,950 got the connection from this port number and we can verify this using the net stat command. 50 00:04:08,550 --> 00:04:16,110 Now you can see over here the state is established, which means both the machines are currently in 51 00:04:16,110 --> 00:04:20,250 an established state and are communicating with each other. 52 00:04:20,580 --> 00:04:22,260 So this is it for this video. 53 00:04:22,290 --> 00:04:23,840 I hope you guys understood. 54 00:04:23,850 --> 00:04:29,130 You can also see there are plenty of other services which have been running in the background. 55 00:04:29,130 --> 00:04:36,240 Now, most of these services are being run by the system commands in which they try to frequently get 56 00:04:36,240 --> 00:04:43,950 connected to the servers for security patches or updates, etc. or in case if you're running any system 57 00:04:43,950 --> 00:04:50,430 level applications or antivirus and background, they also frequently connect to their servers for frequent 58 00:04:50,430 --> 00:04:51,090 updates. 59 00:04:51,570 --> 00:04:53,040 So this is it for this video. 60 00:04:53,070 --> 00:04:54,590 I hope you guys understood. 61 00:04:54,600 --> 00:04:59,550 In case you have any doubts or queries, you can you can always ask it into the Q&A. 62 00:04:59,580 --> 00:05:00,240 Thank you.