#!/bin/bash #set -xv if [[ $EUID -ne 0 ]]; then echo "This script needs to run as root." exit 1 fi 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) chgrp wireshark /usr/bin/dumpcap chmod 750 /usr/bin/dumpcap setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap ;; 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 ;; esac 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."