Last active
January 29, 2021 22:14
-
-
Save davenicoll/6870dedffe75877701bd5bb0eaa5f15d 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 | |
if [[ -z "$SSH_CLIENT" ]]; then SSH_CLIENT="127.0.0.1"; fi | |
TEXT="A user successfully logged on to \`$USER@$HOSTNAME\` ($(hostname -I | awk '{print $1}')) from \`$(echo $SSH_CLIENT | awk '{print $1}')\`.<br/>Please review this activity." | |
MESSAGE=$( echo ${TEXT} | sed 's/"/\"/g' | sed "s/'/\'/g" ) | |
JSON="{\"title\": \"Unusual user login activity\", \"themeColor\": \"\", \"text\": \"${MESSAGE}\" }" | |
curl --silent -H "Content-Type: application/json" -d "${JSON}" "https://outlook.office.com/webhook/..." > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment