# michaelneu/pjl-honeypot architecture

> Architecture diagram of the GitHub repository michaelneu/pjl-honeypot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/michaelneu/pjl-honeypot
- Repository: https://github.com/michaelneu/pjl-honeypot

## Overview

PJL Honeypot is a standalone TCP printer-protocol simulator. A client connects to the listener, sends PJL commands or PCL data, and receives simulated printer responses; PCL jobs can be saved in a configured directory. The command dictionary supplies emulated responses, while a virtual filesystem supports file queries. The README documents PRET compatibility and logging configuration. The excerpts show the socket and command-handling pieces, but omit parts of the session loop and file-saving implementation, so those relationships are cited to the README.

Main entry points: [`jetdirect.py`](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py) (Session handler), [`send-file.py`](https://github.com/michaelneu/pjl-honeypot/blob/master/send-file.py) (File sender)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Network Session"]
  node_tcp_listener["TCP listener<br/>[jetdirect.py]"]
  node_pjl_client["PJL connection<br/>[jetdirect.py]"]
  node_command_loop["Session handler<br/>[jetdirect.py]"]
end

subgraph group_protocol["PJL Emulation"]
  node_command_parser["Command parser<br/>[jetdirect.py]"]
  node_command_table["PJL responses<br/>[jetdirect.py]"]
end

subgraph group_storage["Files and Output"]
  node_virtual_fs[("Virtual filesystem<br/>[jetdirect.py]")]
  node_pcl_output[("PCL output directory")]
  node_log_output[("Log output")]
end

node_pret(("PRET client"))
node_file_sender["File sender<br/>[send-file.py]"]

node_pret -->|"connects"| node_tcp_listener
node_file_sender -->|"sends bytes"| node_tcp_listener
node_tcp_listener -->|"accepts connection"| node_pjl_client
node_pjl_client -->|"receives commands"| node_command_loop
node_command_loop -->|"dispatches commands"| node_command_parser
node_command_parser -->|"searches responses"| node_command_table
node_command_table -.->|"provides response"| node_command_parser
node_command_parser -->|"queries files"| node_virtual_fs
node_command_loop -->|"sends replies"| node_pjl_client
node_command_loop -->|"saves PCL jobs"| node_pcl_output
node_command_loop -.->|"writes logs"| node_log_output

click node_file_sender "https://github.com/michaelneu/pjl-honeypot/blob/master/send-file.py"
click node_tcp_listener "https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py"
click node_pjl_client "https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py"
click node_command_loop "https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py"
click node_command_parser "https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py"
click node_command_table "https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py"
click node_virtual_fs "https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.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_tcp_listener,node_pjl_client,node_command_loop,node_pret toneBlue
class node_command_parser,node_command_table toneAmber
class node_virtual_fs,node_pcl_output,node_log_output toneMint
class node_file_sender toneTeal
```

## Components

### Network Session

- [TCP listener](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py): `jetdirect.py`
- [PJL connection](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py): `jetdirect.py`
- [Session handler](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py): `jetdirect.py`

### PJL Emulation

- [Command parser](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py): `jetdirect.py`
- [PJL responses](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py): `jetdirect.py`

### Files and Output

- [Virtual filesystem](https://github.com/michaelneu/pjl-honeypot/blob/master/jetdirect.py): `jetdirect.py`
- **PCL output directory**
- **Log output**

### Other components

- **PRET client**
- [File sender](https://github.com/michaelneu/pjl-honeypot/blob/master/send-file.py): `send-file.py`

## Connections

- PRET client → TCP listener: connects (evidence: `README.md`)
- File sender → TCP listener: sends bytes (evidence: `send-file.py`)
- TCP listener → PJL connection: accepts connection (evidence: `jetdirect.py`)
- PJL connection → Session handler: receives commands (evidence: `jetdirect.py`)
- Session handler → Command parser: dispatches commands (evidence: `jetdirect.py`)
- Command parser → PJL responses: searches responses (evidence: `README.md`)
- PJL responses → Command parser: provides response (evidence: `jetdirect.py`)
- Command parser → Virtual filesystem: queries files (evidence: `jetdirect.py`)
- Session handler → PJL connection: sends replies (evidence: `jetdirect.py`)
- Session handler → PCL output directory: saves PCL jobs (evidence: `README.md`)
- Session handler → Log output: writes logs
