Skip to content

Instantly share code, notes, and snippets.

@anroots
Last active April 1, 2016 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anroots/8dd3d27eec8f698ea5b20a5c96923a7e to your computer and use it in GitHub Desktop.
Save anroots/8dd3d27eec8f698ea5b20a5c96923a7e to your computer and use it in GitHub Desktop.
Spam random Chuck Norris facts to a list of target e-mails (spammy April Fools joke)
#!/bin/bash
# Generate a random Chuck Norris fact and e-mail it to the target
# Requires the 'cowsay' and 'cn' (https://www.npmjs.com/package/cn) programs to be installed
# Requires Mailgun API key
#
# Usage: ./chuckify.sh NUM EMAIL
# ...where NUM is an integer of how many e-mails to send and EMAIL is the target's e-mail
#
# Replace placeholders (Mailgun API key and domain)
function chuckify {
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
FROM="Chuck Norris <chuck+$NEW_UUID@email.example.com>"
echo "From: $FROM"
TEXT=$(/usr/local/bin/cn|/usr/games/cowsay -f meow)
echo "To: $1"
echo "Body: $TEXT"
curl -s --user 'api:key-XXXXXXXXXXXXXX' 'https://api.mailgun.net/v3/email.example.com/messages' \
-F from="$FROM" \
-F to="$1" \
-F subject='Chuck Norris Fact' \
-F text="$TEXT" > /dev/null
}
echo "Sending $1 Chuck Norris facts to $2..."
for i in `seq 1 $1`;
do
chuckify $2
done
# m h dom mon dow user command
# Send a random Chuck fact every ten minutes for three hours
*/10 8,9,10 * * * root /root/send-chucks.sh
_________________________________________
/ Chuck Norris began selling the Total \
| Gym as an ill-fated attempt to make his |
| day-to-day opponents less laughably |
\ pathetic. /
-----------------------------------------
\
\ , _ ___.--'''`--''//-,-_--_.
\`"' ` || \\ \ \\/ / // / ,-\\`,_
/'` \ \ || Y | \|/ / // / - |__ `-,
/@"\ ` \ `\ | | ||/ // | \/ \ `-._`-,_.,
/ _.-. `.-\,___/\ _/|_/_\_\/|_/ | `-._._)
`-'``/ / | // \__/\__ / \__/ \
`-' /-\/ | -| \__ \ |-' |
__/\ / _/ \/ __,-' ) ,' _|'
(((__/(((_.' ((___..-'((__,'
#!/bin/bash
#
# Call the "send-chucks" program for a list of different recipients
# Specify a list target e-mails
declare -a targets=("henn@fleep.io" "target@example.com" "target2@example.com")
for i in "${targets[@]}"
do
/root/chuckify 1 $i >> /root/chuckify.log
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment