Last active
December 5, 2022 02:55
-
-
Save viz-prakash/047991e925751dc2acf4f2ed0e21dac5 to your computer and use it in GitHub Desktop.
Copy TCPDUMP capture to remote location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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