Skip to content

Commit

Permalink
添加 web/view_source
Browse files Browse the repository at this point in the history
  • Loading branch information
13m0n4de committed Oct 16, 2023
1 parent 5485a73 commit 0e34dab
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/chal.web.view_source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Challenge view_source

on:
push:
branches: ["main"]
paths:
- "!**/README.md"
- "challenges/web/view_source/build/**"
workflow_dispatch:

env:
TYPE: web
NAME: view_source
REGISTRY: ghcr.io

jobs:
challenge-build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.NAME }}
tags: |
latest
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: challenges/${{ env.TYPE }}/${{ env.NAME }}/build
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
11 changes: 11 additions & 0 deletions challenges/web/view_source/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 没课就睡觉

- **作者**:Only
- **参考**:-
- **难度**:Easy
- **分类**:Web
- **暴露端口**:80

## 题目描述

## 题目解析
8 changes: 8 additions & 0 deletions challenges/web/view_source/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ghcr.io/svuctf/base/php:latest

COPY index.php /var/www/html/index.php
RUN chown -R www-data:www-data /var/www/html/

COPY --chmod=500 init.sh /etc/init.sh

CMD ["/etc/init.sh"]
10 changes: 10 additions & 0 deletions challenges/web/view_source/build/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>今日没课</title>
</head>
<body>
<h1>今日没课,睡个觉吧</h1>
<p class="<?php echo getenv("GZCTF_FLAG"); ?>">ZZZ~</p>
</body>
</html>
4 changes: 4 additions & 0 deletions challenges/web/view_source/build/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

php-fpm -D
nginx -g 'daemon off;'

0 comments on commit 0e34dab

Please sign in to comment.