Skip to content

Commit

Permalink
csrf2 now retrieved with curl
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsoft committed Nov 27, 2016
1 parent 1eb74d8 commit 160cbee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions doBackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ password=$2;

curl -Ss --insecure --cookie-jar cookies.txt https://router/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf.txt

wget -qO- --keep-session-cookies --load-cookies cookies.txt --save-cookies cookies.txt --no-check-certificate --post-data "login=Login&usernamefld=$username&passwordfld=$password&__csrf_magic=$(cat csrf.txt)" https://router/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt
#curl -Ss --insecure --trace-ascii trace --cookie-jar cookies.txt --cookie cookies.txt --data "login=Login&usernamefld=$username&passwordfld=$password&__csrf_magic=$(cat csrf.txt)" https://router/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt
curl -Ss --insecure --location --cookie-jar cookies.txt --cookie cookies.txt --data "login=Login&usernamefld=$username&passwordfld=$password&__csrf_magic=$(cat csrf.txt)" https://router/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt

curl -Ss --insecure --cookie cookies.txt --cookie-jar cookies.txt --data "Submit=download&donotbackuprrd=yes&__csrf_magic=$(head -n 1 csrf2.txt)" https://router/diag_backup.php > config-router-`date +%Y%m%d%H%M%S`.xml

Expand Down

0 comments on commit 160cbee

Please sign in to comment.