File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ Then add following line to your /etc/pam.d/sshd file:
9
9
session optional pam_exec.so /root/shelltracer/exec.sh
10
10
```
11
11
12
+ ## (Optional) Telegram-integration
13
+ To send notifications via telegram, the telegram-cli is required. (https://github.com/vysheng/tg ).
14
+ You need to initiate the telegram-cli once and register yourself with your mobilenumber.
15
+ A user name must be activated in the telegram account on the mobile device.
16
+
17
+ Edit your information in the config file.
18
+
19
+
12
20
## Demo
13
21
14
22
![ screenshot_lockscreen] ( https://cloud.githubusercontent.com/assets/3774136/18708456/2b20a088-7ffb-11e6-9381-ac06e43553ab.png )
Original file line number Diff line number Diff line change 3
3
PUSHOVER_TOKEN_APP=" your_pushover_app_token"
4
4
PUSHOVER_TOKEN_USER=" your_pushover_user_token"
5
5
6
+ # installed telegram-cli is needed
7
+ USE_TELEGRAM=" NO"
8
+ TELEGRAM_ACCOUNT_NAME=" your_telegram_account_name"
9
+ TELEGRAM=/bin/telegram-bin
10
+ TELEGRAM_SERVER_KEY=/etc/telegram-bin/server.pub
11
+
12
+
6
13
TITLE=" Shelltracer"
7
14
8
15
LOGFILE=/var/log/shelltracer/log-trace.log
@@ -20,3 +27,4 @@ HOSTNAME=/bin/hostname
20
27
W=/usr/bin/w
21
28
AWK=/usr/bin/awk
22
29
30
+
Original file line number Diff line number Diff line change @@ -5,7 +5,13 @@ SCRIPT_DIR=`dirname $0`
5
5
6
6
PUSHOVER_TITLE=" $1 "
7
7
PUSHOVER_MESSAGE=" $2 "
8
+ FILE_TO_SEND=" $3 "
8
9
PUSHOVER_URL=" https://api.pushover.net/1/messages.json"
9
10
10
11
${CURL} -s -F " token=${PUSHOVER_TOKEN_APP} " -F " user=${PUSHOVER_TOKEN_USER} " -F " title=${PUSHOVER_TITLE} " -F " message=${PUSHOVER_MESSAGE} " ${PUSHOVER_URL} >> ${LOGFILE} 2>&1
12
+
13
+ if [ $USE_TELEGRAM = " YES" ]; then
14
+ ${TELEGRAM} -W ${TELEGRAM_SERVER_KEY} -e " send_text $TELEGRAM_ACCOUNT_NAME $FILE_TO_SEND " >> ${LOGFILE} 2>&1
15
+ fi
16
+
11
17
echo >> ${LOGFILE}
Original file line number Diff line number Diff line change 63
63
64
64
PUSHOVER_TITLE=$TITLE
65
65
PUSHOVER_MESSAGE=` cat $LOGFILE_TEMP `
66
- ${SCRIPT_DIR} /notify.sh " ${PUSHOVER_TITLE} " " ${PUSHOVER_MESSAGE} "
66
+ ${SCRIPT_DIR} /notify.sh " ${PUSHOVER_TITLE} " " ${PUSHOVER_MESSAGE} " " ${LOGFILE_TEMP} "
67
67
68
68
exit_program " ${ACTION} END"
You can’t perform that action at this time.
0 commit comments