Jump to content

Best way of doing this?


newbtophp

Recommended Posts

I have some encoded code and if I change eval to $some, then add

$some= preg_replace('eval', 'echo', $some);

eval ($some); before ?>, I get the decoded.

 

So here and example encoded: (not functional)

 

<?php $_G="string"; eval($_G("string")); ?>

 

Heres how it would look if was to decode it: (example)

 

<?php $_G="string"; $some($_G("string"));  $some= preg_replace('eval', 'echo', $some); eval ($some); ?>

 

 

if you were to create a script to do so how would you do it?

 

I've tried and come up with:

 

<form action="index2.php" method='post'>

<textarea name='so' rows="8" cols="20"></textarea><br>


<input type='submit' name='submit' value='Submit'/><br>
</form>

<?php
$so = $_POST['so'];
$so = str_replace(?>', "", $so);
$so = str_replace('eval($_G', '$some($_G', $so);
$submit= $_POST['submit'];
if($so == "") echo "";
else {
    if($submit == "Submit") {
echo $so;
$some= preg_replace('eval', 'echo', $some);
eval ($some);
echo "?>\n";
    }
}
?>

 

Can anyone suggest a better way?, since the way Im trying is not functioning, Im using str replace to change the text.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.