====== Envoyer des SMS avec une Airbox ====== #!/bin/bash LOGIN="admin" PASSWORD="admin" ################################# curl -sSL -D - http://192.168.1.1/html/home.html | grep -e csrf_token -e SessionID > tmpfile COOKIE=`grep SessionID tmpfile | cut -b 12-150` TOKEN=`grep csrf_token tmpfile | head -n 1 | cut -b 34-65` NUMBER=$1 SMS=$2 password=`echo -n "${LOGIN}$(echo -n "${PASSWORD}" | sha256sum | awk '{ORS=""} {print $1}' | base64 -w 0)${TOKEN}" | sha256sum | awk '{ORS=""} {print $1}' | base64 -w 0` curl -sSL -D - http://192.168.1.1/api/user/login -H 'part_encrypt_transmit: options' -H "Cookie: $COOKIE" -H "__RequestVerificationToken: $TOKEN" --data "${LOGIN}${password}4" > tmpfile COOKIE=`grep SessionID tmpfile | cut -b 12-149` TOKEN=`grep RequestVerificationToken tmpfile | cut -b 31-62` data=`echo '-1'"$NUMBER"''"$SMS"''${#SMS}'1'$(date '+%Y-%m-%d %T')''` #echo $data curl -v http://192.168.1.1/api/sms/send-sms -H "__RequestVerificationToken: $TOKEN" -H "Cookie: $COOKIE" --data "$data"