Created
October 8, 2018 13:25
-
-
Save Und3rf10w/796dfe9d8aa7c22ace01767571229abb to your computer and use it in GitHub Desktop.
For being a dick when you steal someone's slack token
This file contains hidden or 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 | |
# Usage: slackpost <token> <channel> <message> | |
# Enter the name of your slack host here - the thing that appears in your URL: | |
# https://slackhost.slack.com/ | |
slackhost= | |
# Stolen apikey | |
token= | |
if [[ $token == "" ]] | |
then | |
echo "No token specified" | |
exit 1 | |
fi | |
shift | |
channel=$1 | |
if [[ $channel == "" ]] | |
then | |
echo "No channel specified" | |
exit 1 | |
fi | |
shift | |
text=$* | |
if [[ $text == "" ]] | |
then | |
echo "No text specified" | |
exit 1 | |
fi | |
escapedText=$(echo $text | sed 's/"/\"/g' | sed "s/'/\'/g" ) | |
# json="{\"channel\": \"$channel\", \"text\": \"$escapedText\"}" | |
post="channel=$channel&text=$text&token=$token" | |
curl -s -d "$post" "https://$slackhost.slack.com/api/chat.postMessage" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment