# inderpreetsinghips/php2shell-audit architecture

> Architecture diagram of the GitHub repository inderpreetsinghips/php2shell-audit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inderpreetsinghips/php2shell-audit
- Repository: https://github.com/inderpreetsinghips/php2shell-audit

## Overview

php2shell_audit is a dependency-free defensive scanner for PHP2Shell version and configuration exposure. Its principal workflow dispatches a codebase, authorized host, or authorized fleet scan; gathers version/configuration signals; classifies risk into findings; and presents a ranked text or JSON report. The README documents the scan capabilities, while the excerpt shows the finding model, version parsing, host-header handling, output functions, and CLI dispatch. Internal details not shown in the partial source are represented only where the README documents them.

Main entry points: [`php2shell_audit.py`](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py) (Codebase scan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["Scan workflows"]
  node_cli["CLI dispatch<br/>[php2shell_audit.py]"]
  node_codebase["Codebase scan<br/>[php2shell_audit.py]"]
  node_repo_sources["Runtime and config files<br/>[php2shell_audit.py]"]
  node_host_scan["Host scan<br/>[php2shell_audit.py]"]
  node_fleet_scan["Fleet scan<br/>[php2shell_audit.py]"]
  node_inventory["Host inventory<br/>[php2shell_audit.py]"]
end

subgraph group_analysis["Detection and assessment"]
  node_version["Version fingerprint<br/>[php2shell_audit.py]"]
  node_version_rules["Fixed-version rules<br/>[php2shell_audit.py]"]
  node_config_risk["Config risk checks<br/>[php2shell_audit.py]"]
end

subgraph group_reporting["Findings and reports"]
  node_findings["Finding model<br/>[php2shell_audit.py]"]
  node_rank["Finding ranking<br/>[php2shell_audit.py]"]
  node_text_report["Text report<br/>[php2shell_audit.py]"]
  node_json_report["JSON report<br/>[php2shell_audit.py]"]
end

node_operator(("Operator"))
node_web_target(("Web target"))
node_output(("Report destination"))

node_operator -->|"runs"| node_cli
node_cli -->|"dispatches"| node_codebase
node_cli -->|"dispatches"| node_host_scan
node_cli -->|"dispatches"| node_fleet_scan
node_codebase -->|"scans"| node_repo_sources
node_codebase -->|"checks pins"| node_version
node_codebase -->|"checks settings"| node_config_risk
node_host_scan -->|"requests headers"| node_web_target
node_host_scan -->|"fingerprints"| node_version
node_fleet_scan -->|"reads"| node_inventory
node_fleet_scan -->|"scans hosts"| node_host_scan
node_version -->|"classifies"| node_version_rules
node_codebase -->|"produces"| node_findings
node_host_scan -->|"produces"| node_findings
node_version_rules -->|"sets verdict"| node_findings
node_config_risk -->|"adds risks"| node_findings
node_findings -->|"sorts"| node_rank
node_rank -->|"renders"| node_text_report
node_rank -->|"renders"| node_json_report
node_text_report -->|"writes or prints"| node_output
node_json_report -->|"writes or prints"| node_output

click node_cli "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_codebase "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_repo_sources "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_host_scan "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_fleet_scan "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_inventory "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_version "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_version_rules "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_config_risk "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_findings "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_rank "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_text_report "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"
click node_json_report "https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_codebase,node_repo_sources,node_host_scan,node_fleet_scan,node_inventory toneBlue
class node_version,node_version_rules,node_config_risk toneAmber
class node_findings,node_rank,node_text_report,node_json_report toneMint
class node_operator,node_web_target,node_output toneIndigo
```

## Components

### Scan workflows

- [CLI dispatch](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Codebase scan](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Runtime and config files](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Host scan](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Fleet scan](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Host inventory](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`

### Detection and assessment

- [Version fingerprint](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Fixed-version rules](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Config risk checks](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`

### Findings and reports

- [Finding model](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Finding ranking](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [Text report](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`
- [JSON report](https://github.com/inderpreetsinghips/php2shell-audit/blob/main/php2shell_audit.py): `php2shell_audit.py`

### Other components

- **Operator**
- **Web target**
- **Report destination**

## Connections

- Operator → CLI dispatch: runs (evidence: `README.md`)
- CLI dispatch → Codebase scan: dispatches (evidence: `php2shell_audit.py`)
- CLI dispatch → Host scan: dispatches (evidence: `php2shell_audit.py`)
- CLI dispatch → Fleet scan: dispatches (evidence: `php2shell_audit.py`)
- Codebase scan → Runtime and config files: scans (evidence: `README.md`)
- Codebase scan → Version fingerprint: checks pins (evidence: `README.md`)
- Codebase scan → Config risk checks: checks settings (evidence: `README.md`)
- Host scan → Web target: requests headers (evidence: `README.md`)
- Host scan → Version fingerprint: fingerprints (evidence: `php2shell_audit.py`)
- Fleet scan → Host inventory: reads (evidence: `README.md`)
- Fleet scan → Host scan: scans hosts (evidence: `README.md`)
- Version fingerprint → Fixed-version rules: classifies (evidence: `php2shell_audit.py`)
- Codebase scan → Finding model: produces (evidence: `README.md`)
- Host scan → Finding model: produces (evidence: `README.md`)
- Fixed-version rules → Finding model: sets verdict (evidence: `php2shell_audit.py`)
- Config risk checks → Finding model: adds risks (evidence: `README.md`)
- Finding model → Finding ranking: sorts (evidence: `php2shell_audit.py`)
- Finding ranking → Text report: renders (evidence: `php2shell_audit.py`)
- Finding ranking → JSON report: renders (evidence: `php2shell_audit.py`)
- Text report → Report destination: writes or prints (evidence: `README.md`)
- JSON report → Report destination: writes or prints (evidence: `README.md`)
