Skip to content

Instantly share code, notes, and snippets.

@mezerotm
Last active August 19, 2020 08:18
Show Gist options
  • Save mezerotm/961143bc0a0e8842e3d8dc0d95942105 to your computer and use it in GitHub Desktop.
Save mezerotm/961143bc0a0e8842e3d8dc0d95942105 to your computer and use it in GitHub Desktop.
#!/bin/bash
script_version=1.0.2
snake_handler_ip_file=snake-handler-ip-list
snake_handler_script=https://gist.githubusercontent.com/mezerotm/1ea45da80f4c160dadd7dd38dbbeeddb/raw/4ec9676194a39993fbed089638e2ce090400dcfe/snake-handler.sh
cat << "EOF"
88 88
88 "" ,d
88 88
,adPPYba, 8b,dPPYba, ,adPPYYba, 88 ,d8 ,adPPYba, 8b,dPPYba, 88 MM88MMM
I8[ "" 88P' `"8a "" `Y8 88 ,a8" a8P_____88 88P' "8a 88 88
`"Y8ba, 88 88 ,adPPPPP88 8888[ 8PP""""""" 88 d8 88 88
aa ]8I 88 88 88, ,88 88`"Yba, "8b, ,aa 88b, ,a8" 88 88,
`"YbbdP"' 88 88 `"8bbdP"Y8 88 `Y8a `"Ybbd8"' 88`YbbdP"' 88 "Y888
88
88
EOF
echo "version: $script_version"
echo "by: Adder"
echo "contributor(s): Carlos Rincon and Ian Gerard"
echo ""
cat << "EOF"
What would you like to run?
1. Snake Handler
2. Digital Ocean
EOF
read run_choice
if [ "$run_choice" == "1" ]; then
echo "What is the name of the Snake Handler list?"
read snake_handler_ip_file
elif [ "$run_choice" == "2" ]; then
echo "What is password for the droplet(s)?"
read ssh_password
echo ""
echo "installing required tools..."
sudo snap install doctl
echo ""
echo "running Digital Ocean setup..."
/snap/bin/doctl auth init
ip_list=$(/snap/bin/doctl compute droplet list --format PublicIPv4)
ip_list=${ip_list[@]:12}
for ip in $ip_list; do
echo root:$ip:$ssh_password | tee -a $snake_handler_ip_file
done
fi
echo ""
echo "running snake-handler..."
sudo su -c "env snake_handler_ip_file=$snake_handler_ip_file bash <( wget -qO- $snake_handler_script )"
echo ""
echo "cleaning up snake-pit artifacts..."
sudo apt autoremove -y
if [ "$run_choice" == "2" ]; then
rm $snake_handler_ip_file
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment