Last active
June 30, 2022 13:26
-
-
Save dozykeys/9b76b16bd675447a6f7592a14efa64c6 to your computer and use it in GitHub Desktop.
This is a php Obfuscator class. It simply obfuscates the php source code while still parsing it correctly when implemented.
This file contains hidden or 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 | |
namespace Obfuscator; | |
/** | |
* Class Obfuscator | |
* @author Duru Chidozie | |
* @copyright 2019 | |
* @version 1.0.0 | |
* | |
*/ | |
class Obfuscator { | |
public static $inputPath; | |
public static $outputPath; | |
public function __construct($inputPath,$outputPath){ | |
self::$inputPath=$inputPath; | |
self::$outputPath=$outputPath; | |
} | |
public static function obfuscate(){ | |
if (!self::$inputPath || !self::$outputPath) { | |
die("Error: Not Found - input file or output file\n"); | |
} | |
$data="ob_end_clean();?>"; | |
$data.=php_strip_whitespace(self::$inputPath); | |
// compress data | |
$data=gzcompress($data,9); | |
// encode in base64 | |
$data=base64_encode($data); | |
$out='<?php ob_start();$akugkjugkjgkujfkhdjdutduydihfoufkudysiyikufolufkudikydiufoujfoudkyxujtsyrsrfsytgdihogipigogoakugkjugkjgkujfkhdjdutduydihfoufkudysiyikufolufkudikydiufoujfoudkyxujtsyrsrfsytgdihogipigogoakugkjugkjgkujfkhdjdutduydihfoufkudysiyikufolufkudikydiufoujfoudkyxujtsyrsrfsytgdihogipigogo=\''.$data.'\';eval(gzuncompress(base64_decode($akugkjugkjgkujfkhdjdutduydihfoufkudysiyikufolufkudikydiufoujfoudkyxujtsyrsrfsytgdihogipigogoakugkjugkjgkujfkhdjdutduydihfoufkudysiyikufolufkudikydiufoujfoudkyxujtsyrsrfsytgdihogipigogoakugkjugkjgkujfkhdjdutduydihfoufkudysiyikufolufkudikydiufoujfoudkyxujtsyrsrfsytgdihogipigogo)));$v=ob_get_contents();ob_end_clean(); echo $v;?>'; | |
// write output text | |
file_put_contents(self::$outputPath,$out); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment