Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating README.md: Fixing Farsi & English errors. #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 82 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,119 @@
# gfw_resist_tls_proxy
# آپدیت
رو ایرانسل پکت با موفقیت رد میشه ولی شدید کنده تحت بررسیه<br>
این محصول نهایی نیست یه اسکریپت پایتونه جهت اثبات ادعا<br>
بزارید به نقطه پایدار برسیم بعد برا کلاینت v2ray پیاده میشه<br>
الان متخصص حرفه ای شبکه و برنامه نویس c لازم داریم جهت تبادل اطلاعات<br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These problems have not been solved yet, so don't delete them.
Do not delete this section.



فایل جدید randchunk پکت رو به شکل رندوم به 47 قسمت نامساوی تقسیم می‌کنه؛ -به روش سامورایی با تاخیر کم- یه کوچولو بهتر شده انگار.<br>
رو ایرانسل همچنان مشکل داریم؛ ولی ترتیب اونم به امید خدا و یاری شما می‌دیم.<br>
عزیزانی که تست می‌کنن از branch های دیگه مثل load balancer هم بازدید کنن.<br>
این محصول نهایی نیست! یه اسکریپت پایتونه جهت اثبات ادعا.<br>
به نقطه‌ی پایدار که برسیم، برای کلاینت v2ray هم پیاده‌سازی می‌شه.<br>
الان به متخصص حرفه‌ای شبکه و برنامه‌نویس زبان C نیاز داریم. برای تبادل اطلاعات، لطفاً در Discussions پیام بدید.<br>
# internet for everyone or no one
سلام گرم به همه دوستانی که برای حق اولیه و ابتدایی شهروندی ، برای دسترسی به اینترنت ، تلاش میکنند
سلام گرم به همه دوستانی که برای حق اولیه و ابتدایی شهروندی، دسترسی به اینترنت، تلاش می‌کنند.
<br>
سلام به هیدیفای،باشسیز،سگارو،آی آر سی اف،پروژه امید،ثنایی،هگزا،وحید،صفا،اردشیر،ایمان،امین،حسین، یوتیوبرها و همه عزیزان دوست داشتنی
سلام به هیدیفای، باشسیز، سگارو، آی آر سی اف، پروژه امید، ثنایی، هگزا، وحید، صفا، اردشیر، ایمان، امین، حسین، یوتیوبرها و همه‌ی عزیزان دوست داشتنی!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove spaces between virgool and words

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dictation, the spaces between each punctuation mark and its next word are necessary. That's why I added them. :)
I will add the updates you mentioned (Irancell, tests, etc.) though.

