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. Link to comment https://forums.phpfreaks.com/topic/171305-best-way-of-doing-this/ 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. Link to comment https://forums.phpfreaks.com/topic/171305-best-way-of-doing-this/#findComment-903672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.