Skip to content

Instantly share code, notes, and snippets.

@yireo
Created June 24, 2014 15:23
Show Gist options
  • Save yireo/f9e3ba3b7e8cca7d74c3 to your computer and use it in GitHub Desktop.
Save yireo/f9e3ba3b7e8cca7d74c3 to your computer and use it in GitHub Desktop.
Decode evil scripts encoded with eval(gzinflate(base64_decode()))
<?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";
@vlain1337
Copy link

vlain1337 commented Jul 21, 2024

'.base64_decode(gzinflate(str_rot13(convert_uudecode(gzinflate(base64_decode('FZPXsaNQAEP/6QIwOWdMNpjMJefo/qvYtwVoRiOdA0o1ZeIi21/CHLBtKpaAfS8/QoRbWZNV1kukJAwx4sukw2e6TjqkKQudZ5c/wx8ENKQ4ruKwYu9LCOFNFAWfmtq7J1tQvyTWXycfi6t9TMx70Tnul3lkUIAAQ2R/g8DWJdyaT48d4E1IXsj79tuvtPrdnR5eTZR04oiI+8u/DS4deHOHaCVutx7ZfJpBAJEyECxaiM9NfSffX3gVsoO0a2Cqj/trqArRVd1zsso69TCjTF5VKv0jMRr5OSBQIQ3wrblU8MaXapPZCHBvafXBU2PoZFIQJA0RFG1EvjY+HzfzchIbVfhYD0UbAt1CTvNLfW+u3Z4JkR9l6b5GrxoM8hragbikcBByNHh90Fd3rGbWIess4G4ue39pV3RPJuvl5Fu9d/2lf7wVt2ec3N/bdBR91HKJPDJfhDkNcly2ZxAsKrcqilXiCQJfFksCD3OxsKlp59iSPD3FH/JwuoumTJ1uUUp1D/tUrGPOnLrV9li6U45dZ/6GgIGM6NMW63eEhTXr2Y+4C6v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Hv0t5r+XJWYBx7RPGpwFcxnGfLQB1vgc6HB4wfaZhwxcPpF8mvSaWi9Ncoi3YjyRwwUlcajvWuTuvfFkBeZ52UHfzcTxUx1cWMifm0P4VdH8U7scVjOH/SD/gE=')))))));

here is the decoded version

query("SELECT * FROM stories where story_time > '{$story_time}' order by story_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 * FROM stories WHERE user_id='{$value['user_id']}' and story_time > '{$story_time}' order by story_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)]); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment