Skip to main content
Snort can operate in several distinct modes depending on what you pass on the command line. Without a config file, Snort acts as a packet sniffer. With -c snort.lua, it activates intrusion detection. Using the afpacket DAQ with a bridged interface pair enables inline blocking.
Without a configuration file, Snort reads or captures packets and optionally dumps them to the console. No detection or alerting occurs.Read a pcap and display statistics:
snort -r a.pcap
Dump all packets to stdout:
snort -r a.pcap -L dump
Dump packets including application payload (-d) and layer 2 headers (-e):
snort -r a.pcap -L dump -d -e
Command line flags must be specified separately. snort -de will not work, but snort -Ldump will.
Dump all pcaps in a directory matching a filter:
snort --pcap-dir /path/to/pcap/dir --pcap-filter '*.pcap' -L dump -d -e
Log packets from a directory to a log directory:
snort --pcap-dir /path/to/pcap/dir --pcap-filter '*.pcap' -L dump -l /path/to/log/dir
Capture live traffic from an interface:
snort -i eth0 -L dump
Use -n <count> to limit the number of packets captured. For live capture, press Ctrl-C to stop.
Capture and save 10 packets to a pcap file:
snort -i eth0 -L pcap -n 10
Snort writes to log.pcap.<timestamp>. You can then read it back with -r.