Hack Forums
[PHP] Help with obfuscation? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [PHP] Help with obfuscation? (/showthread.php?tid=6273172)



Help with obfuscation? - I cry blood - Jun 12, 2024

Does anyone know a good obfuscator for PHP?

I've worked with ChatGPT however that only seems effective on small snippets of code. Online obfuscators are practically ineffective. I'm witnessed other PHP code obfuscated very well and I was wonder if anyone had any recommendations?

Cheers!


RE: Help with obfuscation? - happygonutty - Jun 12, 2024

(Jun 12, 2024 06:38 PM)I cry blood Wrote:  Does anyone know a good obfuscator for PHP?

I've worked with ChatGPT however that only seems effective on small snippets of code. Online obfuscators are practically ineffective. I'm witnessed other PHP code obfuscated very well and I was wonder if anyone had any recommendations?

Cheers!

The only PHP obfuscator that I know that is very effective and have used it on a project was Zend Guard. The only problem with this tool is that it is not free. People I have worked with from the past that uses PHP in the enterprise field have used this especially with banking systems. πŸ™ƒ


RE: Help with obfuscation? - I cry blood - Jun 12, 2024

(Jun 12, 2024 09:10 PM)happygonutty Wrote:  The only PHP obfuscator that I know that is very effective and have used it on a project was Zend Guard. The only problem with this tool is that it is not free. People I have worked with from the past that uses PHP in the enterprise field have used this especially with banking systems. πŸ™ƒ

I heard about this! Its good to hear a positive sentiment about it. If it works, then I wont mind purchasing a license. Thanks brother 😎


RE: Help with obfuscation? - happygonutty - Jun 12, 2024

(Jun 12, 2024 09:29 PM)I cry blood Wrote:  I heard about this! Its good to hear a positive sentiment about it. If it works, then I wont mind purchasing a license. Thanks brother 😎

But funny thing is that, those companies that didn't purchase latest versions of Zend Guard are prone to deobfuscation tools. There are other forums aside this community that posted this and also here is a good example.

https://github.com/dawwinci/decode-Zend-Guard-php-5.6

You can use it on older versions my friend.


RE: Help with obfuscation? - I cry blood - Jun 13, 2024

(Jun 12, 2024 10:41 PM)happygonutty Wrote:  But funny thing is that, those companies that didn't purchase latest versions of Zend Guard are prone to deobfuscation tools. There are other forums aside this community that posted this and also here is a good example.

https://github.com/dawwinci/decode-Zend-Guard-php-5.6

You can use it on older versions my friend.

Geez. Good to know. Thanks! I'll have to keep that in mind


RE: Help with obfuscation? - happygonutty - Jun 13, 2024

(Jun 13, 2024 01:04 PM)I cry blood Wrote:  Geez. Good to know. Thanks! I'll have to keep that in mind

Yeah and that's what you get for not using up-to-date software and being cheap. Lol. πŸ˜†


RE: Help with obfuscation? - emperorwurm - Jun 13, 2024

What about ionCube [I can't post links yet since I am new user]? I heard they are the competitor of Zend Guard.


RE: Help with obfuscation? - obtainhigh - Jul 3, 2024

ZendCube sure, IonCube sure, or use ObtainHigh obfuscation.

Here’s a PHP script that takes a given PHP file, obfuscates the code by converting it to a more obscure form, and outputs the obfuscated code.

PHP Code

<?php
function obfuscate($code) {
    
$chars = str_split($code);
    
$obfuscated = '';
    foreach (
$chars as $char) {
        
$obfuscated .= '&#'.ord($char).';';
    }
    return 
$obfuscated;
}

if (
$argc < 2) {
    echo 
"Usage: php obfuscator.php <filename>\n";
    exit(
1);
}

$filename = $argv[1];
if (!
file_exists($filename)) {
    echo 
"File not found: $filename\n";
    exit(
1);
}

$code = file_get_contents($filename);
$obfuscatedCode = obfuscate($code);

$outputFile = 'obfuscated_' . basename($filename);
file_put_contents($outputFile, "<?php\n" . $obfuscatedCode . "\n?>");

echo 
"Obfuscated code written to $outputFile\n";
?>

How to use the script:

1. Save the script above in a file, for example, obfuscator.php.

2. Run the script from the command line, providing the name of the PHP file you want to obfuscate. For example:

PHP Code

<?php 
php obfuscator
.php myscript.php 

The script will read myscript.php, obfuscate the PHP code, and save the obfuscated code in a new file named obfuscated_myscript.php.

The obfuscation process converts each character of the original PHP code into its HTML entity representation. This makes the code harder to read while preserving its functionality.


RE: Help with obfuscation? - I cry blood - Jul 4, 2024

(Jul 3, 2024 05:41 PM)obtainhigh Wrote:  ZendCube sure, IonCube sure, or use ObtainHigh obfuscation.

Here’s a PHP script that takes a given PHP file, obfuscates the code by converting it to a more obscure form, and outputs the obfuscated code.

PHP Code

<?php
function obfuscate($code) {
    
$chars = str_split($code);
    
$obfuscated = '';
    foreach (
$chars as $char) {
        
$obfuscated .= '&#'.ord($char).';';
    }
    return 
$obfuscated;
}

if (
$argc < 2) {
    echo 
"Usage: php obfuscator.php <filename>\n";
    exit(
1);
}

$filename = $argv[1];
if (!
file_exists($filename)) {
    echo 
"File not found: $filename\n";
    exit(
1);
}

$code = file_get_contents($filename);
$obfuscatedCode = obfuscate($code);

$outputFile = 'obfuscated_' . basename($filename);
file_put_contents($outputFile, "<?php\n" . $obfuscatedCode . "\n?>");

echo 
"Obfuscated code written to $outputFile\n";
?>

How to use the script:

1. Save the script above in a file, for example, obfuscator.php.

2. Run the script from the command line, providing the name of the PHP file you want to obfuscate. For example:

PHP Code

<?php 
php obfuscator
.php myscript.php 

The script will read myscript.php, obfuscate the PHP code, and save the obfuscated code in a new file named obfuscated_myscript.php.

The obfuscation process converts each character of the original PHP code into its HTML entity representation. This makes the code harder to read while preserving its functionality.

I'll look into it. Thank you for the response!