byedpi
repository·main·Indexed 23 days ago
https://github.com/hufrea/byedpiA local SOCKS proxy server designed to bypass Deep Packet Inspection (DPI) by manipulating TCP/TLS packet characteristics. It implements various bypass methods including packet fragmentation, disordering, TTL manipulation, and fake packets. Supports protocol whitelisting, automatic bypass mode detection, and outbound proxy connections via schemes such as SOCKS, Shadowsocks, and HTTP.
What's inside byedpi
- byedpi is a local SOCKS proxy server designed to implement various DPI (Deep Packet Inspection) bypass methods. It allows users to circumvent network restrictions by manipulating packet characteristics such as TTL, fragmentation, and ordering.
Use byedpi via Docker
mainDocker images are available on DockerHub athufrea/byedpi. Configuration examples can be found in thedist/dockerdirectory of the repository.Optimize byedpi for Linux vs Windows
mainBypass strategies differ significantly by operating system due to how TCP retransmission is handled.
Linux Recommended Patterns:
- Simple disorder:
--disorder 1 - Fake packets:
--fake -1 --md5sig
Windows Recommended Patterns:
- Simple disorder:
--split 1+s --disorder 3+s - Fake packets:
--disorder 1 --fake -1
General Example:
ciadpi --disorder 1 --auto=torst --tlsrec 1+s ciadpi --fake -1 --ttl 8- Simple disorder:
Build byedpi from source
mainTo build the project, you need
makeand a C compiler (gccorclangfor Linux, ormingwfor Windows).Linux:
makeWindows:
make windows CC=x86_64-w64-mingw32-gccmake make windows CC=x86_64-w64-mingw32-gccConfigure byedpi automatic bypass modes
mainThe
--autoflag allows you to define groups of bypass parameters that are applied only when specific triggers occur.Triggers for
--auto <t,r,s,n>:torst: Connection timeout or server reset after the first request.redirect: HTTP Redirect with aLocationheader that doesn't match the outgoing domain.ssl_err: NoServerHelloreceived afterClientHello, or invalidsession_idinSH.none: Skips the previous group (e.g., due to domain or protocol restrictions).
Auto Mode (
--auto-mode <0-3>):0: Cache IP only if reconnection is possible.1: Cache IP iftorstorssl_erroccurs during initial packet exchange.2: Sort groups by trigger frequency (ascending).3: Both1and2.
Example: Apply different TTLs based on error type:
ciadpi --fake -1 --ttl 10 --auto=ssl_err --fake -1 --ttl 5Configure byedpi packet fragmentation and manipulation
mainUse these flags to manipulate packet structure to bypass DPI:
-s, --split <pos_t>: Split request at a specific position. Format:offset[:repeats:skip][+flag1[flag2]]. Flags:+s(SNI offset),+h(Host offset),+n(zero offset),+e(end),+m(middle).-d, --disorder <pos_t>: Similar to--split, but parts are sent in reverse order.-o, --oob <pos_t>: Similar to--split, but part is sent as Out-of-Band (OOB) data using the URG flag.-q, --disoob <pos_t>: Similar to--disorder, but part is sent as OOB data.-f, --fake <pos_t>: Similar to--disorder, but a fake part is sent before the first real part.-t, --ttl <num>: TTL for the fake packet (default:8).-r, --tlsrec <pos_t>: Split ClientHello into separate TLS records at the specified offset.-m, --tlsminor <ver>: Changes the third byte of the TLS record to the specified value.-M, --mod-http <h[,d,r]>: HTTP packet manipulations:hcsmix(case mix Host),dcsmix(case mix Host),rmspace(remove space in Host).
Configure byedpi filtering and restrictions
mainRestrict which traffic is processed using these flags:
-K, --proto <t,h,u,i>: Protocol whitelist:tls,http,udp,ipv4.-H, --hosts <file|:string>: Limit scope to a list of domains (separated by newline or space).-j, --ipset <file|:str>: Limit scope to specific IPs or subnets.-V, --pf <port[-portr]>: Limit scope to specific port ranges.
Configure byedpi operational modes
mainControl how the proxy runs and handles connections:
-D, --daemon: Run in daemon mode (Linux and BSD only).-w, --pidfile <filename>: Location of the PID file.-E, --transparent: Run in transparent proxy mode (SOCKS functionality is disabled).-U, --no-udp: Do not proxy UDP traffic.-F, --tfo: Enable TCP Fast Open (Linux 4.11+ only).-Y, --drop-sack: Ignore SACK (Selective Acknowledgement), forcing the kernel to retransmit delivered packets (Linux only).
Configure byedpi SOCKS proxy settings
mainUse the following flags to configure the listening interface and port for the SOCKS proxy:
-i, --ip <ip>: Listening IP (default:0.0.0.0).-p, --port <num>: Listening port (default:1080).-c, --max-conn <count>: Maximum client connections (default:512).-I, --conn-ip <ip>: IP address to bind outgoing connections to (default:::). Specifying an IPv4 address will reject IPv6 requests.
Reference: ByeDPI CLI Flags
mainFull list of available command-line arguments for ByeDPI.Configure Whitelists and Protocol Filtering
mainRestrict which hosts, IPs, or protocols ByeDPI will process.
-K, --proto <t,h,u,i>: Protocol whitelist. Options:tls,http,udp,ipv4.-H, --hosts <file|:str>: Hosts whitelist. Provide a filename or a colon-prefixed string (e.g.,:example.com).-j, --ipset <file|:str>: IP whitelist. Provide a filename or a colon-prefixed string.-V, --pf <port[-portr]>: Port range whitelist (e.g.,80-443).
Configure ByeDPI Listening IP and Port
mainSet the local address and port that ByeDPI will listen on. By default, it listens on
0.0.0.0:1080.-i, --ip <ip>: Specify the listening IP address.-p, --port <num>: Specify the listening port number.