# shisones/ptconsole architecture

> Architecture diagram of the GitHub repository shisones/ptconsole, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shisones/ptconsole
- Repository: https://github.com/shisones/ptconsole

## Overview

##### Project type and purpose
- This is an open-source CLI pentesting toolkit (“PTConsole”) written in Python.
- It provides a core console/engine that dynamically loads and runs a variety of “check” and “scan” modules against target hosts.

##### File structure
- Top-level scripts:
- console.py      – Entry point for an interactive shell or command-line interface.
- main.py         – Likely the script that parses arguments and dispatches commands.
- pentest.py      – Core engine that implements module discovery, loading, and result aggregation.
- modules/ directory:
- Each “*-check.py” or “*-scan.py” file is a plugin module implementing a specific test (FTP, HTTP, RDP, SMB, SNMP, etc.).
- No database or web frontend; the system communicates directly with network targets.

##### Core architectural components
A. CLI Frontend
- console.py  – Interactive shell environment
- main.py     – Command parser (argparse, subcommands)
B. Core Engine
- pentest.py  –
- Plugin manager (scans modules/ directory)
- Task scheduler/dispatcher
- Result collector and reporter
C. Plugin Layer
- modules/*.py  – Individual test modules conforming to a common interface (e.g., `run(target, options) → result`)
D. Network/Subsystem
- Target Host(s) – External systems on which checks are performed
- Protocol libraries (e.g., socket, ftplib, paramiko)
E. Reporting/Output
- STDOUT/Log files – Where results are displayed or persisted

##### Relationships and interactions
- Core Engine ↔ Plugin Layer: dynamically load and invoke module logic
- Plugin Layer → Network/Subsystem: open connections and perform scans
- Plugin Layer → Core Engine: return results
- Core Engine → Reporting/Output: format and present findings

##### Architectural patterns and principles
- Plugin architecture: decouples new checks from core logic
- Dependency injection via a common module interface
- Single responsibility: each module handles one protocol/service
- Core orchestrator (engine) manages control flow

##### Technologies, frameworks, libraries
- Python 3.x
- Standard libs: argparse, importlib, socket, logging
- Third-party libs (if any): paramiko (SSH), pymssql, pysnmp, nikto wrapper

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "CLI Frontend"
        console["console.py"]:::core
        main["main.py"]:::core
    end

    subgraph "Core Engine"
        engine["pentest.py"]:::core
    end

    subgraph "Plugin Layer"
        modules_dir["modules/"]:::plugin
        ftp["ftp-check.py"]:::plugin
        http["http-check.py"]:::plugin
        mssql["mssql-check.py"]:::plugin
        netbios["netbios-scan.py"]:::plugin
        nikto["nikto-iischeck.py"]:::plugin
        rdp1["rdp-brute.py"]:::plugin
        rdp2["rdp-timeout.py"]:::plugin
        secure["securechannel-scan.py"]:::plugin
        smb["smb-check.py"]:::plugin
        smbhd["smbharddisk.py"]:::plugin
        snmp["snmp-check.py"]:::plugin
        sshb["ssh-blocked.py"]:::plugin
        telnet["telnet-check.py"]:::plugin
    end

    subgraph "Network/Subsystem"
        target["Target Host(s)"]:::external
        libs["Protocol Libraries"]:::external
    end

    subgraph "Reporting/Output"
        output["STDOUT / Log Files"]:::output
    end

    console -->|"issue command"| engine
    main -->|"parse & dispatch"| engine
    engine -->|"discover modules"| modules_dir
    modules_dir -->|"load module"| ftp
    modules_dir -->|"load module"| http
    modules_dir -->|"load module"| mssql
    modules_dir -->|"load module"| netbios
    modules_dir -->|"load module"| nikto
    modules_dir -->|"load module"| rdp1
    modules_dir -->|"load module"| rdp2
    modules_dir -->|"load module"| secure
    modules_dir -->|"load module"| smb
    modules_dir -->|"load module"| smbhd
    modules_dir -->|"load module"| snmp
    modules_dir -->|"load module"| sshb
    modules_dir -->|"load module"| telnet

    ftp -->|"execute scan"| target
    http -->|"execute scan"| target
    mssql -->|"execute scan"| target
    netbios -->|"execute scan"| target
    nikto -->|"execute scan"| target
    rdp1 -->|"execute scan"| target
    rdp2 -->|"execute scan"| target
    secure -->|"execute scan"| target
    smb -->|"execute scan"| target
    smbhd -->|"execute scan"| target
    snmp -->|"execute scan"| target
    sshb -->|"execute scan"| target
    telnet -->|"execute scan"| target

    ftp -->|"return result"| engine
    http -->|"return result"| engine
    mssql -->|"return result"| engine
    netbios -->|"return result"| engine
    nikto -->|"return result"| engine
    rdp1 -->|"return result"| engine
    rdp2 -->|"return result"| engine
    secure -->|"return result"| engine
    smb -->|"return result"| engine
    smbhd -->|"return result"| engine
    snmp -->|"return result"| engine
    sshb -->|"return result"| engine
    telnet -->|"return result"| engine

    engine -->|"report results"| output

    click console "https://github.com/shisones/ptconsole/blob/main/console.py"
    click main "https://github.com/shisones/ptconsole/blob/main/main.py"
    click engine "https://github.com/shisones/ptconsole/blob/main/pentest.py"
    click modules_dir "https://github.com/shisones/ptconsole/tree/main/modules/"
    click ftp "https://github.com/shisones/ptconsole/blob/main/modules/ftp-check.py"
    click http "https://github.com/shisones/ptconsole/blob/main/modules/http-check.py"
    click mssql "https://github.com/shisones/ptconsole/blob/main/modules/mssql-check.py"
    click netbios "https://github.com/shisones/ptconsole/blob/main/modules/netbios-scan.py"
    click nikto "https://github.com/shisones/ptconsole/blob/main/modules/nikto-iischeck.py"
    click rdp1 "https://github.com/shisones/ptconsole/blob/main/modules/rdp-brute.py"
    click rdp2 "https://github.com/shisones/ptconsole/blob/main/modules/rdp-timeout.py"
    click secure "https://github.com/shisones/ptconsole/blob/main/modules/securechannel-scan.py"
    click smb "https://github.com/shisones/ptconsole/blob/main/modules/smb-check.py"
    click smbhd "https://github.com/shisones/ptconsole/blob/main/modules/smbharddisk.py"
    click snmp "https://github.com/shisones/ptconsole/blob/main/modules/snmp-check.py"
    click sshb "https://github.com/shisones/ptconsole/blob/main/modules/ssh-blocked.py"
    click telnet "https://github.com/shisones/ptconsole/blob/main/modules/telnet-check.py"

    classDef core fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef plugin fill:#90EE90,stroke:#000,stroke-width:1px
    classDef external fill:#F08080,stroke:#000,stroke-width:1px
    classDef output fill:#FFD700,stroke:#000,stroke-width:1px
```
