I had this code working smh:
csrf_token=$(curl -s -b /tmp/cookies.txt –insecure “https://127.0.0.1/admin” |
grep -oP “csrf_token = ‘\K[^’]+(?=')”)
allow_from=“172.22.1.1,127.0.0.1,$ip_prefix.7”
data=“allow_from=${allow_from}&active=on&admin_api%5Brw%5D=&login_user=${user}&pass_user=${adminPASS}&csrf_token=${csrf_token}”
Modified curl command to follow redirects
response=$(curl -L -s -b /tmp/cookies.txt ‘https://127.0.0.1/admin’ \
-H ‘content-type: application/x-www-form-urlencoded’ \
–data “$data” \
–insecure \
-w “\nHTTP_STATUS:%{http_code}”)
Extract API-KEY
adminAPIkey=$(echo “$response” | grep -oP ‘value=“\K[^”]{34}’)
but now it doesnt work anymore.. maybe someone else has better luck?