目次 †
セットアップ †
インストール †
使い方 †
概要 †
基本形 †
- HTTPのGETを抽出
# ngrep -q GET
interface: eth0 (127.0.0.1/255.255.255.255)
match: GET
T 122.220.231.146:34359 -> 115.146.24.152:80 [AP]
GET / HTTP/1.1..Host: www.ebisawa.co.jp..Connection: keep-alive..Accept: application/xml,application/xhtml+xml,text
/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5..User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) Apple
WebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10..Accept-Encoding: gzip,deflate,sdch..Accept-Lang
uage: ja,en-US;q=0.8,en;q=0.6..Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.3..Cookie: __utmz=241295958.1294292936.1
.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=241295958.1706058868.1294292936.1294292936.1294292936.1; _
_utmc=241295958; __utmb=241295958.3.10.1294292936; aqusr=JPD1SV12.410258BB021AB34581....
- 特定の文字を含むHTTP通信を改行で区切って出力
# ngrep 'ebisawa' -d eth0 -t port 80 -W byline
interface: venet0:0 (115.146.24.152/255.255.255.255)
filter: (ip) and ( tcp port 80 )
match: ebisawa
####
T 122.220.231.146:59996 -> 115.146.24.152:80 [AP]
GET /favicon.ico HTTP/1.1.
Host: www.ebisawa.co.jp.
Connection: keep-alive.
Accept: */*.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: ja,en-US;q=0.8,en;q=0.6.
Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.3.
.
フィルタのかけ方 †
- TCPポート番号80
# ngrep -d eth0 tcp port 80 -W byline
- 送信元IP
# ngrep -d eth0 src 192.168.1.1 -W byline
- 送信先IP
# ngrep -d eth0 dst 192.168.1.1 -W byline
- (AND)送信元IPとポート80
# ngrep -d eth0 src 203.183.222.225 and tcp port 80 -W byline
オプション †
- -d <device>
- インターフェイスを指定
- -W byline
- 改行を入れて出力
- -q
- 余計な情報を表示しない
|