Created
September 14, 2014 09:14
-
-
Save Xyl2k/62383594e5661b8a61d6 to your computer and use it in GitHub Desktop.
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
<?php | |
function decode($data, $key) { | |
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, ''); | |
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); | |
mcrypt_generic_init($td, $key, $iv); | |
mcrypt_generic($td, $data); | |
$data = mdecrypt_generic($td, $data); | |
mcrypt_generic_deinit($td); | |
mcrypt_module_close($td); | |
return $data; | |
} | |
function visualDecrypt(&$data) { | |
$len = strlen($data); | |
if ($len > 0) | |
for ($i = $len - 1; $i > 0; $i--) | |
$data[$i] = chr(ord($data[$i]) ^ ord($data[$i - 1])); | |
} | |
$data = file_get_contents('config.bin'); | |
$key = md5('hasd7h12g1', true); | |
$decoded = decode($data, $key); | |
visualDecrypt($decoded); | |
$size = strlen($decoded); | |
header('Content-Type: application/octet-stream;'); | |
header('Content-Transfer-Encoding: binary'); | |
header('Content-Length: ' . $size); | |
header('Content-Disposition: attachment; filename=config_decrypted.dll'); | |
header('Expires: 0'); | |
header('Cache-Control: no-cache, must-revalidate'); | |
header('Pragma: no-cache'); | |
echo($decoded); | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment