-
-
Save gorillamoe/5922aa7b410ea6f03a57d25490492c02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
VULNERABLE_MESSAGE="vulnerable" | |
SAFE_MESSAGE="safe" | |
if command -v apt-get &>/dev/null; then | |
PKG_MANAGER="apt-get" | |
elif command -v zypper &>/dev/null; then | |
PKG_MANAGER="zypper" | |
else | |
echo "unsupported system" | |
exit 1 | |
fi | |
if [ "$PKG_MANAGER" = "zypper" ]; then | |
version=$(rpm -q xz) | |
if [[ $version =~ (5\.6\.(0|1)) ]]; then | |
echo "$VULNERABLE_MESSAGE" | |
else | |
echo "$SAFE_MESSAGE" | |
fi | |
elif [ "$PKG_MANAGER" = "apt-get" ]; then | |
version=$(dpkg -l | grep "xz-utils" | awk '{print $3}') | |
if [[ "$version" == *"5.6.0"* || "$version" == *"5.6.1"* ]]; then | |
echo "$VULNERABLE_MESSAGE" | |
else | |
echo "$SAFE_MESSAGE" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment