Created
May 18, 2016 12:48
-
-
Save djumaka/c1d97ff0916bd8eda4ad07df9c25d0a3 to your computer and use it in GitHub Desktop.
decode encrypted JS file from array to real code
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 | |
$jsString = file_get_contents("./load_save_banner.js"); | |
preg_match("/^var (.*?) = (\[.*?\]);/i", $jsString, $output_array); | |
$varName = $output_array[1]; | |
$varData = eval('return '.$output_array[2].';'); | |
foreach($varData as $key => $val) { | |
$jsString = str_replace($varName.'['.$key.']', "\"".addslashes($val)."\"", $jsString); | |
} | |
file_put_contents('./js/load_save_banner.js', $jsString); | |
file_put_contents('./js/load_save_banner.js', preg_replace("/\[\"([a-zA-Z-_0-9]+?)\"\]\(/i", ".$1(", $jsString)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment