When we install any application, it opens some ports, but we do not know about them. It may prove to be a potentially dangerous situation where it may be using a port without our knowledge. Is it possible to check my open ports without installing any third-party application?
All the applications need to access a port to communicate with the Internet. Since Windows open the ports automatically and does not inform us, we can dig out this information from the system using the inbuilt Windows tool called “NETSTAT.” This Tool can check the records maintained by windows about the listening activities on all the ports.
Please follow the instructions word to word and with full care to avoid inconvenience. Here is a step by step procedure to check my open ports.
Steps to check my open ports
1. Open the command window:
Press “Windows” and “R” keys simultaneously (Win + R). It will open a un’ dialogue box. In this box, type the command “cmd” and press enter. It opens a small window with a black background showing C:\WINDOWS\system32> prompt.
Note: It is important to note here that you should be logged in as an administrator to access screens in the next steps. If you are not the administrator, you should have the admin password and select the option “Run as administrator” to open the cmd’ window.
2. Use netstat -ab command:
This command lets you view the ports that are open or are being used by a particular host. The term listening ports is synonymous with checking my open ports.
At the cmd prompt, type the command netstat -ab’ without the quotation marks. Make sure that you have got a space between the words. Now press and enter and wait for the list to be displayed.
It will show active connections along with the name of the executables, ports, and other details. The executable name is available below the port name. It takes a few seconds or more to display the details depending upon the speed of the computer. If for any reason, you must stop, press ctrl + c’ to abort this operation and type exit, then press the Enter key to come out of the cmd’ window.
3. To see only the listening (open) ports:
If you do not intend to see the clutter and want to focus on the listening ports, type this command “Netstat -ab |find /i “listening.” Match the words exactly and also key-in the quotes around the phrase listening.’
4. The ‘ON’ command option of netstat:
Now type “netstat -aon” at the command prompt as we did in the last step and press enter. You will notice that a PID number is there at the end of each line. Note down the PID number for use in later steps.
Tip: The cmd’ window scrolls the information after you give the above command. If you can’t see some part of the screen, use your mouse to scroll up. Don’t use arrow keys as it will display earlier commands.
5. The listening command for the ‘AON’ variant:
You may like to see only the open ports along with PID numbers. For this purpose, type Netstat -aon |find /i “listening.” This way, I can check my open ports instantly with a single command.
6. Track PID numbers to check my open ports:
Now select the “Win + X” combination. You will see a column of commands. Click “Task Manager.” The task manager window opens in a few seconds. Click the “Details” tab in this window. It will show all the running executables. Match the PID number with the list of PID numbers.
Right-click on the executable corresponding to the PID number and select the “Open the file location” button. It displays the location information of the application, which is using the port. You can also click on the PID heading to sort the PID number in ascending or the descending order to locate your PID number quickly.
7. Creating a file from the list of open ports:
Some of you do not want to come back to these commands repeatedly to check PID numbers. There is a simple solution to save the list of open ports. Add the letters and filename ‘c:\myopenports.txt’ at the end of the netstat’ commands where ‘myopenports’ is an example of the filename. Make sure to use windows explorer to go to the system32 folder and open the text file in the WordPad program in no-wrap’ mode.
8. Third-party tools:
There are a host of third-party freeware tools available on the Internet. They will also provide the same information in an organized way and with a single click. Be careful while using third-party tools as some of them may infect your system with viruses and trojans.
9. Microsoft tools: tcpview:
TCPView or TCPView.exe tool displays the netstat’ information graphically. You may download the Tool from the Microsoft SysInternals website. This Tool is not required to be installed and is a standalone application. It also provides information in terms of used protocols, sent and received packets, local and remote TCP information, and the processes.
10. Microsoft tools: portqry:
Similarly, PortQry or PortQry.exe is also available at the Microsoft download center. This Tool also scans open ports on a local or remote host. The parameters of this command let you specify the hostname and range or group of ports. For example, if I want to see the open ports on a remote host IP address 192.168.1.247 and all the open ports ranging from 110 to 130, it will display the list by scanning the specific host and only for the given range. You can also provide an array of ports as well. A typical query used with the Tool may look like “Portqry.exe -n -129.168.1.247 -r 110:130”.
11. Use our Open Port Viewer Tool
Conclusion
By Scanning the open ports, we can get to the root of the problem to troubleshoot network issues or vulnerability checks. The ability to check my open ports is a critical aspect of my network security plan.
Please Note: This step by step guide works in Windows 10. However, the steps are similar in earlier operating systems.