04.03.2019, 08:00
You can run netstat from a script and log the results:
You'll get something similar to this:
This will show all active internal and external connections. localhost entries are internal, others are external.
Code:
res = io.readproc('netstat -tup')
log(res)
You'll get something similar to this:
Code:
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost:46306 localhost:6379 ESTABLISHED 1075/lua
tcp 0 52 192.168.1.10:ssh 192.168.1.204:51579 ESTABLISHED 1213/dropbear
tcp 0 0 192.168.1.10:www 192.168.1.204:51785 ESTABLISHED 1090/nginx: worker
tcp 0 0 localhost:6379 localhost:46306 ESTABLISHED 999/redis-server
tcp 0 0 localhost:46308 localhost:6379 TIME_WAIT -
tcp 0 0 192.168.1.10:www 192.168.1.204:51787 ESTABLISHED 1090/nginx: worker
udp 0 0 localhost:51645 127.255.255.255:6720 ESTABLISHED 993/eibd
udp 0 0 localhost:33733 127.255.255.255:1200 ESTABLISHED 1055/lua
This will show all active internal and external connections. localhost entries are internal, others are external.