$ show bol-van/zapret2
This repository is a DPI bypass toolkit that intercepts and manipulates network packets to evade Deep Packet Inspection systems. It uses a modular architecture with a core daemon (nfqws2/dvtws2/winws2) that processes packets via NFQUEUE (Linux), divert sockets (*BSD), or WinDivert (Windows/Cygwin). Packet manipulation logic is implemented in Lua scripts, allowing flexible obfuscation strategies like packet splitting, reordering, and fake packet generation. The system includes automatic IP/host list management from external sources (antizapret, reestr), connection tracking for flow state, and cross-platform service integration. Key entry points are the main daemon, installation scripts, and list management utilities. Data flow involves packet interception → dissection → profile-based Lua processing → verdict (PASS/MODIFY/DROP) → reinjection. External dependencies include kernel interfaces (netfilter/WinDivert), Lua, zlib, and shell utilities for list updates.
The LLM identified 5 files worth highlighting for reuse:
Provides a clean Lua C API for packet manipulation, exposing over 50 functions for accessing packet metadata, modifying payloads, managing timers, and loading blobs. Isolated from core logic, allowing reuse in any project needing Lua-scriptable packet processing. Demonstrates non-obvious skill in designing a bidirectional Lua/C interface for high-performance network applications.
Abstracts host list loading, storage, and lookup with automatic reload on file changes. Uses hash tables for efficient domain/IP matching and supports both static and auto-updating lists. Self-contained with minimal dependencies (uthash.h, timer.h). Reusable for any application requiring dynamic filtering based on domain/IP lists, such as firewalls or ad blockers.
Implements cross-platform privilege dropping (setuid/setgid), capability dropping (Linux seccomp), and low-integrity mode (Windows). Isolates security-sensitive operations into a single module with clear initialization and drop functions. Reduces attack surface for network daemons and can be extracted for similar services needing privilege minimization.
Tracks TCP/UDP connection states (sequence numbers, byte/packet counts) with configurable timeouts using a timer wheel for efficient cleanup. Provides flow state to Lua via desync.track. Self-contained, depending only on timer.h and uthash.h. Reusable in any stateful packet processing tool requiring connection awareness, such as proxies or traffic shapers.
Manages delayed packet handling for techniques like splitting and replay. Uses a timer wheel to schedule packet reinjection and handles reference-counted packet buffers. Isolated from core logic, making it reusable in traffic shaping, QoS, or delay-based applications requiring precise packet timing control.