LetsHack CTF (lth) is an open-source CLI automation tool designed for penetration testers and Capture The Flag (CTF) players (HackTheBox, TryHackMe, VulnHub, etc.). It automates repetitive setup tasks, network port scanning, web vulnerability scanning, directory enumeration, and OpenVPN connection management into simple, fast terminal commands.
-
🎯 Target Setup & Management:
- Validates IP addresses and registers targets in
~/.lth/targets.json. - Creates structured output folders (
~/.lth/<target_name>/) for scan results. - Automatically appends host mappings to
/etc/hostsusingsudo.
- Validates IP addresses and registers targets in
-
🔍 Automated Enumeration:
-
🔒 OpenVPN Lifecycle Management:
- Launches OpenVPN connections in background daemon mode.
- Saves your default
.ovpnconfiguration file so you don't need to specify it every time. - Monitors connection progress and displays assigned
tun0interface IPv4 address. - Gracefully stops VPN daemon processes using PID tracking.
lth interacts with standard Linux security utilities. Ensure the following tools are installed on your system:
- Python 3.8+
- Nmap (
sudo apt install nmap) - Gobuster (
sudo apt install gobuster) - Nikto (
sudo apt install nikto) - OpenVPN (
sudo apt install openvpn) - Wordlist at
/usr/share/wordlists/dirb/common.txt(or update inlth/scanners.py)
-
Clone the repository:
git clone https://github.com/EricSL07/LetsHack-CTF.git cd LetsHack-CTF -
Make the main script executable & create a command alias/symlink:
chmod +x main.py # Optional: Create a symlink to run 'lth' from anywhere on your system sudo ln -s "$(pwd)/main.py" /usr/local/bin/lth
-
Verify installation:
lth --help
usage: lth [-h] {add,scan,webscan,vpn} ...
LTH (LetsHack CTF) - Canivete Suíço para Automação de CTFs
positional arguments:
{add,scan,webscan,vpn}
add Registra um novo alvo e prepara o ambiente
scan Inicia enumeração Nmap em um alvo conhecido
webscan Roda Nikto e Gobuster em paralelo no alvo
vpn Gerencia a conexão OpenVPN
Registers a machine IP and hostname, creates output directory ~/.lth/<name>, and appends entry to /etc/hosts.
lth add 10.10.10.3 lameExecutes an Nmap service scan on the target. If port 80 (HTTP) is found open, lth will prompt to launch a webscan immediately.
lth scan lame
# OR by IP address
lth scan 10.10.10.3Runs Nikto vulnerability scanner and Gobuster directory brute-forcer concurrently.
lth webscan lame-
Start VPN connection:
# Start and set default .ovpn file: lth vpn start ~/htb_profile.ovpn # Start using previously saved default .ovpn file: lth vpn start
-
Check VPN Status:
lth vpn status
Output:
STATUS: Conectado (PID: 12345) | IP tun0: 10.10.14.5 -
Stop VPN connection:
lth vpn stop
When you use lth, it stores configuration and scan outputs in ~/.lth/:
~/.lth/
├── targets.json # Central JSON database of registered targets
├── default.ovpn # Saved default OpenVPN profile
├── openvpn.pid # Active OpenVPN daemon PID tracker
├── openvpn.log # OpenVPN daemon log output
└── <target_name>/ # Per-target scan directory
├── nmap_<IP>.txt # Nmap scan results
├── nikto_<IP>.txt # Nikto web scan results
└── gobuster_<IP>.txt# Gobuster directory brute-force results
LetsHack-CTF-/
├── main.py # Main execution entry point
├── lth/ # Core Python package
│ ├── __init__.py # Package metadata
│ ├── cli.py # Command-line argument parser & router
│ ├── config.py # Config paths, IP validation & JSON registry persistence
│ ├── scanners.py # Nmap, Nikto, Gobuster & /etc/hosts helpers
│ └── vpn.py # OpenVPN daemon lifecycle & tun0 IP detector
├── LICENSE # MIT License
└── README.md # Documentation
Contributions, feature requests, and bug reports are welcome!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for details.