Sometimes recon scripts take forever. I like to keep them running while doing something else, so I was looking for a way to get a notification when they are finished. I found that it is quite easy to set up Telegram notifications. To do so, simply follow these steps:
@BotFather
on Telegram, and send him a /start
message./newbot
command.telegram_api_token="APITOKEN"
with your API token/start
message.curl "https://api.telegram.org/bot$telegram_api_token/getUpdates" | jq '.result[0].message.chat.id'
to get your chat_id.zshrc
, or .bashrc
tnotify(){
message=$1
token="YOURAPITOKEN"
chatid="YOURCHATID"
curl -s -X POST https://api.telegram.org/bot$token/sendMessage -d chat_id=$chatid -d text="$message"
}
Now you can run tnotify "hi"
in your shell to get a notification!