[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1112":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":37,"readmeContent":38,"aiSummary":39,"trendingCount":16,"starSnapshotCount":16,"syncStatus":40,"lastSyncTime":41,"discoverSource":42},1112,"sni-spoofing-rust","therealaleph\u002Fsni-spoofing-rust","therealaleph","DPI bypass via fake TLS ClientHello injection with wrong TCP sequence number. Rust port of @patterniha's SNI-Spoofing. Linux, macOS, Windows. Works with v2ray\u002Fxray VLESS configs behind Cloudflare.","https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust#setup-guide",null,"Rust",794,82,6,4,0,14,98,425,42,99.76,"MIT License",false,"main",true,[27,28,29,30,31,32,33,34,35,36],"censorship-circumvention","cloudflare","dpi-bypass","proxy","rust","sni-spoofing","tcp","v2ray","vless","xray","2026-06-12 04:00:07","# sni-spoof-rs\n\n[![Release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002Ftherealaleph\u002Fsni-spoofing-rust)](https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Freleases\u002Flatest)\n[![Total Downloads](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fdownloads\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Ftotal?label=total%20downloads)](https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Freleases)\n[![Latest Downloads](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fdownloads\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Flatest\u002Ftotal?label=latest%20release)](https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Freleases\u002Flatest)\n[![Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Ftherealaleph\u002Fsni-spoofing-rust?style=flat)](https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Fstargazers)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Ftherealaleph\u002Fsni-spoofing-rust)](LICENSE)\n\nRust implementation of [patterniha's SNI-Spoofing](https:\u002F\u002Fgithub.com\u002Fpatterniha\u002FSNI-Spoofing) DPI bypass technique. All credit for the original idea and method goes to [@patterniha](https:\u002F\u002Fgithub.com\u002Fpatterniha).\n\nA TCP forwarder that injects a fake TLS ClientHello with an intentionally wrong TCP sequence number right after the 3-way handshake. Stateful DPI reads the fake SNI and whitelists the flow. The real server drops the packet (out-of-window seq). Real traffic then passes through undetected.\n\n**[English Guide](#setup-guide)** | **[Persian Guide](#%D8%B1%D8%A7%D9%87%D9%86%D9%85%D8%A7%DB%8C-%D9%81%D8%A7%D8%B1%D8%B3%DB%8C)**\n\n## Platforms\n\n- **Linux** -- AF_PACKET raw sockets. Requires root or `CAP_NET_RAW`.\n- **macOS** -- BPF device. Requires root.\n- **Windows** -- WinDivert driver. Requires Administrator.\n\n## Build\n\n```\ncargo build --release\n```\n\nPre-built binaries for Linux (amd64\u002Farm64), macOS (amd64\u002Farm64), and Windows (amd64) are available two ways:\n- [GitHub Releases](https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Freleases) page\n- The [`releases\u002F`](releases\u002F) folder in this repository (useful if the Releases page is blocked for you -- just clone the repo or download as ZIP)\n\n## Setup Guide\n\nThis tool works with VLESS\u002FVMess configs that go through Cloudflare (CDN-based configs). Your server must be behind Cloudflare.\n\n### Step 1: Find your server's Cloudflare IP\n\nYour v2ray\u002Fxray config has a server address (a domain like `myserver.example.com`). Resolve it to get the IP:\n\n```\nnslookup myserver.example.com\n```\n\nYou should get a Cloudflare IP (usually starts with `104.`, `172.67.`, `141.101.`, etc).\n\n### Step 2: Create config.json\n\n```json\n{\n  \"graceful_shutdown_sec\": 0,\n  \"listeners\": [\n    {\n      \"listen\": \"0.0.0.0:40443\",\n      \"connect\": \"CLOUDFLARE_IP:443\",\n      \"fake_sni\": \"security.vercel.com\"\n    }\n  ]\n}\n```\n\nReplace `CLOUDFLARE_IP` with the IP from step 1. The `fake_sni` can be any domain that is allowed by your DPI (a well-known site behind Cloudflare works best).\n\n| Field | Description |\n|---|---|\n| `listen` | Local address and port to listen on |\n| `connect` | Cloudflare IP and port (must be an IP, not a hostname) |\n| `fake_sni` | SNI for the fake ClientHello (max 219 bytes) |\n| `conn_timeout_sec` | Seconds to wait for the upstream TCP connection to complete (default: `5`) |\n| `handshake_timeout_sec` | Seconds to wait for the sniffer to confirm the fake packet was sent (default: `2`) |\n| `keepalive_time_sec` | Seconds of idle before TCP keepalive probes begin (default: `11`) |\n| `keepalive_interval_sec` | Seconds between individual TCP keepalive probes (default: `2`) |\n\n| Top-level Field | Description |\n|---|---|\n| `graceful_shutdown_sec` | Seconds to wait for active connections to finish after receiving a shutdown signal. `0` exits immediately (default: `0`) |\n\nMultiple listeners are supported -- each maps to one upstream.\n\n### Step 3: Edit your v2ray\u002Fxray config\n\nIn your VLESS\u002FVMess client config, change:\n\n- **Address**: from `myserver.example.com` (or its IP) to `127.0.0.1`\n- **Port**: to the `listen` port from config.json (e.g. `40443`)\n- **Keep everything else the same** (SNI, host, path, UUID, etc.)\n\nExample -- if your original config has:\n```\naddress: myserver.example.com\nport: 443\n```\n\nChange it to:\n```\naddress: 127.0.0.1\nport: 40443\n```\n\nThe tool sits between your v2ray client and the server. Your client connects to the tool, the tool handles the DPI bypass, and forwards traffic to Cloudflare.\n\n### Step 4: Run\n\n```\n# Linux\u002FmacOS\nsudo .\u002Fsni-spoof-rs config.json\n\n# Windows (run as Administrator)\nsni-spoof-rs.exe config.json\n```\n\n**Windows note:** The Windows download is a zip containing `sni-spoof-rs.exe` and `WinDivert64.sys`. Keep both files in the same folder. The `.sys` file is the kernel driver that WinDivert needs to intercept packets.\n\nThen connect with your v2ray\u002Fxray client as usual.\n\n### Finding a working fake_sni (scan mode)\n\nIf your chosen `fake_sni` stops working (e.g., after a DPI update), the tool includes a scanner that probes a built-in list of ~650 Cloudflare-fronted domains and reports which ones pass through your network:\n\n```\n# scan using built-in list (no sudo needed -- scan mode is plain outbound TLS)\n.\u002Fsni-spoof-rs scan\n\n# save working SNIs to a file\n.\u002Fsni-spoof-rs scan -o working.txt\n\n# scan your own list\n.\u002Fsni-spoof-rs scan --list my-snis.txt\n\n# probe against a specific Cloudflare IP\n.\u002Fsni-spoof-rs scan --target 172.67.139.236:443\n\n# faster scanning\n.\u002Fsni-spoof-rs scan --concurrency 30 --timeout 4\n```\n\nPick any SNI from the output as your `fake_sni` in `config.json`. The scanner does not need root or the raw socket -- it just opens a TCP connection and sends a ClientHello.\n\n**Caveat:** this works for passive SNI-based DPI (the current common case). If your ISP does full TLS MITM (terminates and re-establishes TLS), most SNIs will appear \"reachable\" but the DPI bypass itself will still fail -- that problem requires a different tool (REALITY, Hysteria, ECH in xray).\n\n### Logging\n\nThe default log level is `warn` -- the tool runs silent unless something goes wrong. No connection metadata is logged by default.\n\nSet `RUST_LOG` for verbosity when debugging:\n\n```\nsudo RUST_LOG=info .\u002Fsni-spoof-rs config.json\nsudo RUST_LOG=debug .\u002Fsni-spoof-rs config.json\n```\n### Building from source\nTo build cross-platform binaries for all supported platforms, use the included Makefile:\n\n```bash\nmake all\n```\n\nThis will create binaries for Linux (x64\u002FARM64), macOS (x64\u002FARM64), and Windows (x64) in the bins\u002F directory. Individual platform targets are also available: make linux-x64, make macos-arm64, etc.\n\n\n## How it works\n\n1. Client connects to the listener, tool dials the upstream, kernel does the TCP 3-way handshake normally.\n2. A raw packet sniffer captures the outbound SYN (records ISN) and the 3rd-handshake ACK.\n3. After the 3rd ACK, a fake TLS ClientHello is injected with `seq = ISN + 1 - len(fake)`. This sequence number is before the server's receive window.\n4. DPI parses the fake packet, sees an allowed SNI, and whitelists the connection.\n5. The server drops the fake packet (out-of-window).\n6. Tool waits for the server's ACK with `ack == ISN + 1` confirming the fake was ignored.\n7. Bidirectional relay starts. The real TLS handshake and all subsequent traffic flow normally.\n\n---\n\n## راهنمای فارسی\n\nاین ابزار با کانفیگ‌های VLESS\u002FVMess که از Cloudflare عبور می‌کنند کار می‌کند. سرور شما باید پشت Cloudflare باشد.\n\n### مرحله ۱: پیدا کردن IP کلادفلر سرور\n\nآدرس سرور در کانفیگ v2ray شما یک دامنه است (مثل `myserver.example.com`). IP آن را پیدا کنید:\n\n```\nnslookup myserver.example.com\n```\n\nباید یک IP کلادفلر بگیرید (معمولا با `104.`، `172.67.`، `141.101.` شروع می‌شود).\n\n### مرحله ۲: ساخت config.json\n\n```json\n{\n  \"graceful_shutdown_sec\": 0,\n  \"listeners\": [\n    {\n      \"listen\": \"0.0.0.0:40443\",\n      \"connect\": \"IP_CLOUDFLARE:443\",\n      \"fake_sni\": \"security.vercel.com\"\n    }\n  ]\n}\n```\n\nبه جای `IP_CLOUDFLARE` آی‌پی مرحله ۱ را بگذارید. مقدار `fake_sni` می‌تواند هر دامنه‌ای باشد که فیلتر نیست (یک سایت معروف پشت کلادفلر بهتر جواب می‌دهد).\n\n| فیلد | توضیح |\n|---|---|\n| `listen` | آدرس و پورت محلی برای گوش دادن |\n| `connect` | آی‌پی و پورت کلادفلر (باید IP باشد، نه دامنه) |\n| `fake_sni` | SNI برای ClientHello جعلی (حداکثر ۲۱۹ بایت) |\n| `conn_timeout_sec` | ثانیه‌های انتظار برای برقراری اتصال  (پیش‌فرض: `5`) |\n| `handshake_timeout_sec` | ثانیه‌های انتظار برای تأیید ارسال پکت جعلی توسط sniffer (پیش‌فرض: `2`) |\n| `keepalive_time_sec` | ثانیه‌های بی‌فعالیتی قبل از شروع پروب‌های TCP keepalive (پیش‌فرض: `11`) |\n| `keepalive_interval_sec` | فاصله زمانی بین پروب‌های TCP keepalive به ثانیه (پیش‌فرض: `2`) |\n\n| فیلد سطح بالا | توضیح |\n|---|---|\n| `graceful_shutdown_sec` | مدت انتظار (به ثانیه) برای اتمام اتصالات فعال پس از دریافت سیگنال خاموشی. مقدار `0` بلافاصله خارج می‌شود (پیش‌فرض: `0`) |\n\n### مرحله ۳: تغییر کانفیگ v2ray\u002Fxray\n\nدر کانفیگ VLESS\u002FVMess خود این تغییرات را بدهید:\n\n- **آدرس (address)**: عوض کنید به `127.0.0.1`\n- **پورت (port)**: عوض کنید به پورت listen از config.json (مثلا `40443`)\n- **بقیه تنظیمات را دست نزنید** (SNI، host، path، UUID و غیره)\n\nمثال -- اگر کانفیگ اصلی شما اینطوری است:\n```\naddress: myserver.example.com\nport: 443\n```\n\nتغییر دهید به:\n```\naddress: 127.0.0.1\nport: 40443\n```\n\n### مرحله ۴: اجرا\n\n```\n# لینوکس\u002Fمک\nsudo .\u002Fsni-spoof-rs config.json\n\n# ویندوز (با دسترسی Administrator اجرا کنید)\nsni-spoof-rs.exe config.json\n```\n\n**نکته ویندوز:** فایل دانلودی ویندوز یک zip است که شامل `sni-spoof-rs.exe` و `WinDivert64.sys` می‌باشد. هر دو فایل باید در یک پوشه باشند. فایل `.sys` درایور کرنل WinDivert است که برای رهگیری پکت‌ها لازم است.\n\nبعد از اجرا، کلاینت v2ray\u002Fxray خود را مثل همیشه وصل کنید.\n\n### پیدا کردن fake_sni قابل استفاده (حالت scan)\n\nاگر `fake_sni` فعلی شما کار نمی‌کند (مثلا بعد از آپدیت DPI)، ابزار یک اسکنر داخلی دارد که لیستی از حدود ۶۵۰ دامنه پشت کلادفلر را روی شبکه‌ی شما تست می‌کند و SNI‌های در دسترس را نشان می‌دهد:\n\n```\n# اسکن با لیست داخلی (نیاز به sudo ندارد)\n.\u002Fsni-spoof-rs scan\n\n# ذخیره نتایج در فایل\n.\u002Fsni-spoof-rs scan -o working.txt\n\n# استفاده از لیست سفارشی\n.\u002Fsni-spoof-rs scan --list my-snis.txt\n\n# تست روی یک IP کلادفلر خاص\n.\u002Fsni-spoof-rs scan --target 172.67.139.236:443\n\n# اسکن سریع‌تر\n.\u002Fsni-spoof-rs scan --concurrency 30 --timeout 4\n```\n\nهر SNI از خروجی را می‌توانید در `config.json` به عنوان `fake_sni` بگذارید. حالت scan نیازی به root یا raw socket ندارد -- فقط یک اتصال TCP عادی باز می‌کند و ClientHello می‌فرستد.\n\n**نکته مهم:** این روش برای DPI غیرفعال که SNI را چک می‌کند (حالت رایج فعلی) جواب می‌دهد. اگر ISP شما TLS MITM کامل انجام می‌دهد (یعنی TLS را ترمینیت و دوباره باز می‌کند)، اکثر SNIها \"قابل دسترس\" نشان داده می‌شوند ولی خود دور زدن DPI کار نمی‌کند -- این مشکل نیاز به ابزار دیگری دارد (REALITY، Hysteria، یا فعال کردن ECH در xray).\n\n### بیلد از سورس\nبرای ساخت فایل‌های اجرایی برای تمام پلتفرم‌ها، از Makefile موجود استفاده کنید:\n\n```bash\nmake all\n```\n\nاین دستور فایل‌های اجرایی برای لینوکس (x64\u002FARM64)، مک (x64\u002FARM64) و ویندوز (x64) را در پوشه bins\u002F می‌سازد. همچنین می‌توانید برای هر پلتفرم جداگانه بیلد بگیرید: make linux-x64، make macos-arm64 و غیره.\n\n### دانلود\n\nفایل‌های اجرایی آماده برای لینوکس، مک و ویندوز از دو جا قابل دانلودند:\n- صفحه [GitHub Releases](https:\u002F\u002Fgithub.com\u002Ftherealaleph\u002Fsni-spoofing-rust\u002Freleases)\n- پوشه [`releases\u002F`](releases\u002F) در خود ریپازیتوری (اگر صفحه Releases برای شما فیلتر است از اینجا دانلود کنید -- کافیست ریپو را clone یا به صورت ZIP دانلود کنید)\n\n## License\n\nMIT\n","sni-spoofing-rust 是一个用于绕过深度包检测（DPI）的工具，通过注入带有错误TCP序列号的伪造TLS ClientHello来实现。该项目采用Rust语言编写，是patterniha的SNI-Spoofing技术的一个移植版本，支持Linux、macOS和Windows平台。其核心功能在于利用状态性DPI系统读取伪造的SNI并将其列入白名单，从而允许真实流量在不被检测的情况下通过。适用于需要在存在网络审查或限制的环境下使用VLESS\u002FVMess配置并通过Cloudflare进行通信的场景。",2,"2026-06-11 02:41:40","CREATED_QUERY"]