newbtophp Posted August 21, 2009 Share Posted August 21, 2009 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. Quote Link to comment Share on other sites More sharing options...
newbtophp Posted August 21, 2009 Author Share Posted August 21, 2009 I was thinking i may have done something wrongh when echoing?, not sure how i'd solve it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.