2026-03-15 16:13:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
#set -xv
|
|
|
|
|
|
2026-03-30 19:16:01 +00:00
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
|
echo "This script needs to run as root."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-03-15 16:13:10 +00:00
|
|
|
|
2026-03-30 19:16:01 +00:00
|
|
|
DISTRO_ID=$(grep -i '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')
|
|
|
|
|
|
|
|
|
|
echo "Detected OS: $DISTRO_ID"
|
|
|
|
|
echo "Installing Wireshark for the user $(logname)..."
|
|
|
|
|
case "$DISTRO_ID" in
|
|
|
|
|
ubuntu|debian|raspbian)
|
|
|
|
|
echo "wireshark-common wireshark-common/install-setuid boolean true" | debconf-set-selections
|
|
|
|
|
apt update && apt install -y debconf-utils wireshark
|
|
|
|
|
usermod -aG wireshark $(logname)
|
2026-03-15 16:13:10 +00:00
|
|
|
chgrp wireshark /usr/bin/dumpcap
|
2026-03-30 19:16:01 +00:00
|
|
|
chmod 750 /usr/bin/dumpcap
|
2026-03-15 16:13:10 +00:00
|
|
|
setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
|
2026-03-30 19:16:01 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
arch|manjaro)
|
|
|
|
|
pacman -Sy --noconfirm --needed wireshark-qt wireshark-cli
|
|
|
|
|
usermod -aG wireshark $(logname)
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
fedora|centos|rhel|rocky|almalinux)
|
|
|
|
|
dnf install wireshark -y
|
|
|
|
|
usermod -aG wireshark $(logname)
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
*)
|
|
|
|
|
echo "Error: ${DISTRO_ID} is not currently supported..."
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
2026-03-15 16:13:10 +00:00
|
|
|
esac
|
2026-03-30 19:16:01 +00:00
|
|
|
|
|
|
|
|
echo "Installation complete! Log out then log back in to ensure all interfaces to be available to Wireshark"
|
|
|
|
|
echo "If the interfaces are not available, then a reboot maybe required."
|