Jump to content

encrypt - base64 - eval


hassank1

Recommended Posts

Hi

1st I know encoding the php files isn't secure and can easilty been decoded.. however It's better than showing the code...

 

ok well the issue is that I've  php files I want to make them look encoded..

 

so I want the file to be something like eval(base64_orsomething(the code here)) <-- I think this is correct right?

 

what I want to know is how to create [the code here] part .. from my php files ?

Link to comment
https://forums.phpfreaks.com/topic/155321-encrypt-base64-eval/
Share on other sites

Encode them with base64_encode(). To keep from escaping all single quotes when defining the string containing the file contents, you can just encode the files somewhere online (or make your own form/script running base64_encode() on the POST'ed content), or alternatively define the string using the nowdoc syntax (available since PHP 5.3.0). It also seems you shouldn't include the PHP opening/closing tags, since eval() doesn't expect those.

 

Example: I've encoded the below file (without <?php and ?>).

 

<?php
$var = 'var contents';
echo $var;
?>

 

In base64:

 

JHZhciA9ICd2YXIgY29udGVudHMnOwplY2hvICR2YXI7

 

Decode and run it with:

 

<?php
$encoded = 'JHZhciA9ICd2YXIgY29udGVudHMnOwplY2hvICR2YXI7';
eval(base64_decode($encoded));
?>

 

Outputs:

 

var contents

Link to comment
https://forums.phpfreaks.com/topic/155321-encrypt-base64-eval/#findComment-817177
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.