LoginSignup
0
1

TSharkのインストール

Posted at

TsharkはWiresharkのCLI版。今回はGUIを使わない環境でCLIで直接パケットキャプチャし解析を行い、スクリプト内で自動化する用途で構築。

環境

仮想化:VMware workstation-pro15
ホスト:Windows10
ゲスト:ubuntu22.04.3TLS

TSharkのインストール

UbuntuにTSharkをインストールする

sudo apt install tshark

インストール後の確認

利用可能なインターフェースのリストを表示

sudo tshark -D

表示されたインターフェースの中からキャプチャしたいインターフェースの番号(または名前)を指定して、以下のようにTSharkを実行。

sudo tshark -i インターフェース番号または名前

設定・出力例

インターフェースのリストの表示例

miwapinn@VM1:~$ sudo tshark -D
Running as user "root" and group "root". This could be dangerous.
1. ens33
2. ens34
3. ens35
4. br-34894d3fe50f
5. vethdf48cd7
6. veth87321e8
7. br-cfac700030c1
8. vethe6475e1
9. vethf264c88
10. vethb09c894
11. veth223737a
12. veth7ff872d
13. veth2bc5c4b
14. br-e420010af561
15. veth81b6228
16. veth2950d99
17. any
18. lo (Loopback)
19. docker0
20. bluetooth0
21. bluetooth-monitor
22. nflog
23. nfqueue
24. dbus-system
25. dbus-session
26. ciscodump (Cisco remote capture)
27. dpauxmon (DisplayPort AUX channel monitor capture)
28. randpkt (Random packet generator)
29. sdjournal (systemd Journal Export)
30. sshdump (SSH remote capture)
31. udpdump (UDP Listener remote capture)
miwapinn@VM1:~$ 
miwapinn@VM1:~$ 

TSharkの実行例

miwapinn@VM1:~$ sudo tshark -i ens33
Running as user "root" and group "root". This could be dangerous.
Capturing on 'ens33'
 ** (tshark:192050) 08:47:57.628025 [Main MESSAGE] -- Capture started.
 ** (tshark:192050) 08:47:57.628139 [Main MESSAGE] -- File: "/tmp/wireshark_ens33DHHAJ2.pcapng"
    1 0.000000000 192.168.0.201 → 192.168.0.249 SSH 202 Server: Encrypted packet (len=148)
    2 0.040893473 192.168.0.249 → 192.168.0.201 TCP 60 58087 → 22 [ACK] Seq=1 Ack=149 Win=511 Len=0
    3 0.412210787 192.168.0.228 → 239.255.255.250 SSDP 217 M-SEARCH * HTTP/1.1 
    4 0.412210657 Elecom_01:11:80 → Broadcast    0x8899 60 Realtek Layer 2 Protocols
    5 0.514252766  192.168.0.1 → 224.0.0.1    IGMPv2 60 Membership Query, general
    6 0.515530460 192.168.0.201 → 192.168.0.249 SSH 218 Server: Encrypted packet (len=164)
    7 0.527750321 192.168.0.105 → 224.0.0.251  IGMPv2 60 Membership Report group 224.0.0.251
    8 0.556054131 192.168.0.249 → 192.168.0.201 TCP 60 58087 → 22 [ACK] Seq=1 Ack=313 Win=510 Len=0
    9 0.616965819 Microsof_65:93:c1 → Broadcast    ARP 60 Who has 192.168.0.9? Tell 192.168.0.242
   10 0.738206223 192.168.0.249 → 239.255.255.250 IGMPv2 60 Membership Report group 239.255.255.250
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1