info about logged in extended
This commit is contained in:
parent
d1a52ba962
commit
b2743157eb
|
@ -1,14 +1,48 @@
|
|||
#! /bin/sh
|
||||
|
||||
TXT_MSG="[Authorization] $(cat /etc/hostname): ${USER}"
|
||||
|
||||
SESSION=$(who | grep "${USER}")
|
||||
if [ -n "${SESSION}" ]; then
|
||||
TXT_MSG=$(cat <<-END
|
||||
${TXT_MSG}
|
||||
--- GDE/SSH:
|
||||
${SESSION}
|
||||
END
|
||||
)
|
||||
fi
|
||||
|
||||
SESSION=$(lsof -a -i -u "${USER}" -sTCP:ESTABLISHED | grep 'vnc' \
|
||||
| awk '{print $3,$9,$10}')
|
||||
if [ -n "${SESSION}" ]; then
|
||||
TXT_MSG=$(cat <<-END
|
||||
${TXT_MSG}
|
||||
--- VNC:
|
||||
${SESSION}
|
||||
END
|
||||
)
|
||||
fi
|
||||
|
||||
SESSION=$(ps -ef -u "${USER}" | grep '[s]shd:.*@notty' \
|
||||
| awk '{$2=$3=$4=$6=$7=""; print $0}')
|
||||
if [ -n "${SESSION}" ]; then
|
||||
TXT_MSG=$(cat <<-END
|
||||
${TXT_MSG}
|
||||
--- SFTP:
|
||||
${SESSION}
|
||||
END
|
||||
)
|
||||
fi
|
||||
|
||||
(
|
||||
python3 /usr/local/bin/sendmail.py \
|
||||
-u "$(cat /usr/local/bin/sendmail.config | grep "from=" | cut -d= -f2)" \
|
||||
-p "$(cat /usr/local/bin/sendmail.config | grep "pass=" | cut -d= -f2)" \
|
||||
-d "$(cat /usr/local/bin/sendmail.config | grep "dest=" | cut -d= -f2)" \
|
||||
--smtp "$(cat /usr/local/bin/sendmail.config | grep "smtp=" | cut -d= -f2)" \
|
||||
--port "$(cat /usr/local/bin/sendmail.config | grep "port=" | cut -d= -f2)" \
|
||||
-u "$(grep "from=" /usr/local/bin/sendmail.config | cut -d= -f2)" \
|
||||
-p "$(grep "pass=" /usr/local/bin/sendmail.config | cut -d= -f2)" \
|
||||
-d "$(grep "dest=" /usr/local/bin/sendmail.config | cut -d= -f2)" \
|
||||
--smtp "$(grep "smtp=" /usr/local/bin/sendmail.config | cut -d= -f2)" \
|
||||
--port "$(grep "port=" /usr/local/bin/sendmail.config | cut -d= -f2)" \
|
||||
--stls "True" \
|
||||
--subj "[Authorization] $(cat /etc/hostname): user logged in system" \
|
||||
--text "$(w)" \
|
||||
--subj "[Authorization] $(cat /etc/hostname): ${USER}" \
|
||||
--text "${TXT_MSG}" \
|
||||
>> /dev/null 2>&1 &
|
||||
)
|
||||
|
|
|
@ -1,10 +1,42 @@
|
|||
#! /bin/sh
|
||||
|
||||
API_URL="$(grep "API_URL=" /usr/local/bin/sendtelegram.config | cut -d= -f2)"
|
||||
SILENCE="$(grep "SILENCE=" /usr/local/bin/sendtelegram.config | cut -d= -f2)"
|
||||
CHAT_ID="$(grep "CHAT_ID=" /usr/local/bin/sendtelegram.config | cut -d= -f2)"
|
||||
THRD_ID="$(grep "THRD_ID=" /usr/local/bin/sendtelegram.config | cut -d= -f2)"
|
||||
TXT_MSG="[Authorization] $(cat /etc/hostname):
|
||||
$(w -h)"
|
||||
TXT_MSG="[Authorization] $(cat /etc/hostname): ${USER}"
|
||||
|
||||
SESSION=$(who | grep "${USER}")
|
||||
if [ -n "${SESSION}" ]; then
|
||||
TXT_MSG=$(cat <<-END
|
||||
${TXT_MSG}
|
||||
--- GDE/SSH:
|
||||
${SESSION}
|
||||
END
|
||||
)
|
||||
fi
|
||||
|
||||
SESSION=$(lsof -a -i -u "${USER}" -sTCP:ESTABLISHED | grep 'vnc' \
|
||||
| awk '{print $3,$9,$10}')
|
||||
if [ -n "${SESSION}" ]; then
|
||||
TXT_MSG=$(cat <<-END
|
||||
${TXT_MSG}
|
||||
--- VNC:
|
||||
${SESSION}
|
||||
END
|
||||
)
|
||||
fi
|
||||
|
||||
SESSION=$(ps -ef -u "${USER}" | grep '[s]shd:.*@notty' \
|
||||
| awk '{$2=$3=$4=$6=$7=""; print $0}')
|
||||
if [ -n "${SESSION}" ]; then
|
||||
TXT_MSG=$(cat <<-END
|
||||
${TXT_MSG}
|
||||
--- SFTP:
|
||||
${SESSION}
|
||||
END
|
||||
)
|
||||
fi
|
||||
|
||||
(
|
||||
if [ -z "${THRD_ID}" ]; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user