私のサーバーからGET
リクエストを計算しようとしています。ファイルに書き込む前にtsharkの結果をフィルタリングする方法は?
私はtshark
を使用します。 samples.pcap
:あなたは、私が最大サイズ1Gと名前を持つ1つのファイルにフィルタリングされた結果を格納するために定義されて見たよう
/usr/sbin/tshark -b filesize:1024000 -b files:1 \
'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' \
-w samples.pcap -R 'http.request.method == "GET"'
:私は実行
は、着信トラフィックをフィルタリングし、唯一GET
要求を取得するためのコマンドを追いました。私はPCAPファイルサイズの950mのを取得する10分の間、
3245 172.692247 1.1.1.1 -> 2.2.2.2 HTTP [TCP Retransmission] Continuation or non-HTTP traffic
3246 172.730928 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
3247 172.731944 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
3248 172.791934 1.1.1.1 -> 2.2.2.2 HTTP GET /services/client/client.php?cnc=13 HTTP/1.1
3249 172.825303 1.1.1.1 -> 2.2.2.2 HTTP HTTP/1.1 200 OK [Unreassembled Packet [incorrect TCP checksum]]
3250 172.826329 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
3251 172.826341 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
3252 172.826347 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
3253 172.826354 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
3254 172.826359 1.1.1.1 -> 2.2.2.2 HTTP Continuation or non-HTTP traffic
は、私は本当に大きなトラフィックを持っている:私はtshark stored all traffic there
ことが分かりのpcapファイルを開こうとすると
問題が、あります。それを解析するのに約4分かかります。私はそれを実行しようとする
興味深いのは、(しかし、/ tmpの下の)ローカルファイルに格納することなく、次のとおりです。
/usr/sbin/tshark \
'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' \
-R 'http.request.method == "GET"':
3.776587 1.1.1.1 -> 2.2.2.2 HTTP GET /services/client/client.php?cnc=13 HTTP/1.1
4.775624 1.1.1.1 -> 2.2.2.2 HTTP GET /services/client/clsWebClient.php HTTP/1.1
8.804702 1.1.1.1 -> 2.2.2.2 HTTP GET /services/client/client.php?cnc=13 HTTP/1.1
それは動作しますが、この場合には、私は/ tmpのいくつかの一時ファイルの下に持っています巨大なサイズの1G +です。
私は何かを見逃しましたか?
は========================================あなた
ありがとうございました===============
編集
ラースは-f
を追加するように求め:
sudo /usr/sbin/tshark -T fields -e 'http.request.uri contains "cnc=13"' \
-b filesize:1024000 -b files:1 \
-f 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' \
-w samples.pcap
は助けにはならない、まだすべての店舗をsamples.pcap交通量:
74 6.908388 172.20.0.23 -> 89.78.170.96 HTTP Continuation or non-HTTP traffic
75 6.908394 172.20.0.23 -> 89.78.170.96 HTTP Continuation or non-HTTP traffic
キャプチャフィルタ式に '-f'オプションを付けてみましたか? –
私は試しましたが、まだすべてのトラフィックを取得します。あなたは '-f'をどこに置いていますか? –
フィルタ式の直前、つまり '-f 'tcp ...' –