### Command-Line Installation of Hackingtool Source: https://context7.com/z4nzu/hackingtool/llms.txt Provides commands for installing Hackingtool via a shell script, manual Python setup, or Docker. The installer handles prerequisites and environment setup. ```bash # One-liner installation (recommended) curl -sSL https://raw.githubusercontent.com/Z4nzu/hackingtool/master/install.sh | sudo bash ``` ```bash # Manual installation git clone https://github.com/Z4nzu/hackingtool.git cd hackingtool sudo python3 install.py ``` ```bash # Run after installation hackingtool ``` ```bash # Docker installation docker build -t hackingtool . docker run -it --rm hackingtool ``` -------------------------------- ### Install HackingTool with One-liner Source: https://github.com/z4nzu/hackingtool/blob/master/README_template.md Use this command to automatically install HackingTool, including prerequisites, repository cloning, and virtual environment setup. ```bash curl -sSL https://raw.githubusercontent.com/Z4nzu/hackingtool/master/install.sh | sudo bash ``` -------------------------------- ### Define Port Scanner Tool (No Installation) Source: https://context7.com/z4nzu/hackingtool/llms.txt Example of a tool that does not require installation as it relies on an existing utility (nmap). The `run` method directly executes the command. ```python from core import HackingTool, HackingToolsCollection class PortScanner(HackingTool): TITLE = "Port Scanning" DESCRIPTION = "Quick port scan using nmap" def __init__(self): super().__init__(installable=False) # No installation needed def run(self): from rich.prompt import Prompt import subprocess target = Prompt.ask("Enter target IP") subprocess.run(["sudo", "nmap", "-O", "-Pn", target]) ``` -------------------------------- ### Install System Packages with OS Detection Source: https://context7.com/z4nzu/hackingtool/llms.txt Use the `install_packages` function from `os_detect` to install system packages. It automatically uses the detected package manager and prepends `sudo` on Linux if the user is not root. ```python from os_detect import CURRENT_OS, detect, install_packages # Install system packages using detected package manager # Automatically prepends sudo on Linux if not root success = install_packages(["git", "curl", "wget"]) ``` -------------------------------- ### Define Network Mapper Tool Source: https://context7.com/z4nzu/hackingtool/llms.txt Example of defining a tool that requires git cloning and compilation for installation. It includes project URL and tags for categorization. ```python from core import HackingTool, HackingToolsCollection class NetworkMapper(HackingTool): TITLE = "Network Map (nmap)" DESCRIPTION = "Network discovery and security auditing utility" INSTALL_COMMANDS = [ "git clone https://github.com/nmap/nmap.git", "cd nmap && ./configure && make && sudo make install" ] PROJECT_URL = "https://github.com/nmap/nmap" TAGS = ["scanner", "network", "recon"] ``` -------------------------------- ### Define Masscan Tool Source: https://context7.com/z4nzu/hackingtool/llms.txt Example of defining a tool with a simple package installation command and a help command for running. Includes project URL and tags. ```python from core import HackingTool, HackingToolsCollection class MassScanner(HackingTool): TITLE = "Masscan" DESCRIPTION = "Fastest Internet port scanner" INSTALL_COMMANDS = ["sudo apt-get install -y masscan"] RUN_COMMANDS = ["masscan --help"] PROJECT_URL = "https://github.com/robertdavidgraham/masscan" TAGS = ["scanner", "network"] ``` -------------------------------- ### Manual Installation of HackingTool Source: https://github.com/z4nzu/hackingtool/blob/master/README_template.md Manually install HackingTool by cloning the repository and running the install script. This method is useful for detecting local source installations. ```bash git clone https://github.com/Z4nzu/hackingtool.git cd hackingtool sudo python3 install.py ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/z4nzu/hackingtool/blob/master/README_template.md Install the required Python packages for HackingTool using pip. Ensure Python 3.10+ is installed. ```bash pip install -r requirements.txt ``` -------------------------------- ### Run HackingTool with Docker Compose Source: https://github.com/z4nzu/hackingtool/blob/master/README.md Recommended method to run HackingTool using Docker Compose, including commands to start, access, and stop the container. ```bash # Run (Compose — recommended) docker compose up -d docker exec -it hackingtool bash ``` -------------------------------- ### Check Tool Installation Status Source: https://context7.com/z4nzu/hackingtool/llms.txt The `is_installed` property of a `HackingTool` subclass checks for tool availability by examining PATH binaries and git clone directories. This example demonstrates checking if 'AutoDetectTool' is installed. ```python from core import HackingTool import shutil import os class AutoDetectTool(HackingTool): TITLE = "Auto-Detect Example" INSTALL_COMMANDS = [ "git clone https://github.com/example/tool.git", "cd tool && pip install -r requirements.txt" ] RUN_COMMANDS = ["cd tool && python3 main.py"] tool = AutoDetectTool() # Check installation status # 1. Checks if binary from RUN_COMMANDS is in PATH # 2. Checks if git clone target directory exists if tool.is_installed: print("Tool is ready to use") else: print("Tool needs to be installed") tool.install() ``` -------------------------------- ### Build HackingTool Docker Image Source: https://github.com/z4nzu/hackingtool/blob/master/README_template.md Build the Docker image for HackingTool. The initial build may take a few minutes due to the Kali base image and apt package installations. ```bash git clone https://github.com/Z4nzu/hackingtool.git cd hackingtool docker build -t hackingtool . ``` -------------------------------- ### Modify and Save User Configuration Source: https://context7.com/z4nzu/hackingtool/llms.txt After loading configuration with `load()`, modify the dictionary directly and then use `save(cfg)` to persist the changes to `~/.hackingtool/config.json`. This example updates `show_archived` and `theme`. ```python from config import load, save, get_tools_dir, get_sudo_cmd from constants import ( VERSION, VERSION_DISPLAY, REPO_URL, USER_CONFIG_DIR, USER_TOOLS_DIR, USER_CONFIG_FILE, APP_INSTALL_DIR, APP_BIN_PATH, DEFAULT_CONFIG ) # Modify and save configuration cfg['show_archived'] = True cfg['theme'] = 'cyan' save(cfg) ``` -------------------------------- ### Filter Tools by Operating System Source: https://context7.com/z4nzu/hackingtool/llms.txt Define `SUPPORTED_OS` in a tool class to restrict its availability to specific operating systems. The example shows a tool that only appears on Linux. ```python from os_detect import CURRENT_OS, detect, install_packages # Use in tool definitions to filter by OS class LinuxOnlyTool(HackingTool): TITLE = "Linux-Only Scanner" SUPPORTED_OS = ["linux"] # Won't appear on macOS def run(self): if CURRENT_OS.system != "linux": console.print("[red]This tool only works on Linux[/red]") return # Run Linux-specific commands os.system("sudo some-linux-tool") ``` -------------------------------- ### Get Tool Directory Path Source: https://context7.com/z4nzu/hackingtool/llms.txt Retrieves the absolute path of the tool directory. Returns None if not found. ```python tool_dir = tool._get_tool_dir() # Returns absolute path or None ``` -------------------------------- ### Update Installed Tool Source: https://context7.com/z4nzu/hackingtool/llms.txt The `update()` method on a `HackingTool` instance intelligently determines and executes the correct update command based on how the tool was installed (e.g., `git pull`, `pip install --upgrade`, `go install`, `gem update`). ```python from core import HackingTool import shutil import os class AutoDetectTool(HackingTool): TITLE = "Auto-Detect Example" INSTALL_COMMANDS = [ "git clone https://github.com/example/tool.git", "cd tool && pip install -r requirements.txt" ] RUN_COMMANDS = ["cd tool && python3 main.py"] tool = AutoDetectTool() # Smart update - auto-detects and runs appropriate command: # - git clone → git pull # - pip install → pip install --upgrade # - go install → go install (re-fetches latest) # - gem install → gem update tool.update() ``` -------------------------------- ### Define a Collection of Network Scanning Tools Source: https://context7.com/z4nzu/hackingtool/llms.txt Create a custom collection by inheriting from HackingToolsCollection and defining the TITLE, DESCRIPTION, and TOOLS attributes. This example groups NetworkMapper, PortScanner, and MassScanner. ```python class NetworkScanningTools(HackingToolsCollection): TITLE = "Network Scanning Tools" DESCRIPTION = "Tools for network discovery and port scanning" TOOLS = [ NetworkMapper(), PortScanner(), MassScanner(), ] if __name__ == "__main__": collection = NetworkScanningTools() collection.show_options() # Shows interactive menu with all tools ``` -------------------------------- ### Get Privilege Escalation Command Source: https://context7.com/z4nzu/hackingtool/llms.txt Retrieve the preferred command for privilege escalation using `get_sudo_cmd()` from the `config` module. It prioritizes `doas` over `sudo`. ```python from config import load, save, get_tools_dir, get_sudo_cmd from constants import ( VERSION, VERSION_DISPLAY, REPO_URL, USER_CONFIG_DIR, USER_TOOLS_DIR, USER_CONFIG_FILE, APP_INSTALL_DIR, APP_BIN_PATH, DEFAULT_CONFIG ) # Get privilege escalation command (prefers doas over sudo) priv_cmd = get_sudo_cmd() # Returns "doas" or "sudo" ``` -------------------------------- ### Define Custom Security Tool with HackingTool Class Source: https://context7.com/z4nzu/hackingtool/llms.txt Use the HackingTool class to define a new security tool. Specify installation, run, and uninstall commands, along with OS compatibility and metadata. Hooks like `before_install` and `after_install` can be implemented for custom logic. ```python from core import HackingTool, HackingToolsCollection class MyCustomScanner(HackingTool): TITLE = "My Custom Scanner" DESCRIPTION = "A network vulnerability scanner for authorized testing" # Installation commands executed in order INSTALL_COMMANDS = [ "git clone https://github.com/example/scanner.git", "cd scanner && pip install -r requirements.txt" ] # Commands to run the tool RUN_COMMANDS = ["cd scanner && python3 scanner.py"] # Uninstall commands (optional) UNINSTALL_COMMANDS = ["rm -rf scanner"] # Project URL for "Open Project Page" option PROJECT_URL = "https://github.com/example/scanner" # OS compatibility: "linux", "macos" SUPPORTED_OS = ["linux", "macos"] # Capability requirements REQUIRES_ROOT = False REQUIRES_WIFI = False REQUIRES_GO = False REQUIRES_RUBY = False REQUIRES_DOCKER = False # Tags for search/filter functionality TAGS = ["scanner", "network", "recon"] # Mark deprecated tools ARCHIVED = False ARCHIVED_REASON = "" def __init__(self): # installable=True adds "Install" option # runnable=True adds "Run" option # Additional custom options can be passed as list of (name, callback) tuples super().__init__( options=[("Custom Scan", self.custom_scan)], installable=True, runnable=True ) def before_install(self): """Hook called before installation begins.""" console.print("[cyan]Preparing installation...[/cyan]") def after_install(self): """Hook called after installation completes.""" console.print("[green]Scanner installed successfully![/green]") def before_run(self): """Hook called before running the tool.""" pass def after_run(self): """Hook called after the tool exits.""" pass def custom_scan(self): """Custom menu option implementation.""" from rich.prompt import Prompt target = Prompt.ask("Enter target IP") os.system(f"cd scanner && python3 scanner.py -t {target}") ``` -------------------------------- ### Get Tools Directory Path Source: https://context7.com/z4nzu/hackingtool/llms.txt Use `get_tools_dir()` from the `config` module to retrieve the absolute path to the user's tools directory. The function will create the directory if it does not exist. ```python from config import load, save, get_tools_dir, get_sudo_cmd from constants import ( VERSION, VERSION_DISPLAY, REPO_URL, USER_CONFIG_DIR, USER_TOOLS_DIR, USER_CONFIG_FILE, APP_INSTALL_DIR, APP_BIN_PATH, DEFAULT_CONFIG ) # Get tools directory (creates if not exists, returns absolute Path) tools_path = get_tools_dir() # ~/.hackingtool/tools/ print(f"Tools stored at: {tools_path}") ``` -------------------------------- ### Uninstall HackingTool Manually Source: https://context7.com/z4nzu/hackingtool/llms.txt Manually uninstall HackingTool by removing its installation directory, executable, and configuration files. This is an alternative to the in-menu uninstall option. ```bash sudo rm -rf /usr/share/hackingtool /usr/bin/hackingtool ~/.hackingtool ``` -------------------------------- ### Update HackingTool via Git Source: https://context7.com/z4nzu/hackingtool/llms.txt Manually update HackingTool by navigating to its installation directory and performing a git pull. This method is an alternative to the in-tool update option. ```bash cd /usr/share/hackingtool && git pull ``` -------------------------------- ### Create Custom Tool Category in Python Source: https://context7.com/z4nzu/hackingtool/llms.txt Defines custom HackingTool classes with installation, running commands, and options. Groups them into a HackingToolsCollection. Requires importing core modules and Rich prompts. ```python from core import HackingTool, HackingToolsCollection, console from rich.prompt import Prompt import subprocess import os ``` ```python class Nuclei(HackingTool): TITLE = "Nuclei" DESCRIPTION = "Fast and customizable vulnerability scanner based on YAML templates" INSTALL_COMMANDS = ["go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest"] RUN_COMMANDS = ["nuclei -h"] PROJECT_URL = "https://github.com/projectdiscovery/nuclei" SUPPORTED_OS = ["linux", "macos"] REQUIRES_GO = True TAGS = ["scanner", "web", "vulnerability"] def __init__(self): super().__init__(options=[ ("Scan URL", self.scan_url), ("Scan with templates", self.scan_templates), ]) def scan_url(self): url = Prompt.ask("Enter target URL") subprocess.run(["nuclei", "-u", url]) def scan_templates(self): url = Prompt.ask("Enter target URL") template = Prompt.ask("Template path", default="~/nuclei-templates/") subprocess.run(["nuclei", "-u", url, "-t", template]) ``` ```python class FFUF(HackingTool): TITLE = "ffuf" DESCRIPTION = "Fast web fuzzer written in Go" INSTALL_COMMANDS = ["go install github.com/ffuf/ffuf/v2@latest"] PROJECT_URL = "https://github.com/ffuf/ffuf" REQUIRES_GO = True TAGS = ["bruteforce", "web", "fuzzer"] def run(self): url = Prompt.ask("Enter URL with FUZZ keyword", default="http://example.com/FUZZ") wordlist = Prompt.ask("Wordlist path", default="/usr/share/wordlists/dirb/common.txt") subprocess.run(["ffuf", "-u", url, "-w", wordlist]) ``` ```python class Nikto(HackingTool): TITLE = "Nikto" DESCRIPTION = "Web server scanner for dangerous files and outdated software" INSTALL_COMMANDS = ["sudo apt-get install -y nikto"] RUN_COMMANDS = ["nikto -h"] PROJECT_URL = "https://github.com/sullo/nikto" SUPPORTED_OS = ["linux"] # apt-get only TAGS = ["scanner", "web"] ``` ```python class WebAttackTools(HackingToolsCollection): TITLE = "Web Attack Tools" DESCRIPTION = "Tools for web application security testing" TOOLS = [ Nuclei(), FFUF(), Nikto(), ] ``` ```python # Register in main menu by adding to hackingtool.py: # from tools.web_attack import WebAttackTools # all_tools = [..., WebAttackTools(), ...] ``` -------------------------------- ### Docker Compose Commands Source: https://context7.com/z4nzu/hackingtool/llms.txt Commands to manage the HackingTool application using Docker Compose. Use 'up -d' to start in detached mode and 'exec' to access the container's bash shell. ```bash docker compose up -d ``` ```bash docker exec -it hackingtool bash ``` -------------------------------- ### Load and Access User Configuration Source: https://context7.com/z4nzu/hackingtool/llms.txt Use `load()` from the `config` module to retrieve user settings, which are merged with default values. Access configuration values like `tools_dir`, `version`, `theme`, and `show_archived` from the returned dictionary. ```python from config import load, save, get_tools_dir, get_sudo_cmd from constants import ( VERSION, VERSION_DISPLAY, REPO_URL, USER_CONFIG_DIR, USER_TOOLS_DIR, USER_CONFIG_FILE, APP_INSTALL_DIR, APP_BIN_PATH, DEFAULT_CONFIG ) # Load configuration (merges with defaults for missing keys) cfg = load() print(f"Tools directory: {cfg['tools_dir']}") print(f"Current version: {cfg['version']}") print(f"Theme: {cfg['theme']}") print(f"Show archived: {cfg['show_archived']}") ``` -------------------------------- ### Build Docker Image for HackingTool Source: https://github.com/z4nzu/hackingtool/blob/master/README.md Command to build the Docker image for the HackingTool project. ```bash # Build docker build -t hackingtool . ``` -------------------------------- ### Access OS Detection Information Source: https://context7.com/z4nzu/hackingtool/llms.txt Import and use CURRENT_OS to access detailed information about the operating system, distribution, package manager, and system capabilities. This information is computed once at import. ```python from os_detect import CURRENT_OS, detect, install_packages # Access current OS information (computed once at import) print(f"System: {CURRENT_OS.system}") # "linux", "macos", "windows" print(f"Distro: {CURRENT_OS.distro_id}") # "kali", "ubuntu", "arch", etc. print(f"Distro Family: {CURRENT_OS.distro_like}") # "debian", "rhel", etc. print(f"Version: {CURRENT_OS.distro_version}") # "2024.1", "22.04", etc. print(f"Package Manager: {CURRENT_OS.pkg_manager}") # "apt-get", "pacman", "brew" print(f"Is Root: {CURRENT_OS.is_root}") # True/False print(f"Is WSL: {CURRENT_OS.is_wsl}") # True if Windows Subsystem for Linux print(f"Architecture: {CURRENT_OS.arch}") # "x86_64", "aarch64", "arm64" print(f"Home Dir: {CURRENT_OS.home_dir}") # Path object ``` -------------------------------- ### Run HackingTool with Docker Source: https://github.com/z4nzu/hackingtool/blob/master/README_template.md Run HackingTool using Docker. Option A is for direct execution, Option B uses Docker Compose for background services and interactive shells, and Option C enables dev mode with live source mounting. ```bash docker run -it --rm hackingtool ``` ```bash # Start in background docker compose up -d # Open an interactive shell docker exec -it hackingtool bash # Then launch the tool inside the container python3 hackingtool.py ``` ```bash docker compose --profile dev up docker exec -it hackingtool-dev bash ``` -------------------------------- ### Access Configuration and Application Path Constants Source: https://context7.com/z4nzu/hackingtool/llms.txt Import and utilize constants related to configuration files, directories, application paths, and repository URLs from the `constants` module. ```python from config import load, save, get_tools_dir, get_sudo_cmd from constants import ( VERSION, VERSION_DISPLAY, REPO_URL, USER_CONFIG_DIR, USER_TOOLS_DIR, USER_CONFIG_FILE, APP_INSTALL_DIR, APP_BIN_PATH, DEFAULT_CONFIG ) # Access path constants print(f"Config file: {USER_CONFIG_FILE}") # ~/.hackingtool/config.json print(f"Config dir: {USER_CONFIG_DIR}") # ~/.hackingtool/ print(f"Install dir: {APP_INSTALL_DIR}") # /usr/share/hackingtool (Linux) print(f"Binary path: {APP_BIN_PATH}") # /usr/bin/hackingtool (Linux) print(f"Repository: {REPO_URL}") # https://github.com/Z4nzu/hackingtool.git print(f"Version: {VERSION_DISPLAY}") # v2.0.0 ``` -------------------------------- ### Re-detect OS Information Source: https://context7.com/z4nzu/hackingtool/llms.txt Call the `detect` function from `os_detect` to re-scan and obtain fresh operating system information. This creates a new `OSInfo` instance. ```python from os_detect import CURRENT_OS, detect, install_packages # Re-detect OS (creates fresh OSInfo instance) fresh_info = detect() ``` -------------------------------- ### Interactive Menu System in Python Source: https://context7.com/z4nzu/hackingtool/llms.txt Utilizes the Rich library for a console interface. Supports navigation, search, tag filtering, and recommendations. Import necessary functions for menu interaction. ```python from hackingtool import ( interact_menu, # Main menu loop search_tools, # Search by keyword filter_by_tag, # Filter by tag recommend_tools, # Task-based recommendations build_menu, # Render main menu show_help, # Display help overlay all_tools, # List of all tool collections _collect_all_tools, # Get flat list of (tool, category) tuples _get_all_tags, # Get tag → tools index ) from core import console, clear_screen ``` ```python # Start the interactive menu (main entry point) # Navigation: 1-20 select category, /query search, t tags, r recommend, q quit interact_menu() ``` ```python # Programmatic search search_tools("nmap") # Search tools matching "nmap" search_tools() # Prompt user for search query ``` ```python # Filter by tag (osint, scanner, web, wireless, c2, cloud, mobile, etc.) filter_by_tag() # Shows available tags, user selects one ``` ```python # Task-based recommendations recommend_tools() # Shows tasks like "scan a network", "crack passwords", etc. ``` ```python # Get all tools as flat list all_tool_list = _collect_all_tools() for tool, category_name in all_tool_list: print(f"{tool.TITLE} in {category_name}") print(f" Installed: {tool.is_installed}") print(f" Tags: {getattr(tool, 'TAGS', [])}") ``` ```python # Get tag index tag_index = _get_all_tags() for tag, tools in tag_index.items(): print(f"Tag '{tag}': {len(tools)} tools") ``` ```python # Console utilities clear_screen() # Clear terminal console.print("[bold green]Success![/bold green]") # Rich-formatted output console.print_exception() # Pretty exception traceback ``` -------------------------------- ### Run HackingTool in Docker Compose Dev Mode Source: https://github.com/z4nzu/hackingtool/blob/master/README.md Command to run HackingTool in development mode with live source code mounting using Docker Compose. ```bash # Dev mode (live source mount) docker compose --profile dev up docker exec -it hackingtool-dev bash ``` -------------------------------- ### Run HackingTool Container Directly with Docker Source: https://github.com/z4nzu/hackingtool/blob/master/README.md Command to run the HackingTool Docker container directly. ```bash # Run (direct) docker run -it --rm hackingtool ``` -------------------------------- ### Docker Compose Dev Mode Source: https://context7.com/z4nzu/hackingtool/llms.txt Commands to run HackingTool in development mode with live source mounting. This allows for real-time code changes without rebuilding the image. Use 'exec' to access the development container's bash shell. ```bash docker compose --profile dev up ``` ```bash docker exec -it hackingtool-dev bash ``` -------------------------------- ### Open Tool Directory in Shell Source: https://context7.com/z4nzu/hackingtool/llms.txt Use the `open_folder()` method of a `HackingTool` instance to launch a new shell session directly within the tool's directory, facilitating manual inspection or modification. ```python from core import HackingTool import shutil import os class AutoDetectTool(HackingTool): TITLE = "Auto-Detect Example" INSTALL_COMMANDS = [ "git clone https://github.com/example/tool.git", "cd tool && pip install -r requirements.txt" ] RUN_COMMANDS = ["cd tool && python3 main.py"] tool = AutoDetectTool() # Open tool directory in new shell for manual inspection tool.open_folder() # Opens shell at tool's location ``` -------------------------------- ### Stop HackingTool Docker Compose Services Source: https://github.com/z4nzu/hackingtool/blob/master/README.md Commands to stop and optionally remove volumes for HackingTool services managed by Docker Compose. ```bash # Stop docker compose down # stop container docker compose down -v # also remove data volume ``` -------------------------------- ### Stop HackingTool Docker Containers Source: https://github.com/z4nzu/hackingtool/blob/master/README_template.md Commands to stop and remove HackingTool Docker containers and optionally their associated volumes. ```bash docker compose down ``` ```bash docker compose down -v ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.