reteps-ctfcli


Namereteps-ctfcli JSON
Version 0.0.14 PyPI version JSON
download
home_page
SummaryTool for creating and running Capture The Flag competitions
upload_time2023-07-28 02:43:45
maintainer
docs_urlNone
authorKevin Chung
requires_python
licenseApache 2.0
keywords ctf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ctfcli

*ctfcli is a tool to manage Capture The Flag events and challenges.*

`ctfcli` provides challenge specifications and templates to make it easier to generate challenges of different categories. It also provides an integration with the [CTFd](https://github.com/CTFd/CTFd/) REST API to allow for command line uploading of challenges and integration with CI/CD build systems.

`ctfcli` features tab completion, a REPL interface (thanks to [Python-Fire](https://github.com/google/python-fire)) and plugin support for custom commands.

*WIP: ctfcli is an alpha project and changes will happen. Be sure to pin versions and read the CHANGELOG when updating.*

# Installation and Usage

ctfcli can be installed with `pip install ctfcli`

## 1. Create an Event

ctfcli turns the current folder into a CTF event git repo. It asks for the base url of the CTFd instance you're working with and an access token.

```
❯ ctf init
Please enter CTFd instance URL: https://demo.ctfd.io
Please enter CTFd Admin Access Token: d41d8cd98f00b204e9800998ecf8427e
Do you want to continue with https://demo.ctfd.io and d41d8cd98f00b204e9800998ecf8427e [y/N]: y
Initialized empty Git repository in /Users/user/Downloads/event/.git/
```

This will create the `.ctf` folder with the `config` file that will specify the URL, access token, and keep a record of all the challenges dedicated for this event.

## 2. Add challenges

Events are made up of challenges. Challenges can be made from a subdirectory or pulled from another repository. Remote challenges are pulled into the event repo and a reference is kept in the `.ctf/config` file.

```
❯ ctf challenge add [REPO | FOLDER]
```

```
❯ ctf challenge add crypto/stuff
```

```
❯ ctf challenge add https://github.com/challenge.git
challenge
Cloning into 'challenge'...
remote: Enumerating objects: 624, done.
remote: Counting objects: 100% (624/624), done.
remote: Compressing objects: 100% (540/540), done.
remote: Total 624 (delta 109), reused 335 (delta 45), pack-reused 0
Receiving objects: 100% (624/624), 6.49 MiB | 21.31 MiB/s, done.
Resolving deltas: 100% (109/109), done.
```

## 3. Install challenges

Installing a challenge will automatically create the challenge in your CTFd instance using the API.

```
❯ ctf challenge install [challenge.yml | DIRECTORY]
```

```
❯ ctf challenge install buffer_overflow
Found buffer_overflow/challenge.yml
Loaded buffer_overflow
Installing buffer_overflow
Success!
```

## 4. Update challenges

Syncing a challenge will automatically update the challenge in your CTFd instance using the API. Any changes made in the `challenge.yml` file will be reflected in your instance.

```
❯ ctf challenge sync [challenge.yml | DIRECTORY]
```

```
❯ ctf challenge sync buffer_overflow
Found buffer_overflow/challenge.yml
Loaded buffer_overflow
Syncing buffer_overflow
Success!
```

The additional flag, `--ctfd-name [NAME]` can be passed to optionally sync to a challenge with a different-name in CTFd.

## 5. Verify & pull challenges

If, at any point, changes may have been made to a challenge through the CTFd UI by an admin. To verify that your challenge.yml file matches remote contents, you can use:

```
❯ ctf challenge verify [challenge.yml | DIRECTORY] [--verify-files] [--verify-defaults]
```

If the `--verify-files` flag is set, challenge files will be downloaded and the binary files will be compared.

If the `--verify-defaults` flag is set, challenge files will be verified to make sure they include default optional keys present on CTFd.
If you want to pull down the latest version of the challenge, and its challenge files, you can use:

```
❯ ctf challenge verify [challenge.yml | DIRECTORY] [--update_files] [--create-files] [--create_defaults]
```

If the `--update_files` flag is set, the latest version of every file will be redownloaded from CTFd.

If the `--create-files` flag is set, any new files added to through the CTFd UI will be downloaded to the same directory as the `challenge.yml` file.

If the `--create-defaults` flag is set, any optional default values will be added to the `challenge.yml`.

**This is a destructive action! It will overwrite the local version of `challenge.yml` with the version on CTFd!**
# Challenge Templates

`ctfcli` contains pre-made challenge templates to make it faster to create CTF challenges with safe defaults.

```
ctf challenge new
                ├── binary
                ├── crypto
                ├── programming
                └── web
```

```
❯ ctf challenge new binary
/Users/user/.virtualenvs/ctfcli/lib/python3.7/site-packages/ctfcli-0.0.1-py3.7.egg/ctfcli/templates/binary/default
name [Hello]: buffer_overflow

❯ ls -1 buffer_overflow
Makefile
README.md
WRITEUP.md
challenge.yml
dist/
src/
```

**Contributions welcome on improving the challenge templates to make CTF challenges better for everyone!**

# Challenge Specification

`ctfcli` provides a [challenge specification](ctfcli/spec/challenge-example.yml) (`challenge.yml`) that outlines the major details of a challenge.

Every challenge generated by or processed by `ctfcli` should have a `challenge.yml` file.

The specification format has already been tested and used with CTFd in production events but comments, suggestions, and PRs are welcome on the format of `challenge.yml`.

# Plugins

`ctfcli` plugins are essentially additions to to the command line interface via dynamic class modifications. See the [plugin documentation page](docs/plugins.md) for a simple example.

*`ctfcli` is an alpha project! The plugin interface is likely to change!*

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "reteps-ctfcli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ctf",
    "author": "Kevin Chung",
    "author_email": "kchung@ctfd.io",
    "download_url": "",
    "platform": null,
    "description": "# ctfcli\n\n*ctfcli is a tool to manage Capture The Flag events and challenges.*\n\n`ctfcli` provides challenge specifications and templates to make it easier to generate challenges of different categories. It also provides an integration with the [CTFd](https://github.com/CTFd/CTFd/) REST API to allow for command line uploading of challenges and integration with CI/CD build systems.\n\n`ctfcli` features tab completion, a REPL interface (thanks to [Python-Fire](https://github.com/google/python-fire)) and plugin support for custom commands.\n\n*WIP: ctfcli is an alpha project and changes will happen. Be sure to pin versions and read the CHANGELOG when updating.*\n\n# Installation and Usage\n\nctfcli can be installed with `pip install ctfcli`\n\n## 1. Create an Event\n\nctfcli turns the current folder into a CTF event git repo. It asks for the base url of the CTFd instance you're working with and an access token.\n\n```\n\u276f ctf init\nPlease enter CTFd instance URL: https://demo.ctfd.io\nPlease enter CTFd Admin Access Token: d41d8cd98f00b204e9800998ecf8427e\nDo you want to continue with https://demo.ctfd.io and d41d8cd98f00b204e9800998ecf8427e [y/N]: y\nInitialized empty Git repository in /Users/user/Downloads/event/.git/\n```\n\nThis will create the `.ctf` folder with the `config` file that will specify the URL, access token, and keep a record of all the challenges dedicated for this event.\n\n## 2. Add challenges\n\nEvents are made up of challenges. Challenges can be made from a subdirectory or pulled from another repository. Remote challenges are pulled into the event repo and a reference is kept in the `.ctf/config` file.\n\n```\n\u276f ctf challenge add [REPO | FOLDER]\n```\n\n```\n\u276f ctf challenge add crypto/stuff\n```\n\n```\n\u276f ctf challenge add https://github.com/challenge.git\nchallenge\nCloning into 'challenge'...\nremote: Enumerating objects: 624, done.\nremote: Counting objects: 100% (624/624), done.\nremote: Compressing objects: 100% (540/540), done.\nremote: Total 624 (delta 109), reused 335 (delta 45), pack-reused 0\nReceiving objects: 100% (624/624), 6.49 MiB | 21.31 MiB/s, done.\nResolving deltas: 100% (109/109), done.\n```\n\n## 3. Install challenges\n\nInstalling a challenge will automatically create the challenge in your CTFd instance using the API.\n\n```\n\u276f ctf challenge install [challenge.yml | DIRECTORY]\n```\n\n```\n\u276f ctf challenge install buffer_overflow\nFound buffer_overflow/challenge.yml\nLoaded buffer_overflow\nInstalling buffer_overflow\nSuccess!\n```\n\n## 4. Update challenges\n\nSyncing a challenge will automatically update the challenge in your CTFd instance using the API. Any changes made in the `challenge.yml` file will be reflected in your instance.\n\n```\n\u276f ctf challenge sync [challenge.yml | DIRECTORY]\n```\n\n```\n\u276f ctf challenge sync buffer_overflow\nFound buffer_overflow/challenge.yml\nLoaded buffer_overflow\nSyncing buffer_overflow\nSuccess!\n```\n\nThe additional flag, `--ctfd-name [NAME]` can be passed to optionally sync to a challenge with a different-name in CTFd.\n\n## 5. Verify & pull challenges\n\nIf, at any point, changes may have been made to a challenge through the CTFd UI by an admin. To verify that your challenge.yml file matches remote contents, you can use:\n\n```\n\u276f ctf challenge verify [challenge.yml | DIRECTORY] [--verify-files] [--verify-defaults]\n```\n\nIf the `--verify-files` flag is set, challenge files will be downloaded and the binary files will be compared.\n\nIf the `--verify-defaults` flag is set, challenge files will be verified to make sure they include default optional keys present on CTFd.\nIf you want to pull down the latest version of the challenge, and its challenge files, you can use:\n\n```\n\u276f ctf challenge verify [challenge.yml | DIRECTORY] [--update_files] [--create-files] [--create_defaults]\n```\n\nIf the `--update_files` flag is set, the latest version of every file will be redownloaded from CTFd.\n\nIf the `--create-files` flag is set, any new files added to through the CTFd UI will be downloaded to the same directory as the `challenge.yml` file.\n\nIf the `--create-defaults` flag is set, any optional default values will be added to the `challenge.yml`.\n\n**This is a destructive action! It will overwrite the local version of `challenge.yml` with the version on CTFd!**\n# Challenge Templates\n\n`ctfcli` contains pre-made challenge templates to make it faster to create CTF challenges with safe defaults.\n\n```\nctf challenge new\n                \u251c\u2500\u2500 binary\n                \u251c\u2500\u2500 crypto\n                \u251c\u2500\u2500 programming\n                \u2514\u2500\u2500 web\n```\n\n```\n\u276f ctf challenge new binary\n/Users/user/.virtualenvs/ctfcli/lib/python3.7/site-packages/ctfcli-0.0.1-py3.7.egg/ctfcli/templates/binary/default\nname [Hello]: buffer_overflow\n\n\u276f ls -1 buffer_overflow\nMakefile\nREADME.md\nWRITEUP.md\nchallenge.yml\ndist/\nsrc/\n```\n\n**Contributions welcome on improving the challenge templates to make CTF challenges better for everyone!**\n\n# Challenge Specification\n\n`ctfcli` provides a [challenge specification](ctfcli/spec/challenge-example.yml) (`challenge.yml`) that outlines the major details of a challenge.\n\nEvery challenge generated by or processed by `ctfcli` should have a `challenge.yml` file.\n\nThe specification format has already been tested and used with CTFd in production events but comments, suggestions, and PRs are welcome on the format of `challenge.yml`.\n\n# Plugins\n\n`ctfcli` plugins are essentially additions to to the command line interface via dynamic class modifications. See the [plugin documentation page](docs/plugins.md) for a simple example.\n\n*`ctfcli` is an alpha project! The plugin interface is likely to change!*\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Tool for creating and running Capture The Flag competitions",
    "version": "0.0.14",
    "project_urls": null,
    "split_keywords": [
        "ctf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "574c9bb9e5569e5b58184cc55bf1edc9313be26b727007ed61da416538f74ae1",
                "md5": "d80708239012b194ea8500914482eb91",
                "sha256": "9a38b47a8720f1724390e28ffe0d21dfb8c63b4af777437f8bd9e010b7fa28bd"
            },
            "downloads": -1,
            "filename": "reteps_ctfcli-0.0.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d80708239012b194ea8500914482eb91",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 55127,
            "upload_time": "2023-07-28T02:43:45",
            "upload_time_iso_8601": "2023-07-28T02:43:45.422306Z",
            "url": "https://files.pythonhosted.org/packages/57/4c/9bb9e5569e5b58184cc55bf1edc9313be26b727007ed61da416538f74ae1/reteps_ctfcli-0.0.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-28 02:43:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "reteps-ctfcli"
}
        
Elapsed time: 0.09866s