Files
tldr/pages.zh/common/ngrep.md

24 lines
478 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ngrep
> 使用正则表达式过滤网络流量数据包。
> 更多信息:<https://github.com/jpr5/ngrep>。
- 捕获所有接口的流量:
`ngrep -d any`
- 捕获特定接口的流量:
`ngrep -d {{eth0}}`
- 捕获通过 eth0 接口的 22 端口的流量:
`ngrep -d {{eth0}} port {{22}}`
- 捕获来自或去往某个主机的流量:
`ngrep host {{www.example.com}}`
- 过滤 eth0 接口的关键字 'User-Agent:'
`ngrep -d {{eth0}} '{{User-Agent:}}'`