Outils pour utilisateurs

Outils du site


doc:hacks:envoyer_des_sms_avec_une_airbox
no way to compare when less than two revisions

Différences

Ci-dessous, les différences entre deux révisions de la page.


doc:hacks:envoyer_des_sms_avec_une_airbox [2020/08/04 07:17] (Version actuelle) – créée beu
Ligne 1: Ligne 1:
 +====== Envoyer des SMS avec une Airbox ======
  
 +<code bash>
 +#!/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 "<?xml version="1.0" encoding="UTF-8"?><request><Username>${LOGIN}</Username><Password>${password}</Password><password_type>4</password_type></request>" > tmpfile
 +COOKIE=`grep SessionID tmpfile | cut -b 12-149`
 +TOKEN=`grep RequestVerificationToken tmpfile | cut -b 31-62`
 +
 +data=`echo '<?xml version: "1.0" encoding="UTF-8"?><request><Index>-1</Index><Phones><Phone>'"$NUMBER"'</Phone></Phones><Sca></Sca><Content>'"$SMS"'</Content><Length>'${#SMS}'</Length><Reserved>1</Reserved><Date>'$(date '+%Y-%m-%d %T')'</Date></request>'`
 +#echo $data
 +curl -v http://192.168.1.1/api/sms/send-sms -H "__RequestVerificationToken: $TOKEN" -H "Cookie: $COOKIE" --data "$data"
 +</code>
doc/hacks/envoyer_des_sms_avec_une_airbox.txt · Dernière modification : 2020/08/04 07:17 de beu