# 安裝Wireshark並抓取封包 ## 在Ubuntu中安裝Wireshark 1. 通過apt工具安裝Wireshark,輸入以下指令: ``` sudo apt install wireshark ``` ![](https://i.imgur.com/jgQpr8u.png) 2. 稍等片刻,安裝完成後,會自動跳出以下畫面,詢問是否允許non-superusers抓取網路上的封包,選取"是"即可 ![](https://i.imgur.com/J9cWQha.png) 3. 檢視Wireshark使用者組 ![](https://i.imgur.com/gZ8zRe1.png) 4. 輸入以下指令將使用者加入到Wireshark使用者組中: ``` sudo usermod -aG wireshark $USER ``` ![](https://i.imgur.com/98v2w2A.png) 安裝完成! ## 抓取SSH連線封包 1. 執行Wireshark ``` sudo wireshark ``` ![](https://i.imgur.com/KLHsf8U.png) 2. 選擇ens33 ![](https://i.imgur.com/JuZrUh6.png) 3. 指定ip.addr及Protocol,將不需要的資訊過濾掉 ``` ip.addr==10.2.200.216 && ssh ``` ![](https://i.imgur.com/UGF9xIv.png) 4. 開終端機ssh連線到伺服器,成功連線後,Wireshark上會顯示電腦與伺服器之間來回傳送的各種封包 ``` ssh s1082959@10.2.200.216 ``` ![](https://i.imgur.com/GmdRY6B.png) 5. 將Wireshark先前顯示的封包清空,在終端機下"ip addr"的新指令,Wireshark會再顯示電腦與伺服器間新產生的各種封包 ![](https://i.imgur.com/hFO2sAv.png) ## 參考資料 1. [Ubuntu 安装 Wireshark 软件](https://getiot.tech/ubuntu/ubuntu-install-wireshark.html) 2. [12月10日 ubuntu 安裝wireshark](https://iter01.com/567937.html) ###### tags: `Linux系統管理` `Wireshark安裝`