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 #!/bin/bash
#set -xv #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 \") if [[ $EUID -ne 0 ]]; then
read -p "Enter username: " USE 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 case "$DISTRO_ID" in
[uU]buntu|[dD]ebian) ubuntu|debian|raspbian)
echo "wireshark-common wireshark-common/install-setuid boolean true" | debconf-set-selections
echo "Will now install and configure Wireshark" apt update && apt install -y debconf-utils wireshark
echo "Press [Enter] to continue..." usermod -aG wireshark $(logname)
apt install -y wireshark && gpasswd -a $USE wireshark
chgrp wireshark /usr/bin/dumpcap 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 setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
echo "Rebooting to allow user to see network interfaces"
;; ;;
[aA]rch) arch|manjaro)
pacman -Sy --noconfirm --needed wireshark-qt wireshark-cli
echo "Will now install and configure Wireshark" usermod -aG wireshark $(logname)
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) fedora|centos|rhel|rocky|almalinux)
echo "Will now install and configure Wireshark" dnf install wireshark -y
echo "Press [Enter] to continue..." usermod -aG wireshark $(logname)
dnf install wireshark -y && gpasswd -a $USE wireshark
echo "Rebooting to allow user to see network interfaces"
;; ;;
*) *)
echo "Error: ${DISTRO_ID} is not currently supported..."
echo "Unknown OS.." exit 1
exit 0
;; ;;
esac 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."