Skip to content

Instantly share code, notes, and snippets.

@alkalinecoffee
Last active September 3, 2018 13:05
Show Gist options
  • Save alkalinecoffee/3fbabfc6914aade0e3c44ecf90de0233 to your computer and use it in GitHub Desktop.
Save alkalinecoffee/3fbabfc6914aade0e3c44ecf90de0233 to your computer and use it in GitHub Desktop.
#!/bin/sh
# wget -qO- http://mywebsite.com/myscript.txt | bash -s phone-number username64 password64
to=$1
username64=$2
password64=$3
attempts=2
ip=192.168.1.234
output=$(ping -w$attempts $ip)
if [[ $output = *"0 packets received"* ]]; then
echo "$ip is offline!"
(
echo "EHLO localhost"; sleep 1;
echo "auth login"; sleep 1;
echo "$username64"; sleep 1;
echo "$password64"; sleep 1;
echo "mail from:<[email protected]>"; sleep 1;
echo "rcpt to:<[email protected]>"; sleep 1;
echo "Data"; sleep 1;
echo "From: <$tovtext.com>"; sleep 1;
echo "To: <[email protected]"; sleep 1;
echo "Subject:"; sleep 1;
echo " "; sleep 1;
echo "Wifi device $ip is offline"; sleep 1;
echo "."; sleep 1;
echo "quit"
) | openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlf -ign_eof
else
echo "$ip online"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment