- 3 kinds of packet capture
- Directly install Wireshark on the endpoint
- Pros
- Super easy
- Cons
- Often the machine is already stressed
- etc.
- SPAN/mirror port
- On a switch, mirror traffic to another interface with your device connected
- Easy to over-provision the port
- Network tap
- A physical device that sits on the wire and intercepts packets
- Couple hundred dollars, sometimes the client doesn't want the tap removed
- Capturing at multiple locations
- Often useful when troubleshooting network slowness
- Ideal to get a capture on both sides of the connection (client and server)
- Capture Filter (redux)
- If you really know what you're looking for, it can be helpful
- e.g., server side taps
- However, it's also easy to miss backend/alternate traffic that could be impacting the conversation
Start Capturing
- Upon bootup, it will grab all interfaces and preview them
- Click the blue shark fin at the top left, and it will begin capturing
- Wireshark will only stop capturing when you manually stop capturing or system failure (loss of power, full storage, etc.)
Capture Options
- Capture>Options
- Input tab
- Promiscuous mode enables you to capture packets that are not destined for your machine
- Snaplength
- Normally set default, and you can set how much you capture
- Helpful if you are working in a secure environment, where you should not have access to the data in transit
- Also reduces pcap size
- Long-term capture, intermittent, and cybersecurity issues
- Helpful for triaging intermittent issues or network threats
Modify Output
- Capture>Options>Output
- Capture to a permanent file
- Name the file
- Create a new file automatically... to choose when a new file is created (recommended)
- Chris recommends doing it with 500 megabytes (about 50Gb), but you can choose increments based on packet count, size, and time
- Ring Buffer
- When creating a new PCAP file, it will delete the oldest PCAP in the series beyond the buffer
Capturing packets via CLI with Dumpcap
- Dumpcap super helpful on CLI-only environments
- Linux servers, etc.
- Dumpcap on Windows
- Dumpcap gets installed with Wireshark along with several other tools
> cd C:\Program Files\Wireshark
- rawshark.exe, tshark.exe, dumpcap.exe
- Add folder to path
- Control Panel>System>Advanced System Settings>Environment Variables
- Add path to Wireshark folder
- Dumpcap commands
dumpcap -help
- Shows list of all possible commands
dumpcap -D
- List all available interfaces to capture from
dumpcap -i <interface number>
- Begin dumpcap targeting the interface you want to capture
dumpcap -w <pcap file>
- Enter the pcap file and directory you want to write to
dumpcap -b <ring-buffer options>
- Configure the pcap options
- duration:NUM - switch to next file after NUM secs
- filesize:NUM - switch to next file after NUM kB
- files:NUM - ringbuffer: replace after NUM files
- packets:NUM - ringbuffer: replace after NUM packets
- interval:NUM - switch to next file when the time is an exact multiple of NUM secs
- printname:FILE - print filename to FILE when written (can use 'stdout' or 'stderr')