Giter Site home page Giter Site logo

Comments (62)

luxysiv avatar luxysiv commented on June 12, 2024 2

Mình làm rồi đó bạn hiền ơi @nhubaotruong

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024 1

Mình update chặn quá 300k rồi

from cloudflare-gateway-pihole.

nhubaotruong avatar nhubaotruong commented on June 12, 2024 1

@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.

luxysiv avatar luxysiv commented on June 12, 2024 1

@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.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

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.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

hiện mình dùng regex để lấy domains từ 2 format là domainhost domain thôi à, cũng chưa có idea nào khác

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

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.

luxysiv avatar luxysiv commented on June 12, 2024

Ok thanks bạn nhiều nha

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

Tốc độ quá nhanh @nhubaotruong

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

thanks bạn, tối nay đi chơi ko có máy để fix :((

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

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.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

Này là lỗi do rule của ổng violate check gì đó của cloudflare rồi =)), để thử debug

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

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.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

Đú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.

luxysiv avatar luxysiv commented on June 12, 2024

Đú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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

Giống wireguard là bị gì ấy nhỉ

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

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.

luxysiv avatar luxysiv commented on June 12, 2024

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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

Ok thanks bạn. Bạn pro quá

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

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.

luxysiv avatar luxysiv commented on June 12, 2024

Bạn muốn sửa gì cứ PR mình sẽ merge

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@luxysiv ngon

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

Ủ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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@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 avatar luxysiv commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

@nhubaotruong hình như sau khi tăng khả năng up thì phần create policy dễ bị fail

from cloudflare-gateway-pihole.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@luxysiv là sao nhỉ, có log ko b

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@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 avatar luxysiv commented on June 12, 2024

@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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

Ý 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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

Cám ơn bạn, để mình nghiên cứu

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

Ủa mình thêm như này đúng không

domains = self.get_least_specific_subdomains(domains)

from cloudflare-gateway-pihole.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

đúng rồi bạn

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

Hình như nó loop lâu lắm

from cloudflare-gateway-pihole.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

yeah =))) nó phải check mọi line mà :((

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

Tí tớ update code bạn xem có khả năng tăng tốc xử lý không nhé

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

@nhubaotruong bạn tính sang code go hả

from cloudflare-gateway-pihole.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

sieucaocao avatar sieucaocao commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

@kojin91 có bạn

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

sorted chính là sắp xếp và loại bỏ domains trùng

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@luxysiv ý bạn là logic bỏ subdomain thừa ?

from cloudflare-gateway-pihole.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

@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.

luxysiv avatar luxysiv commented on June 12, 2024

https://github.com/luxysiv/CGP như này nè bạn @nhubaotruong

from cloudflare-gateway-pihole.

nhubaotruong avatar nhubaotruong commented on June 12, 2024

@luxysiv Có cái https://pyinstaller.org/en/stable/. B xem thử

from cloudflare-gateway-pihole.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.