Skip to content

Instantly share code, notes, and snippets.

@viz-prakash
Last active December 5, 2022 02:55
Show Gist options
  • Save viz-prakash/047991e925751dc2acf4f2ed0e21dac5 to your computer and use it in GitHub Desktop.
Save viz-prakash/047991e925751dc2acf4f2ed0e21dac5 to your computer and use it in GitHub Desktop.
Copy TCPDUMP capture to remote location
#!/bin/bash
sudo pkill -9 -f tcpdump
while [ 1 ]
do
ip=`hostname -I | cut -f 1 -d ' '`
#exits after every 2 hrs
sudo tcpdump -i eth0 -G 7200 "host not $ip and not arp" -w - | ssh remote_location 'cat > ~/your_pcap_dir/`date +%F-%s`.pcap'
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment