ngrep使用方法
ngrep 是grep(在文本中搜索字符串的工具)的網絡版,他力求更多的grep特征,
 用于搜尋指定的數據包。正由于安裝ngrep需用到libpcap庫, 所以支持大量的
 操作系統和網絡協議。能識別TCP、UDP和ICMP包,理解bpf的過濾機制。 
ngrep搜尋數據包
 ngrep 是grep(在文本中搜索字符串的工具)的網絡版,他力求更多的grep特征,
 用于搜尋指定的數據包。正由于安裝ngrep需用到libpcap庫, 所以支持大量的
 操作系統和網絡協議。能識別TCP、UDP和ICMP包,理解bpf的過濾機制。
 ngrep下載地址:http://ngrep.sourceforge.net/;
 libpcap下載地址:http://www.tcpdump.org/。
使用方法:()
usage: ngrep <-LhNXViwqpevxlDtTRM> <-IO pcap_dump> <-n num> <-d dev> <-A num>
 ???????????? <-s snaplen> <-S limitlen> <-W normal|byline|single|none> <-c cols>? 
???????????? <-P char> <-F file> <match expression> <bpf filter>
 ?? -h? is help/usage
 ?? -V? is version information
 ?? -q? is be quiet (don't print packet reception hash marks)靜默模式,如果沒有此開關,未匹配的數據包都以“#”顯示
?? -e? is show empty packets 顯示空數據包
 ?? -i? is ignore case??? 忽略大小寫
 ?? -v? is invert match 反轉匹配
 ?? -R? is don't do privilege revocation logic 
 ?? -x? is print in alternate hexdump format 以16進制格式顯示
 ?? -X? is interpret match expression as hexadecimal? 以16進制格式匹配
 ?? -w? is word-regex (expression must match as a word) 整字匹配
 ?? -p? is don't go into promiscuous mode 不使用混雜模式
 ?? -l? is make stdout line buffered
 ?? -D? is replay pcap_dumps with their recorded time intervals 
 ?? -t? is print timestamp every time a packet is matched在每個匹配的包之前顯示時間戳
 ?? -T? is print delta timestamp every time a packet is matched顯示上一個匹配的數據包之間的時間間隔
 ?? -M? is don't do multi-line match (do single-line match instead)僅進行單行匹配
 ?? -I? is read packet stream from pcap format file pcap_dump 從文件中讀取數據進行匹配
 ?? -O? is dump matched packets in pcap format to pcap_dump 將匹配的數據保存到文件
 ?? -n? is look at only num packets 僅捕獲指定數目的數據包進行查看
 ?? -A? is dump num packets after a match匹配到數據包后Dump隨后的指定數目的數據包
 ?? -s? is set the bpf caplen 
 ?? -S? is set the limitlen on matched packets
 ?? -W? is set the dump format (normal, byline, single, none) 設置顯示格式byline將解析包中的換行符
 ?? -c? is force the column width to the specified size 強制顯示列的寬度
 ?? -P? is set the non-printable display char to what is specified 
 ?? -F? is read the bpf filter from the specified file 使用文件中定義的bpf(Berkeley Packet Filter)
 ?? -N? is show sub protocol number 顯示由IANA定義的子協議號
 ?? -d? is use specified device (index) instead of the pcap default 使用哪個網卡,可以用-L選項查詢
 ?? -L? is show the winpcap device list index 查詢網卡接口
舉例:
C:\ngrep>ngrep.exe -d2 -N -q PASS
 interface: \Device\NPF_{ADAAEBF4-46FA-485E-B3EB-4ACB56285D80} (192.168.1.0/255.2
 55.255.0)
 match: PASS
T(6) 192.168.1.111:1717 -> 123.125.50.29:110 [AP]
 ? PASS 123456..
?
?
?
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
 
                            
                        - 上一篇: VMware出错 Reason Fail
- 下一篇: Delphi 字符串转十六进制
