diff --git a/routerapi.sh b/routerapi.sh index dc09296..4f41490 100755 --- a/routerapi.sh +++ b/routerapi.sh @@ -1,11 +1,14 @@ #!/bin/bash +home_html=$(curl -s $ROUTER_ADDRESS/html/home.html) +csrf_token1=$(echo $home_html | htmlq 'meta[name="csrf_token"]' --attribute content | head -n1) +csrf_token2=$(echo $home_html | htmlq 'meta[name="csrf_token"]' --attribute content | tail -n1) token=$(curl -c .cookie $ROUTER_ADDRESS/api/webserver/token -s | xmlstarlet sel -t -v "/response/token") -echo $token token_start=$(echo "${token::${#token}-32}") token_end=$(echo ${token:32}) +echo $token echo $token_start$token_end echo $token_start echo $token_end