CmdID

CmdID / Commands

netstat

Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). Windows commands reference

On Windows, Linux, macOS 11 Sigma rules name it File netstat.exe

Opens CmdID with your command. It is read in your browser and sent nowhere.

Windows

from the Windows commands reference, CC BY 4.0

Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols). Used without parameters, this command displays active TCP connections. IMPORTANT: This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.

netstat [-a] [-b] [-e] [-n] [-o] [-p <Protocol>] [-q] [-r] [-s] [<interval>]
netstat -e -s
netstat -s -p tcp udp
netstat -o 5
netstat -n -o
netstat -anobq
-aDisplays all active TCP connections and the TCP and UDP ports on which the computer is listening.
-eDisplays Ethernet statistics, such as the number of bytes and packets sent and received. This parameter can be combined with -s.
-nDisplays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names.
-oDisplays active TCP connections and includes the process ID (PID) for each connection. You can find the application based on the PID on the Processes tab in Windows Task Manager. This parameter can be combined with -a, -n, and -p.
-p <Protocol>Shows connections for the protocol specified by Protocol. In this case, the Protocol can be tcp, udp, tcpv6, or udpv6. If this parameter is used with -s to display statistics by protocol, Protocol can be tcp, udp, icmp, ip, tcpv6, udpv6, icmpv6, or ipv6.
-qDisplays all connections, listening ports, and bound nonlistening TCP ports. Bound nonlistening ports may or may not be associated with an active connection.
-sDisplays statistics by protocol. By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols. If the IPv6 protocol is installed, statistics are shown for the TCP over IPv6, UDP over IPv6, ICMPv6, and IPv6 protocols. The -p parameter can be used to specify a set of protocols.
-rDisplays the contents of the IP routing table. This is equivalent to the route print command.
<interval>Redisplays the selected information every interval seconds. Press CTRL+C to stop the redisplay. If this parameter is omitted, this command prints the selected information only once.
/?Displays help at the command prompt.

Linux

from the toybox, 0BSD

Display networking information. Default is netstat -tuwx

netstat [-pWrxwutneal]
-rRouting table
-aAll sockets (not just connected)
-lListening server sockets
-tTCP sockets
-uUDP sockets
-wRaw sockets
-xUnix sockets
-eExtended info
-nDon't resolve names
-WWide display
-pShow PID/program name of sockets

Several platforms

from tldr-pages, CC BY 4.0

Display network-related information such as open connections, open socket ports, etc.

List all ports

netstat --allIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

List all listening ports

netstat --listeningIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

List listening TCP ports

netstat --tcpIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

Display PID and program names

netstat --programIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

List information continuously

netstat --continuousIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

List routes and do not resolve IP addresses to hostnames

netstat --route --numericIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

List listening TCP and UDP ports (+ user and process if you're root)

netstat --tcp --udp --listening --program --numeric --extendIdentify

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

Display network-related information such as open connections, open socket ports, etc.

Display the PID and program name listening on a specific protocol

netstat -p protocolIdentify
-pShow PID/program name of sockets toybox

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

Print the routing table and do not resolve IP addresses to hostnames

netstat -nrIdentify
-nDon't resolve names toybox
-rRouting table toybox

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

Print the routing table of IPv4 addresses

netstat -nr -f inetIdentify
-nDon't resolve names toybox
-rRouting table toybox

Trips 3 Sigma rules: lowSystem Network Connections Discovery - Linux by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Connections Discovery - MacOs by Daniil Yugoslavskiy, oscd.community; informationalSystem Network Discovery - Linux by Ömer Günal and remotephone, oscd.community

Windows

from tldr-pages, CC BY 4.0

Display active TCP connections, ports on which the computer is listening, network adapter statistics, the IP routing table, IPv4 statistics, and IPv6 statistics.

Display active TCP connections

netstatIdentify

Display all active TCP connections and the TCP and UDP ports on which the computer is listening

netstat -aIdentify
-aDisplays all active TCP connections and the TCP and UDP ports on which the computer is listening. Windows commands reference

Display network adapter statistics, such as the number of bytes and packets sent and received

netstat -eIdentify
-eDisplays Ethernet statistics, such as the number of bytes and packets sent and received. Windows commands reference

Display active TCP connections and express addresses and port numbers numerically

netstat -nIdentify
-nDisplays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names. Windows commands reference

Display active TCP connections and include the process ID (PID) for each connection

netstat -oIdentify
-oDisplays active TCP connections and includes the process ID (PID) for each connection. Windows commands reference

Display the contents of the IP routing table

netstat -rIdentify
-rDisplays the contents of the IP routing table. Windows commands reference

Display statistics by protocol

netstat -sIdentify
-sDisplays statistics by protocol. Windows commands reference

Display a list of currently open ports and related IP addresses

netstat -anIdentify
-aDisplays all active TCP connections and the TCP and UDP ports on which the computer is listening. Windows commands reference
-nDisplays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names. Windows commands reference

What detects it

Sigma process creation rules that name netstat
criticalSuspicious Child Process Of Veeam DabataseNasreddine Bencherchali (Nextron Systems)
highLinux Suspicious Child Process from Node.js - React2ShellSwachchhanda Shrawan Poudel (Nextron Systems), Nasreddine Bencherchali
highLinux Webshell IndicatorsFlorian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
highSuspicious Child Process Of SQL ServerFPT.EagleEye Team, wagga
highSuspicious Child Process Of Wermgr.EXEFlorian Roth (Nextron Systems)
highWebshell Detection With Command Line KeywordsFlorian Roth (Nextron Systems), Jonhnathan Ribeiro, Anton Kutepov, oscd.community, Chad Hudson, Matt Anderson
lowSystem Network Connections Discovery - LinuxDaniil Yugoslavskiy, oscd.community
informationalSystem Network Connections Discovery - MacOsDaniil Yugoslavskiy, oscd.community
informationalSystem Network Discovery - LinuxÖmer Günal and remotephone, oscd.community
informationalSystem Network Discovery - macOSremotephone, oscd.community