Skip to content

danielbodnar/awrtconf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

awrtconf

A fast, safe CLI tool to deobfuscate and manipulate ASUS router configuration files

Crates.io License: MIT Build Status


awrtconf is a command-line utility for working with ASUS router (Asuswrt) configuration backup files. It can decode obfuscated .CFG files into human-readable JSON, allow you to edit settings, and re-encode them back to the original format.

Features

  • Decode obfuscated ASUS router config files to JSON
  • Encode JSON configurations back to binary format
  • Inspect config file metadata without full decoding
  • Cross-platform support (Linux, macOS, Windows)
  • Zero dependencies at runtime
  • Memory safe implementation in Rust

Installation

From crates.io

cargo install awrtconf

From source

git clone https://github.com/BigNerd95/Asuswrt-Configs-Deobfuscator.git
cd Asuswrt-Configs-Deobfuscator
cargo install --path .

Pre-built binaries

Download pre-built binaries from the Releases page.

Quick Start

# View config file information
awrtconf info -i Settings_Router.CFG

# Dump config to editable JSON
awrtconf dump -i Settings_Router.CFG -o settings.json

# Edit settings.json with your favorite editor...

# Pack JSON back to config file
awrtconf pack -i settings.json -o Settings_Router_Modified.CFG

Usage

Display Config Information

Inspect a configuration file without decoding its contents:

awrtconf info -i Settings_DSL-N55U.CFG

Output:

** Conf Info **
Profile: HDR2
Body length: 31744 bytes (0x7c00)

Obfuscated conf file
Randkey: 5 (0x5)

Lost ASCII chars: 5 (0x5), 6 (0x6), 7 (0x7)
        If you used one of these chars in your configs,
        please make the backup again until the randkey is higher or at least 3 value smaller.
        Recommended randkey values: randkey <= 4 (0x04) or randkey >= 14 (0x0E).
        Best is 0, only 2 chars lost (0x01 and 0x02).

Dump Config to JSON

Convert a binary config file to editable JSON format:

awrtconf dump -i Settings_DSL-N55U.CFG -o settings.json

The output JSON structure:

{
    "PROFILE": "HDR2",
    "SETTINGS": {
        "lan_ipaddr": "192.168.1.1",
        "lan_netmask": "255.255.255.0",
        "wl0_ssid": "MyNetwork",
        "wl0_wpa_psk": "MyPassword123"
    }
}

Warning: Do not modify the PROFILE value unless you know what you're doing.

Pack JSON to Config

Convert a JSON file back to binary config format:

awrtconf pack -i settings.json -o Settings_Modified.CFG

Force Plaintext Format

All ASUS firmware versions support plaintext (HDR1) config files. Use the -p flag to avoid obfuscation algorithm bugs:

awrtconf pack -i settings.json -o Settings_Plain.CFG -p

This is the recommended approach for maximum compatibility.

Supported Profiles

Profile Format Description
HDR1 Plaintext Unobfuscated configuration
HDR2 Obfuscated Standard obfuscated format
N55U Obfuscated DSL-N55U specific format
AC55U Obfuscated RT-AC55U specific format

Technical Details

File Structure

ASUS config files consist of an 8-byte header followed by the configuration body:

Plaintext (HDR1):

Offset Size Type Description
0x00 4 char[4] Profile identifier (HDR1)
0x04 4 uint32_le Body size (KB-aligned)

Obfuscated (HDR2, N55U, AC55U):

Offset Size Type Description
0x00 4 char[4] Profile identifier
0x04 3 uint24_le Body size (KB-aligned)
0x07 1 uint8 Random key (0-29)

Obfuscation Algorithm

The obfuscation is a simple XOR-based transformation with a random key. Due to implementation bugs in the original ASUS code, certain byte values may be lost during encoding:

  • Bytes equal to randkey, randkey+1, or randkey+2 collide with NULL byte encoding
  • Best practice: Use plaintext format (-p flag) or ensure randkey <= 4 or randkey >= 14

For detailed algorithm analysis, see the original research.

Command Reference

awrtconf <COMMAND>

Commands:
  info   Display config file information
  dump   Dump config to JSON format
  pack   Pack JSON config back to binary format
  help   Print help information

Options:
  -h, --help  Print help

info

awrtconf info -i <INPUT_FILE>

Options:
  -i, --input <INPUT_FILE>  Input config file (.CFG)

dump

awrtconf dump -i <INPUT_FILE> -o <OUTPUT_FILE>

Options:
  -i, --input <INPUT_FILE>    Input config file (.CFG)
  -o, --output <OUTPUT_FILE>  Output JSON file

pack

awrtconf pack -i <INPUT_FILE> -o <OUTPUT_FILE> [-p]

Options:
  -i, --input <INPUT_FILE>    Input JSON file
  -o, --output <OUTPUT_FILE>  Output config file (.CFG)
  -p, --plain                 Force plaintext (HDR1) format

Building from Source

Prerequisites

  • Rust 1.70 or later
  • Cargo

Build

# Debug build
cargo build

# Release build (optimized)
cargo build --release

# Run tests
cargo test

Cross-compilation

# Windows
cargo build --release --target x86_64-pc-windows-gnu

# macOS (from Linux)
cargo build --release --target x86_64-apple-darwin

# Linux static binary
cargo build --release --target x86_64-unknown-linux-musl

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Related Projects


Made with Rust

About

CLI for deobfuscating and parsing ASUS router (asuswrt) configuration files — extract readable config from binary blobs.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages