Coder Social home page Coder Social logo

diggid4ever / admin-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from darinmao/admin-bot

0.0 0.0 0.0 149 KB

Puppeteer service for client-side CTF challenges

License: GNU General Public License v3.0

JavaScript 66.79% CSS 2.27% HTML 23.34% Dockerfile 5.91% Shell 1.70%

admin-bot's Introduction

admin-bot

Puppeteer service for client-side CTF challenges

Setup

With Docker

$ cp .env.example .env
$ docker-compose up -d

Manually

First install dependencies with

$ npm install

You will also need access to a Redis server, either locally or on a different server.

Configure admin-bot with environment variables or a .env file. There's not a ton to configure, and anything left unconfigured will have the below default values:

RECAPTCHA_PUBLIC_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_PRIVATE_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
WORKER_CONCURRENCY=30
REDIS_URL=redis://127.0.0.1:6379

The only setting you must provide a value for is CHALLENGE_CONFIG, which points to a YAML file containing challenge configuration. If you're running workers on multiple servers, make sure the Redis server is accessible from all of them.

Challenge Configuration

Much like the previous attempt at writing admin-bot, challenge configuration is a combination of a YAML file and a module with handlers.

Handlers

Challenge handlers are specified in a module. Make sure they are callable with require(<module>).<handler>. They should have the following signature:

async (job, ctx, submission)

job is the bull job, ctx is a fresh incognito browsing context, and submission is what the user submitted. If you would like to set progress during the handler, you can call job.progress() with a number between 0 and 100. Check out bull's reference for more options, though many of these methods are unhandled in this service.

YAML

handlerModule: ./handlers.js                # points to the handler module
challenges:
  test-title:                               # challenge ID as well as its submission URL
    displayName: "Test Challenge - Title"   # challenge name
    message: "Message to display"           # (optional) challenge message
    handler: getTitle                       # challenge handler
    showOutput: true                        # (optional, default false) show output on status page
    showError: true                         # (optional, default false) show errors on status page
    filter: ^http:\/\/2020\.redpwnc\.tf...  # (optional) submission regex filter

Running

node server.js
node worker.js

You can have as many workers as you like, but running multiple workers on one machine will likely not improve performance (untested).

admin-bot's People

Contributors

darinmao avatar dependabot[bot] avatar

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.