Quick Linux Tip #120:
Question: A rogue script is calling an external API. How do I find and stop it?
Try: sudo ss -tnp dst 203.0.113.45
Info: Filters socket connections by destination IP to expose associated processes and PIDs for immediate termination.
Examples:
- $
sudo ss -tnp 'dst 192.168.1.0/24'# Filter connections targeting an entire subnet - $
sudo lsof -i @203.0.113.45# Inspect active network sockets using lsof - $
sudo iptables -I OUTPUT -d 203.0.113.45 -j DROP# Block outbound traffic at the firewall level
Note: If terminated processes respawn instantly, inspect parent processes using pgrep -P. Firewall rules provide more durable blocking than process termination.
Leave a Reply