Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function script_looksvalid($code) {
- $code = str_replace("\t", ' ', $code);
- $keywords = [' set ', ' add ', 'command ', ' trigger:', ' else', ' if ', ' send ', ' message ', 'every ', 'loop ', ' player ', ' to ', 'on '];
- foreach ($keywords as $word) {
- if (stripos($code, $word) !== false) {
- return true;
- }
- }
- return false;
- }
- function deobfuscate($code) {
- $read = false;
- $options = null;
- $code = str_replace("\r", null, $code);
- foreach (explode(PHP_EOL, $code) as $line) {
- if (($line == 'options:') && ($read == false)) {
- $read = true;
- $code = str_replace($line, null, $code);
- } else if ($read == true) {
- if ((strpos($line, ' ') === 0) || (strpos($line, "\t") === 0)) {
- $option = explode(': ', trim($line), 2);
- $options['{@' . $option[0] . '}'] = $option[1];
- $code = str_replace($line.PHP_EOL, '', $code);
- } else {
- $read = false;
- }
- }
- }
- if (is_array($options)) {
- $temp_keys = array_map('strlen', array_keys($options));
- array_multisort($temp_keys, SORT_DESC, $options);
- $code = str_replace(array_keys($options), array_values($options), $code);
- if (!script_looksvalid($code)) {
- $notice['warning'] = 'This code doesn\'t look like valid script code. Are you sure this is a script that has been obfuscated using <b>Deobfuskator</b>?';
- }
- } else {
- $notice['error'] = 'Oops! Something went wrong while reading the file. Are you sure that this is a script that has been obfuscated using <b>Deobfuskator</b>? (ERR1)';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement