Fysac / orbicfg

Decrypt/encrypt Netgear Orbi config (.cfg) files
10 stars 4 forks source link

RFE: re-encrypt a modified clear text dump into a valid cfg file #4

Closed sphakka closed 1 month ago

sphakka commented 3 years ago

I just decoded successfully a Nighthawk X4 R7500 (FW v1.0.0.124) configuration file, kudos to Fysac :-) Now, it would be really handy to be able to modify the clear text dump and re-encrypt it into a valid cfg file. Is it doable?

Fysac commented 3 years ago

It's definitely doable. I'm working on a ~Rust~ Go rewrite of this tool that will allow re-encrypting. Stay tuned.

igorpolsh commented 1 year ago

It's definitely doable. I'm working on a ~Rust~ Go rewrite of this tool that will allow re-encrypting. Stay tuned.

Hey, any update on this? I am also not a C developer, struggling with instructions a little :)

If you have time (and can be bothered) could you please elaborate on the process of using this tool?

Thank you!

Fysac commented 1 year ago

Hey, any update on this?

Yes: in the go-rewrite branch, there is a preliminary Go version of this program that can re-encrypt config files.

Steps to build:

$ git clone -b go-rewrite https://github.com/Fysac/orbicfg
$ cd orbicfg
$ go build

To decrypt a file called, e.g., NETGEAR_Orbi.cfg (in the same directory) into a JSON file containing the plaintext config entries:

$ ./orbicfg -decrypt NETGEAR_Orbi.cfg -out NETGEAR_Orbi.json
Decrypted to /home/ubuntu/orbicfg/NETGEAR_Orbi.json
Magic number is: 0x20131224
Pass this value in -magic to re-encrypt the config

Make note of that magic number. Then, after you've made the necessary edits to the data in NETGEAR_Orbi.json, you can re-encrypt it to get a config file you can upload to the router:

$ ./orbicfg -encrypt NETGEAR_Orbi.json -out modified.cfg -magic 0x20131224
Using 0x20131224 as magic
Wrote encrypted config to /home/ubuntu/orbicfg/modified.cfg
Fysac commented 1 month ago

Added in master branch.