Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeObfuscator class #27

Open
flakka2022 opened this issue Jun 26, 2023 · 0 comments
Open

DeObfuscator class #27

flakka2022 opened this issue Jun 26, 2023 · 0 comments

Comments

@flakka2022
Copy link

class DeObfuscator {

/** @var string */
private $sName;

/** @var string */
private $sData;

/** @var string */
private $sPreOutput;

/** @var string */
private $sOutput;

/**
 * @param string $sData Obfuscated code.
 * @param string $sName The name of the original code that was obfuscated.
 */
public function __construct($sData, $sName) {
    $this->sName = $sName;
    $this->sData = $sData;
    $this->decrypt();
}

public function getDecryptedCode() {
    return base64_decode(gzuncompress(base64_decode($this->sPreOutput)));
}

private function decrypt() {
    $this->sOutput = base64_decode(str_replace('[BREAK]', "\n", $this->sData));
    preg_match('/Loading\s(.+)/', $this->sOutput, $matches);
    $this->sName = isset($matches[1]) ? $matches[1] : '';

    preg_match('/base64_decode\((.+)\);/', $this->sOutput, $matches);
    $this->sPreOutput = isset($matches[1]) ? eval("return {$matches[1]};") : '';

    $this->sPreOutput = str_replace('$__', 'base64_decode', $this->sPreOutput);
    $this->sPreOutput = preg_replace('/\$(\w+)\s*=\s*\'(.+)\'\s*;\s*/', '\$$1=$2;', $this->sPreOutput);
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant