githubEdit

Packet Scanning

tcpdump

# Basic capture
tcpdump -i eth0
tcpdump -c 100 -i eth0                    # Capture 100 packets
tcpdump -A -i eth0                         # Print packets in ASCII
tcpdump -XX -i eth0                        # Print packets in HEX and ASCII
tcpdump -w capture.pcap -i eth0            # Write to file
tcpdump -r capture.pcap                    # Read from file
tcpdump -n -i eth0                         # Don't resolve hostnames
tcpdump -nn -i eth0                        # Don't resolve hostnames or ports

# Filter by port/host
tcpdump -i eth0 port 22
tcpdump -i eth0 port 80 or port 443
tcpdump -i eth0 src 172.21.10.X
tcpdump -i eth0 dst 172.21.10.X
tcpdump -i eth0 host 10.10.10.10
tcpdump -i eth0 net 192.168.1.0/24

# Filter by protocol
tcpdump -i eth0 icmp
tcpdump -i eth0 tcp
tcpdump -i eth0 udp

# Complex filters
tcpdump -i eth0 'tcp[tcpflags] & (tcp-syn) != 0'     # SYN packets
tcpdump -i eth0 'tcp[tcpflags] & (tcp-rst) != 0'     # RST packets
tcpdump -i eth0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'  # HTTP with data

# Capture credentials (unencrypted)
tcpdump -i eth0 -A port 21 or port 23 or port 110 or port 143

# Online service
https://packettotal.com/

Wireshark / tshark

Protocol-specific analysis

Credential extraction

Encrypted traffic analysis

Network forensics

Last updated

Was this helpful?