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 forhttp://*., 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.gif | http://ads.example.org.us/ad1.gif |
http://subdomain.example.org/ad1.gif | http://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 toexample.org
when you try to navigate to this domain from another website, but if you typeexample.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 |