Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
D-Link gws file decoder
//author rgranadino aug 22 2012
//tested on a D-Link DIR-615 B2 v2.25 firmware.
//this is a php translation of:
$file = $argv[1];
if (!is_readable($file)) {
echo "Cannot read file: $file\n";
$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);
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.