mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-27 09:11:08 -06:00
173 lines
5.8 KiB
Bash
Executable File
173 lines
5.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
print_pgp_key() {
|
|
cat <<-EOF
|
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
|
|
mQINBFDAy/0BEAC8I5bw5gLQqHKx5JCacYcXFL6AZowl3qIOTxo5yfBl8CepNpWY
|
|
OOERvIUJb17WehhhbWOo9WjpBalDXBRtI1NvfArewOT8fLm7BdhYe8U45moBfkYi
|
|
xFtNrPw3pdIltHQISrB8PufhliN8obQuq0rcxYV8NblvYo4gIGNjBfO1QGvBNmp7
|
|
kBtjlAuZguScZmUTdPOwfv8fqN52X9tCv1ahQk1hg8XG9YwW0vXb5z93jkLXBb5b
|
|
sRCnou4m9IV6vOv2HVNRyMKT7uht3z4FqflP9NkySl4daCdZgmXbf169vvLdwLrC
|
|
lVymwAbwvuyILZv4JW1w0Kx8nWiTuK5A886882i83lxnkh1vC9jInva4/5hTrbRw
|
|
XJb7qOyh7sxa5GOfgq1NwVfLkrvVCMystrPu18sF1ORfg1UTFcz86RYdxpmoZvk7
|
|
EeABiLCQDZKOf0fV3U9CxLj8gXPjPY1Lu6udZUN6NG1ALJjsPkGnbpQEqEJlKNAG
|
|
+rF+tp73TrG0PW8C/THL7fN93ET3wn5tfNu86Liui9wd8ZLuPJNEYeE6eyPAgXJ4
|
|
p69Yb4ou5um5jWnzaVameECBZvtc4HOhy3nTEiVMDcKv/o8XxKOCLpjW1RSDirKl
|
|
ZRIsJYPx2yuJSVMCsN5Sghp5+OCsQ+On4OFWxCskemvy97ftkv/fwUI7mQARAQAB
|
|
tCJNZXRhc3Bsb2l0IDxtZXRhc3Bsb2l0QHJhcGlkNy5jb20+iQJUBBMBCAA+AhsD
|
|
BQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAFiEECeVfr094Ys1tVYmXzftfpSAHuVQF
|
|
Al1xL2oFCR98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fEWMoFeHPrWdxgRmjOhUfy6hKhJ1H306aaSQ
|
|
gkE3638Je/onWmnmZrDEZq7zg0Qk3aOOhJXugmRnIjH341y/whxvAdJIyXrjLN4z
|
|
qCU0JkA1rVqS6PXZabKb9DOqYa4pr9thGS5rU+Gn3GWiSq2PtVW6Hh83WOFcEsMk
|
|
2vTa24LE0J2DQg==
|
|
=Qa/n
|
|
-----END PGP PUBLIC KEY BLOCK-----
|
|
EOF
|
|
}
|
|
|
|
install_deb() {
|
|
LIST_FILE=/etc/apt/sources.list.d/metasploit-framework.list
|
|
PREF_FILE=/etc/apt/preferences.d/pin-metasploit.pref
|
|
echo -n "Adding metasploit-framework to your repository list.."
|
|
echo "deb $DOWNLOAD_URI/apt lucid main" > $LIST_FILE
|
|
print_pgp_key | apt-key add -
|
|
if [ ! -f $PREF_FILE ]; then
|
|
mkdir -p /etc/apt/preferences.d/
|
|
cat > $PREF_FILE <<EOF
|
|
Package: metasploit*
|
|
Pin: origin downloads.metasploit.com
|
|
Pin-Priority: 1000
|
|
EOF
|
|
fi
|
|
echo -n "Updating package cache.."
|
|
apt-get update > /dev/null
|
|
echo "OK"
|
|
echo "Checking for and installing update.."
|
|
apt-get install -y --allow-downgrades metasploit-framework
|
|
}
|
|
|
|
install_rpm() {
|
|
echo "Checking for and installing update.."
|
|
REPO_FILE=/etc/yum.repos.d/metasploit-framework.repo
|
|
GPG_KEY_FILE=/etc/pki/rpm-gpg/RPM-GPG-KEY-Metasploit
|
|
echo -n "Adding metasploit-framework to your repository list.."
|
|
|
|
cat > /etc/yum.repos.d/metasploit-framework.repo <<EOF
|
|
[metasploit]
|
|
name=Metasploit
|
|
baseurl=$DOWNLOAD_URI/rpm
|
|
gpgcheck=1
|
|
gpgkey=file://$GPG_KEY_FILE
|
|
enabled=1
|
|
EOF
|
|
print_pgp_key > ${GPG_KEY_FILE}
|
|
yum install -y metasploit-framework
|
|
}
|
|
|
|
install_suse() {
|
|
echo "Checking for and installing update.."
|
|
GPG_KEY_FILE=/etc/pki/rpm-gpg/RPM-GPG-KEY-Metasploit
|
|
echo -n "Adding metasploit-framework to your repository list.."
|
|
|
|
zypper ar -f $DOWNLOAD_URI/rpm metasploit
|
|
print_pgp_key > ${GPG_KEY_FILE}
|
|
rpmkeys --import ${GPG_KEY_FILE}
|
|
zypper install -y metasploit-framework
|
|
}
|
|
|
|
install_pkg()
|
|
{
|
|
(
|
|
cd ~/Downloads
|
|
|
|
echo "Downloading package..."
|
|
curl -O "$DOWNLOAD_URI/osx/metasploitframework-latest.pkg"
|
|
|
|
echo "Checking signature..."
|
|
|
|
if pkgutil --check-signature metasploitframework-latest.pkg; then
|
|
echo "Installing package..."
|
|
installer -pkg metasploitframework-latest.pkg -target /
|
|
fi
|
|
|
|
echo "Cleaning up..."
|
|
rm -fv metasploitframework-latest.pkg
|
|
)
|
|
}
|
|
|
|
DOWNLOAD_URI=http://downloads.metasploit.com/data/releases/metasploit-framework
|
|
PKGTYPE=unknown
|
|
ID=`id -u`
|
|
|
|
if [ -f /etc/redhat-release ] ; then
|
|
PKGTYPE=rpm
|
|
elif [ -f /etc/system-release ] ; then
|
|
# If /etc/system-release is present, this is likely a distro that uses RPM.
|
|
PKGTYPE=rpm
|
|
else
|
|
if uname -sv | grep 'Darwin' > /dev/null; then
|
|
PKGTYPE=pkg
|
|
elif [ -f /usr/bin/zypper ] ; then
|
|
PKGTYPE=sus
|
|
else
|
|
PKGTYPE=deb
|
|
fi
|
|
fi
|
|
|
|
if [ "$ID" -ne 0 ]; then
|
|
if ! hash sudo 2>/dev/null; then
|
|
echo "This script must be executed as the 'root' user or with sudo"
|
|
exit 1
|
|
else
|
|
echo "Switching to root user to update the package"
|
|
sudo -E $0 $@
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
case $PKGTYPE in
|
|
deb)
|
|
install_deb
|
|
;;
|
|
sus)
|
|
install_suse
|
|
;;
|
|
rpm)
|
|
install_rpm
|
|
;;
|
|
*)
|
|
install_pkg
|
|
esac
|