LinuxCommandLibrary

ngrep

TLDR

Search packets for pattern

$ ngrep -q "[pattern]"
copy
Search on specific port
$ ngrep -d [eth0] "[pattern]" port [80]
copy
Search HTTP traffic
$ ngrep -q -W byline "[GET|POST]" port [80]
copy
Search specific host
$ ngrep -q "[pattern]" host [192.168.1.1]
copy
Show packet headers
$ ngrep -q -t "[pattern]"
copy
Read from pcap
$ ngrep -I [file.pcap] "[pattern]"
copy
Case insensitive
$ ngrep -qi "[pattern]"
copy

SYNOPSIS

ngrep [options] pattern [filter]

DESCRIPTION

ngrep is network grep. It searches network packets for patterns.
The tool matches regex in packet payloads. Like grep for network traffic.
ngrep searches network packets.

PARAMETERS

PATTERN

Regex pattern to match.
FILTER
BPF filter expression.
-q
Quiet mode.
-d IFACE
Interface to listen on.
-W MODE
Output mode (byline, single, none).
-i
Case insensitive.
-I FILE
Read from pcap file.
--help
Display help information.

CAVEATS

Requires root. Plaintext only. BPF filter support.

HISTORY

ngrep was created to provide grep-like functionality for network packet inspection.

SEE ALSO

tcpdump(1), grep(1), wireshark(1)

Copied to clipboard