Simple Ping sweep
for i in {1..254}; do ping -c 1 172.16.40.$i | grep 'from'; done
for i in {1..254} ; do (ping -c 1 10.23.42.$i | grep "ttl" |cut -d" " -f4 |cut -d":" -f1 &); done
ping -b -c 3 255.255.255.255 >/dev/null 2>&1; arp -an | awk '{print $2}'
Outbound port scan
telnet portquiz.net 23
UDP port forwarding
source: https://stackpointer.io/network/ssh-port-forwarding-tcp-udp/365/
client # ssh -L 5353:127.0.0.1:5353 -p 22 -l user proxy.example.com proxy # socat tcp4-listen:5353,reuseaddr,fork udp:localhost:53 client # socat -T15 udp4-recvfrom:53,reuseaddr,fork tcp:localhost:5353
Kill TCP connection
tested on MacOS 10.15 Catalina
lsof -i TCP:9878 | awk '/LISTEN/ {print $2}' | xargs kill -9