# gargar3/eggipblocker architecture

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

- Interactive diagram: https://gitdiagram.com/gargar3/eggipblocker
- Repository: https://github.com/gargar3/eggipblocker

## Overview

EggIpBlocker is a local SQL Server login-monitoring and Windows Firewall auto-blocker. Its workflow starts a background worker, polls SQL Server error-log rows, filters usernames and IPs against exemptions and prior blocks, then blocks eligible addresses and records them. The README also documents manual firewall-rule removal. The source is a single script, so several components share its path; relationships are based on that excerpt and the documented unblock procedure.

Main entry points: [`EggsqlIPBlocker.py`](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py) (Polling worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_entry["Script startup<br/>[EggsqlIPBlocker.py]"]
end

subgraph group_detection["Detection"]
  node_worker["Polling worker<br/>[EggsqlIPBlocker.py]"]
  node_connection["DB connection<br/>[EggsqlIPBlocker.py]"]
end

subgraph group_enforcement["Enforcement"]
  node_policy["Login policy<br/>[EggsqlIPBlocker.py]"]
  node_firewall["Windows Firewall"]
  node_history["Blocked-IP history<br/>[EggsqlIPBlocker.py]"]
  node_blocklog["Block log<br/>[EggsqlIPBlocker.py]"]
end

node_operator(("Operator"))
node_sql[("SQL Server")]

node_operator -->|"starts"| node_entry
node_entry -->|"loads history"| node_history
node_entry -->|"starts thread"| node_worker
node_worker -->|"opens connection"| node_connection
node_connection -->|"connects"| node_sql
node_worker -->|"queries error log"| node_sql
node_worker -->|"passes rows"| node_policy
node_policy -->|"adds block rule"| node_firewall
node_policy -->|"updates history"| node_history
node_policy -->|"writes entry"| node_blocklog
node_operator -->|"removes rule"| node_firewall

click node_entry "https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py"
click node_worker "https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py"
click node_connection "https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py"
click node_policy "https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py"
click node_history "https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py"
click node_blocklog "https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.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_entry toneBlue
class node_worker,node_connection,node_sql toneAmber
class node_policy,node_firewall,node_history,node_blocklog toneMint
class node_operator toneIndigo
```

## Components

### Runtime

- [Script startup](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py): `EggsqlIPBlocker.py`

### Detection

- [Polling worker](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py): `EggsqlIPBlocker.py`
- [DB connection](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py): `EggsqlIPBlocker.py`

### Enforcement

- [Login policy](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py): `EggsqlIPBlocker.py`
- **Windows Firewall**
- [Blocked-IP history](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py): `EggsqlIPBlocker.py`
- [Block log](https://github.com/gargar3/eggipblocker/blob/main/EggsqlIPBlocker.py): `EggsqlIPBlocker.py`

### Other components

- **Operator**
- **SQL Server**

## Connections

- Operator → Script startup: starts (evidence: `README.md`)
- Script startup → Blocked-IP history: loads history (evidence: `EggsqlIPBlocker.py`)
- Script startup → Polling worker: starts thread (evidence: `EggsqlIPBlocker.py`)
- Polling worker → DB connection: opens connection (evidence: `EggsqlIPBlocker.py`)
- DB connection → SQL Server: connects (evidence: `EggsqlIPBlocker.py`)
- Polling worker → SQL Server: queries error log (evidence: `EggsqlIPBlocker.py`)
- Polling worker → Login policy: passes rows (evidence: `EggsqlIPBlocker.py`)
- Login policy → Windows Firewall: adds block rule (evidence: `EggsqlIPBlocker.py`)
- Login policy → Blocked-IP history: updates history (evidence: `EggsqlIPBlocker.py`)
- Login policy → Block log: writes entry (evidence: `EggsqlIPBlocker.py`)
- Operator → Windows Firewall: removes rule (evidence: `README.md`)
