Linux netstat Alternative

boson 2d0842cd08 v1.3.1 FIX: Python Shebang 2 years ago
README.md 4603c9f098 v1.2 now with Python 2.x and 3.x support. 4 years ago
sinetstat 2d0842cd08 v1.3.1 FIX: Python Shebang 2 years ago

README.md

sinetstat

An alternative to the standard Linux netstat which shows you all network sockets including hidden IPv4 in IPv6 mapped.

Improvements to the original netstat command:

  • explore IPv4 in IPv6 listening sockets (IPv4-mapped IPv6 addresses)
  • shows real command and arguments
  • shows the UID of the command

This is a Python 2.x/3.x script.
For a full featured output the script needs root-privileges.

Simply try:

 # sinetstat -h
usage: sinetstat [-h] [-l] [-e] [-r] [-w] [-W] [-t] [-u] [-4] [-6]
netstat utility V1.2
2017-2019 by sigi https://wiki.zweiernet.ch/wiki/sinetstat
.
optional arguments:
  -h, --help  show this help message and exit
  -l          Only listening sockets
  -e          Only established sockets
  -r          Resolve IP-Addresses
  -w          Wide (show cmd)
  -W          Wider (show cmd with arguments)
  -t          Only TCP
  -u          Only UDP
  -4          Only IPv4
  -6          Only IPv6

.

A sample output:

Proto   Local Address             Remote Address            State        UID       PID     Program
-----   -------------             --------------            -----        ---       ---     -------
TCP4    0.0.0.0: 587              0.0.0.0: 0                LISTEN       root      22667   /usr/lib/postfix/master
TCP4    192.168.1.10: 53          0.0.0.0: 0                LISTEN       bind      2991    /usr/sbin/named
TCP4    0.0.0.0: 25               0.0.0.0: 0                LISTEN       root      19763   smtpd
TCP4    192.168.1.10: 993         0.0.0.0: 0                LISTEN       root      22714   /usr/sbin/dovecot
TCP4    0.0.0.0: 995              0.0.0.0: 0                LISTEN       root      22714   /usr/sbin/dovecot
TCP4in6 0.0.0.0: 80               ::: 0                     LISTEN       root      1200    /usr/sbin/apache2
TCP4in6 0.0.0.0: 443              ::: 0                     LISTEN       root      1200    /usr/sbin/apache2
TCP6    ::1: 10025                ::: 0                     LISTEN       root      22667   /usr/lib/postfix/master
TCP6    ::: 587                   ::: 0                     LISTEN       root      22667   /usr/lib/postfix/master
TCP6    ::: 80                    ::: 0                     LISTEN       root      1200    /usr/sbin/apache2
TCP6    ::: 53                    ::: 0                     LISTEN       bind      2991    /usr/sbin/named
TCP6    ::: 25                    ::: 0                     LISTEN       root      19763   smtpd
TCP6    ::: 443                   ::: 0                     LISTEN       root      1200    /usr/sbin/apache2
TCP6    ::: 995                   ::: 0                     LISTEN       root      22714   /usr/sbin/dovecot

(c) 2016 by Siegrist(SystemLoesungen)
Website: https://wiki.zweiernet.ch/wiki/Sinetstat

This program is free software under the terms of the GNU General Public License.

The program is based on a python netstat script that was written by da667 available on https://github.com/da667/netstat who had it adapted from Ricardo Pascal, available on http://voorloopnul.com/blog/a-python-netstat-in-less-than-100-lines-of-code.