ai-devsec-gateway 1.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. ai_devsec_gateway-1.2.1/LICENSE +33 -0
  2. ai_devsec_gateway-1.2.1/PKG-INFO +340 -0
  3. ai_devsec_gateway-1.2.1/README.md +305 -0
  4. ai_devsec_gateway-1.2.1/ai_blocker/__init__.py +56 -0
  5. ai_devsec_gateway-1.2.1/ai_blocker/__main__.py +112 -0
  6. ai_devsec_gateway-1.2.1/ai_blocker/block_actions.py +137 -0
  7. ai_devsec_gateway-1.2.1/ai_blocker/config.py +85 -0
  8. ai_devsec_gateway-1.2.1/ai_blocker/constants.py +93 -0
  9. ai_devsec_gateway-1.2.1/ai_blocker/gateway.py +55 -0
  10. ai_devsec_gateway-1.2.1/ai_blocker/i18n.py +141 -0
  11. ai_devsec_gateway-1.2.1/ai_blocker/system_utils.py +84 -0
  12. ai_devsec_gateway-1.2.1/ai_blocker/tray.py +177 -0
  13. ai_devsec_gateway-1.2.1/ai_blocker/ui.py +1254 -0
  14. ai_devsec_gateway-1.2.1/ai_devsec_gateway.egg-info/PKG-INFO +340 -0
  15. ai_devsec_gateway-1.2.1/ai_devsec_gateway.egg-info/SOURCES.txt +25 -0
  16. ai_devsec_gateway-1.2.1/ai_devsec_gateway.egg-info/dependency_links.txt +1 -0
  17. ai_devsec_gateway-1.2.1/ai_devsec_gateway.egg-info/requires.txt +7 -0
  18. ai_devsec_gateway-1.2.1/ai_devsec_gateway.egg-info/top_level.txt +1 -0
  19. ai_devsec_gateway-1.2.1/pyproject.toml +91 -0
  20. ai_devsec_gateway-1.2.1/setup.cfg +4 -0
  21. ai_devsec_gateway-1.2.1/tests/test_blocklist.py +35 -0
  22. ai_devsec_gateway-1.2.1/tests/test_config.py +51 -0
  23. ai_devsec_gateway-1.2.1/tests/test_gateway.py +56 -0
  24. ai_devsec_gateway-1.2.1/tests/test_hosts_operations.py +103 -0
  25. ai_devsec_gateway-1.2.1/tests/test_language_detection.py +35 -0
  26. ai_devsec_gateway-1.2.1/tests/test_platform.py +70 -0
  27. ai_devsec_gateway-1.2.1/tests/test_process_detection.py +52 -0
@@ -0,0 +1,33 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Akunimal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ADDITIONAL NOTICE (non-legal, informational):
26
+
27
+ This software was created and is distributed without any commercial intent
28
+ and without expectation of profit. It is offered to the public as a free
29
+ community tool. You may use it for any purpose — personal, educational,
30
+ commercial, or otherwise — without restriction. No attribution is required,
31
+ although it is always appreciated.
32
+
33
+ This is and will always remain a free, non-profit, community-driven project.
@@ -0,0 +1,340 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-devsec-gateway
3
+ Version: 1.2.1
4
+ Summary: Take back control. Intercept, audit, and route your AI traffic.
5
+ Author: Akunimal
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Akunimal/AI-Router-Blocker-AiO
8
+ Project-URL: Documentation, https://github.com/Akunimal/AI-Router-Blocker-AiO#readme
9
+ Project-URL: Repository, https://github.com/Akunimal/AI-Router-Blocker-AiO
10
+ Project-URL: Bug Tracker, https://github.com/Akunimal/AI-Router-Blocker-AiO/issues
11
+ Project-URL: Changelog, https://github.com/Akunimal/AI-Router-Blocker-AiO/blob/main/CHANGELOG.md
12
+ Keywords: ai,security,privacy,proxy,blocker,devsecops,hosts,firewall,llm,copilot
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Topic :: Security
23
+ Classifier: Topic :: Software Development :: Build Tools
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: pytest-mock>=3.10; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
32
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+
36
+ # 🛡️ AI DevSec Gateway (formerly AI Network Blocker)
37
+
38
+ > **Take back control. Intercept, audit, and route your AI traffic.**
39
+
40
+ <p align="center">
41
+ <img src="assets/screenshot.png" alt="AI DevSec Gateway Interface" width="600">
42
+ </p>
43
+
44
+ [![Python Version](https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-3776AB?logo=python&logoColor=white)](https://www.python.org/)
45
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078D4?logo=windows&logoColor=white)](#-system-requirements)
46
+ [![Test Suite Status](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/test.yml)
47
+ [![Security Scan Status](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/codeql.yml)
48
+ [![codecov](https://codecov.io/gh/Akunimal/AI-Router-Blocker-AiO/graph/badge.svg)](https://codecov.io/gh/Akunimal/AI-Router-Blocker-AiO)
49
+ [![PyPI version](https://img.shields.io/pypi/v/ai-devsec-gateway?color=blue&label=PyPI)](https://pypi.org/project/ai-devsec-gateway/)
50
+ [![License](https://img.shields.io/badge/License-MIT-22c55e)](LICENSE)
51
+ [![Latest Release](https://img.shields.io/github/v/release/Akunimal/AI-Router-Blocker-AiO?color=blue&label=Latest%20Release)](https://github.com/Akunimal/AI-Router-Blocker-AiO/releases)
52
+
53
+ [English](README.md) | [Español](README.es.md)
54
+
55
+ ---
56
+
57
+ ## 📖 What is this?
58
+
59
+ **AI DevSec Gateway** is a free, open-source, desktop tool that puts you back in charge of the AI tools running on your machine. Originally a simple network blocker, it has evolved into a full DevSecOps proxy.
60
+
61
+ It helps you **block unauthorized data leaks**, **audit your running environment using OpenAI's API**, and **transparently route cloud AI requests to your own Local LLMs** (like Llama 3 via Ollama) or your personal API keys (BYOK).
62
+
63
+ With one click it:
64
+ 1. **Blocks & Redirects** 38+ AI domains to `127.0.0.1` in your hosts file.
65
+ 2. **Routes** local traffic through a transparent API Gateway to your Local LLM.
66
+ 3. **Audits** your active editor processes and generates security recommendations via the OpenAI API.
67
+
68
+ ---
69
+
70
+ ## 🤔 Why does this exist?
71
+
72
+ AI coding assistants have deep, unrestricted access to your files, your clipboard, and your terminal. Even when you stop using them, their processes keep running in the background, silently maintaining open connections to remote servers. That means:
73
+
74
+ - Code you wrote *hours ago* could still be transmitted.
75
+ - Prompts containing proprietary logic could be cached or logged on third-party servers.
76
+ - You have **no visibility** into what data is being sent, or when.
77
+
78
+ **AI Network Blocker gives you a hard, deterministic kill switch.** No ambiguity. No trust required. The hosts file is a system-level override — if a domain resolves to `127.0.0.1`, nothing gets through. Period.
79
+
80
+ ---
81
+
82
+ ## ✨ Features
83
+
84
+ | Feature | Description |
85
+ |---|---|
86
+ | 🔀 **Local API Router** | Intercept Copilot/Cursor traffic and route it to your own Local LLM (Ollama/LM Studio). |
87
+ | 🛡️ **AI DevSec Auditor** | Live analysis of your running processes to detect data leak risks, powered by OpenAI. API keys are read at runtime and are not saved to disk. |
88
+ | 🔒 **One-click Kill Switch** | Block or unblock all AI services instantly via the system `hosts` file. |
89
+ | 🌍 **Multilingual support** | 10 languages supported with automatic system detection. |
90
+ | 🎨 **Premium dark UI** | Modern Catppuccin Mocha theme with color-coded status and tabs. |
91
+ | 🔑 **Smart elevation** | Auto UAC on Windows, clear `sudo` instructions on Unix. |
92
+ | 👁️ **Live process detection** | Continuously polls and shows which AI editors are currently running. |
93
+ | 📦 **Portable** | Single-file executable builds available without heavy dependencies. |
94
+
95
+ ---
96
+
97
+ ## 🎯 Blocked Providers & Domains
98
+
99
+ The default blocklist targets **38+ domains** across 10 categories:
100
+
101
+ | Provider | # Domains | Key domains |
102
+ |---|---|---|
103
+ | 🟢 OpenAI | 9 | `api.openai.com` · `chatgpt.com` · `platform.openai.com` |
104
+ | 🟠 Anthropic | 4 | `claude.ai` · `api.anthropic.com` · `anthropic.com` |
105
+ | 🐙 GitHub Copilot | 4 | `copilot.github.com` · `api.githubcopilot.com` |
106
+ | 🔵 Google AI | 4 | `gemini.google.com` · `aistudio.google.com` |
107
+ | 🟦 Microsoft Copilot | 3 | `copilot.microsoft.com` · `bing.com` |
108
+ | 🔷 Meta AI | 2 | `meta.ai` · `ai.meta.com` |
109
+ | 🌊 Mistral AI | 2 | `mistral.ai` · `api.mistral.ai` |
110
+ | 🔮 DeepSeek | 2 | `deepseek.com` · `api.deepseek.com` |
111
+ | 🤖 xAI | 3 | `x.ai` · `api.x.ai` · `grok.x.ai` |
112
+ | 📦 Others | 3 | `perplexity.ai` · `app.wordware.ai` |
113
+
114
+ > **Want to add or remove domains?** Edit the `BLOCKLIST` dictionary inside [`ai_blocker/constants.py`](ai_blocker/constants.py). It's a simple Python dict — no recompilation needed if you run from source.
115
+
116
+ ---
117
+
118
+ ## 🏗️ Architecture & Flow
119
+
120
+ AI DevSec Gateway works as a local interceptor and routing engine. It overrides public AI hostnames at the OS resolver level and runs a local proxy server to capture requests.
121
+
122
+ ```mermaid
123
+ graph TD
124
+ subgraph Client ["Developer Machine"]
125
+ IDE[IDE / Editor <br> Cursor, VS Code, etc.]
126
+ App[AI DevSec Gateway GUI]
127
+ Proxy[Transparent Local Gateway <br> HTTP Server: 127.0.0.1]
128
+ Hosts[OS Hosts File]
129
+ end
130
+
131
+ subgraph External ["Public Cloud & API"]
132
+ Ollama[Local LLM <br> Ollama / LM Studio]
133
+ OpenAI[OpenAI / Anthropic Cloud]
134
+ end
135
+
136
+ IDE -->|1. Resolve domain| Hosts
137
+ Hosts -->|2. Loopback redirection| IDE
138
+ IDE -->|3. Route requests| Proxy
139
+
140
+ Proxy -->|If Blocked| Loopback[127.0.0.1: Connection Refused]
141
+ Proxy -->|4. If Route active| Ollama
142
+ Proxy -.->|Audit telemetry| OpenAI
143
+ ```
144
+
145
+ ### Key Components:
146
+ - **DNS Overrider (Hosts Engine):** Inserts custom comments (`# AI-Block`) to route domains like `api.openai.com` to loopback.
147
+ - **Local API Gateway:** Spin up an HTTP server locally to capture network requests from IDEs and proxy them transparently.
148
+ - **Active Connection Auditor:** Performs runtime socket verification to determine blocking status and alert developers immediately.
149
+
150
+ ### 📁 Project Structure
151
+
152
+ Since v1.2.1, the project has been modularized for improved maintainability:
153
+
154
+ ```
155
+ ai_blocker/
156
+ ├── __init__.py # Package entry and versioning
157
+ ├── __main__.py # Run entry point (single instance & elevation check)
158
+ ├── constants.py # Blocklist domains and Catppuccin color codes
159
+ ├── config.py # User preferences and autostart registration
160
+ ├── i18n.py # Language translations loader
161
+ ├── system_utils.py # OS operations (admin checking, DNS flushing)
162
+ ├── block_actions.py # Process closing and hosts file editing
163
+ ├── gateway.py # HTTP transparent proxy server
164
+ ├── tray.py # Native Windows system tray integration
165
+ └── ui.py # Tkinter application interfaces and themes
166
+ ```
167
+
168
+ ---
169
+
170
+ ## 🔒 Security Model
171
+
172
+ ### Zero-Persistence BYOK
173
+ API keys used for the DevSec Auditor are **never** stored on disk or cached in configuration files. They are:
174
+ - Provided via runtime environment variables (`OPENAI_API_KEY`), or
175
+ - Entered in memory in the UI and cleared immediately upon application exit.
176
+
177
+ ### Minimal hosts file modification
178
+ Our engine uses standard system calls to edit `hosts`. It isolates modifications strictly within lines containing the `# AI-Block` tag, ensuring that your system's existing mappings are completely untouched.
179
+
180
+ ---
181
+
182
+ ## 🤝 Project Governance & Community
183
+
184
+ This project is built and maintained following open-source best practices:
185
+ - **[Architecture Guide](ARCHITECTURE.md):** System design, data flow, security model, and design decisions.
186
+ - **[Contributing Guide](CONTRIBUTING.md):** Conventions, branch structure, and style rules.
187
+ - **[Code of Conduct](CODE_OF_CONDUCT.md):** Community standards of respect and empathy.
188
+ - **[Security Policy](SECURITY.md):** Guidelines for private vulnerability reporting.
189
+ - **[License](LICENSE):** MIT Licensed — completely free of trackers, ads, or telemetry.
190
+
191
+ ---
192
+
193
+ ## 🚀 Quick Start
194
+
195
+ ### Option A — Download the ready-to-use executable
196
+
197
+ 1. Go to the [**Releases**](https://github.com/Akunimal/AI-Router-Blocker-AiO/releases) page.
198
+ 2. Download the binary for your operating system.
199
+ 3. Run the executable.
200
+ - **Windows**: Double-click `AI-Router-Blocker-AiO.exe`. Click **Yes** on the UAC prompt.
201
+ - **Linux / macOS**: Open a terminal and run `sudo ./AI-Router-Blocker-AiO` (root privileges required to modify `/etc/hosts`).
202
+ 4. Click the big button to toggle the block on or off. That's it.
203
+
204
+ > The binaries are self-contained and portable. No installation, no dependencies, no Python required.
205
+
206
+ ### Option B — Run from source code
207
+
208
+ ```bash
209
+ # 1. Clone the repository
210
+ git clone https://github.com/Akunimal/AI-Router-Blocker-AiO.git
211
+
212
+ # 2. Run the script (Python 3.x required)
213
+ # On Windows (auto-elevates via UAC):
214
+ python ai_blocker.py
215
+
216
+ # On Linux / macOS (requires sudo):
217
+ sudo python3 ai_blocker.py
218
+ ```
219
+
220
+ ### Option C — Install via pip
221
+
222
+ ```bash
223
+ pip install ai-devsec-gateway
224
+ python -m ai_devsec_gateway
225
+ ```
226
+
227
+ ### DevSec Auditor API keys
228
+
229
+ The DevSec Auditor asks for an OpenAI API key only when you run an audit. The key is kept in memory for that run and is not written to `config.json`. If you prefer not to paste it into the UI each time, set `OPENAI_API_KEY` in your environment before launching the app.
230
+
231
+ ---
232
+
233
+ ## 🔨 Building the .exe yourself
234
+
235
+ If you want to compile the executable from source (to verify it, modify it, or just learn how), follow these steps:
236
+
237
+ ### Prerequisites
238
+
239
+ - **Python 3.x** installed and available in your PATH
240
+ - **PyInstaller** (the packaging tool):
241
+
242
+ ```bash
243
+ pip install pyinstaller
244
+ ```
245
+
246
+ ### Method 1 — Using the included build scripts
247
+
248
+ ```bash
249
+ # On Windows, run the batch file:
250
+ build.bat
251
+
252
+ # On Linux / macOS, run the bash script:
253
+ ./build.sh
254
+ ```
255
+
256
+ The script will:
257
+ 1. Clean any previous build artifacts (`build/`, `dist/`, `*.spec`)
258
+ 2. Compile `ai_blocker.py` into a single binary (with admin manifest on Windows)
259
+ 3. Copy the final executable to the project root
260
+
261
+ ### Method 2 — Manual command
262
+
263
+ **Windows:**
264
+ ```bash
265
+ pyinstaller --onefile --windowed --uac-admin --name "AI-Router-Blocker-AiO" --clean ai_blocker.py
266
+ ```
267
+
268
+ | **Privileges** | Administrator / root (Windows auto-requests UAC; Linux/macOS run via `sudo`) |
269
+ | **Python** | 3.10+ (3.10, 3.11, 3.12, 3.13) — only needed if running from source |
270
+ | **Dependencies** | None. Uses only Python standard library (`tkinter`, `ctypes`, `subprocess`) |
271
+ | **Disk space** | ~12 MB for the binary, ~15 KB for the `.py` source |
272
+
273
+ ---
274
+
275
+ ## ⚠️ Disclaimer
276
+
277
+ This tool modifies your system's `hosts` file located at:
278
+ - **Windows**: `C:\Windows\System32\drivers\etc\hosts`
279
+ - **Linux/macOS**: `/etc/hosts`
280
+
281
+ It **only** adds or removes lines that contain the marker comment `# AI-Block`. It will **never** touch other entries in your hosts file.
282
+
283
+ That said:
284
+ - Always keep a backup of your hosts file before using any tool that modifies it.
285
+ - Use this software at your own risk.
286
+ - The authors are not responsible for any unintended consequences.
287
+
288
+ ---
289
+
290
+ ## 🗺️ Roadmap & Future Vision
291
+
292
+ We are actively developing **AI DevSec Gateway** to become the ultimate privacy proxy. Our upcoming features include:
293
+ - **Deep Packet Inspection (DPI):** Intercept HTTPS to block specific API routes (e.g., `/completions`).
294
+ - **Token Cost Dashboard:** Track spending when proxying requests to cloud APIs.
295
+ - **Multi-Provider Auditors:** Support Anthropic and Mistral for the DevSec security audits.
296
+
297
+ Check out our complete [**ROADMAP.md**](ROADMAP.md) to see where the project is heading and how you can contribute!
298
+
299
+ ---
300
+
301
+ ## 📜 License — Free as in Freedom
302
+
303
+ This project is released under the **MIT License** — see [LICENSE](LICENSE) for the full text.
304
+
305
+ **In plain language:** you are free to use, copy, modify, merge, publish, distribute, sublicense, and even sell copies of this software. There is no restriction whatsoever. This project was made **without any commercial intent** and is offered to the community as a public good.
306
+
307
+ Do whatever you want with it. Fork it, rebrand it, translate it, embed it in your own tools — no attribution required (though it's always appreciated). The only condition is that the license text stays included if you redistribute it.
308
+
309
+ **This is a non-profit, community-driven project.** No ads. No telemetry. No tracking. No monetization. Ever.
310
+
311
+ ---
312
+
313
+ ## 🤝 Contributing
314
+
315
+ Contributions are welcome! If you want to:
316
+ - Add new AI domains or providers to the blocklist
317
+ - Improve the UI or add features
318
+ - Translate the interface to another language
319
+
320
+ Just open a Pull Request or an Issue. All contributions, big or small, are valued.
321
+
322
+ ---
323
+
324
+ ## 💡 Why open source?
325
+
326
+ Trust is everything when a tool touches your system files. AI DevSec Gateway is:
327
+
328
+ - **Auditable** — readable, well-commented Python source with a comprehensive test suite
329
+ - **Commented** — every function contains detailed explanations in both English and Spanish
330
+ - **Transparent** — no obfuscation, no compiled binary blobs in source, and no telemetry. Network access is limited to user-visible features such as the router, auditor, and connectivity checks.
331
+ - **Deterministic** — it either edits the hosts file or it doesn't. Nothing else.
332
+
333
+ You own your machine. You set the rules.
334
+
335
+ ---
336
+
337
+ <p align="center">
338
+ <strong>Reclaim your sovereignty.</strong><br>
339
+ One click. Total control.
340
+ </p>
@@ -0,0 +1,305 @@
1
+
2
+
3
+ > **Take back control. Intercept, audit, and route your AI traffic.**
4
+
5
+ <p align="center">
6
+ <img src="assets/screenshot.png" alt="AI DevSec Gateway Interface" width="600">
7
+ </p>
8
+
9
+ [![Python Version](https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-3776AB?logo=python&logoColor=white)](https://www.python.org/)
10
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-0078D4?logo=windows&logoColor=white)](#-system-requirements)
11
+ [![Test Suite Status](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/test.yml)
12
+ [![Security Scan Status](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Akunimal/AI-Router-Blocker-AiO/actions/workflows/codeql.yml)
13
+ [![codecov](https://codecov.io/gh/Akunimal/AI-Router-Blocker-AiO/graph/badge.svg)](https://codecov.io/gh/Akunimal/AI-Router-Blocker-AiO)
14
+ [![PyPI version](https://img.shields.io/pypi/v/ai-devsec-gateway?color=blue&label=PyPI)](https://pypi.org/project/ai-devsec-gateway/)
15
+ [![License](https://img.shields.io/badge/License-MIT-22c55e)](LICENSE)
16
+ [![Latest Release](https://img.shields.io/github/v/release/Akunimal/AI-Router-Blocker-AiO?color=blue&label=Latest%20Release)](https://github.com/Akunimal/AI-Router-Blocker-AiO/releases)
17
+
18
+ [English](README.md) | [Español](README.es.md)
19
+
20
+ ---
21
+
22
+ ## 📖 What is this?
23
+
24
+ **AI DevSec Gateway** is a free, open-source, desktop tool that puts you back in charge of the AI tools running on your machine. Originally a simple network blocker, it has evolved into a full DevSecOps proxy.
25
+
26
+ It helps you **block unauthorized data leaks**, **audit your running environment using OpenAI's API**, and **transparently route cloud AI requests to your own Local LLMs** (like Llama 3 via Ollama) or your personal API keys (BYOK).
27
+
28
+ With one click it:
29
+ 1. **Blocks & Redirects** 38+ AI domains to `127.0.0.1` in your hosts file.
30
+ 2. **Routes** local traffic through a transparent API Gateway to your Local LLM.
31
+ 3. **Audits** your active editor processes and generates security recommendations via the OpenAI API.
32
+
33
+ ---
34
+
35
+ ## 🤔 Why does this exist?
36
+
37
+ AI coding assistants have deep, unrestricted access to your files, your clipboard, and your terminal. Even when you stop using them, their processes keep running in the background, silently maintaining open connections to remote servers. That means:
38
+
39
+ - Code you wrote *hours ago* could still be transmitted.
40
+ - Prompts containing proprietary logic could be cached or logged on third-party servers.
41
+ - You have **no visibility** into what data is being sent, or when.
42
+
43
+ **AI Network Blocker gives you a hard, deterministic kill switch.** No ambiguity. No trust required. The hosts file is a system-level override — if a domain resolves to `127.0.0.1`, nothing gets through. Period.
44
+
45
+ ---
46
+
47
+ ## ✨ Features
48
+
49
+ | Feature | Description |
50
+ |---|---|
51
+ | 🔀 **Local API Router** | Intercept Copilot/Cursor traffic and route it to your own Local LLM (Ollama/LM Studio). |
52
+ | 🛡️ **AI DevSec Auditor** | Live analysis of your running processes to detect data leak risks, powered by OpenAI. API keys are read at runtime and are not saved to disk. |
53
+ | 🔒 **One-click Kill Switch** | Block or unblock all AI services instantly via the system `hosts` file. |
54
+ | 🌍 **Multilingual support** | 10 languages supported with automatic system detection. |
55
+ | 🎨 **Premium dark UI** | Modern Catppuccin Mocha theme with color-coded status and tabs. |
56
+ | 🔑 **Smart elevation** | Auto UAC on Windows, clear `sudo` instructions on Unix. |
57
+ | 👁️ **Live process detection** | Continuously polls and shows which AI editors are currently running. |
58
+ | 📦 **Portable** | Single-file executable builds available without heavy dependencies. |
59
+
60
+ ---
61
+
62
+ ## 🎯 Blocked Providers & Domains
63
+
64
+ The default blocklist targets **38+ domains** across 10 categories:
65
+
66
+ | Provider | # Domains | Key domains |
67
+ |---|---|---|
68
+ | 🟢 OpenAI | 9 | `api.openai.com` · `chatgpt.com` · `platform.openai.com` |
69
+ | 🟠 Anthropic | 4 | `claude.ai` · `api.anthropic.com` · `anthropic.com` |
70
+ | 🐙 GitHub Copilot | 4 | `copilot.github.com` · `api.githubcopilot.com` |
71
+ | 🔵 Google AI | 4 | `gemini.google.com` · `aistudio.google.com` |
72
+ | 🟦 Microsoft Copilot | 3 | `copilot.microsoft.com` · `bing.com` |
73
+ | 🔷 Meta AI | 2 | `meta.ai` · `ai.meta.com` |
74
+ | 🌊 Mistral AI | 2 | `mistral.ai` · `api.mistral.ai` |
75
+ | 🔮 DeepSeek | 2 | `deepseek.com` · `api.deepseek.com` |
76
+ | 🤖 xAI | 3 | `x.ai` · `api.x.ai` · `grok.x.ai` |
77
+ | 📦 Others | 3 | `perplexity.ai` · `app.wordware.ai` |
78
+
79
+ > **Want to add or remove domains?** Edit the `BLOCKLIST` dictionary inside [`ai_blocker/constants.py`](ai_blocker/constants.py). It's a simple Python dict — no recompilation needed if you run from source.
80
+
81
+ ---
82
+
83
+ ## 🏗️ Architecture & Flow
84
+
85
+ AI DevSec Gateway works as a local interceptor and routing engine. It overrides public AI hostnames at the OS resolver level and runs a local proxy server to capture requests.
86
+
87
+ ```mermaid
88
+ graph TD
89
+ subgraph Client ["Developer Machine"]
90
+ IDE[IDE / Editor <br> Cursor, VS Code, etc.]
91
+ App[AI DevSec Gateway GUI]
92
+ Proxy[Transparent Local Gateway <br> HTTP Server: 127.0.0.1]
93
+ Hosts[OS Hosts File]
94
+ end
95
+
96
+ subgraph External ["Public Cloud & API"]
97
+ Ollama[Local LLM <br> Ollama / LM Studio]
98
+ OpenAI[OpenAI / Anthropic Cloud]
99
+ end
100
+
101
+ IDE -->|1. Resolve domain| Hosts
102
+ Hosts -->|2. Loopback redirection| IDE
103
+ IDE -->|3. Route requests| Proxy
104
+
105
+ Proxy -->|If Blocked| Loopback[127.0.0.1: Connection Refused]
106
+ Proxy -->|4. If Route active| Ollama
107
+ Proxy -.->|Audit telemetry| OpenAI
108
+ ```
109
+
110
+ ### Key Components:
111
+ - **DNS Overrider (Hosts Engine):** Inserts custom comments (`# AI-Block`) to route domains like `api.openai.com` to loopback.
112
+ - **Local API Gateway:** Spin up an HTTP server locally to capture network requests from IDEs and proxy them transparently.
113
+ - **Active Connection Auditor:** Performs runtime socket verification to determine blocking status and alert developers immediately.
114
+
115
+ ### 📁 Project Structure
116
+
117
+ Since v1.2.1, the project has been modularized for improved maintainability:
118
+
119
+ ```
120
+ ai_blocker/
121
+ ├── __init__.py # Package entry and versioning
122
+ ├── __main__.py # Run entry point (single instance & elevation check)
123
+ ├── constants.py # Blocklist domains and Catppuccin color codes
124
+ ├── config.py # User preferences and autostart registration
125
+ ├── i18n.py # Language translations loader
126
+ ├── system_utils.py # OS operations (admin checking, DNS flushing)
127
+ ├── block_actions.py # Process closing and hosts file editing
128
+ ├── gateway.py # HTTP transparent proxy server
129
+ ├── tray.py # Native Windows system tray integration
130
+ └── ui.py # Tkinter application interfaces and themes
131
+ ```
132
+
133
+ ---
134
+
135
+ ## 🔒 Security Model
136
+
137
+ ### Zero-Persistence BYOK
138
+ API keys used for the DevSec Auditor are **never** stored on disk or cached in configuration files. They are:
139
+ - Provided via runtime environment variables (`OPENAI_API_KEY`), or
140
+ - Entered in memory in the UI and cleared immediately upon application exit.
141
+
142
+ ### Minimal hosts file modification
143
+ Our engine uses standard system calls to edit `hosts`. It isolates modifications strictly within lines containing the `# AI-Block` tag, ensuring that your system's existing mappings are completely untouched.
144
+
145
+ ---
146
+
147
+ ## 🤝 Project Governance & Community
148
+
149
+ This project is built and maintained following open-source best practices:
150
+ - **[Architecture Guide](ARCHITECTURE.md):** System design, data flow, security model, and design decisions.
151
+ - **[Contributing Guide](CONTRIBUTING.md):** Conventions, branch structure, and style rules.
152
+ - **[Code of Conduct](CODE_OF_CONDUCT.md):** Community standards of respect and empathy.
153
+ - **[Security Policy](SECURITY.md):** Guidelines for private vulnerability reporting.
154
+ - **[License](LICENSE):** MIT Licensed — completely free of trackers, ads, or telemetry.
155
+
156
+ ---
157
+
158
+ ## 🚀 Quick Start
159
+
160
+ ### Option A — Download the ready-to-use executable
161
+
162
+ 1. Go to the [**Releases**](https://github.com/Akunimal/AI-Router-Blocker-AiO/releases) page.
163
+ 2. Download the binary for your operating system.
164
+ 3. Run the executable.
165
+ - **Windows**: Double-click `AI-Router-Blocker-AiO.exe`. Click **Yes** on the UAC prompt.
166
+ - **Linux / macOS**: Open a terminal and run `sudo ./AI-Router-Blocker-AiO` (root privileges required to modify `/etc/hosts`).
167
+ 4. Click the big button to toggle the block on or off. That's it.
168
+
169
+ > The binaries are self-contained and portable. No installation, no dependencies, no Python required.
170
+
171
+ ### Option B — Run from source code
172
+
173
+ ```bash
174
+ # 1. Clone the repository
175
+ git clone https://github.com/Akunimal/AI-Router-Blocker-AiO.git
176
+
177
+ # 2. Run the script (Python 3.x required)
178
+ # On Windows (auto-elevates via UAC):
179
+ python ai_blocker.py
180
+
181
+ # On Linux / macOS (requires sudo):
182
+ sudo python3 ai_blocker.py
183
+ ```
184
+
185
+ ### Option C — Install via pip
186
+
187
+ ```bash
188
+ pip install ai-devsec-gateway
189
+ python -m ai_devsec_gateway
190
+ ```
191
+
192
+ ### DevSec Auditor API keys
193
+
194
+ The DevSec Auditor asks for an OpenAI API key only when you run an audit. The key is kept in memory for that run and is not written to `config.json`. If you prefer not to paste it into the UI each time, set `OPENAI_API_KEY` in your environment before launching the app.
195
+
196
+ ---
197
+
198
+ ## 🔨 Building the .exe yourself
199
+
200
+ If you want to compile the executable from source (to verify it, modify it, or just learn how), follow these steps:
201
+
202
+ ### Prerequisites
203
+
204
+ - **Python 3.x** installed and available in your PATH
205
+ - **PyInstaller** (the packaging tool):
206
+
207
+ ```bash
208
+ pip install pyinstaller
209
+ ```
210
+
211
+ ### Method 1 — Using the included build scripts
212
+
213
+ ```bash
214
+ # On Windows, run the batch file:
215
+ build.bat
216
+
217
+ # On Linux / macOS, run the bash script:
218
+ ./build.sh
219
+ ```
220
+
221
+ The script will:
222
+ 1. Clean any previous build artifacts (`build/`, `dist/`, `*.spec`)
223
+ 2. Compile `ai_blocker.py` into a single binary (with admin manifest on Windows)
224
+ 3. Copy the final executable to the project root
225
+
226
+ ### Method 2 — Manual command
227
+
228
+ **Windows:**
229
+ ```bash
230
+ pyinstaller --onefile --windowed --uac-admin --name "AI-Router-Blocker-AiO" --clean ai_blocker.py
231
+ ```
232
+
233
+ | **Privileges** | Administrator / root (Windows auto-requests UAC; Linux/macOS run via `sudo`) |
234
+ | **Python** | 3.10+ (3.10, 3.11, 3.12, 3.13) — only needed if running from source |
235
+ | **Dependencies** | None. Uses only Python standard library (`tkinter`, `ctypes`, `subprocess`) |
236
+ | **Disk space** | ~12 MB for the binary, ~15 KB for the `.py` source |
237
+
238
+ ---
239
+
240
+ ## ⚠️ Disclaimer
241
+
242
+ This tool modifies your system's `hosts` file located at:
243
+ - **Windows**: `C:\Windows\System32\drivers\etc\hosts`
244
+ - **Linux/macOS**: `/etc/hosts`
245
+
246
+ It **only** adds or removes lines that contain the marker comment `# AI-Block`. It will **never** touch other entries in your hosts file.
247
+
248
+ That said:
249
+ - Always keep a backup of your hosts file before using any tool that modifies it.
250
+ - Use this software at your own risk.
251
+ - The authors are not responsible for any unintended consequences.
252
+
253
+ ---
254
+
255
+ ## 🗺️ Roadmap & Future Vision
256
+
257
+ We are actively developing **AI DevSec Gateway** to become the ultimate privacy proxy. Our upcoming features include:
258
+ - **Deep Packet Inspection (DPI):** Intercept HTTPS to block specific API routes (e.g., `/completions`).
259
+ - **Token Cost Dashboard:** Track spending when proxying requests to cloud APIs.
260
+ - **Multi-Provider Auditors:** Support Anthropic and Mistral for the DevSec security audits.
261
+
262
+ Check out our complete [**ROADMAP.md**](ROADMAP.md) to see where the project is heading and how you can contribute!
263
+
264
+ ---
265
+
266
+ ## 📜 License — Free as in Freedom
267
+
268
+ This project is released under the **MIT License** — see [LICENSE](LICENSE) for the full text.
269
+
270
+ **In plain language:** you are free to use, copy, modify, merge, publish, distribute, sublicense, and even sell copies of this software. There is no restriction whatsoever. This project was made **without any commercial intent** and is offered to the community as a public good.
271
+
272
+ Do whatever you want with it. Fork it, rebrand it, translate it, embed it in your own tools — no attribution required (though it's always appreciated). The only condition is that the license text stays included if you redistribute it.
273
+
274
+ **This is a non-profit, community-driven project.** No ads. No telemetry. No tracking. No monetization. Ever.
275
+
276
+ ---
277
+
278
+ ## 🤝 Contributing
279
+
280
+ Contributions are welcome! If you want to:
281
+ - Add new AI domains or providers to the blocklist
282
+ - Improve the UI or add features
283
+ - Translate the interface to another language
284
+
285
+ Just open a Pull Request or an Issue. All contributions, big or small, are valued.
286
+
287
+ ---
288
+
289
+ ## 💡 Why open source?
290
+
291
+ Trust is everything when a tool touches your system files. AI DevSec Gateway is:
292
+
293
+ - **Auditable** — readable, well-commented Python source with a comprehensive test suite
294
+ - **Commented** — every function contains detailed explanations in both English and Spanish
295
+ - **Transparent** — no obfuscation, no compiled binary blobs in source, and no telemetry. Network access is limited to user-visible features such as the router, auditor, and connectivity checks.
296
+ - **Deterministic** — it either edits the hosts file or it doesn't. Nothing else.
297
+
298
+ You own your machine. You set the rules.
299
+
300
+ ---
301
+
302
+ <p align="center">
303
+ <strong>Reclaim your sovereignty.</strong><br>
304
+ One click. Total control.
305
+ </p>