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:
- Building the
exploit.pyscript. - Copy-pasting an
exploit.shscript, whose only job was to spin up multiplepython exploit.py, each targetting a different vulnbox. - Run a
submit_flags.pyto 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.
class MyExploit(Exploit):
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(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,
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}=$")
retry_unsuccessful: bool = False, # whether to re-run unsuccesful exploits
retry_unsuccessful_sleep_interval: int = 60, # seconds to wait before retrying unsuccessful exploits
):
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lents_adutils-0.6.1.tar.gz.
File metadata
- Download URL: lents_adutils-0.6.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.14.4 Darwin/25.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a6e3663556aacc85ceaf14972f2c235a48836ae82558e4282113f546b0a8faa
|
|
| MD5 |
5219204e690a4b8ba1d650a89afd7176
|
|
| BLAKE2b-256 |
34479361f981de7272cf6257f51f6acffa80e5a8f37453a942b29a47e0363682
|
File details
Details for the file lents_adutils-0.6.1-py3-none-any.whl.
File metadata
- Download URL: lents_adutils-0.6.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.14.4 Darwin/25.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0de15ef333f29e1057065bd1391b81d21da0d5156d64e7142131224190c3abae
|
|
| MD5 |
41dc822b575104256adc183402215982
|
|
| BLAKE2b-256 |
693115605ca45cb898809bc62e5977ef9c7e2854823fcb8fc739226cc01764ef
|