コンテンツにスキップ

Wireshark

提供: ArchWiki
2021年1月31日 (日) 14:59時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (→通常ユーザーでキャプチャ: 全面的に書きかえられているので、英語版に差し替え)

Wireshark はフリーでオープンソースのパケットアナライザです。ネットワークのトラブルシューティングや解析、ソフトウェアと通信プロトコルの開発、または教育などに使われています。

インストール

Wireshark GUI の場合は wireshark-qt パッケージをインストールし、tshark CLIの場合は wireshark-cli をインストールします。

Capturing privileges

Do not run Wireshark as root, it is insecure. Wireshark has implemented privilege separation, which means that the Wireshark GUI (or the tshark CLI) can run as a normal user while the dumpcap capture utility runs as root[1].

The wireshark-cli install script sets packet capturing capabilities on the /usr/bin/dumpcap executable.

/usr/bin/dumpcap can only be executed by root and members of the wireshark group, therefore to use Wireshark as a normal user you have to add your user to the wireshark user group (see Users and groups#Group management).

キャプチャのテクニック

フィルターを適用することで Wireshark で見たいパケットだけをキャプチャすることが可能です。

ノート フィルターの構文については、pcap-filter(7) や wireshark-filter(4) の man ページを見て下さい。

TCP パケットを抽出

TCP パケットを全て閲覧したい場合、"Filter" バーに tcp と入力してください。もしくは CLI 版の場合:

$ tshark -f "tcp"

UDP パケットを抽出

UDP パケットを全て閲覧したい場合、"Filter" バーに udp と入力してください。もしくは CLI 版の場合:

$ tshark -f "udp"

特定の IP アドレスのパケットを抽出

  • 特定のアドレスに送信されるトラフィックを全て閲覧したい場合、ip.dst == 1.2.3.4 と入力してください。1.2.3.4 はトラフィックの送信先の IP アドレスに置き換えて下さい。
  • 特定のアドレスから送られたトラフィックを全て閲覧したい場合、ip.src == 1.2.3.4 と入力してください。1.2.3.4 はトラフィックの送信元の IP アドレスに置き換えて下さい。
  • 特定のアドレスから送受信されるトラフィックを全て閲覧したい場合、ip.addr == 1.2.3.4 と入力してください。1.2.3.4 は適当な IP アドレスに置き換えて下さい。