Decrypting D-Link XOR Encrypted Firmware

 

Firmware DIR850LB1_FW207WWb05.bin is encrypted with XOR cipher. Original firmware is XORed with two keys. First key is

wrgac25_dlink.2013gui_dir850l

Second key is numbers from 1 to 251.



Python program to decrypt the firmware is given below:

import itertools
import sys

key1 = itertools.cycle(b'wrgac25_dlink.2013gui_dir850l')
key2 = itertools.cycle(range(1, 252))

with open(sys.argv[1], 'rb') as f:
    fw = f.read()

with open(sys.argv[2], 'wb') as f:
    for i in range(0, len(fw)):
        f.write(bytes([fw[i] ^ next(key1) ^ next(key2)]))




Demo


Comments

  1. HOW TO NOW XOR BITE IN FIRMWARE AND EXTRACT THIS KEY

    ReplyDelete

Post a Comment

Popular posts from this blog

Decrypt TP-Link config.bin Configuration Backup File

Firmadyne Installation & Emulation of Firmware

Extract / Create Cramfs File System from Ubuntu 20.04