Skip to content

Instantly share code, notes, and snippets.

@nsmith5
Created December 6, 2021 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsmith5/a119104e7601c8cb6ec40bf77f286f88 to your computer and use it in GitHub Desktop.
Save nsmith5/a119104e7601c8cb6ec40bf77f286f88 to your computer and use it in GitHub Desktop.
Grabbing a packet capture
# SSH to your remote machine
ssh host.example.com
# Install tcpdump if its not already available
apt install -y tcpdump
# Record a network packet capture
sudo tcpdump -w your-capture.pcap
# You can also narrow this down a low like this. Google around for the right command to filter
# out what you want. This example is only the traffic on the 'eth0' device, destination port 8080
# and TCP only.
sudo tcpdump -i eth0 -w your-other-capture.pcap dest port 8080 and tcp
# Now go back to your laptop
Ctrl+C
# And copy the pcap file back to it
sftp host.example.com
> get your-capture.pcap
> Ctrl+C
# Now open up wireshark and open this pcap file :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment