-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathssh2tg.sh
More file actions
executable file
·30 lines (26 loc) · 976 Bytes
/
ssh2tg.sh
File metadata and controls
executable file
·30 lines (26 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
#
# .∧_∧
# ( ・ω・。)つ━☆・*。
# ⊂ ノ ・゜+.
# しーJ °。+ *´¨)
# .· ´¸.·*´¨) ¸.·*¨)
# (¸.·´ (¸.·'* ☆ вжух, вжух и в продакшн
#
# Generate new tocken by register free plan on ipinfo.io
TOKEN=
KEY="111111111:AAELEbbbbbbbbbbbbbbbbbbbbbbbbbbblno"
URL="https://api.telegram.org/bot$KEY/sendMessage"
TARGET="222222222" #в нашем случае это -9876543210, именно с минусом.
DATE1="$(date "+%H:%M:%S")"
DATE2="$(date "+%d %B %Y")"
GEO="$(curl ipinfo.io/$PAM_RHOST?token=$TOKEN)"
TEXT="🔥 *$PAM_USER* залогинился на *$HOSTNAME*
Время: $DATE1
Дата: $DATE2
Адрес: $PAM_RHOST
Service: $PAM_SERVICE
TTY: $PAM_TTY
GEO: ${GEO}"
PAYLOAD="chat_id=$TARGET&text=$TEXT&parse_mode=Markdown&disable_web_page_preview=true"
curl -s --max-time 10 --retry 5 --retry-delay 2 --retry-max-time 10 -d "$PAYLOAD" $URL > /dev/null 2>&1 &