Wireshark-過濾器-數據包解析
推薦閱讀:
過濾器
顯示過濾器 和 捕獲過濾器,倆者使用非常類似。
在Wireshark首頁未選定介面前可以輸入捕獲規則。
多個過濾要求可以用連接詞 &&
wireshark進行過濾時,按照過濾的語法可分為 協議過濾
和 內容過濾
。
對標準協議,既支援粗粒度的過濾如HTTP,也支援細粒度的、依據協議屬性值進行的過濾。
如
tcp.port==53、http.request.method=="GET"
對內容的過濾,既支援深度的字元串匹配過濾如 http contains "Server"
,也支援特定偏移處值的匹配過濾。
如
tcp[20:3] == 47:45:54
例子:
- 過濾IP和MAC地址
//ip 改成 eth,就是過濾 mac 地址
ip.addr == 8.8.8.8
ip.src == 8.8.8.8
ip.dst == 8.8.8.8
ip.addr == 10.0.0.0/16
- 過濾埠
//tcp 可以改成 udp
tcp.port == 9090
tcp.dstport == 9090
tcp.srcport == 9090
tcp.port >=1 and tcp.port <= 80
- 根據長度過濾
tcp.len >= 7 (tcp data length)
ip.len == 88 (except fixed header length)
udp.length == 26 (fixed header length 8 and data length)
frame.len == 999 (all data packet length)
- HTTP數據包過濾
http.host == xxx.com
// 過濾 host
http.response == 1
// 過濾所有的 http 響應包
http.response.code == 302
// 過濾狀態碼 302
http.request.method==POST
// 過濾 POST 請求包
http.cookie contains xxx
// cookie 包含 xxx
http.request.uri=="/robots.txt"
//過濾請求的uri,取值是域名後的部分
http.request.full_uri=="//.com"
// 過濾含域名的整個url
http.server contains "nginx"
//過濾http頭中server欄位含有nginx字元的數據包
http.content_type == "text/html"
//過濾content_type是text/html
http.content_encoding == "gzip"
//過濾content_encoding是gzip的http包
http.transfer_encoding == "xx"
//根據transfer_encoding過濾
http.content_length == 279
http.content_length_header == "279"
//根據content_length的數值過濾
http.request.version == "HTTP/1.1"
//過濾HTTP/1.1版本的http包,包括請求和響應
- 可用協議
tcp、udp、arp、icmp、http、smtp、ftp、dns、msnms、ip、ssl、oicq、bootp
數據包解析
Packet Details Pane(數據包詳細資訊), 在數據包列表中選擇指定數據包,在數據包詳細資訊中會顯示數據包的所有詳細資訊內容。
數據包詳細資訊面板是最重要的,用來查看協議中的每一個欄位。各行資訊分別為:
(1)Frame: 物理層的數據幀概況
(2)Ethernet II: 數據鏈路層乙太網幀頭部資訊
(3)Internet Protocol Version 4: 互聯網層IP包頭部資訊
(4)Transmission Control Protocol: 傳輸層T的數據段頭部資訊
(5)Hypertext Transfer Protocol: 應用層的資訊
從下圖可以看到Wireshark捕獲到的數據包中的每個欄位:
參考
-
Wireshark-入門到超神
-
顯示過濾器-//www.cnblogs.com/v1vvwv/p/Wireshark-filtering-rules.html
-
數據分析-//cloud.tencent.com/developer/article/1908893?from=article.detail.1380105