Current location - Quotes Website - Team slogan - How to use the netstart -an command to view local open ports and closed ports?
How to use the netstart -an command to view local open ports and closed ports?
1.netstat command that comes with Windows.

Regarding the netstat command, let's take a look at the introduction in the windows Help file:

Netstat

Displays protocol statistics and current TCP/IP network connections. This command can only be used after the TCP/IP protocol is installed.

netstat

parameter

-a: Show all connections and listening ports. Server connections are not usually displayed.

-e: Display Ethernet statistics. This parameter can be used in combination with the -s option.

-n: Displays the address and port number in numeric format (instead of trying to find the name).

-s: Displays statistics for each protocol. By default, statistics of TCP, UDP, ICMP and IP are displayed. The p option can be used to specify the default subset.

-p protocol: displays the connection of the protocol specified by the protocol; The protocol can be tcp or udp. If used with the -s option to display statistics for each protocol, the protocol can be tcp, udp, icmp or ip.

-r: Displays the contents of the routing table.

Interval: redisplay the selected statistics, and pause for seconds between each display. Press CTRL+B to stop redisplaying statistics. If this parameter is omitted, netstat will print the current configuration information once.

Well, after reading these help files, we should understand how to use the netstat command. Now, let's learn to use it and use this command to view the open ports of our machine. Enter the command line and use the two parameters a and n of the netstat command:

c:\ & gt; Network statistical database

flexible connection

Original local address external address status

TCP 0.0.0.0:80 0.0.0.0:0 Monitoring

TCP 0.0.0.0:2 1 0.0.0.0:0 Monitoring

TCP 0.0.0.0:7626 0.0.0.0:0 Listening

UDP 0.0.0.0:445 0.0.0.0:0

UDP 0.0.0.0: 1046

UDP 0.0.0.0: 1047

Explain that Active Connections refers to the current local active connection, Proto refers to the protocol name used for connection, Local Address refers to the IP address of the local computer and the port number used for connection, Foreign Address refers to the IP address and port number of the remote computer connected to the port, and State indicates the status of TCP connection. You can see that the listening ports in the last three lines are all UDP protocols, so there is no state represented by state. Look! Port 7626 of my machine has been opened, and I am listening for the connection. In this case, it is very likely that I have infected the glacier! It is correct to cut off the network in a hurry and kill the virus with antivirus software.