sta-c0000 / tpconf_bin_xml

Command line utility to convert TP-Link router backup config files
160 stars 40 forks source link

Cannot restore generate config #9

Closed CertainlyAria closed 3 years ago

CertainlyAria commented 4 years ago

I got TD-W9970 v2, but I can't restore generated bin file. When I try to restore, the progress bar goes to 100% and then nothing happens. Device does not reboot. I also lose access to 192.168.1.1 and I get "403 Forbidden" everytime I try to access it. After (manually) rebooting the device everything works as expected except telnet.

sta-c0000 commented 4 years ago

Hi, unfortunately I don't have a TD-W9970 v2, I only have a v1, so I cannot really troubleshoot for you.

I assume from your description that these steps work:

Then you should have a conf.xml file that you can then view as plain text.

If the above steps do work, then that is all tpconf_bin_xml.py is supposed to do. If they don't, then someone with a v2 router would need to troubleshoot.

If you are an advanced user and are attempting to manually modify the .xml file, then probably it is not being done correctly.

Without modifying the extracted .xml file, this command: python3 tpconf_bin_xml.py conf.xml conf_new.bin should generate an identical file to the one you downloaded from the router, which the router will of course accept.

It's important that the entire extracted .xml file must be intact, unmodified; any missing, or incorrectly modified parts will cause it to fail the restore process on the router.

It appears, from your description, you may be trying to add the single Description telnet hack line to the <DeviceInfo> section; that section should look something like this (and like the rest of the XML must also be all there and untouched!):

<?xml version="1.0"?>
[...]
    <DeviceInfo>
      <ManufacturerOUI val=XXXXXX />
      <Description val="300Mbps Wireless N USB VDSL/ADSL Modem Router`telnetd -p 1023 -l login`" />
      <SerialNumber val=XXXXXXXXXXXX />
      <HardwareVersion val="TD-W9970 v0 00000000" />
      <SoftwareVersion val="(versioninfo)" />
      <AdditionalHardwareVersion val=00000000 />
      <UpTime val=0 />
      <X_TP_IsFD val=0 />
    </DeviceInfo>
[...]
Amenobiss commented 4 years ago

I got TD-W9970 v1, but I can't restore generated bin file. I observed that modified bin after running the script is so short (4,4 k) instead original 25,3 K and I suppose this is the reason I can't upload new bin file. Process from backed up bin to xml goes without errors. I added a description as you said, exactly as this: \ before <Serialnumber ...>. Again ran script and with no errors but generated file is so short and when I try to upload I get an error Error code: 4501, you put a wrong file.... Router remains unchanged.

sta-c0000 commented 4 years ago

The conf.bin is compressed so it is normal for it to be 20% or so of the .xml. You should have noticed this with the downloaded conf.bin?

As mentioned above, if you do:

python3 tpconf_bin_xml.py conf.bin conf.xml

then, without modifying anything:

python3 tpconf_bin_xml.py conf.xml conf_new.bin

The resulting conf_new.bin should be identical to the original downloaded conf.bin (do a file compare) and should upload fine to the router without issues.

Again, if you are modifying the .xml before converting to .bin and the upload fails, you could be doing it wrong. The problem could be as simple as the (non-programmer?) editor you are using, it could be incorrectly modifying the file contents, or using wrong line endings (e.g. Windows CRLF instead of standard LF) without you realizing it.

And again, modifying the .xml is meant for advanced users only, if you are not 100% sure what you are doing, it's not a good idea.

Sorry, I can't reproduce the problem.

sta-c0000 commented 3 years ago

Confirmed that it works fine with both v1 and v2, so closing. (issue was probably incorrectly modified XML files)