├── README.md └── port-ip-monitor.sh /README.md: -------------------------------------------------------------------------------- 1 | port-client-ip-monitor 2 | ====================== 3 | 4 | Use to monitor shadowsocks client ip. 5 | 6 | I use shadowsocks server with port_password. I set different port for different password so that I can distinguish the users. 7 | -------------------------------------------------------------------------------- /port-ip-monitor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # File: port-ip-monitor.sh 4 | # 5 | # Created: Wednesday, August 27 2014 by Hua Liang[Stupid ET] 6 | # 7 | 8 | filename="port-ip-monitor.log" 9 | regex="600[0-2][0-9]" # monitor 60000-60029 10 | 11 | date +"[%Y-%m-%d %H:%M:%S]" >> $filename 12 | netstat -anp | egrep $regex | grep -E "tcp.*ESTABLISHED" | awk '{print $4, $5}' | cut -d: -f2 | sort -u >> $filename 13 | --------------------------------------------------------------------------------