-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Challenge get | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
paths: | ||
- "!**/README.md" | ||
- "challenges/web/get/build/**" | ||
workflow_dispatch: | ||
|
||
env: | ||
TYPE: web | ||
NAME: get | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# GET | ||
|
||
- **作者**:ksks | ||
- **参考**:- | ||
- **难度**:Easy | ||
- **分类**:Web | ||
- **暴露端口**:80 | ||
|
||
## 题目描述 | ||
|
||
## 题目解析 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM python:alpine | ||
|
||
ENV FLASK_APP=app FLASK_ENV=production FLASK_ENV_DEBUG=False | ||
|
||
RUN pip install flask gunicorn --no-cache-dir | ||
|
||
COPY --chmod=500 init.sh /init.sh | ||
COPY ./app /app | ||
|
||
WORKDIR /app | ||
|
||
CMD ["/init.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
from flask import Flask, request | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
FLAG = os.getenv("GZCTF_FLAG", "flag{test_flag}") | ||
|
||
|
||
@app.route("/") | ||
def index(): | ||
if want := request.args.get("want"): | ||
return FLAG | ||
else: | ||
return "请用 GET 方式提交一个名为 want,值为 flag 的变量" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
gunicorn main:app -b 0.0.0.0:80 |