Created
June 24, 2014 15:23
-
-
Save yireo/f9e3ba3b7e8cca7d74c3 to your computer and use it in GitHub Desktop.
Decode evil scripts encoded with eval(gzinflate(base64_decode()))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Basic script to decrypt files encoded with eval(gzinflate(base64_decode($data))); | |
*/ | |
$file = 'encrypted.php'; | |
$content = file_get_contents($file); | |
function evaldecode($content, $step = 0) { | |
//echo "STEP $step\n"; | |
$step++; | |
if(preg_match('/^eval\(/', $content)) { | |
$content = str_replace('eval(', 'print(', $content); | |
ob_start(); | |
eval($content); | |
$content = ob_get_contents(); | |
ob_end_clean(); | |
} | |
$content = trim($content); | |
if(preg_match('/^eval\(/', $content)) { | |
$content = evaldecode($content, $step); | |
} | |
return $content; | |
} | |
echo evaldecode($content)."\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here is the decoded version
query("SELECT * FROM
stories
wherestory_time
> '{$story_time}' order bystory_id
ASC"); if ($users_list->num_rows > 0) { $users = []; while ($list = $users_list->fetch_assoc()) { $users['u' . $list['user_id']] = $list; } foreach ($users as $key => $value) { //print_r($value); $stories_list = $mysqli->query("SELECT * FROMstories
WHEREuser_id
='{$value['user_id']}' andstory_time
> '{$story_time}' order bystory_id
ASC"); if ($stories_list->num_rows > 0) { $user_stories = []; while ($list = $stories_list->fetch_assoc()) { $story['story_id'] = $list['story_id']; $story['story_source'] = $list['story_source']; $story['story_description'] = $list['story_description']; $story['story_type'] = $list['story_type']; $story['story_time'] = $list['story_time']; $story_seen = json_decode($list['story_seen'], true); $story['story_seen'] = is_array($story_seen) ? count($story_seen) : 0; array_push($user_stories, $story); } } $story_seen = in_array($data['user_id'], json_decode($value['story_seen'], true)) ? 'true' : 'false'; $user = userDetails($value['user_id']); $user_story_data = [ 'user_photo' => myavatar($user['user_tumb']), 'user_name' => '' . $user['user_name'] . '', 'user_id' => $user['user_id'], 'last_updated' => $value['story_time'], 'story_seen' => $story_seen, 'story' => $user_stories ]; array_push($stories, $user_story_data); } } echo json_encode(['stories' => $stories, 'stories_count' => count($stories)]); }