GithubHelp home page GithubHelp logo

goofygiraffe06 / dailyctfrobot Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 1.0 539 KB

An Awesome, Feature Rich Discord Bot for Hosting and Managing CTF Challenges on Discord Written in Python3

License: GNU General Public License v3.0

Python 100.00%
ctfs discord-bot discordpy python3 bot discord ctf-challenges ctf-tools cybersecurity

dailyctfrobot's Introduction


Logo

DailyCTF Robot

An Awesome, Feature Rich Discord Bot to Host and Manage CTF Challenges on Discord Written in Python3

Report Bug . Request Feature

Contributors Forks Stargazers Issues License Contributor Covenant

Table Of Contents

About The Project

DailyCTF Robot is a Discord bot designed specifically for hosting and managing CTF challenges. It provides a seamless and streamlined experience for both organizers and participants, handling everything from the announcement of a challenge to the submission and validation of flags.

Features

  • Dynamic bot presence: The bot's activity status is heavily inspired from Cyberchef loading screen messages.
  • Role-based management: Organizers can designate roles that can create or manage challenges, ensuring that the system remains tamper-proof.
  • Intuitive UI components: The bot leverages Discord's UI components such as modals providing form like interface for users to create challenges and to setup.
  • Versatile command suite: The bot includes commands for users (e.g., submitting flags, querying challenge time remaining) and admins (e.g., setting up and shutting down challenges, gathering feedback).
  • Feedback loop: Users can provide feedback, after every submission creating a loop of feedback and continuous improvement.
  • Event logging: All significant actions and interactions with the bot are logged for transparency and traceability.
  • Personalized on_guild message: The bot introduces itself and provides essential guidelines when introduced to a new server.
  • Configurable settings: Different servers can have different requirements, so the bot offers configurable settings for a tailored experience.
  • Security: The bot has built-in security protocols, such as rigorous permission checks and safeguarding challenge answers.

Under the Hood

The bot relies on a modular design, with each cog handling a specific set of tasks. This ensures maintainability and scalability. Keeping the primary logic clutter-free and comprehensible.

Getting Started

These instructions will guide you on how to deploy and run the DailyCTF Robot on your local machine for development and testing purposes, as well as how to deploy it for production use on your Discord server.

Prerequisites

  • git installed on your machine.
  • Python (version 3.8 or above).

Installation

Local Installation

  1. Clone the Repository:
https://github.com/Goofygiraffe06/DailyCTFRobot.git
  1. Navigate to the Directory:
cd DailyCTFRobot
  1. Install Required Packages:
pip install -r requirements.txt
  1. Configuring env Variables:
echo token='<Your_Discord_Bot_Token_Here>' >> .env
  1. Run The Bot:
python main.py

[DEPRICATED] Replit Installation (Free 24/7)

1.Start a New Python Project: On your Replit dashboard, click on the + button to create a new repl and select Python.

2.Import from GitHub: On the Replit interface, you'll see an option to 'import from GitHub'. Enter the repository URL: https://github.com/Goofygiraffe06/DailyCTFRobot.git

3. Configure Secrets: On the left sidebar, you'll see an icon resembling a lock. Clicking on it and add a new secret with the secret name being 'token' and the key being Discord Bot Token.

4.Install Required Packages: Once the code is imported, Replit should automatically recognize the requirements.txt file and install the necessary dependencies. If not, run this in the Replit shell:

pip install -r requirements.txt

5.Run the bot: Click on the green Run button at the top of your Replit environment. Your bot should now be active and visit my blog, If you want to learn how to keep it persistent.

Important

This bot is designed for a single server use only and requires self-hosting.

Usage

  • /setup: Initiate bot's server-specific setup - select roles & channels.
  • /help: Displays a list of all available bot commands.
  • /setchallenge: Start a new Capture The Flag challenge.
  • /shutdown: Conclude the currently active CTF challenge.
  • /timeleft: Check the remaining time for the current challenge and hint.
  • /feedback: Provide feedback or report issues regarding the bot.
  • /ping: Check the bot's responsiveness.
  • /rate: Rate the active challenge out of 5.
  • /submit <flag>: Submit your answer for the active CTF challenge.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  • If you have suggestions for new features, optimizations or documentation, feel free to open an issue to discuss it (If you need any assistance), or directly create a pull request after you edit the README.md file with necessary changes.
  • Please make sure you test the bot thoroughly .
  • Create individual PR for each suggestion.

License

Distributed under the GPLv3 License. See LICENSE for more information.

dailyctfrobot's People

Contributors

goofygiraffe06 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ep1cgamer007

dailyctfrobot's Issues

Help Needed in Modularizing the Codebase

Hello fellow devs,

As our project has grown, so has the complexity of our codebase. I believe it's time to consider refactoring our code to make it more modular and maintainable.

Currently, the code is written in a monolithic style, making it challenging to understand, debug, and extend.

Desired Outcome:

  • Break the existing code into logical modules.
  • Create separate files/folders for each module, keeping related functions and classes together.
  • Improved readability and maintainability.
  • Easier testing, as modules can be tested independently.

I'm opening this issue here to ask the public for assistance. Please leave a comment below if you have any knowledge of refactoring codebases or ideas on how we might go about doing this. Even better if you're willing to take on this responsibility! Please inform me so that we can continue our conversation.

We appreciate your ongoing assistance and contributions to make the bot more better and friendlier.

Thanks,
Goofygiraffe06

Store flags encrypted with SHA256

In lines 75-84 of AdminCommands.py:

challenge_data = {
          "master_id": interaction.user.id,
          "day": day,
          "desc": description,
          "answer": answer,
          "hints": hints,
          "writeup": writeup,
          "leaderboard": {},
          "start_time": int(datetime.datetime.utcnow().timestamp()),
      }

instead of storing plaintext flag("answer"), store SHA256 encrypted version.
And in line 104 of GeneralCommands.py:

if "answer" in challenge_data and challenge_data["answer"] == flag:

compare extracted answer to encrypted inputted answer instead of plaintext.

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.