<br><br>
روش این پیج یک زخم عمیق بر پیکر GFW می گذارد که تا سالها سوزش آن در ماتحت فیلترچیان دنیا باقی خواهد ماند
روش این پیج، یک زخم عمیق بر پیکر GFW میگذارد که تا سال‌ها سوزش آن در ماتحت فیلترچیان دنیا باقی خواهد ماند. 😁
<br>
<br>
خلاصه کار به فارسی:<br>
روترهای gfw تلاش میکنند اما نمیتوانند همه packet های fragment را سرهم کنند زمانی که delay بین پکت ها باشد<br>
چرا؟ چون کل ترافیک کشور ازشون عبور میکنه و براشون سخته و cache محدود دارند و باید سریع باشند<br>
از طرفی gfw نمیتونه پکت های فرگمنت رو reject کنه چون اولا fragmet جزو اصول شبکه هست<br>
ثانیا در خیلی از نت های ضعیف packet ها تکه میشوند<br>
در صورت reject کردن نت بسیاری از گوشی های قدیمی و خطوط ضعیف مختل میشه<br>
همچنین در مسیر روترهای پرسرعت fragmentation اتفاق می افته<br>
و اینو gfw میدونه بنابراین سعی میکنه اسمبل کنه و اگر نتونه عبور میده<br>
سرورها ولی موظف به سرهم کردن fragment ها هستند چون در پروتکل ip قید شده و سرشون به اندازه gfw شلوغ نیست<br>
سرورهای کلودفلر به خوبی این کارو میکنن<br>
باور کنید یا نکنید کار gfw ساختست<br>
الان عمده ترافیک TLS هست و تنها با تحلیل SNI میتونه ترافیک TLS رو تفکیک کنه<br>
و ما کار رو براش هزینه بر و پردازش بر میکنیم<br>
یا باید کل cloudflare رو با همه سایت هاش ببنده و عملا نت جهانی رو قطع کنه<br>
یا باید فرگمنت رو drop کنه که در هر صورت سیستم های خودشون هم دچار اختلال میشه<br>
این سیستم تست شده و کار میکنه<br>
و شما با domain فیلتر شده و با ip کثیف cloudflare میتوانید از gfw عبور کنید<br>
با اندکی تنظیمات ، سرعت handshake اول هم بالا خواهد رفت<br>
اینترنت برای همه یا برای هیچکس<br>
خلاصه‌ی کار به فارسی:<br>
روترهای gfw تلاش می‌کنن، اما نمی‌تونن همه‌ی packet های fragment را زمانی که delay بین پکت ها باشه سرهم کنن. <br>
چرا؟ چون کل ترافیک کشور ازشون عبور می‌کنه و براشون سخته؛ همچنین، cache محدود دارن و باید سریع باشن.<br>
از طرفی، gfw نمی‌تونه پکتهای فرگمنت رو reject کنه چون اولاً fragmet جزو اصول شبکه هست؛<br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some places, the word fragment is not written correctly, like here, correct it and txt there is no problem.

ثانیاً در خیلی از نت های ضعیف، packet ها تکه می‌شن.<br>
در صورت reject کردن، نت بسیاری از گوشیهای قدیمی و خطوط ضعیف مختل می‌شه.<br>
همچنین، در مسیر روترهای پرسرعت fragmentation اتفاق میافته.<br>
و gfw این رو می‌دونه؛ بنابراین سعی می‌کنه اسمبل کنه و اگه نتونه، عبور می‌ده.<br>
سرورها اما، موظف به سرهم کردن fragment ها هستن؛ چون در پروتکل اینترنت (ip) قید شده و سرشون به اندازه‌ی gfw شلوغ نیست.<br>
سرورهای کلودفلر به خوبی این کار رو می‌کنن.<br>
باور کنید یا نه، کار gfw ساخته‌ست!<br>
در حال حاضر عمده‌ی ترافیک TLS هست و تنها با تحلیل SNI می‌تونه ترافیک TLS رو تفکیک کنه؛<br>
و ما کار رو براش هزینهبر و پر پردازش می‌کنیم.<br>
یا باید کل cloudflare رو با همه‌ی سایتهاش ببنده و عملاً نت جهانی رو قطع کنه،<br>
یا باید فرگمنت رو drop کنه؛ که در هر صورت سیستمهای خودشون هم دچار اختلال می‌شه.<br>
*این سیستم تست شده و کار میکنه*<br>
شما با domain فیلتر شده و با ip کثیف cloudflare می‌تونید از gfw عبور کنید.<br>
با تنظیمات اندک، سرعت handshake اول هم بالا خواهد رفت.<br>
اینترنت برای همه یا برای هیچکس!<br>


# goodbye SNI filtering & goodbye GFW mf'er
<img src="/asset/meme1.jpg?raw=true" width="300" >
<br><br>

# main Idea:
in TLS protocol (even latest v1.3) SNI transferred in plain-text<br>
GFW finds it, and when SNI is not in the whitelist, replies with TCP-RST<br>
so it filter cloudflare-ip, based on SNI, such that some popular sites<br>
like plos.org is open, and all other sites closed, through that ip<br>
so we need to hide SNI from GFW<br>
we fragment TLS "client Hello" packet into chunks in a simple manner<br>
we show that it passes the firewall<br>
more importantly, we show that GFW can't fix it because its nearly impossible<br>
to cache TBs of data in high-speed router, so they MUST give up or break the whole network<br>
in TLS protocol (even latest v1.3) SNI is transfered in plain-text.<br>
GFW finds it and when SNI is not in whitelist, replies with TCP-RST.<br>
So that filters cloudflare-ip, based on the SNI, such that some popular sites<br>
like plos.org is open; and all other sites are closed through that ip.<br>
Therefore, we need to hide SNI from GFW.<br>
We fragment TLS "client Hello" packet into chunks in a simple manner.<br>
We show that it'll pass the firewall;<br>
more importantly, we show that GFW can't fix it. Because its nearly impossible<br>
to cache TBs of data in high speed router. Hence, they MUST give up or break the whole network.<br>
<br>
<img src="/asset/slide1.png?raw=true" width="600" >
<br><br>


# about SNI, ESNI & ECH (skip if you want)
leaking domain name (SNI) is the famous old bug of TLS protocol which is not fixed yet as of 2023<br>
some attempt started a few years ago trying to encrypt SNI called ESNI, which is deprecated today<br>
Cloudflare stopped supporting ESNI in the summer of 2022<br>
another way is Encrypted Client Hello (ECH), which is in draft version and not well-documented<br>
I made many efforts to use ECH, but its too complex and still is in development<br>
also its based on DNS-over-HTTPS which is already filtered by GFW<br>
leaking domain name (SNI) is the old famous bug of TLS protocol which is not fixed yet as of 2023.<br>
Some attempts started few years ago, trying to encrypt SNI in a project called ESNI which is deprecated today.<br>
cloudflare stopped supporting ESNI in summer 2022.<br>
Another way is the Encrypted Client Hello (ECH) which is in draft version and not well-documented.<br>
I made so much effort to use ECH, but its too complex and still in development.<br>
Also, it's based on DNS-over-HTTPS which is already filtered by GFW.<br>

# about GFW SNI filtering on Cloudflare IPs (skip if you want)
Cloudflare IPs are high traffic, and 30% of the web is behind them<br>
so GFW can't simply block them by traffic volume<br>
and all traffic is encrypted except client hello, which leaks server name (SNI)<br>
# about GFW SNI filtering on cloudflare IPs (skip if you want)
cloudflare IPs are high traffic and 30% of web is behind them;<br>
So GFW can't simply block them by traffic volume.<br>
Plus, all the traffic is encrypted except for client hello which leaks the server name (SNI).<br>
<br><br>
so GFW extracts SNI from client hello, and when SNI is in the whitelist, it passes <br><br>
So GFW extracts SNI from client hello and when SNI is in white list, it passes.<br><br>
![Alt text](/asset/plos-not-filtered.png?raw=true "plos.org is in whitelist")
<br><br>
if SNI is in the blacklist, GFW sends TCP-RST to terminate TCP socket<br><br>
But if SNI is in blacklist, GFW sends TCP-RST to terminate the tcp socket.<br><br>
![Alt text](/asset/youtube-filtered.png?raw=true "youtube is in backlist")
<br><br>

# about packet fragment (skip if you want)
we hide SNI by fragmenting client hello packet into several chunks.<br>
but GFW already knows this and tries assembling those chunks to find SNI! LOL<br>
but we add a time delay between fragments. LOL<br>
since Cloudflare IPs have too much traffic, GFW can't wait too long. LOL<br>
GFW high-speed cache is limited, so it can't cache TBs of data looking for a tiny TCP fragment. LOL<br>
so it forgets those fragments after a second. LOL<br>
it's impossible to look at huge traffic for a packet that don't know when or where it arrives. LOL<br>
so it's forced to Give up. LOL<br>
We hide SNI by fragmenting client hello packet into several chunks.<br>
But GFW already knew this and tries to assemble those chunks to find SNI!<br>
So, we add a time delay between fragment. LOL.<br>
Since cloudflare IPs have too much traffic, GFW is not able to wait too long. LOL<br>
GFW high-speed cache is limited so it doesn't have the ability to cache TBs of data looking for a tiny tcp fragment. LOL<br>
And that's why, it forgets those fragments after a second. LOL<br>
It's impossible to looking at huge traffic for a packet not knowing when or where it has arrived. LOL<br>
So it's forced to give up! 😁<br>

# How to run
1. assume that you have v2ray config {websocket+tls+Cloudflare}<br>
2. setup pyprox listen_port and cloudflare_dirty_ip<br>
# how to run
1. Assume that you have v2ray config {websocket+tls+Cloudflare}.<br>
2. Setup pyprox listen_port and cloudflare_dirty_ip.<br>
<img src="/asset/pyprox_tcp_setup.png?raw=true" ><br>
3. setup your v2ray client to forward to 127.0.0.1:listen_port<br>
<img src="/asset/v2rayng_setup.png?raw=true" ><br>
4. on your local machine, run<br>
<code>python pyprox_tcp.py</code><br>
5. monitor traffic by Wireshark or Microsoft Network Monitor<br>
6. adjust fragment_size & fragment_sleep<br>
typical Client Hello packet is ~300 byte<br>
we split 300 into {77+77+77+69} and send each by delay of 0.3 second<br>
<code>fragment_size=77 byte , fragment_sleep=0.3 sec -> moderate packet size with moderate delay -> work good</code><br>
3. Setup your v2ray client to forward to 127.0.0.1:listen_port<br>
<img src="/asset/v2rayng_setup.png?raw=true".><br>
4. Nn your local machine, run<br>
<code>python pyprox_tcp.py</code.><br>
5. Monitor traffic by Wireshark or Microsoft Network Monitor.<br>
6. Adjust fragment_size & fragment_sleep.<br>
Typical Client Hello packet is ~300 byte.<br>
We split 300 into {77+77+77+69} and send each by delay of 0.3 second.<br>
<code>fragment_size=77 byte , fragment_sleep=0.3 sec -> moderate packet sizes with moderated delays -> works good</code><br>
another setup might be:<br>
<code>fragment_size=77 byte , fragment_sleep=0.2 sec -> moderate packet size with moderate delay -> work nice</code><br>
<code>fragment_size=17 byte , fragment_sleep=0.03 sec -> too small chunk with less delay -> work good</code><br>
<code>too big chunk -> assembled by GFW -> TCP-RST recieved</code><br>
<code>fragment_size=77 byte , fragment_sleep=0.2 sec -> moderate packet sizes with moderated delays -> works nice</code><br>
<code>fragment_size=17 byte , fragment_sleep=0.03 sec -> very small chunk with less delay -> works good</code><br>
<code>very big chunk -> assembled by GFW -> TCP-RST recieved</code><br>
<code>too small delay -> assembled by GFW -> TCP-RST recieved</code><br>
7. just surf the web using your filtered SNI and a dirty Cloudflare IP !<br>
7. Just surf the web using your filtered SNI and a dirty cloudflare IP!<br>

# We are working on it to adjust parameters better
it might be slow at initiating TLS handshake<br>
but we make it better by setting up persistent TLS<br>
stay tuned!<br>
# we are working on it to adjust parameters better
it might be slow at initiating tls handshake;<br>
but we make it better by setting up persistent TLS.<br>
Stay tuned!<br>

# TO DO NEXT
1. implement into v2ray clients or xray-core -> Client Hello Fragmentation option<br>
2. setup persistent TLS (thus one handshake is enough for everything)<br>
3. sending TCP packet in reverse time order<br>
4. your ideas are welcome<br>
1. Implement this method into v2ray clients or xray-core -> Client Hello Fragmentation option.<br>
2. Setting up persistent TLS (thus one handshake is enough for everything).<br>
3. Sending TCP packets in reverse time order.<br>
4. All your ideas are welcome!<br>