fetch csrf tokens

This commit is contained in:
Shihaam Abdul Rahman 2023-05-22 19:17:36 +05:00
parent 0255e9ff25
commit 979656c114
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636

View File

@ -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