Skip to main content

Overview

HackingTool uses a simple file-based configuration system to manage where tools are installed and stored. Configuration is set up on first run and persists across sessions.

Path Configuration File

hackingtoolpath.txt

The primary configuration file is hackingtoolpath.txt, which stores the installation directory path:
# From hackingtool.py:154-172
def choose_path():
    fpath = os.path.expanduser("~/hackingtoolpath.txt")
    if not os.path.exists(fpath):
        os.system("clear" if system() == "Linux" else "cls")
        build_menu()
        console.print(Panel("Setup path for tool installations", border_style="magenta"))
        choice = Prompt.ask("[magenta]Set Path[/magenta]", choices=["1", "2"], default="2")
        if choice == "1":
            inpath = Prompt.ask("[magenta]Enter Path (with Directory Name)[/magenta]")
            with open(fpath, "w") as f:
                f.write(inpath)
            console.print(f"[green]Successfully Set Path to:[/green] {inpath}")
        else:
            autopath = "/home/hackingtool/"
            with open(fpath, "w") as f:
                f.write(autopath)
            console.print(f"[green]Your Default Path Is:[/green] {autopath}")
            sleep(1)
    return fpath

File Location

~/hackingtoolpath.txt

Initial Setup

On first run, HackingTool prompts you to configure the installation path:
You’ll see a panel asking to set up the path:
╭─────────────────────────────────────╮
│ Setup path for tool installations   │
╰─────────────────────────────────────╯
Two options are available:
  • 1: Custom path (you specify)
  • 2: Default path (automatic)
Option 1 - Custom Path:
if choice == "1":
    inpath = Prompt.ask("[magenta]Enter Path (with Directory Name)[/magenta]")
    with open(fpath, "w") as f:
        f.write(inpath)
Option 2 - Default Path:
else:
    autopath = "/home/hackingtool/"
    with open(fpath, "w") as f:
        f.write(autopath)
The directory is created and set as working directory:
# From hackingtool.py:207-211
with open(fpath) as f:
    archive = f.readline().strip()
    os.makedirs(archive, exist_ok=True)
    os.chdir(archive)

Default Installation Directory

The default installation path is:
/home/hackingtool/
This directory is created automatically if it doesn’t exist (exist_ok=True).

Directory Structure

Once tools are installed, your directory might look like:
/home/hackingtool/
├── tool1/
├── tool2/
├── tool3/
└── ...
Each tool is typically cloned or installed in its own subdirectory.

Custom Path Configuration

Setting a Custom Path

To use a custom installation directory:
  1. Choose option 1 when prompted on first run
  2. Enter your desired path with directory name
  3. Example custom paths:
/home/username/my-tools/
Ensure you have write permissions for the directory you specify.

Modifying Existing Configuration

To change the installation path after initial setup:
# Edit the configuration file
nano ~/hackingtoolpath.txt

# Update the path
/your/new/path/
Or delete it to trigger setup again:
rm ~/hackingtoolpath.txt
python3 hackingtool.py

Tool Installation Directories

How Tools Are Installed

Each tool defines its own INSTALLATION_DIR and INSTALL_COMMANDS:
# From core.py:36-44
class HackingTool(object):
    TITLE: str = ""
    DESCRIPTION: str = ""
    INSTALL_COMMANDS: List[str] = []
    INSTALLATION_DIR: str = ""
    UNINSTALL_COMMANDS: List[str] = []
    RUN_COMMANDS: List[str] = []
    OPTIONS: List[Tuple[str, Callable]] = []
    PROJECT_URL: str = ""

Installation Process

When you select “Install” for a tool:
# From core.py:104-113
def install(self):
    self.before_install()
    if isinstance(self.INSTALL_COMMANDS, (list, tuple)):
        for INSTALL_COMMAND in self.INSTALL_COMMANDS:
            console.print(f"[yellow]→ {INSTALL_COMMAND}[/yellow]")
            os.system(INSTALL_COMMAND)
        self.after_install()
  1. before_install() hook is called
  2. Each command in INSTALL_COMMANDS executes
  3. Commands run in the configured directory
  4. after_install() hook confirms success
Installation commands typically use git clone, apt install, or pip install.

Environment Setup

System Requirements

HackingTool requires:
# From requirements.txt
boxes
flask
lolcat
requests
rich

Python Dependencies

Install dependencies with:
pip3 install -r requirements.txt
Or individually:
pip3 install boxes flask lolcat requests rich

System Packages

Some tools may require additional system packages:
# From tool_manager.py:29-31
def update_sys(self):
    os.system("sudo apt update && sudo apt full-upgrade -y")
    os.system("sudo apt-get install tor openssl curl && sudo apt-get update tor openssl curl")
    os.system("sudo apt-get install python3-pip")
sudo apt update
sudo apt install git python3-pip figlet sudo
sudo apt install boxes php curl xdotool wget
sudo apt install tor openssl curl

Working Directory

HackingTool changes the working directory to the configured path:
# From hackingtool.py:210
os.chdir(archive)
This ensures:
  • Tools install in the correct location
  • Relative paths work correctly
  • All operations are contained

Verifying Current Directory

Check where HackingTool is operating:
pwd
# Should output: /home/hackingtool/ (or your custom path)

Docker Configuration

When running in Docker, the path is pre-configured:
# From Dockerfile:10
RUN true && echo "/root/hackingtool/" > /home/hackingtoolpath.txt;
In Docker, the installation path is always /root/hackingtool/ and cannot be changed.

Customizing Tool Behavior

Installation Hooks

Tools can customize installation behavior:
# From core.py:102, 112-113
def before_install(self): pass

def after_install(self):
    console.print("[green]✔ Successfully installed![/green]")
Override these in your tool classes to add custom logic.

Run Hooks

Similarly for running tools:
# From core.py:128, 138
def before_run(self): pass
def after_run(self): pass

Configuration Best Practices

Recommended Setup:
  1. Use the default path (/home/hackingtool/) for simplicity
  2. Ensure sufficient disk space (tools can be large)
  3. Run with appropriate permissions
  4. Keep the path consistent across sessions
Avoid:
  • Installing to system directories without sudo
  • Using paths with spaces or special characters
  • Changing the path after tools are installed
  • Deleting the configuration file while tools are installed

Troubleshooting Configuration

Path Not Found

If you see path-related errors:
# Check if config file exists
ls -la ~/hackingtoolpath.txt

# View current configuration
cat ~/hackingtoolpath.txt

# Verify directory exists
ls -la $(cat ~/hackingtoolpath.txt)

Permission Denied

If you can’t write to the configured path:
# Check permissions
ls -ld $(cat ~/hackingtoolpath.txt)

# Fix permissions (if needed)
sudo chown -R $USER:$USER $(cat ~/hackingtoolpath.txt)

Reset Configuration

To start fresh:
# Remove configuration
rm ~/hackingtoolpath.txt

# Optionally clean installation directory
rm -rf /home/hackingtool/

# Run HackingTool to reconfigure
python3 hackingtool.py

Build docs developers (and LLMs) love