# bol-van/zapret-win-bundle architecture

> Architecture diagram of the GitHub repository bol-van/zapret-win-bundle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bol-van/zapret-win-bundle
- Repository: https://github.com/bol-van/zapret-win-bundle

## Overview

This repository is a Windows deployment bundle for the zapret / zapret2 DPI-bypass tools. It is not a typical application codebase; it is mostly packaged binaries, batch launchers, shell scripts, and support files that assemble a user-mode traffic manipulator around the WinDivert driver.

1. Core runtime boundary  
The central architectural boundary is between the Windows kernel and user space. WinDivert (`WinDivert64.sys`) captures and reinjects network packets, while `winws.exe` and `winws2.exe` run in user space and decide how to transform traffic to evade DPI.

2. Two parallel engines: zapret1 and zapret2  
The repo ships two generations of the bypass engine:
- `zapret-winws/` for the first engine, centered on `winws.exe`
- `zapret-winws/` plus `blockcheck/zapret2/` for the second engine, centered on `winws2.exe`
Both are packaged separately because they use different Lua logic, presets, and blockcheck flows.

3. Traffic-processing pipeline  
The main data flow is:
Windows network traffic -> WinDivert driver -> `winws` / `winws2` -> packet mangling rules -> reinjection onto the network.  
The engine can rewrite, split, fake, or reorder packets depending on the chosen strategy, especially for TLS, QUIC, WireGuard, STUN, Discord media, and DHT traffic.

4. Rule logic and protocol knowledge in Lua  
The `lua/` directory is the policy layer. Scripts such as `zapret-antidpi.lua`, `zapret-auto.lua`, `zapret-obfs.lua`, and `zapret-tests.lua` contain the traffic classification and obfuscation behavior. This is the main place where protocol-specific bypass strategies live.

5. Embedded fake traffic payloads  
The `files/fake/` directories contain binary packet templates used as decoys or crafted protocol fragments. These include TLS ClientHello variants, QUIC initial packets, WireGuard initiation/response, STUN, DTLS, HTTP, and zero-filled blobs. They are part of the bypass mechanism, not sample data.

6. Strategy presets and interactive launchers  
Files like `preset1_example.cmd`, `preset2_example.cmd`, and `preset2_wireguard.cmd` are launch entry points for specific bypass strategies. They sit above the engines and assemble the command-line arguments, filters, and options for a chosen scenario.

7. Service mode vs interactive mode  
The `service*.cmd` scripts create and control Windows services for non-interactive startup, while the preset `.cmd` files are intended for manual, interactive runs. This is an important operational boundary: the same engine can run either as a foreground tool or as an autostart service.

8. Blockcheck subsystem for strategy discovery  
`blockcheck/` and `blockcheck2/` are analysis toolchains used to detect what kind of DPI interference exists and which bypass method works. They are separate from the runtime bypass path and should be thought of as a diagnostics/probing subsystem.

9. Probing and test harnesses  
Blockcheck uses shell scripts plus bundled tools like `curl`, `mdig.exe`, and `ip2net.exe` to generate and observe traffic patterns against target services. The `blockcheck2.d/standard` and `custom` directories define test suites for HTTP, TLS 1.2/1.3, QUIC, and other protocols.

10. Windows portability layers  
The repo includes a minimal `cygwin/` tree so the shell-based tooling can run on Windows. It also includes admin/elevation helpers such as `elevator.exe` and `cygwin-admin.cmd`, because many operations require administrator privileges to load the driver and manipulate traffic.

11. Platform-specific bundles  
There are separate platform support folders:
- `arm64/` for Windows 11+ ARM64
- `win7/` for older Windows 7 / Server 2008 R2 compatibility
- `windivert-hide/` for driver-related hiding/removal utilities  
These folders reflect deployment constraints rather than separate products.

12. Operational dependencies and constraints  
The architecture depends on:
- Windows x64 / ARM64 support
- WinDivert kernel driver
- elevated privileges
- sometimes testsigning mode or secure boot adjustments
- the Windows networking stack and, for some scenarios, service installation  
The README’s antivirus warning matters because the driver-hooking model is behaviorally similar to security-sensitive software.

13. Overall architectural shape  
At a high level, this repo is a packaged DPI-bypass platform with three layers:
- capture layer: WinDivert driver
- decision/action layer: `winws` / `winws2` plus Lua and fake-packet assets
- orchestration/diagnostics layer: batch scripts, Cygwin shell scripts, blockcheck, and service installers  
The key diagram should show these layers explicitly, with blockcheck separated from the live packet modification path.

Main entry points: [`zapret-winws/winws.exe`](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/winws.exe) (winws), [`zapret-winws/winws2.exe`](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/winws2.exe) (winws2), [`zapret-winws/WinDivert64.sys`](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/WinDivert64.sys) (WinDivert), [`blockcheck/zapret2/blockcheck2.sh`](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.sh) (Blockcheck2)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Live bypass runtime"]
  node_win_traffic(("Windows traffic<br/>network traffic"))
  node_windivert_driver[("WinDivert<br/>kernel driver<br/>[WinDivert64.sys]")]
  node_winws_engine["winws<br/>user-space engine<br/>[winws.exe]"]
  node_winws2_engine["winws2<br/>user-space engine<br/>[winws2.exe]"]
end

subgraph group_presets["Launchers and services"]
  node_zapret1_presets["zapret1 presets<br/>cmd launchers"]
  node_zapret2_presets["zapret2 presets<br/>cmd launchers"]
  node_service_scripts["Service mode<br/>cmd service control<br/>[service_create.cmd]"]
end

subgraph group_policy["Policy assets"]
  node_lua_rules1["Lua policy<br/>rule scripts<br/>[zapret-antidpi.lua]"]
  node_lua_rules2["Lua policy 2<br/>rule scripts<br/>[zapret-antidpi.lua]"]
  node_fake_payloads1["Fake payloads<br/>binary decoys"]
  node_fake_payloads2["Fake payloads 2<br/>binary decoys"]
end

subgraph group_diagnostics["Blockcheck"]
  node_blockcheck1["Blockcheck<br/>probe harness<br/>[blockcheck.sh]"]
  node_blockcheck2["Blockcheck2<br/>probe harness<br/>[blockcheck2.sh]"]
  node_standard_tests["Test suites<br/>sh test cases<br/>[10-http-basic.sh]"]
  node_custom_tests["Custom lists<br/>test lists<br/>[list_http.txt]"]
end

subgraph group_portability["Windows support"]
  node_cygwin_runtime["Cygwin<br/>windows shell layer<br/>[bash.exe]"]
  node_elevation_tools["Elevators<br/>privilege helpers<br/>[elevator.exe]"]
  node_platform_bundles[("Platform bundles<br/>platform support<br/>[WinDivert64.sys]")]
  node_hide_tools[("Hide tools<br/>driver utilities<br/>[Monkey64.sys]")]
end

node_win_traffic -->|"captures"| node_windivert_driver
node_windivert_driver -->|"feeds"| node_winws_engine
node_windivert_driver -->|"feeds"| node_winws2_engine
node_winws_engine -->|"reinjects"| node_win_traffic
node_winws2_engine -->|"reinjects"| node_win_traffic
node_zapret1_presets -->|"launches"| node_winws_engine
node_zapret2_presets -->|"launches"| node_winws2_engine
node_service_scripts -->|"starts"| node_winws_engine
node_service_scripts -->|"starts"| node_winws2_engine
node_lua_rules1 -->|"configures"| node_winws_engine
node_lua_rules2 -->|"configures"| node_winws2_engine
node_fake_payloads1 -->|"supplies decoys"| node_winws_engine
node_fake_payloads2 -->|"supplies decoys"| node_winws2_engine
node_blockcheck1 -.->|"evaluates"| node_lua_rules1
node_blockcheck2 -.->|"evaluates"| node_lua_rules2
node_standard_tests -.->|"drives"| node_blockcheck2
node_custom_tests -.->|"drives"| node_blockcheck2
node_cygwin_runtime -->|"runs"| node_blockcheck1
node_cygwin_runtime -->|"runs"| node_blockcheck2
node_elevation_tools -->|"enables"| node_service_scripts
node_platform_bundles -->|"packages"| node_windivert_driver
node_hide_tools -->|"manages"| node_windivert_driver
node_blockcheck1 -.->|"profiles"| node_winws_engine
node_blockcheck2 -.->|"profiles"| node_winws2_engine

click node_windivert_driver "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/WinDivert64.sys"
click node_winws_engine "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/winws.exe"
click node_winws2_engine "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/winws2.exe"
click node_zapret1_presets "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/preset1_example.cmd"
click node_zapret2_presets "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/preset2_example.cmd"
click node_service_scripts "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/service_create.cmd"
click node_lua_rules1 "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/lua/zapret-antidpi.lua"
click node_lua_rules2 "https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/lua/zapret-antidpi.lua"
click node_fake_payloads1 "https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/files/quic_initial_www_google_com.bin"
click node_fake_payloads2 "https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret/files/fake/tls_clienthello_www_google_com.bin"
click node_blockcheck1 "https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret/blockcheck.sh"
click node_blockcheck2 "https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.sh"
click node_standard_tests "https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.d/standard/10-http-basic.sh"
click node_custom_tests "https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.d/custom/list_http.txt"
click node_cygwin_runtime "https://github.com/bol-van/zapret-win-bundle/blob/master/cygwin/bin/bash.exe"
click node_elevation_tools "https://github.com/bol-van/zapret-win-bundle/blob/master/tools/elevator.exe"
click node_platform_bundles "https://github.com/bol-van/zapret-win-bundle/blob/master/arm64/WinDivert64.sys"
click node_hide_tools "https://github.com/bol-van/zapret-win-bundle/blob/master/windivert-hide/Monkey64.sys"

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_win_traffic,node_windivert_driver,node_winws_engine,node_winws2_engine toneBlue
class node_zapret1_presets,node_zapret2_presets,node_service_scripts toneAmber
class node_lua_rules1,node_lua_rules2,node_fake_payloads1,node_fake_payloads2 toneMint
class node_blockcheck1,node_blockcheck2,node_standard_tests,node_custom_tests toneRose
class node_cygwin_runtime,node_elevation_tools,node_platform_bundles,node_hide_tools toneIndigo
```

## Components

### Live bypass runtime

Windows packet-capture and traffic-mangling path used during actual DPI bypass.

- **Windows traffic**: network traffic · Normal Windows network packets entering the bypass stack.
- [WinDivert](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/WinDivert64.sys): kernel driver · Kernel capture/reinject boundary for intercepted packets. · `zapret-winws/WinDivert64.sys`
- [winws](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/winws.exe): user-space engine · First-generation packet mangler and reinjection engine. · `zapret-winws/winws.exe`
- [winws2](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/winws2.exe): user-space engine · Second-generation bypass engine with updated Lua and presets. · `zapret-winws/winws2.exe`

### Launchers and services

Batch entry points that assemble arguments and start the runtime in manual or service mode.

- [zapret1 presets](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/preset1_example.cmd): cmd launchers · Interactive preset scripts that assemble command lines for winws. · `zapret-winws/preset1_example.cmd`
- [zapret2 presets](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/preset2_example.cmd): cmd launchers · Interactive preset scripts for winws2 scenarios such as WireGuard. · `zapret-winws/preset2_example.cmd`
- [Service mode](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/service_create.cmd): cmd service control · Windows service create/start/stop scripts for unattended startup. · `zapret-winws/service_create.cmd`

### Policy assets

Lua rule logic and bundled fake traffic payloads used by the engines.

- [Lua policy](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/lua/zapret-antidpi.lua): rule scripts · Protocol classification and obfuscation logic for the first engine. · `zapret-winws/lua/zapret-antidpi.lua`
- [Lua policy 2](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/lua/zapret-antidpi.lua): rule scripts · Updated policy layer used by the second engine and blockcheck2. · `blockcheck/zapret2/lua/zapret-antidpi.lua`
- [Fake payloads](https://github.com/bol-van/zapret-win-bundle/blob/master/zapret-winws/files/quic_initial_www_google_com.bin): binary decoys · Bundled crafted packet templates for decoy TLS, QUIC, WireGuard, STUN, and related traffic. · `zapret-winws/files/quic_initial_www_google_com.bin`
- [Fake payloads 2](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret/files/fake/tls_clienthello_www_google_com.bin): binary decoys · Expanded fake-traffic corpus used by blockcheck2 experiments. · `blockcheck/zapret/files/fake/tls_clienthello_www_google_com.bin`

### Blockcheck

Probing and strategy-discovery toolchains separate from the live bypass path.

- [Blockcheck](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret/blockcheck.sh): probe harness · Shell-driven diagnostics flow for discovering effective bypass strategies. · `blockcheck/zapret/blockcheck.sh`
- [Blockcheck2](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.sh): probe harness · Second-generation probing suite with standard and custom test sets. · `blockcheck/zapret2/blockcheck2.sh`
- [Test suites](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.d/standard/10-http-basic.sh): sh test cases · Standard blockcheck2 scenarios for HTTP, TLS, QUIC, and multi-stage probing. · `blockcheck/zapret2/blockcheck2.d/standard/10-http-basic.sh`
- [Custom lists](https://github.com/bol-van/zapret-win-bundle/blob/master/blockcheck/zapret2/blockcheck2.d/custom/list_http.txt): test lists · User-selectable probe target lists for blockcheck2. · `blockcheck/zapret2/blockcheck2.d/custom/list_http.txt`

### Windows support

Platform-specific installers, driver bundles, and portability helpers.

- [Cygwin](https://github.com/bol-van/zapret-win-bundle/blob/master/cygwin/bin/bash.exe): windows shell layer · Embedded POSIX-like runtime used to execute shell tooling on Windows. · `cygwin/bin/bash.exe`
- [Elevators](https://github.com/bol-van/zapret-win-bundle/blob/master/tools/elevator.exe): privilege helpers · Admin/elevation helpers needed for driver and network operations. · `tools/elevator.exe`
- [Platform bundles](https://github.com/bol-van/zapret-win-bundle/blob/master/arm64/WinDivert64.sys): platform support · Architecture-specific driver and tooling bundles for ARM64 and Win7 compatibility. · `arm64/WinDivert64.sys`
- [Hide tools](https://github.com/bol-van/zapret-win-bundle/blob/master/windivert-hide/Monkey64.sys): driver utilities · Driver-related removal or hiding utilities packaged separately. · `windivert-hide/Monkey64.sys`

## Connections

- Windows traffic → WinDivert: captures · Windows packets are intercepted at the driver boundary.
- WinDivert → winws: feeds · WinDivert supplies packets to the first user-space engine.
- WinDivert → winws2: feeds · WinDivert supplies packets to the second user-space engine.
- winws → Windows traffic: reinjects · Processed traffic is sent back to the network stack.
- winws2 → Windows traffic: reinjects · Processed traffic is sent back to the network stack.
- zapret1 presets → winws: launches · Interactive presets construct command lines for winws.
- zapret2 presets → winws2: launches · Interactive presets construct command lines for winws2.
- Service mode → winws: starts · Service scripts manage unattended startup for the runtime.
- Service mode → winws2: starts · Service scripts manage unattended startup for the runtime.
- Lua policy → winws: configures · Lua policy defines packet-classification and bypass behavior.
- Lua policy 2 → winws2: configures · Lua policy defines packet-classification and bypass behavior.
- Fake payloads → winws: supplies decoys · Binary templates provide crafted payloads for obfuscation.
- Fake payloads 2 → winws2: supplies decoys · Binary templates provide crafted payloads for obfuscation.
- Blockcheck → Lua policy: evaluates · Diagnostics probe strategy effectiveness against live interference.
- Blockcheck2 → Lua policy 2: evaluates · Diagnostics probe strategy effectiveness against live interference.
- Test suites → Blockcheck2: drives · Standard suites define the probe sequence for blockcheck2.
- Custom lists → Blockcheck2: drives · Custom lists provide target sets for blockcheck2 probes.
- Cygwin → Blockcheck: runs · Shell tooling depends on the bundled Cygwin runtime.
- Cygwin → Blockcheck2: runs · Shell tooling depends on the bundled Cygwin runtime.
- Elevators → Service mode: enables · Privilege helpers support service installation and driver operations.
- Platform bundles → WinDivert: packages · Platform-specific bundles ship matching driver and support binaries.
- Hide tools → WinDivert: manages · Auxiliary utilities operate on the bundled driver installation.
- Blockcheck → winws: profiles · Diagnostics output informs the runtime configuration.
- Blockcheck2 → winws2: profiles · Diagnostics output informs the runtime configuration.
