Coder Social home page Coder Social logo

weyung / gzctf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gztimewalker/gzctf

0.0 0.0 0.0 4.14 MB

The GZ::CTF project, an open source CTF platform.

License: GNU Affero General Public License v3.0

Shell 0.01% JavaScript 0.05% C# 49.46% TypeScript 47.84% CSS 0.03% HTML 2.51% Dockerfile 0.11%

gzctf's Introduction

Banner

GZ::CTF

Build & Publish Image

GZ::CTF 是一个基于 ASP.NET Core 的开源 CTF 平台。

特性

  • 创建高度可自定义的题目
    • 题目类型:静态附件、动态附件、静态容器、动态容器
      • 静态附件:共用附件,任意添加的 flag 均可提交。
      • 动态附件:需要至少满足队伍数量的 flag 和附件,附件及 flag 按照队伍进行分发。
      • 静态容器:共用容器,任意添加的 flag 均可提交。
      • 动态容器:自动生成并通过容器环境变量进行 flag 下发,每个队伍 flag 唯一。
    • 动态分值
      • 分值曲线: $$f(S, r, d, x) = \left \lfloor S \times \left[r + ( 1- r) \times exp\left( \dfrac{1 - x}{d} \right) \right] \right \rfloor $$ 其中 $S$ 为原始分值、 $r$ 为最低分值比例、 $d$ 为难度系数、 $x$ 为提交次数。前三个参数可通过自定义实现绝大部分的动态分值需求。
      • 三血奖励: 平台对一二三血分别奖励 5%、3%、1% 的当前题目分值
    • 比赛进行中可启用新题
    • 动态 flag 中启用作弊检测
  • 基于 Docker 或 K8s 的动态容器分发
  • 动态展示可缩放的前十名队伍得分时间线、动态隐藏的积分榜
  • 基于 signalR 的实时比赛通知、比赛事件和 flag 提交监控及日志监控
  • SMTP 注册邮件发送、基于 Google ReCaptchav3 的恶意注册防护
  • 用户封禁、用户三级权限管理
  • 以及更多……

Demo

安装配置

应用已编译打包成 Docker 镜像,可通过以下方式获取:

docker pull ghcr.io/gztimewalker/gzctf/gzctf:develop

也可使用根目录下的 docker-compose.yml 文件进行配置。

appsettings.json 配置

为了使注册功能正常使用,请补全 EmailConfigGoogleRecaptcha 部分,其中验证码请借由 recaptcha 处注册。

ContainerProviderDocker 时:

  • 如需使用本地 docker,请将 Uri 置空,并将 /var/run/docker.sock 挂载入容器对应位置
  • 如需使用外部 docker,请将 Uri 指向对应 docker API Server

ContainerProviderK8s 时:

  • 请将集群连接配置放入 k8sconfig.yaml 文件中,并将其挂载到 /app 目录下
{
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "DefaultConnection": "Host=db:5432;Database=ctf;Username=postgres;Password=Fyjd0HtrL00QD555W1b6WLKbLl62cHT0"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Trace",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "EmailConfig": {
    "SendMailAddress": "",
    "UserName": "",
    "Password": "",
    "Smtp": {
      "Host": "",
      "Port": 587,
      "EnableSsl": true
    }
  },
  "ContainerProvider": "Docker",
  "DockerConfig": {
    "Uri": "",
    "PublicIP": "127.0.0.1"
  },
  "GoogleRecaptcha": {
    "IsEnable": false,
    "VerifyAPIAddress": "https://www.recaptcha.net/recaptcha/api/siteverify",
    "Sitekey": "",
    "Secretkey": "",
    "RecaptchaThreshold": "0.5"
  }
}

初始管理员

生产环境中默认不存在管理员权限用户,需要手动更改数据库条目。当管理员注册完成并成功登录后,进入所选数据库表格后执行:

update "AspNetUsers" set "Role"=3 where "UserName"='GZTime';

关于 i18n

暂不考虑进行多语言适配。

Stargazers over time

Stargazers over time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.