How r0oth3x49/ghauri works
Project Type and Purpose
• This is a security tool focused on SQL injection detection and exploitation.
• Its primary role is to automate testing against various DBMS backends (e.g., MySQL, MSSQL, Postgres, Oracle) by sending crafted HTTP requests and analyzing responses.
• The README lists a wide range of features and injection techniques, clearly showing it’s a feature-rich command-line security application.
File Structure and Extract Main Architectural Components
• The project is organized within a “ghauri” directory that houses multiple sub-modules:
• “core” module: Encompasses primary functions like extraction, injection, sending requests, testing, and updating. This drives the core exploitation logic.
• “dbms” module: Focused on fingerprinting the target database management systems to determine specifics (e.g., probably based on response signatures).
• “extractor” module: Likely contains more advanced or specialized routines for payload extraction and additional intelligence gathering (both “advance.py” and “common.py”).
• “scripts” module: Contains a command-line interface (CLI) script which acts as an entry point for the end user.
• There are also configuration files like setup.py and requirements.txt which signal that the project is built as a Python package.
Architectural Relationships and Data Flow
• The entry point (likely the “ghauri/ghauri.py” or “scripts/ghauri.py”) accepts command-line parameters and parses the user’s input.
• User input then flows into the core processing functions – the “core” module which orchestrates:
• Preparation of HTTP requests (using the “core/request.py”).
• Payload injection (via “core/inject.py”).
• Extraction of data from the response (handled in “core/extract.py” and further supplemented by the “extractor” module).
• The “common” directory provides support functions (configuration, utility functions, payload definitions, table formatting for output, session handling for storing state, etc.), which are used by almost every other module.
• The “dbms” module takes the parsed HTTP responses, analyzes them for DBMS-specific indicators and fingerprints the possible back-end system.
• Logging (via “logger/colored_logger.py”) records all events for debugging/info purposes.
• The flow is iterative: the tool may resume, flush sessions, or update its execution strategies based on feedback from previous requests. There’s also support for updating itself through a built-in update mechanism (in “core/update.py”).