Ngrep 便利的数据包匹配和显示工具
发布时间:2022-04-22 09:17:56 所属栏目:安全 来源:互联网
导读:ngrep 是grep(在文本中搜索字符串的工具)的网络版,他力求更多的grep特征,用于搜寻指定的数据包。正由于安装ngrep需用到libpcap库,所以支持大量的操作系统和网络协议。能识别TCP、UDP和ICMP包,理解bpf的过滤机制。 复制 iron_gavel$ngrep -qd rl0 (同时在
ngrep 是grep(在文本中搜索字符串的工具)的网络版,他力求更多的grep特征,用于搜寻指定的数据包。正由于安装ngrep需用到libpcap库,所以支持大量的操作系统和网络协议。能识别TCP、UDP和ICMP包,理解bpf的过滤机制。 复制 iron_gavel$ngrep -qd rl0 (同时在另一控制台$mazilla http://www.google.com) U 10.178.41.31:1054 ->; 211.98.2.4:53 .............www.google.com..... T 216.239.57.104:80 ->; 10.178.41.31:1029 [AFP] HTTP/1.0 302 Found..Location: http://www.google.com/intl/zh-CN/..Set-Cookie 复制 iron_gavel$ngrep -iw 'lynx' interface: rl0 (10.178.41.0/255.255.255.0) match: ((^lynxW)|(Wlynx$)|(WlynxW)) T 10.178.41.31:1050 ->; 64.233.161.99:80 [AP] GET / HTTP/1.0 Accept-Language: en..User-Agent: Lynx/2.8.4rel.1 l ibwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7c.... 匹配进出数据包中包括lynx(参数"i"忽略大小写)的信息。 iron_gavel$ngrep host 10.178.41.5/*看看对面的同事在干嘛*/ interface: rl0 (10.178.0.0/255.255.0.0) filter: ip and ( host 10.178.41.5 ) T 10.178.41.5:2035 ->; 61.153.48.247:80 [AP] GET /show.asp HTTP/1.1..Host: www.music9999.com. .Connection: Keep-Alive..Referer: http://www.music9999.com/.... T 219.133.40.79:7204 ->; 10.178.41.5:1115 [AP] 做为sinffer的用法: 可以用ngrep来匹配特定的数据包: 复制 iron_gavel$ngrep '' udp /*匹配udp包*/ iron_gavel$ngrep '' icmp/*匹配icmp包*/ iron_gavel$ngrep '' port 53 /*显示所有的dns请求*/ iron_gavel$ngrep '../'/*监听远程主机的'../'请求*/ iron_gavel$ngrep -d rl0 port 80/*服务器端http数据*/ iron_gavel$ngrep -d rl0 'error' port syslog/**/ 下面是一些常用的参数: ngrep -v '' port 23 显示除telnet的数据包,-v意为反转。 ngrep -d eth0 '' 在redhat上显示所有的数据包,-d 指定硬件接口。 (编辑:PHP编程网 - 黄冈站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |