jpskill.com
📦 その他 コミュニティ

wireshark

Wiresharkやtsharkを使ってネットワークの通信データを解析し、パケットのキャプチャ、プロトコルのデバッグ、ファイル抽出、TLSハンドシェイクの確認、ネットワーク遅延のトラブルシューティングなど、ネットワークに関する様々な問題を解決するSkill。

📜 元の英語説明(参考)

Capture and analyze network traffic with Wireshark and tshark. Use when a user asks to sniff packets, debug a protocol, extract files from PCAPs, inspect TLS handshakes, troubleshoot network latency, or triage a CTF PCAP challenge.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Wiresharkやtsharkを使ってネットワークの通信データを解析し、パケットのキャプチャ、プロトコルのデバッグ、ファイル抽出、TLSハンドシェイクの確認、ネットワーク遅延のトラブルシューティングなど、ネットワークに関する様々な問題を解決するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o wireshark.zip https://jpskill.com/download/15570.zip && unzip -o wireshark.zip && rm wireshark.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15570.zip -OutFile "$d\wireshark.zip"; Expand-Archive "$d\wireshark.zip" -DestinationPath $d -Force; ri "$d\wireshark.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して wireshark.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → wireshark フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Wireshark

概要

Wireshark は、最も普及しているパケットアナライザです。3000 以上のプロトコルをデコードでき、「なぜこの API は遅いのか?」から「この PCAP から流出した ZIP ファイルを抽出する」まで、あらゆることのリファレンスとなります。tshark は CLI のコンパニオンツールです。スクリプトや SSH 経由、またはキャプチャが GUI には大きすぎる場合に使用します。キャプチャフィルタ (BPF) はキャプチャ時にトラフィックを絞り込み、表示フィルタは後で表示内容を絞り込みます。

手順

ステップ 1: トラフィックのキャプチャ

# インターフェースの一覧表示
tshark -D
# 1. eth0
# 2. wlan0
# 3. lo (Loopback)

# ローリングリングバッファへのキャプチャ (ディスクをいっぱいにする心配はありません)
sudo tshark -i eth0 -b filesize:100000 -b files:10 -w capture.pcapng
# filesize は KB 単位です。最後の 10 × 100MB ファイルを保持します

# BPF キャプチャフィルタを使用して、関連するトラフィックのみをキャプチャ
sudo tshark -i eth0 -f "host 10.0.0.5 and port 443" -w target.pcapng

# パケット数制限付きでキャプチャ
sudo tshark -i eth0 -c 1000 -w sample.pcapng

# SSH 経由でサーバー上で、ローカルの Wireshark にパイプ
ssh user@host "sudo tcpdump -U -s0 -w - 'not port 22'" | wireshark -k -i -

ステップ 2: GUI または CLI でフィルタ

# 表示フィルタ (キャプチャフィルタとは異なる構文です!)
# キャプチャフィルタ: "tcp port 80"
# 表示フィルタ: "tcp.port == 80"

# PCAP を読み込み、表示フィルタを適用
tshark -r capture.pcapng -Y "http.request.method == POST"
tshark -r capture.pcapng -Y "ip.src == 10.0.0.5 and tcp.flags.syn == 1"
tshark -r capture.pcapng -Y "dns.qry.name contains \"example.com\""
tshark -r capture.pcapng -Y "tls.handshake.type == 1"  # Client Hello

# 一般的な表示フィルタのチートシート
# http.request.uri contains "login"
# tcp.analysis.retransmission
# frame.time >= "2026-04-11 12:00:00"
# !(arp or icmp or dns)

ステップ 3: 役立つフィールドの抽出

# grep/awk/jq パイプライン用に、特定のフィールドを TSV として抽出
tshark -r capture.pcapng -T fields \
  -e frame.time -e ip.src -e ip.dst -e tcp.dstport -e http.host -e http.request.uri \
  -Y "http.request" -E header=y -E separator=,
# 出力: pandas または ClickHouse にロードできる CSV

# トップトーカー
tshark -r capture.pcapng -q -z conv,ip | head -20

# HTTP リクエストリスト
tshark -r capture.pcapng -q -z http,tree

# TLS サーバー名 (SNI) — クライアントがアクセスしたホストを明らかにします
tshark -r capture.pcapng -Y "tls.handshake.type == 1" \
  -T fields -e tls.handshake.extensions_server_name | sort -u

ステップ 4: ファイルと認証情報の抽出 (所有している PCAP から)

# HTTP オブジェクト (画像、スクリプト、ダウンロード) のエクスポート
tshark -r capture.pcapng --export-objects http,./http-objects/
ls http-objects/

# FTP-DATA 転送の抽出
tshark -r capture.pcapng --export-objects ftp-data,./ftp-files/

