【匯總】Wireshark 過濾規則



作者:Bay0net
時間:2019-07-01 14:20:09
更新:
介紹:記錄使用過的 wireshark 過濾規則


0x01、 使用介紹

抓包采用 wireshark,提取特征時,要對 session 進行過濾,找到關鍵的stream,這里總結了 wireshark 過濾的基本語法,供自己以后參考。(腦子記不住東西)

wireshark進行過濾時,按照過濾的語法可分為 協議過濾內容過濾

對標准協議,既支持粗粒度的過濾如HTTP,也支持細粒度的、依據協議屬性值進行的過濾
tcp.port==53、http.request.method=="GET"

對內容的過濾,既支持深度的字符串匹配過濾如 http contains "Server"
也支持特定偏移處值的匹配過濾如 tcp[20:3] == 47:45:54

0x02、過濾規則

過濾 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
// 過濾狀態碼 202

http.request.method==POST 
// 過濾 POST 請求包

http.cookie contains xxx
// cookie 包含 xxx

http.request.uri=="/robots.txt"
//過濾請求的uri,取值是域名后的部分

http.request.full_uri=="http://1.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 == "chunked"
//根據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

0x03、知識學習

IP 報文

三次握手

實戰

Reference

Wireshark User’s Guide

TCP三次握手和四次握手 - vplus - 博客園

從實戰角度,對TCP的“三次握手”過程詳細分析 - coder_vivid - CSDN博客


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM