Skip to content

nxctf/nxdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nxdown

A tool to download all the challenges and files from a CTFd instance.

Installation

Using Pipx

pipx install nxdown

USING python setup

rm -rf ~/nxdown_output/

python3 setup.py build
python3 setup.py install --user

nxdown --config ktcg.yml
nxdown --config ktcg.yml --skip-download

Usage

Generate Access Token

In order to interact with the CTFd API, you'll need to create an Access Token. You can do this by browsing to the Settings page under your profile in the top-right corner of the page, then click on the Access Tokens tab. After inputting an expiration date, click on Generate to create a new token.

Run nxdown

nxdown -u http://ctf.url -n ctf_name -o /home/user/Desktop/ -t access_token

You can use the --update flag to update an existing repository with new challenges without redownloading everything.

Output Structure

folder_tujuan/
  README.md
  CategoryName/
    challenge-slug/
      README.md
      attachment.zip
      images/

Config File (Optional)

You can put settings into a config.yml file and run the downloader without long CLI args.

ctfd:
  url: "http://ctf.url"
  name: "CTF Name"
  session: "access_token_or_session"
  output_dir: "./ctf-output"
  update: false
  skip_download: false

github:
  enabled: true
  repo: "owner/repo"
  branch: "main"
  token: "ghp_xxx"
  target_path: "ctf/CTF-Name"
  commit_message: "Update CTF export"

Run it with:

nxdown --config config.yml
nxdown --config config.yml --skip-download

If you already have the output directory and only want to push/sync it, set skip_download: true or pass --skip-download.

GitHub sync uses a temporary clone and deletes it after pushing, so your output folder is never turned into a git repo.

Formatter

There is also another script, which you can use to add a check mark emoji on any completed writeups in the main README file. You can do this by adding writeups to challenge README files under a ## Solution header.

# Example Challenge README

<autogenerated challenge description>

## Solution

My solution

Run the formatter just by pointing it at the directory of the repo.

nxdown-format ./ctfd_repo/

Releases

Packages

Contributors

Languages