GoodbyeDPI

repository·master·Indexed 12 days ago

https://github.com/valdikss/goodbyedpi

A Deep Packet Inspection (DPI) circumvention utility for Windows designed to bypass ISP-level censorship and website blocking. It employs techniques such as TCP-level fragmentation, host header manipulation, and fake packets to fool active and passive DPI systems.

Tokens
3.8K
Snippets
4
Records
7
Agent score
49%

What's inside GoodbyeDPI

  1. How GoodbyeDPI circumvents DPI

    master

    GoodbyeDPI uses several methods to bypass different types of Deep Packet Inspection (DPI):

    Passive DPI

    Passive DPI systems (using optical splitters or port mirroring) do not block data but respond faster than the destination (e.g., sending HTTP 302 Redirects or TCP Resets). GoodbyeDPI blocks these redirect/reset packets.

    Active DPI

    To fool Active DPI systems, the software employs 7 primary methods:

    1. TCP-level fragmentation for the first data packet.
    2. TCP-level fragmentation for persistent (keep-alive) HTTP sessions.
    3. Host header manipulation: Replacing Host with hoSt.
    4. Header spacing: Removing the space between the header name and its value in the Host header.
    5. Method/URI spacing: Adding extra space between the HTTP Method (e.g., GET) and the Request-URI.
    6. Case mixing: Mixing the case of the Host header value.
    7. Fake Packets: Sending fake HTTP/HTTPS packets with low TTL, incorrect checksums, or incorrect TCP Sequence/Acknowledgement numbers to prevent the DPI from correctly classifying the traffic.
  2. Verify if DPI can be circumvented

    master

    Before configuring advanced options, verify if your ISP's DPI can be bypassed by following these steps:

    1. Enable Secure DNS (DNS over HTTPS) in your browser to ensure your provider isn't poisoning DNS answers:
      • Chrome: Settings → Privacy and security → Use secure DNS → Select NextDNS.
      • Firefox: Settings → Network Settings → Enable DNS over HTTPS → Select NextDNS.
    2. Run GoodbyeDPI: Execute goodbyedpi.exe without any arguments.
    3. Test: If websites that were previously blocked now load, the basic circumvention is working.
  3. Quick start GoodbyeDPI

    master

    To quickly set up GoodbyeDPI, download the latest version from the Releases page, unpack it, and run the appropriate script based on your location:

    • For Russia: Run 1_russia_blacklist_dnsredir.cmd.
    • For other countries: Run 2_any_country_dnsredir.cmd.

    These scripts use a recommended mode that includes DNS resolver redirection to Yandex DNS on a non-standard port to prevent DNS poisoning.

    # For Russia
    1_russia_blacklist_dnsredir.cmd
    
    # For other countries
    2_any_country_dnsredir.cmd
  4. Install GoodbyeDPI as a Windows Service

    master

    You can install GoodbyeDPI as a Windows service to run it in the background. Use the provided .cmd scripts as templates and modify them according to your specific requirements (e.g., using a blacklist or specific DNS settings).

    Refer to these files in the repository:

    • service_install_russia_blacklist.cmd
    • service_install_russia_blacklist_dnsredir.cmd
    • service_remove.cmd
  5. Build GoodbyeDPI from source

    master

    To build GoodbyeDPI, you need GNU Make, mingw, and the WinDivert dependency.

    Ensure you provide the correct paths to the WinDivert headers and libraries for your target architecture.

    # For x86
    make CPREFIX=i686-w64-mingw32- WINDIVERTHEADERS=/path/to/windivert/include WINDIVERTLIBS=/path/to/windivert/x86
    
    # For x86_64
    make CPREFIX=x86_64-w64-mingw32- BIT64=1 WINDIVERTHEADERS=/path/to/windivert/include WINDIVERTLIBS=/path/to/windivert/amd64
  6. Reference: GoodbyeDPI CLI arguments

    master

    The goodbyedpi.exe utility accepts various flags to control fragmentation, header manipulation, and DNS redirection. Use -h or --help to see the full list for your specific version.

    Usage: goodbyedpi.exe [OPTION...]
     -p          block passive DPI
     -q          block QUIC/HTTP3
     -r          replace Host with hoSt
     -s          remove space between host header and its value
     -m          mix Host header case (test.com -> tEsT.cOm)
     -f <value>  set HTTP fragmentation to value
     -k <value>  enable HTTP persistent (keep-alive) fragmentation and set it to value
     -n          do not wait for first segment ACK when -k is enabled
     -e <value>  set HTTPS fragmentation to value
     -a          additional space between Method and Request-URI (enables -s, may break sites)
     -w          try to find and parse HTTP traffic on all processed ports (not only on port 80)
     --port        <value>    additional TCP port to perform fragmentation on (and HTTP tricks with -w)
     --ip-id       <value>    handle additional IP ID (decimal, drop redirects and TCP RSTs with this ID).
                              This option can be supplied multiple times.
     --dns-addr    <value>    redirect UDP DNS requests to the supplied IP address (experimental)
     --dns-port    <value>    redirect UDP DNS requests to the supplied port (53 by default)
     --dnsv6-addr  <value>    redirect UDPv6 DNS requests to the supplied IPv6 address (experimental)
     --dnsv6-port  <value>    redirect UDPv6 DNS requests to the supplied port (53 by default)
     --dns-verb               print verbose DNS redirection messages
     --blacklist   <txtfile>  perform circumvention tricks only to host names and subdomains from
                              supplied text file (HTTP Host/TLS SNI).
                              This option can be supplied multiple times.
     --allow-no-sni           perform circumvention if TLS SNI can't be detected with --blacklist enabled.
     --frag-by-sni            if SNI is detected in TLS packet, fragment the packet right before SNI value.
     --set-ttl     <value>    activate Fake Request Mode and send it with supplied TTL value.
                              DANGEROUS! May break websites in unexpected ways. Use with care (or --blacklist).
     --auto-ttl    [a1-a2-m]  activate Fake Request Mode, automatically detect TTL and decrease
                              it based on a distance. If the distance is shorter than a2, TTL is decreased
                              by a2. If it's longer, (a1; a2) scale is used with the distance as a weight.
                              If the resulting TTL is more than m(ax), set it to m.
                              Default (if set): --auto-ttl 1-4-10. Also sets --min-ttl 3.
                              DANGEROUS! May break websites in unexpected ways. Use with care (or --blacklist).
     --min-ttl     <value>    minimum TTL distance (128/64 - TTL) for which to send Fake Request
                              in --set-ttl and --auto-ttl modes.
     --wrong-chksum           activate Fake Request Mode and send it with incorrect TCP checksum.
                              May not work in a VM or with some routers, but is safer than set-ttl.
     --wrong-seq              activate Fake Request Mode, use TCP SEQ/ACK in the past.
     --native-frag            fragment (split) the packets by sending them in smaller packets, without
                              shrinking the Window Size. Works faster (does not slow down the connection)
                              and better.
     --reverse-frag           fragment (split) the packets just as --native-frag, but send them in a
                              reversed order. Works with the websites which could not handle segmented
                              HTTPS TLS ClientHello (because they receive the TCP flow "combined").
     --fake-from-hex <value>  Load fake packets for Fake Request Mode from HEX values (like 1234abcDEF).
                              This option can be supplied multiple times, in this case each fake packet
                              would be sent on every request in the command line argument order.
     --fake-with-sni <value>  Generate fake packets for Fake Request Mode with given SNI domain name.
                              The packets mimic Mozilla Firefox 130 TLS ClientHello packet
                              (with random generated fake SessionID, key shares and ECH grease).
                              Can be supplied multiple times for multiple fake packets.
     --fake-gen <value>       Generate random-filled fake packets for Fake Request Mode, value of them
                              (up to 30).
     --fake-resend <value>    Send each fake packet value number of times.
                              Default: 1 (send each packet once).
     --max-payload [value]    packets with TCP payload data more than [value] won't be processed.
                              Use this option to reduce CPU usage by skipping huge amount of data
                              (like file transfers) in already established sessions.
                              May skip some huge HTTP requests from being processed.
                              Default (if set): --max-payload 1200.
  7. Reference: Legacy and Modern Modesets

    master

    GoodbyeDPI provides predefined modesets (sets of arguments) to simplify configuration.

    Legacy Modes (prioritize compatibility):

    • -1: Most compatible mode.
    • -2: Better speed for HTTPS, still compatible.
    • -3: Better speed for HTTP and HTTPS.
    • -4: Best speed.

    Modern Modes (stable, compatible, and faster):

    • -5 to -9: These use advanced techniques like --auto-ttl, --reverse-frag, and --max-payload. Mode -9 is the default and includes --q (block QUIC/HTTP3).
    LEGACY modesets:
     -1          -p -r -s -f 2 -k 2 -n -e 2 (most compatible mode)
     -2          -p -r -s -f 2 -k 2 -n -e 40 (better speed for HTTPS yet still compatible)
     -3          -p -r -s -e 40 (better speed for HTTP and HTTPS)
     -4          -p -r -s (best speed)
    
    Modern modesets (more stable, more compatible, faster):
     -5          -f 2 -e 2 --auto-ttl --reverse-frag --max-payload
     -6          -f 2 -e 2 --wrong-seq --reverse-frag --max-payload
     -7          -f 2 -e 2 --wrong-chksum --reverse-frag --max-payload
     -8          -f 2 -e 2 --wrong-seq --wrong-chksum --reverse-frag --max-payload
     -9          -f 2 -e 2 --wrong-seq --wrong-chksum --reverse-frag --max-payload -q (this is the default)