-3
Good morning guys, I’m new here... actually, I just made this account for a specific question, because I didn’t find anything relevant to solve my problem. Anyway; I am trying to log into a php web application by a shellscript... it happens that; with the normal request, without being in the script I can log in normally but when I pass the variables pro Curl with the necessary login data, do not log in! for sure it’s some stupidity that I did rsrs follows the code:
#!/usr/bin/env bash passdefault="a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3" cookie=$(curl -Is $1/admin/login.php|grep Cookie|awk '{print $2}'|cut -d';' -f1) echo -e "\ncookie: $cookie";sleep 1 token=$(curl -s $1/admin/login.php|grep token|sed 's|[\""=/);]||g'|awk '{print $4}') tokenf=$(echo ${token: -37}|cut -c -32) echo -e "token: $tokenf\n";sleep 1 curl $1/admin/executar.php --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'Cookie: $cookie' --data-raw 'login=YWRtaW4%3D&senha=$passdefault&token_webadmin=$tokenf'
a request is as follows::
curl 'http://x.x.x.x/admin/executar.php' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'Cookie: 2p53poksqp9bao4grknm8ja98lm5iarq' --data-raw 'login=YWRtaW4%3D&senha=a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3&token_webadmin=da59d1bf5ad7ac5161bb55623fdf6071'
I have already checked the values of the variables and they are correct, I don’t know what happens when Curl asks for the script, could anyone help me? thank you in advance (: