3 ms·
No I was trying to see it could use tools/binaries that come with MacOS.
by m348e912 2y ago
No I was trying to see it could use tools/binaries that come with MacOS.
- OutOfHere 2y agonetstat is now considered too old to be used in new code.
- m348e912 2y agoFair, but you'd think the latest most advanced model of GPT 4o1 (eg strawberry) would be able to successfully complete this task.
- m348e912 2y ago4o1 mini seems to have got it right. The trick is to give it minimal direction and let it do its thing. netstat -an | while IFS= read -r line; do ips=$(echo "$line" | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}|([a-fA-F0-9]{1,4}:){1,7}[a-fA-F0-9]{1,4}'); for ip in $ips; do clean_ip=$(echo "$ip" | cut -d'%' -f1); fqdn=$(dig +short -x "$clean_ip" | grep '\.'); if [ -n "$fqdn" ]; then line=$(echo "$line" | sed "s/$ip/$fqdn/g"); fi; done; echo "$line"; done