Skip to content

Latest commit

 

History

History
129 lines (108 loc) · 6.19 KB

CONTRIBUTING.md

File metadata and controls

129 lines (108 loc) · 6.19 KB

Contributing

Pull requests, bug reports, and all other forms of contribution are welcomed and highly encouraged!

Table of Contents

  1. Introduction
  2. Code of Conduct
  3. How to Contribute
  4. Style Guides
  5. Setting Up Your Development Environment

Introduction

We welcome contributions from the community to help improve this project and thank you for considering contributing to CTF Archive!

This document outlines the guidelines for contributing ensuring that your contributions are aligned with our standards and consistent throughout the project.

How to Contribute

Note: Our working directory is /challenge/ in pwn.college for the purposes of archiving with the challenges.

Reporting Bugs

If you encounter any bugs, please report them by following these steps:

  1. Check the issues page to see if the bug has already been reported.
  2. If not, open a new issue and include:
    • A clear and descriptive title.
    • Steps to reproduce the bug.
    • Expected and actual results.
    • Any relevant screenshots or logs.

Suggesting Enhancements

We appreciate suggestions for new features or improvements. To suggest an enhancement:

  1. Check the issues page for existing suggestions.
  2. If your suggestion is new, open an issue and provide:
    • A detailed description of the enhancement.
    • The benefits of the enhancement.
    • Any relevant examples.

Submitting Pull Requests

To submit a pull request (PR):

  1. Fork the repository and create a new branch for your feature or bug fix.
  2. Ensure your code follows the project's coding standards.
  3. Write clear and concise commit messages.
  4. Open a pull request and include:
    • A detailed description of your changes.
    • A reference to any related issues (e.g., "Closes #abc").

Questions/Discussions

If you have any questions or would like to discuss something, please use the GitHub Discussions for this repository. It's a great place to engage with the community and seek help or share ideas.

Style Guides

Coding Standards

Please ensure that your code adheres to the following standards:

  • Follow the existing coding style in the repository.
  • Follow the existing file heirarchy in the repository.
  • Write clear and concise comments where necessary.
  • Make sure to document the process in the README.md(which conatins editors notes), REHOST.md(conatins how to rehost the challenge), and DESCRIPTION.md(contains the description of the challenge from its original source).
  • Ensure your code is well-tested and passes all existing tests which includes that the challenge works as intended initially by the organizers. Make sure you find a way for the user to get the pwn.college flag which looks like pwn.college{practice}.

Commit Messages

Commit messages should be formatted as follows:

  • Use the present tense ("Add feature" not "Added feature").
  • Limit the subject line to 50 characters.
  • Include a detailed description of the changes in the body, if necessary.

Setting Up Your Development Environment

To set up your development environment, follow these steps:

  1. Clone the repository:
    git clone https://github.com/pwncollege/ctf-archive.git
    cd ctf-archive
  2. Configure your environment as per the REHOST.md instructions, make sure to take a look at the module of the challenge as mostly challenges of the same module require same configurations unless specified in the Editor's Note of the challenges which can be found in README.md.

Troubleshooting Flag Issues

As this is an extensive archive of various CTF's which might have a different way to display or call for the flag of the respective challenge. These are some of the ways you can redirect the challenge's flag to the flag required by pwn.college to complete the challenge.

  1. Encoutering a flag.txt file being called by the challenge. Steps to redirect:
  • Make a symlink between the flag.txt file and the flag generated by pwn.college with the code shown below, by having the code in the .init file the symlink is created as soon as the challenge is run.
    #!/bin/bash
    
    # Attempt to create a symbolic link
    ln -s /flag /challenge/flag.txt 2>/dev/null
    

This would create a symlink and whenever flag.txt is called, the hacker gets the pwn.college flag.

  1. Any encounters with anything being called like flag should be solved by using the same way suggested above.
  2. If the challenge gives the flag as soon as it is solved. Use this method to provide the hacker with the flag to solve the challenge on pwn.college:
  • Make new file in any language, we are going to be using C for the purpose of showing what the process looks like:

    vim flag_check.c
    

    Then write the code which should look something like this:

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    
    int main() {
        char input[256];
    
        printf("Enter the flag: ");
        if (fgets(input, sizeof(input), stdin) == NULL) {
            fprintf(stderr, "Error reading input.\n");
            return 1;
        }
        input[strcspn(input, "\n")] = 0;
    
        if (strcmp(input, CORRECT_FLAG) == 0) {
            printf("Flag is correct! Here is the real flag:\n");
            system("cat /flag");
        } else {
            printf("Incorrect flag. Try again.\n");
        }
    
        return 0;
    }
    

    Now after this compile the file:

    gcc -o flag_check flag_check.c
    

    Provide user with a note in DESCRIPTION.md that they need to get their flag checked by running flag_check using /challenge/flag_check to get the pwn.college flag.

    These were some basic ways to keep the authenticity of the archived challenge and still provide user a way to earn the completion of the challenge.