# SMB ファイル転送の抽出
tshark -r capture.pcapng --export-objects smb,./smb-files/

# TCP ストリームの再構築 (例: 暗号化されていないプロトコルのダンプ)
tshark -r capture.pcapng -q -z follow,tcp,ascii,0
# 0 はストリームインデックスです — 最初に -Y "tcp.stream eq 0" で見つけてください

ステップ 5: TLS の復号化 (正当に制御しているキーを使用)

# クライアント側: ブラウザを起動する前に SSLKEYLOGFILE を設定
export SSLKEYLOGFILE=~/tls-keys.log
firefox &
# すべてのセッションキーは、ブラウザが TLS をネゴシエートする際に追記されます

# Wireshark で: 編集 → 設定 → プロトコル → TLS → "(Pre)-Master-Secret ログファイル名"
# または CLI 経由で:
tshark -r traffic.pcapng -o tls.keylog_file:~/tls-keys.log \
  -Y "http.request" -T fields -e http.host -e http.request.uri

例 1: 遅い API 呼び出しの診断

# API ホストへのクライアントのトラフィックをキャプチャ
sudo tshark -i eth0 -f "host api.example.com and port 443" -w slow-api.pcapng -a duration:60

# 再送信と RTT の問題を検索
tshark -r slow-api.pcapng -q -z io,stat,1,"tcp.analysis.retransmission"
tshark -r slow-api.pcapng -Y "tcp.analysis.retransmission or tcp.analysis.duplicate_ack" \
  -T fields -e frame.time -e ip.src -e ip.dst -e tcp.seq

# 高レイテンシの会話を特定
tshark -r slow-api.pcapng -q -z conv,tcp | sort -k6 -n -r | head

例 2: CTF — PCAP チャレンジからファイルを抽出

# 簡単なトリアージ
tshark -r challenge.pcap -q -z io,phs    # プロトコル階層
tshark -r challenge.pcap -q -z conv,tcp  # 会話

# FTP で何か面白いこと
tshark -r challenge.pcap -Y "ftp.request.command == \"RETR\"" \
  -T fields -e ftp.request.arg

