Skip to content

Instantly share code, notes, and snippets.

View phamthanhnhan14's full-sized avatar

Thanh Nhan Pham phamthanhnhan14

View GitHub Profile
@matriphe
matriphe / ssh-telegram.sh
Last active May 7, 2023 15:00
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@hvnsweeting
hvnsweeting / python2015summer.rst
Last active May 23, 2016 02:27
[Hanoi] python class powered by FAMILUG