Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
D-Link gws file decoder
#/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
You can’t perform that action at this time.