LoginSignup
3
3

More than 1 year has passed since last update.

wiresharkでsshdumpを、sudoパスワード設定有のリモートサーバーに対して行う

Last updated at Posted at 2021-08-05

結論のみ

Remote capture commandに次のコマンドを入力する

echo PASS | sudo -S tcpdump -U -i PORT -w - 'capture filter'

-S: SUDOパスワードを標準入力から読み込む
PASS: sudoパスワード
PORT: キャプチャしたいポート。ens37など
capture filter: キャプチャフィルタ。
  Remote capture filterの内容をコピペでよい。
  Remote capture commandを利用すると、Remote interface や Use sudo on the remote machine、
  No promiscus mode や Remote capture filter の入力値は無視されるため。

image.png

その他

コマンドラインで済ませたい人はこちら

echo SUDOPASS | sshpass -p SSHPASS ssh user@host "sudo -S tcpdump -U -n -w - -i PORT 'not port 22'" | sudo wireshark -k -i -

-k : すぐにキャプチャを始める
-i : キャプチャインタフェースを指定。-はstdinのこと。
3
3
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
3
3