• home
  • about
  • 全ての投稿
  • ソフトウェア・ハードウェアの設定のまとめ
  • 分析関連のまとめ
  • ヘルスケア関連のまとめ
  • 生涯学習関連のまとめ

tshark

date: 2021-02-24 excerpt: tsharkの使い方

tag: wiresharktsharkcli


tsharkの使い方

概要

tsharkはwiresharkのcli版である
Linuxではpcap等のオプションが必要なく、代わりにinterfaceの指定でパケットをスキャンできる

インストール

$ sudo apt install tshark

実行

# tshark -i ${IF}

スキャンした内容をcsv形式で保存する

# tshark -i ${IF} -o'column.format:"Dport","%D","Protocol","%p","Length","%L"' -T fields -E separator=, -E header=y -e eth.src -e ip.dst -e _ws.col.Dport -e _ws.col.Protocol  -e _ws.col.Length 

tsharkの出力のフォーマット

# tshark -G column-formats
Running as user "root" and group "root". This could be dangerous.
%q	802.1Q VLAN id
%Yt	Absolute date, as YYYY-MM-DD, and time
%YDOYt	Absolute date, as YYYY/DOY, and time
%At	Absolute time
%V	Cisco VSAN
%B	Cumulative Bytes
%Cus	Custom
%y	DCE/RPC call (cn_call_id / dg_seqnum)
%Tt	Delta time
%Gt	Delta time displayed
%rd	Dest addr (resolved)
%ud	Dest addr (unresolved)
...

フィルターのオプション

-r <infile> read data from input file
-Y <display filter> Filter display packets. This uses the same syntax as the Wireshark GUI filter
-G [ <report type> ] List glossary
-o <preference>:<value> set a preference value
-T fields|pdml|ps|psml|text
-e <field> add a field to display. This is required when -T fields is used. In order to display columns from Wireshark you must prefix the column with _ws.col.*
-E <field print option> format how fields are printed.

これらの使い方はこのブログ1が参考になる

参考

  • Generating Custom CSV Reports With Tshark


wiresharktsharkcli Share Tweet