如何設定 Wireshark 僅記錄 DNS 請求?

如何設定 Wireshark 僅記錄 DNS 請求?

這有效:

tethereal -i eth0 -w /root/mycapture.pcap

但它捕獲每個資料包。我只需要捕獲 DNS 請求。這可能嗎?伺服器是Linux。

另一件事是:是否可以透過網路將檔案保存到另一台電腦上?伺服器只有一個小硬碟,不足以容納擷取檔案。

謝謝。

答案1

使用指定捕獲過濾器-f "port 53"

附註:是tshark現在,不再是tethereal了。


要在本地捕獲資料但將資料儲存在遠端伺服器上,請使用-/dev/stdout作為輸出文件,並將命令透過管道傳輸到ssh

tshark -i eth0 -f "port 53" -l -w - | ssh otherhost "cat > foo.pcap"

tcpdump -i eth0 -f "port 53" -l -w - | ssh otherhost "cat > foo.pcap"

您也可以執行相反的操作 - 在遠端伺服器上捕獲但在本地儲存資料:

ssh otherhost "tshark -i eth0 -f "port 53" -l -w -" > foo.pcap

ssh otherhost "tcpdump -i eth0 -f "port 53" -l -w -" > foo.pcap

筆記:總是儲存這樣的資料時指定捕獲過濾器。如果不這樣做,每個資料包都會導致無限循環。

相關內容