抓包工具wireshark的操作使用

上一篇 / 下一篇  2017-09-27 15:48:19 / 个人分类:测试工具

一、wireshark的基本使用
1、选择网络,然后点击上方绿色符号:start,开始进行对该网络所有协议进行抓包。
2、过滤器中可输入条件,如协议为xml且源IP地址为指定IP地址,回车,返回结果。
3、查看某条数据包的具体内容:可双击该记录,或者右键follow tcp stream,可查看该数据包的包头、内容等。

二、wireshark过滤语句中常用的操作符

关键字有:eq,== 等于、ne,!= 不等于、gt,> 比…大、lt,< 比…小 ge,>= 大于等于、le,<= 小于等于 and,|| 且 or,&& 或 not,! 取反

: ! or “not” (去掉双引号)
: && or “and”
: || or “or”

另外还有contains和matches两个不常用的关键字,过滤效果不错。

“contains”过滤包含指定字符串的数据包。例如:

http.request.uri contains “/dll/test.htm?”
//过滤http请求的uri中含有/dll/test.htm?字段的请求信息

udp contains 81:60:03
//过滤包含81:60:03的udp数据包

http.request.uri matches “V4=..1″
//matches 匹配过滤条件中给定的正则表达式,支持与Perl兼容的正则表达式(PCRE)。

 http.host==magentonotes.com

http.host contains magentonotes.com
//过滤经过指定域名的http数据包,这里的host值不一定是请求中的域名

http.response.code==302
//过滤http响应状态码为302的数据包

http.response==1
//过滤所有的http响应包

http.request==1
//过滤所有的http请求,貌似也可以使用http.request

http.request.method==POST
//wireshark过滤所有请求方式为POST的http请求包,注意POST为大写

http.cookie contains guid
//过滤含有指定cookie的http数据包

http.request.uri==”/online/setpoint”
//过滤请求的uri,取值是域名后的部分

http.request.full_uri==” http://task.browser.360.cn/online/setpoint”
//过滤含域名的整个url则需要使用http.request.full_uri

http.server contains “nginx”
//过滤http头中server字段含有nginx字符的数据包

http.content_type == “text/html”
//过滤content_type是text/html的http响应、post包,即根据文件类型过滤http数据包

http.content_encoding == “gzip”
//过滤content_encoding是gzip的http包

http.transfer_encoding == “chunked”
//根据transfer_encoding过滤

http.content_length == 279
http.content_length_header == “279″
//根据content_length的数值过滤

http.server
//过滤所有含有http头中含有server字段的数据包

http.request.version == “HTTP/1.1″
//过滤HTTP/1.1版本的http包,包括请求和响应

http.response.phrase == “OK”

//过滤http响应中的phrase

三、捕捉UDP数据包

UDP协议分析常用过滤条件
ip.addr==192.168.0.1 //过滤ip地址
data.len==8 //过滤data部分长度为8的数据包
data.data == 00:08:30:03:00:00:00:00 //过滤指定内容的数据包

udp.srcport == 10092 //过滤经过本机10092端口的udp数据包
udp.dstport == 80 //过滤目标机器10092端口的udp数据包
udp.port==10092 //过滤本机或目标机器10092端口的数据包
udp.length == 20 //过滤指定长度的UDP数据包

UDP校验和过滤条件
udp.checksum == 0x250f
udp.checksum_good == 0 //Boolean类型
udp.checksum_bad == 0

进程相关的过滤条件

以下过滤条件不支持Windows,因为需要特殊的驱动。

udp.proc.dstcmd //过滤目标进程名
udp.proc.dstpid //过滤目标进程PID
udp.proc.dstuid //过滤目标进程的用户ID
udp.proc.dstuname //过滤目标进程的用户名
udp.proc.srccmd //过滤源进程名
udp.proc.srcpid //过滤源进程PID
udp.proc.srcuid //过滤源进程的用户ID
udp.proc.srcuname //过滤源进程的用户名

四、根据mac地址进行过滤

ether host 00:11:22:33:44:55 //过滤目标或源地址是00:11:22:33:44:55的数据包

ether dst host 00:11:22:33:44:55 //过滤目标地址是00:11:22:33:44:55的数据包

ether src host 00:11:22:33:44:55 //过滤源地址是00:11:22:33:44:55的数据包

eth.addr== 00:11:22:33:44:55 //过滤目标或源地址是00:11:22:33:44:55的数据包

eth.src== 00:11:22:33:44:55 //过滤源地址是00:11:22:33:44:55的数据包

eth.dst== 00:11:22:33:44:55 //过滤目标地址是00:11:22:33:44:55的数据包


TAG:

 

评分:0

我来说两句

Open Toolbar