# 転送されたファイルをプル
tshark -r challenge.pcap --export-objects ftp-data,./ftp/
file ./ftp/*
# flag.zip: Zip アーカイブデータ, 少なくとも v2.0

ガイドライン

  • 許可されたもののみをキャプチャしてください。 共有ネットワークでは、他のユーザーからのトラフィックは、ROE で別段の定めがない限り、許可されていません。
  • キャプチャフィルタは BPF 構文 (tcp port 443) です。表示フィルタは Wireshark 独自の構文 (tcp.port == 443) です。これらを混同することが、初心者の最大のミスです。
  • 長いキャプチャの場合は、ディスクがいっぱいにならないように、常にリングバッファ (-b filesize:N -b files:N) を使用してください。
  • .pcap よりも .pcapng が推奨されます。インターフェースのメタデータ、コメント、およびパケットごとのアノテーションが格納されます。
  • 大きなキャプチャは tshark または editcap に適しています。GUI は ~1GB を超えると処理が遅くなります。editcap -c 100000 を使用して分割してください。
  • TLS 復号化には、クライアントプロセスからのキーログファイルが必要です。それなしに任意の TLS セッションを復号化することはできません。
  • 長期的なパケットストレージには、サーバー上で tcpdump -U -w を使用し、Wireshark でオフラインで分析します。
  • コンパニオンツール: tcpdump (より軽量なキャプチャ)、mergecap (PCAP の結合)、editcap (スライス)、capinfos (サマリー)。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Wireshark

Overview

Wireshark is the dominant packet analyzer. It decodes 3000+ protocols and is the reference for anything from "why is this API slow?" to "extract the exfiltrated ZIP from this PCAP." tshark is the CLI companion — use it in scripts, over SSH, or when the capture is too large for the GUI. Capture filters (BPF) trim traffic at capture time; display filters refine what you see afterward.

Instructions

Step 1: Capture Traffic

# List interfaces
tshark -D
# 1. eth0
# 2. wlan0
# 3. lo (Loopback)

# Capture to a rolling ring buffer (never fill the disk)
sudo tshark -i eth0 -b filesize:100000 -b files:10 -w capture.pcapng
# filesize in KB; keeps the last 10 × 100MB files

# Capture only relevant traffic using a BPF capture filter
sudo tshark -i eth0 -f "host 10.0.0.5 and port 443" -w target.pcapng

# Capture with packet count limit
sudo tshark -i eth0 -c 1000 -w sample.pcapng

# On a server over SSH, pipe into local Wireshark
ssh user@host "sudo tcpdump -U -s0 -w - 'not port 22'" | wireshark -k -i -

Step 2: Filter in the GUI or CLI

# Display filters (different syntax from capture filters!)
# Capture filter: "tcp port 80"
# Display filter: "tcp.port == 80"

# Read a PCAP and apply a display filter
tshark -r capture.pcapng -Y "http.request.method == POST"
tshark -r capture.pcapng -Y "ip.src == 10.0.0.5 and tcp.flags.syn == 1"
tshark -r capture.pcapng -Y "dns.qry.name contains \"example.com\""
tshark -r capture.pcapng -Y "tls.handshake.type == 1"  # Client Hello

# Common display filter cheatsheet
# http.request.uri contains "login"
# tcp.analysis.retransmission
# frame.time >= "2026-04-11 12:00:00"
# !(arp or icmp or dns)

Step 3: Extract Useful Fields

# Pull specific fields as TSV for grep/awk/jq pipelines
tshark -r capture.pcapng -T fields \
  -e frame.time -e ip.src -e ip.dst -e tcp.dstport -e http.host -e http.request.uri \
  -Y "http.request" -E header=y -E separator=,
# Output: CSV you can load in pandas or ClickHouse

# Top talkers
tshark -r capture.pcapng -q -z conv,ip | head -20

# HTTP request list
tshark -r capture.pcapng -q -z http,tree

# TLS server names (SNI) — reveals what hosts a client visited
tshark -r capture.pcapng -Y "tls.handshake.type == 1" \
  -T fields -e tls.handshake.extensions_server_name | sort -u

Step 4: Extract Files and Credentials (from PCAPs you own)

# Export HTTP objects (images, scripts, downloads)
tshark -r capture.pcapng --export-objects http,./http-objects/
ls http-objects/

# Extract FTP-DATA transfers
tshark -r capture.pcapng --export-objects ftp-data,./ftp-files/

# Extract SMB file transfers
tshark -r capture.pcapng --export-objects smb,./smb-files/

# Reconstruct a TCP stream (e.g., unencrypted protocol dump)
tshark -r capture.pcapng -q -z follow,tcp,ascii,0
# 0 is the stream index — find it first with -Y "tcp.stream eq 0"

Step 5: Decrypt TLS (with keys you legitimately control)

# Client-side: set SSLKEYLOGFILE before launching the browser
export SSLKEYLOGFILE=~/tls-keys.log
firefox &
# All session keys are appended as the browser negotiates TLS

# In Wireshark: Edit → Preferences → Protocols → TLS → "(Pre)-Master-Secret log filename"
# Or via CLI:
tshark -r traffic.pcapng -o tls.keylog_file:~/tls-keys.log \
  -Y "http.request" -T fields -e http.host -e http.request.uri

Examples

Example 1: Diagnose a Slow API Call

# Capture the client's traffic to the API host
sudo tshark -i eth0 -f "host api.example.com and port 443" -w slow-api.pcapng -a duration:60

# Look for retransmissions and RTT issues
tshark -r slow-api.pcapng -q -z io,stat,1,"tcp.analysis.retransmission"
tshark -r slow-api.pcapng -Y "tcp.analysis.retransmission or tcp.analysis.duplicate_ack" \
  -T fields -e frame.time -e ip.src -e ip.dst -e tcp.seq

# Identify high latency conversations
tshark -r slow-api.pcapng -q -z conv,tcp | sort -k6 -n -r | head

Example 2: CTF — Extract a File from a PCAP Challenge

# Quick triage
tshark -r challenge.pcap -q -z io,phs    # protocol hierarchy
tshark -r challenge.pcap -q -z conv,tcp  # conversations

# Something interesting on FTP
tshark -r challenge.pcap -Y "ftp.request.command == \"RETR\"" \
  -T fields -e ftp.request.arg

# Pull the transferred file
tshark -r challenge.pcap --export-objects ftp-data,./ftp/
file ./ftp/*
# flag.zip: Zip archive data, at least v2.0

Guidelines

  • Capture only what you are authorized to see. On shared networks, traffic from other users is off-limits unless your ROE says otherwise.
  • Capture filters are BPF syntax (tcp port 443). Display filters are Wireshark's own (tcp.port == 443). Mixing them up is the #1 beginner mistake.
  • For long captures, always use ring buffers (-b filesize:N -b files:N) so you never fill the disk.
  • .pcapng is preferred over .pcap — it stores interface metadata, comments, and per-packet annotations.
  • Big captures belong in tshark or editcap; the GUI chokes past ~1GB. Use editcap -c 100000 to split.
  • TLS decryption needs a key log file from the client process; you cannot decrypt arbitrary TLS sessions without one.
  • For long-term packet storage, use tcpdump -U -w on the server and analyze offline in Wireshark.
  • Companion tools: tcpdump (lighter capture), mergecap (combine PCAPs), editcap (slice), capinfos (summary).