Skip to content

Commit

Permalink
Moving the de-duplication of the csrf2 into the output rather than th…
Browse files Browse the repository at this point in the history
…e read
  • Loading branch information
mintsoft committed Nov 27, 2016
1 parent be3adfd commit 4d901a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doBackup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ password=$2;

curl -Ss --insecure --cookie-jar cookies.txt https://router/diag_backup.php | grep "name='__csrf_magic'" | sed 's/.*value="\(.*\)".*/\1/' > csrf.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 --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/' | head -n 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
curl -Ss --insecure --cookie cookies.txt --cookie-jar cookies.txt --data "Submit=download&donotbackuprrd=yes&__csrf_magic=$(cat csrf2.txt)" https://router/diag_backup.php > config-router-`date +%Y%m%d%H%M%S`.xml

rm csrf.txt csrf2.txt cookies.txt

0 comments on commit 4d901a6

Please sign in to comment.