首先使用下面命令獲取連接本服務(wù)到的ip列表。
netstat -anp|egrep 80|egrep "EST"|awk '{print $(NF-2)}' |cut -f 1 -d ":"
然后用python寫一個腳本實現(xiàn)通過IP獲取歸屬地。