You are not logged in.
I use it for my status bar.
ss -n -a -t -u |\
awk '{print $6}' |\
grep -o '^[0-9]\{2,3\}\.[0-9.]*' |\
grep -v '^127\.0\.0\.1' |\
sort -u |\
parallel 'geoiplookup {}' |\
sed 's/[^:]*: \([A-Z]*\),.*/\L\1/' |\
sort -u
Requires the *geoip* package and *parallel*.
Sample output
us
fr
cn
Regards.
EDIT: added a sort -u to avoid looking for the same ip more than once.
EDIT: less processes
Last edited by pepeapepepe (2015-09-26 01:27:59)
.--.-.... --. .-.-.-..-.-..--....- .- .-...-... --..-..-... -.-.----. ..-.. ...------....-...-.-----..-- .-....---.-..- --. .-.-.-..-.-.--- .-...-... --..-..-... -.-.----. .-...- -......-...-...-..-..-
Offline
-a includes -t and -u so you can shorten that call to `ss -an`. Other than that, it doesn't look too bad
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
-a includes -t and -u so you can shorten that call to `ss -an`. Other than that, it doesn't look too bad
Hi fukawi2,
Thanks for the feedback. It seems that `ss -an` is not equivalent to `ss -n -a -t -u` as I could see using:
diff <(ss -an) <(ss -n -a -t -u)
In particular `-an` seems to be includig other non TCP nor UDP connections (I think).
Cheers.
Last edited by pepeapepepe (2015-09-25 00:01:03)
.--.-.... --. .-.-.-..-.-..--....- .- .-...-... --..-..-... -.-.----. ..-.. ...------....-...-.-----..-- .-....---.-..- --. .-.-.-..-.-.--- .-...-... --..-..-... -.-.----. .-...- -......-...-...-..-..-
Offline
Sorry, you're right. I think what I meant to say was you don't need -a, since only -t and -u will have IP addresses associated with the connection.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline