Wireshark
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 で見たいパケットだけをキャプチャすることが可能です。
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 アドレスに置き換えて下さい。