light changes to wireshark script

This commit is contained in:
2026-03-30 19:16:01 +00:00
parent dff3c279c9
commit d12fcb7d5a

View File

@@ -1,48 +1,40 @@
#!/bin/bash
#set -xv
clear
echo "This script will install Wireshark using the ID"
echo "found in the /etc/os-release file. Currently, Fedora,"
echo "Ubuntu, Debian, and Arch are supported with this script."
echo "Feel free to edit it as needed."
DISTRO_ID=$(grep -i ^ID /etc/os-release | cut -c 4- | tr -d \")
read -p "Enter username: " USE
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
[uU]buntu|[dD]ebian)
echo "Will now install and configure Wireshark"
echo "Press [Enter] to continue..."
apt install -y wireshark && gpasswd -a $USE wireshark
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 755 /usr/bin/dumpcap
chmod 750 /usr/bin/dumpcap
setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
echo "Rebooting to allow user to see network interfaces"
;;
;;
arch|manjaro)
pacman -Sy --noconfirm --needed wireshark-qt wireshark-cli
usermod -aG wireshark $(logname)
;;
[aA]rch)
echo "Will now install and configure Wireshark"
echo "Press [Enter] to continue..."
pacman -S wireshark-qt wireshark-cli && gpasswd -a $USE wireshark
echo "Rebooting to allow user to see network interfaces"
;;
[fF]edora|[cC]entos|[rR]hel)
echo "Will now install and configure Wireshark"
echo "Press [Enter] to continue..."
dnf install wireshark -y && gpasswd -a $USE wireshark
echo "Rebooting to allow user to see network interfaces"
;;
*)
echo "Unknown OS.."
exit 0
;;
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."