Skip to content

A Django-based web platform for cybersecurity enthusiasts to participate in Capture The Flag (CTF) challenges, submit flags, and track scores in real-time. Features separate portals for admins and participants, live scoreboard, and secure session management.

Notifications You must be signed in to change notification settings

Tanush-Jain/Devtrack_CTF_Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capture The Flag (CTF) Web Application

Table of Contents

  1. Introduction
  2. Project Overview
  3. Technology Stack
  4. Project Setup and Development
  5. Backend Architecture and Pipeline
  6. Frontend Overview
  7. Deployment on Render
  8. Functionalities
  9. Database Models and Relationships
  10. Security Considerations
  11. Challenges and Solutions
  12. Conclusion
  13. References
  14. Contact Information

Introduction

This project is a Capture The Flag (CTF) web application built using Django. It provides a platform for cybersecurity enthusiasts to participate in CTF challenges, submit flags, and track scores in real-time. The application supports two types of users: Admins and Participants.


Project Overview

  • Admins can create and manage questions, flags, and participants.
  • Participants can log in, attempt challenges by submitting flags, and view their scores.
  • A live scoreboard displays participant rankings in real-time.

Technology Stack

  • Backend Framework: Django (Python)
  • Frontend: Django Templates, HTML, CSS, JavaScript
  • Database: Initially SQLite3, migrated to PostgreSQL
  • Deployment Platform: Render.com
  • Other Tools: Gunicorn, WhiteNoise, dj-database-url, python-dotenv

Project Setup and Development

  • Started with SQLite3 for rapid development.
  • Migrated to PostgreSQL for production readiness.
  • Models include CTFQuestion, Flag, and Participant.
  • Views handle admin and participant functionalities.
  • Session management and CSRF protection enabled.
  • File uploads supported for challenge files.

Backend Architecture and Pipeline

  • Models represent questions, flags, and participants with relationships.
  • Admin views manage CRUD operations for challenges and users.
  • Participant views handle login, flag submissions, and score tracking.
  • Live scoreboard provides real-time rankings.

Frontend Overview

  • Uses Django templates with custom CSS for styling.
  • Responsive and user-friendly interfaces for admin and participants.
  • Forms for login, adding/editing questions, flags, and participants.
  • Dynamic live scoreboard updates.

Deployment on Render

  • Hosted on Render.com with environment variables configured.
  • Gunicorn used as WSGI server.
  • WhiteNoise serves static files efficiently.
  • Automatic migrations run on startup.

Functionalities

Admin Portal

  • Secure login and session management.
  • Manage questions, flags, participants.
  • Upload files for challenges.
  • View participant scores.

Participant Portal

  • Secure login.
  • View and attempt challenges.
  • Track scores and progress.
  • Download challenge files.

Live Scoreboard

  • Real-time participant rankings.
  • Publicly accessible.

Database Models and Relationships

  • CTFQuestion has many Flags.
  • Participant has many solved questions.
  • Scores update dynamically on correct submissions.

Security Considerations

  • Passwords stored securely (recommend hashing for production).
  • Session and CSRF protections enabled.
  • Environment variables secure sensitive data.
  • Allowed hosts configured.

Challenges and Solutions

  • Database migration from SQLite3 to PostgreSQL.
  • Secure file upload handling.
  • Deployment configuration on Render.
  • Full CRUD operations in admin portal.

Conclusion

This project demonstrates a full-stack Django application for CTF challenges, showcasing backend, frontend, and deployment skills. It is scalable and ready for further enhancements.


References


Contact Information

Your Name
Email: 23020700329@reva.edu.in
GitHub: https://github.com/Tanush-Jain


ER Diagram and Mermaid Code

Below are the ER diagram and Mermaid code diagrams representing the database schema and relationships:

ER Diagram

Mermaid Diagram


In Linux terminal how to run it : source venv/bin/activate

source venv/bin/activate && python3 manage.py runserver deactivate


Schema of the database :

Entities & Attributes:

ctf_participant

  • id (PK)
  • username
  • score
  • password

ctf_ctfquestion

  • id (PK)
  • question_text
  • created_at
  • points
  • file

ctf_flag

  • id (PK)
  • flag_text
  • question_id (FK to ctf_ctfquestion)

ctf_participant_solved_questions

  • id (PK)
  • participant_id (FK to ctf_participant)
  • ctfquestion_id (FK to ctf_ctfquestion)

Thank you for exploring this project!

About

A Django-based web platform for cybersecurity enthusiasts to participate in Capture The Flag (CTF) challenges, submit flags, and track scores in real-time. Features separate portals for admins and participants, live scoreboard, and secure session management.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published