How bol-van/zapret works
Main Project Type and Purpose
• The project is a network-level DPI circumvention toolset. Its purpose is to “fool” or desynchronize deep packet inspection devices by modifying packet streams.
• It supports embedded devices (e.g., routers running OpenWrt), conventional Linux systems, Windows, and even BSD/macOS. The README details advanced methods (fake packets, segmentation, TCP sequence manipulation, etc.) that make it clear the project is about actively “dodging” censorship and DPI tactics.
Recognize the Main Components from the File Structure
• Daemons and core utilities:
– nfqws: The daemon using NFQUEUE to intercept and modify packets in real time using multiple desynchronization modes.
– tpws: A transparent TCP proxy daemon that also applies segmentation and various “tampering” techniques on TCP flows.
– ip2net: A utility written in C for summarizing individual IP addresses into aggregated network prefixes (to optimize IP list sizes).
– mdig: A multi-threaded DNS resolver that supports bulk resolution for host-based filtering.
• Common Scripts and Libraries:
– The “common” directory holds shared shell scripts (for logging, configuration, process elevation, etc.) that underpin the operation of both nfqws and tpws.
• Configuration & Initialization:
– Files such as “config.default”, “Makefile”, and various init.d folders (with examples for different platforms like linux (sysv, systemd), OpenWrt, macOS) indicate that the project is intended to be deployed in a variety of environments. These scripts not only start/stop the daemons but also set up the underlying network interception rules (using iptables or nftables).
• Documentation:
– The extensive README (multilanguage version) and additional docs (bsd.*, windows.*, quick_start.md) provide details on usage, configuration options and technical strategies.
Relationships and Flows
• Data Flow:
– Incoming network traffic from clients is intercepted by firewall rules (either iptables or nftables) and steered toward one of the two daemons.
▸ nfqws functions by hooking into the NFQUEUE to modify packets (applying DPI desynchronization techniques) before the rest of the networking stack processes them.
▸ tpws works as a transparent proxy on TCP streams by “splitting” requests and manipulating TCP segments.
– After processing, these modified packets are released back into the normal network path, with the aim being that DPI devices see modified (or “desynchronized”) traffic that does not trigger censorship.
• Control Flow:
– Configuration files (e.g., config.default) and custom initialization scripts determine which strategies are active (for example, which combination of fake packet injection, TCP split, and header modifications are used).
– Host- and IP-based filtering is supported by additional utilities (mdig for DNS resolutions; ip2net for summarizing IP lists) which feed into firewall rules and into the daemons via parameters like “--hostlist”.
• External Dependencies:
– The system depends on underlying kernel capabilities and networking subsystems: NFQUEUE, iptables/nftables, and conntrack.
▸ The design clearly maps out the separation between user mode daemons (nfqws and tpws), the firewall interception layer, and supporting utilities that prepare host/IP lists.