Comments (62)
Mình làm rồi đó bạn hiền ơi @nhubaotruong
from cloudflare-gateway-pihole.
Mình update chặn quá 300k rồi
from cloudflare-gateway-pihole.
@luxysiv Thanks bạn, đang ở cty nên ko submit MR được, mới fix lúc trưa thôi
from cloudflare-gateway-pihole.
@nhubaotruong code của bạn hay thật. Mình sửa đi sửa lại cuối cùng giống bạn phần convert domains
from cloudflare-gateway-pihole.
Quá hay bạn nhưng từ sau sẽ do bạn bảo trì còn mình đúng là ngoài tầm với. Nếu bạn tâm huyết thì cứ upstream. Nó có liên quan tới phần convert_to_domain_list không? Tớ đang suy nghĩ xem làm cách nào ổn thoả nhất
from cloudflare-gateway-pihole.
Không liên quan tới phần convert_to_domain_list
nha bạn, mình chỉ parallel cho http call (phần chậm nhất của cái script này) thôi
from cloudflare-gateway-pihole.
Ok bạn ơi, bạn có phương pháp convert nào đỉnh không. Mình mới nghĩ ra 1 phương pháp
from cloudflare-gateway-pihole.
hiện mình dùng regex để lấy domains từ 2 format là domain
và host domain
thôi à, cũng chưa có idea nào khác
from cloudflare-gateway-pihole.
Cái mình đang sử dụng là nhiều hơn. Nó là của repository kia convert qua
from cloudflare-gateway-pihole.
Với mình domain là đủ rồi nên mình ko can thiệp, tối mình làm cái PR asyncio
from cloudflare-gateway-pihole.
Ok thanks bạn nhiều nha
from cloudflare-gateway-pihole.
Tốc độ quá nhanh @nhubaotruong
from cloudflare-gateway-pihole.
Nãy bị lỗi download whitelist kiểu này
# https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/optional-list.txt
# https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/sensitive.txt
https://raw.githubusercontent.com/DandelionSprout/AdGuard-Home-Whitelist/master/whitelist.txt
mà tớ fix rồi
from cloudflare-gateway-pihole.
thanks bạn, tối nay đi chơi ko có máy để fix :((
from cloudflare-gateway-pihole.
thanks bạn, tối nay đi chơi ko có máy để fix :((
Không sao bạn ơi. Phải cảm ơn bạn rất nhiều vì tâm huyết
from cloudflare-gateway-pihole.
@nhubaotruong bạn có code nào tầm soát lỗi không? Có một ông fork mà code cứ up báo lỗi
from cloudflare-gateway-pihole.
Whitelists như sau
https://raw.githubusercontent.com/im-sm/Pi-hole-Torrent-Blocklist/main/all-torrent-trackres.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/banks.txt
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/whitelist.txt
https://raw.githubusercontent.com/TogoFire-Home/AD-Settings/main/Filters/whitelist.txt
https://raw.githubusercontent.com/freekers/whitelist/master/domains/whitelist.txt
https://raw.githubusercontent.com/DandelionSprout/AdGuard-Home-Whitelist/master/whitelist.txt
https://raw.githubusercontent.com/AdguardTeam/AdGuardSDNSFilter/master/Filters/exclusions.txt
https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/optional-list.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/issues.txt
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/whitelist-referral.txt
https://raw.githubusercontent.com/mawenjian/china-cdn-domain-whitelist/master/china-cdn-domain-whitelist.txt
https://raw.githubusercontent.com/notracking/hosts-blocklists-scripts/master/hostnames.whitelist.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/mac.txt
https://raw.githubusercontent.com/boutetnico/url-shorteners/master/list.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/windows.txt
https://raw.githubusercontent.com/Dogino/Discord-Phishing-URLs/main/official-domains.txt
https://raw.githubusercontent.com/ookangzheng/blahdns/master/hosts/whitelist.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/android.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/sensitive.txt
https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/whitelist.txt
https://raw.githubusercontent.com/AdguardTeam/HttpsExclusions/master/exclusions/firefox.txt
Blacklists như sau
https://raw.githubusercontent.com/bigdargon/hostsVN/master/option/domain.txt
https://justdomains.github.io/blocklists/lists/adguarddns-justdomains.txt
https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/light-onlydomains.txt
https://o0.pages.dev/Lite/domains.txt
https://raw.githubusercontent.com/Yhonay/antipopads/master/hosts
https://raw.githubusercontent.com/mullvad/dns-blocklists/main/output/doh/doh_adblock.txt
https://raw.githubusercontent.com/mullvad/dns-blocklists/main/output/doh/doh_gambling.txt
https://raw.githubusercontent.com/mullvad/dns-blocklists/main/output/doh/doh_privacy.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts
https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt
https://adaway.org/hosts.txt
Lỗi báo như sau
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/runner/work/Cloudflare-Gateway-Pihole/Cloudflare-Gateway-Pihole/src/__main__.py", line 61, in <module>
asyncio.run(main())
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/runner/work/Cloudflare-Gateway-Pihole/Cloudflare-Gateway-Pihole/src/__main__.py", line 57, in main
await app.run()
File "/home/runner/work/Cloudflare-Gateway-Pihole/Cloudflare-Gateway-Pihole/src/utils.py", line 74, in run
cf_lists = await asyncio.gather(*create_list_tasks)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/Cloudflare-Gateway-Pihole/Cloudflare-Gateway-Pihole/src/cloudflare.py", line 23, in wrapper
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/Cloudflare-Gateway-Pihole/Cloudflare-Gateway-Pihole/src/cloudflare.py", line 52, in create_list
raise Exception("Failed to create Cloudflare list")
Exception: Failed to create Cloudflare list
from cloudflare-gateway-pihole.
Này là lỗi do rule của ổng violate check gì đó của cloudflare rồi =)), để thử debug
from cloudflare-gateway-pihole.
Này là lỗi do rule của ổng violate check gì đó của cloudflare rồi =)), để thử debug
Mình thử fork lại vẫn bị. Thay regex vẫn bị
from cloudflare-gateway-pihole.
@nhubaotruong hình như script up vượt 300k domains. Có lẽ nên thêm tính năng giới hạn domains script
from cloudflare-gateway-pihole.
Đúng ra là chỉ được 300k rules thôi, nhưng mà nếu gọi đủ nhanh thì có thể race condition bên cloudflare á =))). T đang xài cỡ 407k rules lận =)))
from cloudflare-gateway-pihole.
Đúng ra là chỉ được 300k rules thôi, nhưng mà nếu gọi đủ nhanh thì có thể race condition bên cloudflare á =))). T đang xài cỡ 407k rules lận =)))
Tớ thấy có người nói + xem action của bạn hôm qua. Phải block lại không lại giống wireguard mất
from cloudflare-gateway-pihole.
Giống wireguard là bị gì ấy nhỉ
from cloudflare-gateway-pihole.
Giống wireguard là bị gì ấy nhỉ
Cloudflare chặn Wireguard IP VN. Bạn không biết vụ đó hả.
from cloudflare-gateway-pihole.
Cloudflare chặn Wireguard IP VN. Bạn không biết vụ đó hả.
ủa vụ này mình ko biết, cái vụ refer Warp nhận bandwidth đó hả
from cloudflare-gateway-pihole.
Cloudflare chặn Wireguard IP VN. Bạn không biết vụ đó hả.
ủa vụ này mình ko biết, cái vụ refer Warp nhận bandwidth đó hả
Vụ Generate lấy key wireguard làm VPN ấy.
from cloudflare-gateway-pihole.
@luxysiv Mình mới fix 1 cái lỗi khá ngu xuẩn, lúc encode('idna')
có thể exception. Nhớ wrap nó lại nha
try:
domain = domain.encode("idna").decode("utf-8", "replace")
except Exception:
continue
Với lại domain nhớ lowercase
, có nhiều filter nó duplicate rule mà nó khác ghi hoa ghi thường thôi
from cloudflare-gateway-pihole.
Ok thanks bạn. Bạn pro quá
from cloudflare-gateway-pihole.
Bạn coi xem đã đúng chưa ? @nhubaotruong . Mình cóp luôn từ bạn ra. Cái regex đó làm khá chuẩn đấy. Hên. Tớ test 2 cái không bị regex thiếu
from cloudflare-gateway-pihole.
Bạn muốn sửa gì cứ PR mình sẽ merge
from cloudflare-gateway-pihole.
@luxysiv Thanks bạn, đang ở cty nên ko submit MR được, mới fix lúc trưa thôi
Bạn quá nhiệt tình cảm ơn còn không hết
from cloudflare-gateway-pihole.
@nhubaotruong cái Regex domains của tớ xài chuẩn đấy. Tớ thử cái Hagezi và Lists của tớ nó chính xác 100%
from cloudflare-gateway-pihole.
@luxysiv ngon
from cloudflare-gateway-pihole.
Ủa bạn có biết gì về Github Action Variables không? Kế bên cái Secrets ấy? Sử dụng nó thế nào? Nghe ông Việt cải tiến cái Github này rất nhiều
from cloudflare-gateway-pihole.
@luxysiv Mình ko rành github actions lắm, cũng hay copy paste config của người khác thôi à =))
from cloudflare-gateway-pihole.
@luxysiv Mình ko rành github actions lắm, cũng hay copy paste config của người khác thôi à =))
Ờm haha, mình cũng copy người ta
from cloudflare-gateway-pihole.
@nhubaotruong hình như sau khi tăng khả năng up thì phần create policy dễ bị fail
from cloudflare-gateway-pihole.
@luxysiv là sao nhỉ, có log ko b
from cloudflare-gateway-pihole.
@luxysiv là sao nhỉ, có log ko b
À không,hoặc do mình chỉnh sửa linh tinh, bắt chước bạn chạy 3 lần có vẻ không ổn
from cloudflare-gateway-pihole.
@luxysiv à, mình revert cái đó rồi, tại ban đầu tính là để tự retry, đỡ phiền, mà api limit ko đủ để chạy 3 lần liên tục
from cloudflare-gateway-pihole.
@luxysiv à, mình revert cái đó rồi, tại ban đầu tính là để tự retry, đỡ phiền, mà api limit ko đủ để chạy 3 lần liên tục
Mình cũng thấy nó lỗi. Bạn có cách nào để loại bỏ những subdomains nếu đã có domain cấp cao hơn không?
from cloudflare-gateway-pihole.
@luxysiv Có á, nhưng mà kiểu ko biết có đáng tin ko.
Vd như cái domain vn-libs.top
. Nó ko phải là xấu, mà gần đây lên vtv thời sự lừa đảo vì subdomain vietcombank.vn-libs.top
. Cái list vn-bad-site mình đang xài cũng xóa cái domain đó ra rồi, vì cái subdomain ko còn tồn tại nữa
from cloudflare-gateway-pihole.
Ý mình là nếu có ads.google.com
rồi thì loại bỏ sub.ads.google.com
á bạn
from cloudflare-gateway-pihole.
@luxysiv Function đây nha bạn
from collections import defaultdict
def get_least_specific_subdomains(domains):
# Create a dictionary where the keys are the base domains and the values are lists of subdomains
domain_dict = defaultdict(list)
for domain in domains:
# Split the domain into its constituent parts
split_domain = domain.split(".")
# The base domain is the last two parts of the domain (e.g., 'example.com')
base_domain = ".".join(split_domain[-2:])
# Add the domain to the dictionary
domain_dict[base_domain].append(split_domain)
least_specific_domains = []
# For each base domain, find the least specific subdomain(s)
for base_domain, subdomains in domain_dict.items():
# Sort the subdomains by length (number of parts)
sorted_subdomains = sorted(subdomains, key=len)
# Get the length of the shortest subdomain
min_length = len(sorted_subdomains[0])
# Filter out the subdomains that are not the least specific
least_specific_subdomains = [
".".join(subdomain)
for subdomain in sorted_subdomains
if len(subdomain) == min_length
]
# Add the least specific subdomains to the result list
least_specific_domains.extend(least_specific_subdomains)
return least_specific_domains
from cloudflare-gateway-pihole.
Cám ơn bạn, để mình nghiên cứu
from cloudflare-gateway-pihole.
Ủa mình thêm như này đúng không
domains = self.get_least_specific_subdomains(domains)
from cloudflare-gateway-pihole.
đúng rồi bạn
from cloudflare-gateway-pihole.
Hình như nó loop lâu lắm
from cloudflare-gateway-pihole.
yeah =))) nó phải check mọi line mà :((
from cloudflare-gateway-pihole.
Tí tớ update code bạn xem có khả năng tăng tốc xử lý không nhé
from cloudflare-gateway-pihole.
@nhubaotruong bạn tính sang code go hả
from cloudflare-gateway-pihole.
@luxysiv Code cho vui thôi b, reimplement cái mình đã biết bằng language khác là cách học tốt mà =)))
Mà lúc chạy thử thấy có vẻ nhanh hơn python tầm 2s thôi, tại cái chậm ở đây là I/O network
from cloudflare-gateway-pihole.
@nhubaotruong bạn nghiên cứu cái remove subdomains mới đi. Mình tay ngang chả biết gì code đâu
from cloudflare-gateway-pihole.
@luxysiv bạn cho mình hỏi? Trong code của bạn nó có lọc các domain trùng nhau không vậy ạ?
from cloudflare-gateway-pihole.
@kojin91 có bạn
from cloudflare-gateway-pihole.
sorted chính là sắp xếp và loại bỏ domains trùng
from cloudflare-gateway-pihole.
@sieucaocao mình nhầm, set là đã loại bỏ dòng trùng rồi còn sorted là sắp xếp theo thứ tự
from cloudflare-gateway-pihole.
@luxysiv ý bạn là logic bỏ subdomain thừa ?
from cloudflare-gateway-pihole.
@nhubaotruong phần convert to domain list ấy bạn.
def extract_domains(content: str, domains: set[str]) -> None:
for line in content.splitlines():
if line.startswith(("#", "!", "/")) or line == "":
continue
cleaned_line = line.lower().strip().split("#")[0].split("^")[0].replace("\r", "")
domain = replace_pattern.sub("", cleaned_line, count=1)
try:
domain = domain.encode("idna").decode("utf-8", "replace")
if domain_pattern.match(domain) and not ip_pattern.match(domain):
domains.add(domain)
except Exception:
pass
from cloudflare-gateway-pihole.
@nhubaotruong mình đã biết cách đóng gói chương trình thành 1 file chạy thẳng trên Linux luôn bạn, không phải install python nữa
from cloudflare-gateway-pihole.
https://github.com/luxysiv/CGP như này nè bạn @nhubaotruong
from cloudflare-gateway-pihole.
@luxysiv Có cái https://pyinstaller.org/en/stable/. B xem thử
from cloudflare-gateway-pihole.
Related Issues (5)
- More language
- update adblock list HOT 6
- fork update issue HOT 1
- adblock list style HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare-gateway-pihole.