Skip to main content

No project description provided

Project description

Utils for Attack&Defense CTFs

Little package containing useful classes for Attack&Defense CTFs.

Purpose

During my first A&D based CTFs, my workflow was:

  1. Building the exploit.py script.
  2. Copy-pasting an exploit.sh script, whose only job was to spin up multiple python exploit.py, each targetting a different vulnbox.
  3. Run a submit_flags.py to collect the points.

At first it was great, but then things got complicated, and the exploit.sh reached ~100-line length for something that in Python needs half.

Plus, I don't want multiple copies of the same files scattered across my filesystem. I just want to pip install <x> in my venv.

Here it comes adutils!

Installation

You can install it via:

pip install lents_adutils

Usage

When writing an exploit for an A&D CTF, you want to run the same exploit towards multiple vulnboxes at the same time. The Exploit class lets you do exactly that by extending it.

from adutils import Exploit

class MyExploit(Exploit):
# ...

Then you have to implement the run(self, ip: str) method, which gives you access to the IP address of one of the vulnbox you're targeting.

    def run(self, ip: str):
        flag = exploit() # imagine you get the flag via exploit()
        self.flagout(flag) # you add the flag to a list of flags

At the end of each cycle, the submit_flags method will be run for you.

If you want to run the full exploit, you create an instance of MyExploit and then call the start method.

if __name__ == "main":
    port = 1234
    team_token = "deadbeef"
    my_exploit = MyExploit(port, team_token)

    my_exploit.start()

There are lots of options that allow you to fully customize the workflow. You can also override the existing methods to meet your needs.

# The Exploit initializer
def __init__(
    self,
    port: int,
    team_token: str,
    n_teams: int = 80,                                   # number of teams
    sleep_interval: int = 60,                            # time between cycles
    ignore: list[int] = [],                              # list of team ids to ignore
    verbose: bool = True,                                # additional logs
    submit_url: str = "http://10.10.0.1/flags",          # endpoint to submit flags
    submit_timeout: int = 5,
    flag_ids_url: str = "http://10.10.0.1:8081/flagIds", # endpoint that exposes info for challenges
    flag_regex: Pattern = compile(r"^[A-Z0-9]{31}=$")
):

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lents_adutils-0.3.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lents_adutils-0.3.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file lents_adutils-0.3.0.tar.gz.

File metadata

  • Download URL: lents_adutils-0.3.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.4 Linux/7.0.8-100.fc43.x86_64

File hashes

Hashes for lents_adutils-0.3.0.tar.gz
Algorithm Hash digest
SHA256 07446780c4ca8ee4e0a095d9d02708a2c0e44331dada54b5bdb630f04c218ce0
MD5 bf5270bb7fda8d0beadcfe64e6c0027b
BLAKE2b-256 b15f4348abf96524e0ca01a6b8f5d05e21d9483c806c05a2f76f755ce0fd9500

See more details on using hashes here.

File details

Details for the file lents_adutils-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: lents_adutils-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.4 Linux/7.0.8-100.fc43.x86_64

File hashes

Hashes for lents_adutils-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fde59757e6cf8fe0d8c8a71085fc77c029d4d64bb4305cb8e64b4afc6e019f9c
MD5 47fb82be26a50991e237ffccff7911e8
BLAKE2b-256 074d3188d1446ae324eb91221d9aec0d8f2b3cf74713a3ae709a41b7e8a5cf3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page