Linux netstat Alternative

sigi abed02a101 v1.1 runs with non-root privigeges. 2 years ago
README.md abed02a101 v1.1 runs with non-root privigeges. 2 years ago
sinetstat ffb35b18d3 v1.1 runs with non-root privigeges. 2 years ago

README.md

sinetstat

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

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 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.0
2017 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.

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.