Play With Adguard

如何用 AdGuard 解决 DNS 劫持

如何获取 AdGuard 并开始编写你的规则

打开 AdGuard 官网 并下载插件。
你也可以在 Edge 等浏览器的 加载项 里找到它。

打开 AdGuard 的界面,点击右上角的设置图标,找到用户过滤器这一栏。

界面设置界面

AdGuard 语法

AdGuard 中:

|| 符号

  • || — an indication to apply the rule to the specified domain and its subdomains. With this character, you do not have to specify a particular protocol and subdomain in address mask. It means that || stands for http://*., https://*., ws://*., wss://*. at once.

  • || —— 将规则应用于指定域及其子域的指示。使用此字符,您不必在地址掩码中指定特定协议和子域。这意味着 || 同时代表 http://*.、https://*.、ws://*.、wss://*。

^ 符号

  • ^ — a separator character mark. Separator character is any character, but a letter, a digit, or one of the following: _ - . %

  • ^ — 分隔符标记。分隔符可以是任何字符,但可以是字母、数字或以下字符之一:_ - . %

* 符号

  • * — a wildcard character. It is used to represent any set of characters. This can also be an empty string or a string of any length.
  • * — 通配符。它用于表示任何字符集。这也可以是空字符串或任何长度的字符串。

基础规则: ||example.org^

这个规则将会阻止将不会阻止
http://example.org/ad1.gifhttp://ads.example.org.us/ad1.gif
http://subdomain.example.org/ad1.gifhttp://example.com/redirect/http://ads.example.org/
https://ads.example.org:8000/

它的局限性在于,你仍然可以通过在地址栏中输入 example.org 来访问这个网址。

  • By default, such rules do not work for document requests. This means that the ||example.org^ rule will block a request made to example.org when you try to navigate to this domain from another website, but if you type example.org into the address bar and try to navigate to it, the website will open. To block the document request, you will need to use a rule with the $document modifier: ||example.org^$document.
  • 默认情况下,此类规则不适用于文档请求。这意味着当您尝试从其他网站导航到此域时,||example.org^ 规则将阻止向 example.org 发出的请求,但如果您在地址栏中键入 example.org 并尝试导航到该域,该网站将打开。要阻止文档请求,您需要使用带有 $document 修饰符的规则: ||example.org^$document

看完了文档,是时候动手了。

书写规则

规则

! dns-hijacking
||perfectdomain.com^$document

保存你的规则

运行你的规则

点亮这些开关。

用户规则AdGuard开关

现在,你 应该 进不去了。为了保证规则有效,你应该先找一个 比较安全 的网站实验一下。
手动输入进去,如果成功的话,应该会有如下显示:


接下来把所有劫持你 DNS 的网站都按照这个规则 写死 就行了。注意不要误伤了正常的网页。

一些 Domain Parking 网站

你可以 视自己的需要 对它们进行拦截。

规则
||godaddy.com^$document
||perfectdomain.com^$document
||144.dragonparking.com^$document
||*diandongzhi.com^$document

资料来源

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值