Skip to content

Instantly share code, notes, and snippets.

@timhughes
Created February 2, 2021 01:17
Show Gist options
  • Save timhughes/ea9c8a2f0be4e384bb0480f0989ca0ec to your computer and use it in GitHub Desktop.
Save timhughes/ea9c8a2f0be4e384bb0480f0989ca0ec to your computer and use it in GitHub Desktop.
list ports opened in processes namespace
cat /proc/721/net/tcp |awk 'NR>1 {print $2}' | while read line ; do printf "%d.%d.%d.%d:%d\n" "0x${line:6:2}" "0x${line:4:2}" "0x${line:2:2}" "0x${line:0:2}" "0x${line:9:4}" ; done
@timhughes
Copy link
Author

Converts the hex ip:port to decimal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment