CLI Backup - Resolved

  • I went through the process of trying to do a CLI backup using wget and for some reason, I can't figure out why I don't get logged in properly.

    I edited the wiki part to match my config. I removed my password to protect the children.

    wget -qO- --keep-session-cookies --save-cookies cookies.txt --no-check-certificate | 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=admin&passwordfld=MYPASSWORD&__csrf_magic=$(cat csrf.txt)"  | grep "name='__csrf_magic'"   | sed 's/.*value="\(.*\)".*/\1/' > csrf2.txt
    wget --keep-session-cookies --load-cookies cookies.txt --no-check-certificate --post-data "Submit=download&donotbackuprrd=yes&__csrf_magic=$(head -n 1 csrf2.txt)" -O config-router-`date +%Y%m%d%H%M%S`.xml
    Connecting to connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [text/html]
    Saving to: ‘config-router-20170221085520.xml’
    config-router-20170221085520.xml       [ <=>                                                             ]  19.60K  --.-KB/s    in 0.003s
    2017-02-21 08:55:20 (6.44 MB/s) - ‘config-router-20170221085520.xml’ saved [20067]

    I can see I'm getting an error logging on at some point as well.

    Message from syslogd@speedy at Feb 21 08:44:27 ...
    speedy php-fpm[42058]: /diag_backup.php: webConfigurator authentication error for '[b]admin[/b]' from

    It connects on the last command and saves the file, but it doesn't appear that it's logged in. I'm missing something silly but not sure what it is.

    The new wiki page has instructions for the new version and that works fine.

  • Wow.. any luck reversing this for CLI restore?

Log in to reply