Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archer C20 decrypts fine but doesn't encrypt well #44

Open
Scr1ptW0lf opened this issue Sep 24, 2024 · 1 comment
Open

Archer C20 decrypts fine but doesn't encrypt well #44

Scr1ptW0lf opened this issue Sep 24, 2024 · 1 comment

Comments

@Scr1ptW0lf
Copy link

When using the tool to decrypt the file, it works well. My command was as follows:

python3 tpconf_bin_xml.py config.bin original.xml

> WARNING: wrong endianness, automatically switching. (see -h)
> OK: appears your device uses little-endian.
> OK: BIN file decrypted, MD5 hash verified, uncompressing…
> Done.

Here are the first few lines of the decrypted XML:

<?xml version="1.0"?>
<DslCpeConfig>
  <InternetGatewayDevice>
    <DeviceSummary val="InternetGatewayDevice:1.1[](Baseline:1, EthernetLAN:1)" />
    <LANDeviceNumberOfEntries val=1 />
    <DeviceInfo>
      <ManufacturerOUI val=****** />
      <SerialNumber val=************* />
      <HardwareVersion val="Archer C20 v5 00000005" />
      <SoftwareVersion val="0.9.1 4.17 v0001.0 Build 201214 Rel.42010n(4555)" />

However, encrypting this xml file back to a .bin file, it doesn't work properly. This was my command:

python3 tpconf_bin_xml.py -l original.xml original.bin

> OK: XML file - compressing, hashing and encrypting…
> Done.

Here's an image of the hex side by side, with the bin output from the tpconf tool on the left and the original bin from the router on the right:

image

As you can see, the first 4 hex bytes are different, and I don't know why. Everything else is the same. The router moans when I try to upload it. Any ideas as to why this would be happening?

Funnily enough, when using the tool to decrypt the already encrypted file (original.bin), it comes out as expected. My hypothesis is that there's some sort of encoding issue, but I'm not sure :)

@sta-c0000
Copy link
Owner

Try using the -s / --skiphits option required for some Archer models. (see -h / --help)
python3 tpconf_bin_xml.py -l -s conf.xml newconf.bin

It's automatically applied to older Archer C2x v1 models, but not to newer version like your (v5); C2 v5 apparently doesn't use it, but perhaps C20 v5 does? It was difficult to get a clear picture of exactly which models/versions use the older compression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants