Created
August 23, 2012 04:43
-
-
Save rgranadino/3432496 to your computer and use it in GitHub Desktop.
D-Link gws file decoder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usb/bin/php | |
<?php | |
//author rgranadino aug 22 2012 | |
//tested on a D-Link DIR-615 B2 v2.25 firmware. | |
//this is a php translation of: | |
// http://www.shulerent.com/2009/08/21/cracking-the-d-link-settings-file/ | |
$file = $argv[1]; | |
if (!is_readable($file)) { | |
echo "Cannot read file: $file\n"; | |
exit(1); | |
} | |
$handle = fopen($file, 'r'); | |
$size = filesize($file); | |
$out = array(); | |
for ($i=0; $i <$size; $i++) { | |
$char = ord(fread($handle,1)) - ($i%256); | |
if ($char < 0) { | |
$char += 256; | |
} | |
$out[] = chr($char); | |
} | |
fclose($handle); | |
echo implode('', $out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment