HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

ngrep — Filter network traffic packets using `regex`. More information: <https://github.com/jpr5/ngrep/blob/

Submitted by: @import:tldr-pages··
0
Viewed 0 times
filtercommandngreptrafficnetworkcliusingpackets

Problem

How to use the ngrep command: Filter network traffic packets using regex. More information: <https://github.com/jpr5/ngrep/blob/master/EXAMPLES.md>.

Solution

ngrep — Filter network traffic packets using regex. More information: <https://github.com/jpr5/ngrep/blob/master/EXAMPLES.md>.

Capture traffic of all interfaces:
ngrep -d any


Capture traffic of a specific interface:
ngrep -d {{eth0}}


Capture traffic crossing port 22 of interface eth0:
ngrep -d {{eth0}} port {{22}}


Capture traffic from or to a host:
ngrep host {{www.example.com}}


Filter keyword 'User-Agent:' of interface eth0:
ngrep -d {{eth0}} '{{User-Agent:}}'

Code Snippets

Capture traffic of all interfaces

ngrep -d any

Capture traffic of a specific interface

ngrep -d {{eth0}}

Capture traffic crossing port 22 of interface eth0

ngrep -d {{eth0}} port {{22}}

Capture traffic from or to a host

ngrep host {{www.example.com}}

Filter keyword 'User-Agent:' of interface eth0

ngrep -d {{eth0}} '{{User-Agent:}}'

Context

tldr-pages: common/ngrep

Revisions (0)

No revisions yet.