Update 'gammu_receive_sms.sh'
This commit is contained in:
parent
bce17c58c0
commit
a7ef429fe0
@ -4,8 +4,8 @@ SECRETKEY=''
|
|||||||
PHONENUM=''
|
PHONENUM=''
|
||||||
|
|
||||||
|
|
||||||
DATE=`date --date="1 minute ago" +'%Y-%m-%d %H:%M:%S'`
|
DATE=`date --date="2 minute ago" +'%Y-%m-%d %H:%M:%S'`
|
||||||
OTP=`oathtool -w 3 --now="$DATE" --totp -b $SECRETKEY`
|
OTP=`oathtool -w 4 --now="$DATE" --totp -b $SECRETKEY`
|
||||||
|
|
||||||
OTPFROMCLIENT=`echo $SMS_1_TEXT | awk '{print $NF}'`
|
OTPFROMCLIENT=`echo $SMS_1_TEXT | awk '{print $NF}'`
|
||||||
CMD=`echo $SMS_1_TEXT | awk '{print tolower($1)}'`
|
CMD=`echo $SMS_1_TEXT | awk '{print tolower($1)}'`
|
||||||
@ -26,9 +26,16 @@ if [[ $SMS_1_NUMBER -eq $PHONENUM ]]; then
|
|||||||
REPLY="Signal reboot envoyé"
|
REPLY="Signal reboot envoyé"
|
||||||
;;
|
;;
|
||||||
cmd)
|
cmd)
|
||||||
HOST=`echo $SMS_1_TEXT | awk '{print $2}'`
|
HOST=`echo $TEXT | awk '{print $1}'`
|
||||||
COMMAND=`echo $SMS_1_TEXT | awk '{for (i=3; i<NF; i++) print $i}'`
|
COMMAND=`echo $TEXT | awk 'BEGIN {ORS=" "} {for (i=2; i<NF; i++) print $i}'`
|
||||||
REPLY=`ssh -oStrictHostKeyChecking=no root@$HOST $COMMAND`
|
REPLY=`ssh -oStrictHostKeyChecking=no root@$HOST $COMMAND`
|
||||||
|
pxy)
|
||||||
|
PHONENUM=`echo $TEXT | awk '{print $1}'`
|
||||||
|
REPLY=`echo $TEXT | awk 'BEGIN {ORS=" "} {for (i=2; i<NF; i++) print $i}'`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
REPLY="Commande inconnu"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
REPLY="Mauvais OTP"
|
REPLY="Mauvais OTP"
|
||||||
@ -37,4 +44,5 @@ else
|
|||||||
REPLY="FROM: $SMS_1_NUMBER TEXT: $SMS_1_TEXT"
|
REPLY="FROM: $SMS_1_NUMBER TEXT: $SMS_1_TEXT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/usr/bin/sudo /usr/bin/gammu-smsd-inject TEXT $PHONENUM -len 999 -textutf8 "$REPLY"
|
/usr/bin/sudo /usr/bin/gammu-smsd-inject TEXT $PHONENUM -len 999 -textutf8 "$REPLY"
|
||||||
|
echo "[$DATE] $PHONENUM - $REPLY" >> /var/log/gammu_receive.log
|
Loading…
Reference in New Issue
Block a user