
DNSChef (NG) - DNS proxy for Penetration Testers and Malware Analysts
[!NOTE] 这是 DNSChef 的更新版本,最初由 @iphelix 编写。``` _ _ __
| | v0.7 | | / |
| | __ ___ | | | | ______ _ __ __ _ /| '_ \/ __|/ __| '_ \ / _ \ _|______| '_ \ / _| | (| | | | _ \ (__| | | | __/ | | | | | (| | _,|| ||/_|| ||___|| || ||_, | / | |_/ D O C U M E N T A T I O N
DNSChef 是一个高度可配置的 DNS 代理,适用于渗透测试人员和恶意软件分析师。DNS 代理(又称“Fake DNS”)是一种用于应用网络流量分析等用途的工具。例如,可以使用 DNS 代理伪造对“badguy.com”的请求,使其指向本地机器以进行终止或拦截,而不是指向互联网上的某个真实主机。
市面上已有很多 DNS 代理。大多数只是简单地将所有 DNS 查询指向单个 IP 地址,或者仅实现最基本的过滤。DNSChef 是在一次渗透测试中开发的,当时需要一个更具可配置性的系统。因此,DNSChef 是一款跨平台应用程序,能够基于包含和排除域名列表伪造响应,支持多种 DNS 记录类型,使用通配符匹配域名,为不匹配的域名代理真实响应,定义外部配置文件,支持 IPv6 以及许多其他功能。你可以在下面找到每个功能的详细解释和建议用途。
在无法强制应用程序直接使用其他代理服务器的情况下,建议使用 DNS 代理。例如,某些移动应用程序完全忽略操作系统的 HTTP 代理设置。在这些情况下,使用像 DNSChef 这样的 DNS 代理服务器,可以诱使该应用程序将连接转发到所需的目标地址。
## 新特性
- 需要 Python 3.11+
- 支持通过 DNS 暂存文件(目前仅支持 `A`、`AAAA`、`TXT` 记录……)
- 配置文件现在使用 TOML
- 可选 HTTP API(允许远程查询日志和更新配置)
- 完全异步以提升性能(使用 AsyncIO)
- 结构化日志以及多项体验改进
- 现在是一个 Python 包
- 已 Docker 化
- 包含来自原始仓库的多项 PR 和修复
## 安装
要安装最新版本,你应该使用 [pipx](https://pypa.github.io/pipx/)(除非你是个喜欢烂摊子的混蛋):
pipx install dnschef-ng
如果你需要 HTTP API(需要一些额外依赖):
pipx install dnschef-ng[api]
使用 pipx 从 Git 安装最新版本:
pipx install git+https://github.com/byt3bl33d3r/dnschef-ng.git
使用 pipx 从 Git 安装最新版本并包含 HTTP API 依赖:
pipx install "git+https://github.com/byt3bl33d3r/dnschef-ng.git#egg=dnschef-ng[api]"
## 设置 DNS 代理
在开始使用 DNSChef 之前,你必须将机器配置为使用运行该工具的 DNS 名称服务器。根据你使用的操作系统,你有以下几种选择:
- **Linux** - 编辑 */etc/resolv.conf*,在文件最顶部添加一行指向流量分析主机(例如,如果在本地运行,则添加 "nameserver 127.0.0.1")。或者,你可以使用诸如 Network Manager 之类的工具添加 DNS 服务器地址。在 Network Manager 中打开 IPv4 设置,从 *Method* 下拉框中选择 *Automatic (DHCP) addresses only* 或 *Manual*,然后编辑 *DNS Servers* 文本框,填入运行 DNSChef 的 IP 地址。
- **Windows** - 从 *Control Panel* 中选择 *Network Connections*。接着选择其中一个连接(例如 "Local Area Connection"),右键单击并选择属性。在随后出现的对话框中,选择 *Internet Protocol (TCP/IP)* 并点击属性。最后选择 *Use the following DNS server addresses* 单选按钮,并输入运行 DNSChef 的 IP 地址。例如,如果在本地运行,请输入 127.0.0.1。
- **OS X** - 打开 *System Preferences* 并点击 *Network* 图标。选择活动接口并填写 *DNS Server* 字段。如果你使用的是 Airport,则需要点击 *Advanced...* 按钮并从那里编辑 DNS 服务器。或者,你也可以编辑 */etc/resolv.conf*,在最顶部添加一个假的名称服务器(例如 "nameserver 127.0.0.1")。
- **iOS** - 打开 *Settings* 并选择 *General*。接着选择 *Wi-Fi*,然后点击列表中活动接入点右侧的蓝色箭头。编辑 DNS 条目,使其指向运行 DNSChef 的主机。确保已禁用蜂窝网络接口(如果可用)。
- **Android** - 打开 *Settings* 并选择 *Wireless and network*。点击 *Wi-Fi settings*,然后在手机上按 *Options* 按钮后选择 *Advanced*。启用 *Use static IP* 复选框并配置自定义 DNS 服务器。
如果你无法手动修改设备的 DNS 设置,你仍然有几种选择,包括 [ARP 欺骗](http://en.wikipedia.org/wiki/ARP_spoofing)、[恶意 DHCP](http://www.yersinia.net/doc.htm) 等其他创造性方法。
最后,你需要配置一个虚假服务,DNSChef 会将所有请求指向该服务。例如,如果你试图拦截 Web 流量,你必须启动一个运行在 80 端口的独立 Web 服务器,或者设置一个 Web 代理(例如 Burp)来拦截流量。DNSChef 会将查询指向配置了相应服务的代理/服务器主机。
## 运行 DNSChef
DNSChef 是一款使用 Python 开发的跨平台应用程序,应该可以运行在大多数拥有 Python 解释器的平台上。本指南将重点介绍 Unix 环境;不过,下面所有示例也已在 Windows 上测试通过。
让我们通过 DNSChef 最基本的监控功能来体验一下它。以 root 身份执行以下命令(需要在 53 端口启动服务器):
# ./dnschef.py
_ _ __
| | version 0.2 | | / _|
__| |_ __ ___ ___| |__ ___| |_
/ _` | '_ \/ __|/ __| '_ \ / _ \ _|
| (_| | | | \__ \ (__| | | | __/ |
\__,_|_| |_|___/\___|_| |_|\___|_|
[email protected]
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] No parameters were specified. Running in full proxy mode
不带任何参数时,DNSChef 将以全代理模式运行。这意味着所有请求都将简单地转发到上游 DNS 服务器(默认 8.8.8.8),并将响应返回给查询主机。例如,让我们查询某个域的 “A” 记录并观察结果:
$ host -t A thesprawl.org
thesprawl.org has address 108.59.3.64
DNSChef 将打印以下日志行,显示时间、源 IP 地址、请求的记录类型,以及最重要的——被查询的名称:
[23:54:03] 127.0.0.1: proxying the response of type 'A' for thesprawl.org
此模式对于简单的应用程序监控非常有用,当需要弄清楚应用程序在通信中使用了哪些域名时。
DNSChef 完全支持 IPv6,可以使用 *-6* 或 *--ipv6** 标志启用。其工作方式与 IPv4 模式完全相同,区别在于默认监听接口切换为 ::1,默认 DNS 服务器切换为 2001:4860:4860::8888。以下是一个示例输出:
# ./dnschef.py -6
_ _ __
| | version 0.2 | | / _|
__| |_ __ ___ ___| |__ ___| |_
/ _` | '_ \/ __|/ __| '_ \ / _ \ _|
| (_| | | | \__ \ (__| | | | __/ |
\__,_|_| |_|___/\___|_| |_|\___|_|
[email protected]
[*] Using IPv6 mode.
[*] DNSChef started on interface: ::1
[*] Using the following nameservers: 2001:4860:4860::8888
[*] No parameters were specified. Running in full proxy mode
[00:35:44] ::1: proxying the response of type 'A' for thesprawl.org
[00:35:44] ::1: proxying the response of type 'AAAA' for thesprawl.org
[00:35:44] ::1: proxying the response of type 'MX' for thesprawl.org
注意:默认情况下,DNSChef 创建 UDP 监听器。你也可以使用 *--tcp* 参数改用 TCP,稍后会讨论。
## 运行 DNSChef HTTP API
> [!WARNING]
> API 没有认证机制。请通过安全组、iptables、防火墙等在网络层面允许/拒绝访问。
`uvicorn dnschef.api:app`
然后你可以通过 `http://127.0.0.1:8000/docs` 查看 OpenAPI 文档。```
$ uvicorn dnschef.api:app
INFO: Started server process [28327]
INFO: Waiting for application startup.
_ _ __
| | version 0.6.0 | | / _|
__| |_ __ ___ ___| |__ ___| |_
/ _` | '_ \/ __|/ __| '_ \ / _ \ _|
| (_| | | | \__ \ (__| | | | __/ |
\__,_|_| |_|___/\___|_| |_|\___|_|
@iphelix // @byt3bl33d3r
2023-09-28 11:24:59 cooking replies domain=*.thesprawl.org record=192.0.2.1 section=A
2023-09-28 11:24:59 cooking replies domain=*.thesprawl.org record=2001:db8::1 section=AAAA
-- SNIP --
2023-09-28 11:24:59 cooking replies domain=*.thesprawl.org record=1 . alpn=h2 ipv4hint=127.0.0.1 ipv6hint=::1 section=HTTPS
INFO: Application startup complete.
2023-09-28 11:24:59 DNSChef is active interface=127.0.0.1 ipv6=False nameservers=['8.8.8.8'] port=53 tcp=False
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
现在,既然你已经知道如何启动 DNSChef,让我们用 --fakeip 参数配置它,以便将所有响应伪造为指向 127.0.0.1:
# ./dnschef.py --fakeip 127.0.0.1 -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] Cooking all A replies to point to 127.0.0.1
[23:55:57] 127.0.0.1: cooking the response of type 'A' for google.com to 127.0.0.1
[23:55:57] 127.0.0.1: proxying the response of type 'AAAA' for google.com
[23:55:57] 127.0.0.1: proxying the response of type 'MX' for google.com
在上面的输出中,你可以看到 DNSChef 被配置为将所有请求代理到 127.0.0.1。第一行日志(时间 23:55:57)显示我们已将 "A" 记录响应“伪造”为指向 127.0.0.1。然而,后续对 'AAAA' 和 'MX' 记录的请求只是从真实的 DNS 服务器代理转发。让我们看看请求程序的输出:
$ host google.com localhost
google.com has address 127.0.0.1
google.com has IPv6 address 2001:4860:4001:803::1001
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
如你所见,程序被欺骗,将 IPv4 地址使用了 127.0.0.1。然而,从 IPv6(AAAA)和邮件(MX)记录中获得的信息看起来完全合法。DNSChef 的目标是尽可能减少对程序正常运行的影响,因此如果应用程序依赖特定的邮件服务器,它将通过此代理请求正确获取。
让我们再伪造一个请求,以说明如何同时针对多条记录:
# ./dnschef.py --fakeip 127.0.0.1 --fakeipv6 ::1 -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] Cooking all A replies to point to 127.0.0.1
[*] Cooking all AAAA replies to point to ::1
[00:02:14] 127.0.0.1: cooking the response of type 'A' for google.com to 127.0.0.1
[00:02:14] 127.0.0.1: cooking the response of type 'AAAA' for google.com to ::1
[00:02:14] 127.0.0.1: proxying the response of type 'MX' for google.com
除了 --fakeip 标志之外,我现在还指定了用于伪造 'AAAA' 记录查询的 --fakeipv6。以下是更新后的程序输出:
$ host google.com localhost
google.com has address 127.0.0.1
google.com has IPv6 address ::1
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
同样,所有未被应用程序显式覆盖的记录都被代理并从真实 DNS 服务器返回。然而,IPv4(A)和 IPv6(AAAA)都被伪造为指向本地机器。
DNSChef 支持多种记录类型:
注意:为便于使用,并非所有 DNS 记录类型都暴露在命令行中。其他记录(如 PTR、TXT、SOA 等)可以通过 --file 标志和相应的记录头来指定。有关详细信息,请参见下面的外部定义文件部分。
最后,让我们观察应用程序如何处理 ANY 类型的查询:
# ./dnschef.py --fakeip 127.0.0.1 --fakeipv6 ::1 --fakemail mail.fake.com --fakealias www.fake.com --fakens ns.fake.com -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] Cooking all A replies to point to 127.0.0.1
[*] Cooking all AAAA replies to point to ::1
[*] Cooking all MX replies to point to mail.fake.com
[*] Cooking all CNAME replies to point to www.fake.com
[*] Cooking all NS replies to point to ns.fake.com
[00:17:29] 127.0.0.1: cooking the response of type 'ANY' for google.com with all known fake records.
DNS ANY 记录查询会导致 DNSChef 返回它针对适用域名所知道的所有伪造记录。程序将看到如下输出:
# host -t ANY google.com localhost
google.com has address 127.0.0.1
google.com has IPv6 address ::1
google.com mail is handled by 10 mail.fake.com.
google.com is an alias for www.fake.com.
google.com name server ns.fake.com.
使用上面的示例,假设你只想拦截对 thesprawl.org 的请求,而让对所有其他域名(如 webfaction.com)的查询保持不变。你可以使用 --fakedomains 参数,如下所示:
# ./dnschef.py --fakeip 127.0.0.1 --fakedomains thesprawl.org -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] Cooking replies to point to 127.0.0.1 matching: thesprawl.org
[00:23:37] 127.0.0.1: cooking the response of type 'A' for thesprawl.org to 127.0.0.1
[00:23:52] 127.0.0.1: proxying the response of type 'A' for mx9.webfaction.com
从上面的示例可以看出,对 thesprawl.org 的请求被伪造了;然而,对 mx9.webfaction.com 的请求没有受到影响。当你试图隔离单个应用程序而又不破坏其余部分时,过滤域名非常有用。
注意:DNSChef 在伪造响应之前不会验证域名是否存在。如果你指定了某个域名,那么无论该域名是否真实存在,它都将始终解析为伪造的值。
在另一种情况下,你可能需要伪造除一组已定义域名之外的所有请求的响应。你可以使用 --truedomains 参数完成此任务,如下所示:
# ./dnschef.py --fakeip 127.0.0.1 --truedomains thesprawl.org,*.webfaction.com -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] Cooking replies to point to 127.0.0.1 not matching: *.webfaction.com, thesprawl.org
[00:27:57] 127.0.0.1: proxying the response of type 'A' for mx9.webfaction.com
[00:28:05] 127.0.0.1: cooking the response of type 'A' for google.com to 127.0.0.1
上面的示例中发生了几个情况。首先注意使用了通配符 (*)。所有匹配 *.webfaction.com 的域名都将被反向匹配并解析为它们的真实值。对 'google.com' 的请求返回了 127.0.0.1,因为它不在排除域名列表中。
注意:通配符是位置特定的。类型为 *.thesprawl.org 的通配符将匹配 www.thesprawl.org,但不会匹配 www.test.thesprawl.org。然而,类型为 ..thesprawl.org 的通配符将匹配 thesprawl.org、www.thesprawl.org 和 www.test.thesprawl.org。
在某些情况下,为所有匹配的域名定义单个伪造 DNS 记录可能不够。你可以使用一个外部文件,其中包含一组 DOMAIN=RECORD 对,精确定义了你希望请求被导向的位置。
例如,让我们创建以下定义文件并将其命名为 dnschef.toml:```toml
[A]
".google.com"="192.0.2.1"
"thesprawl.org"="192.0.2.2"
".wordpress.*"="192.0.2.3"
注意,节标题 `[A]` 定义了要交给 DNSChef 的记录类型。现在让我们仔细观察多次查询的输出:
# ./dnschef.py --file dnschef.toml -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[+] Cooking A replies for domain *.google.com with '192.0.2.1'
[+] Cooking A replies for domain thesprawl.org with '192.0.2.2'
[+] Cooking A replies for domain *.wordpress.* with '192.0.2.3'
[00:43:54] 127.0.0.1: cooking the response of type 'A' for google.com to 192.0.2.1
[00:44:05] 127.0.0.1: cooking the response of type 'A' for www.google.com to 192.0.2.1
[00:44:19] 127.0.0.1: cooking the response of type 'A' for thesprawl.org to 192.0.2.2
[00:44:29] 127.0.0.1: proxying the response of type 'A' for www.thesprawl.org
[00:44:40] 127.0.0.1: cooking the response of type 'A' for www.wordpress.org to 192.0.2.3
[00:44:51] 127.0.0.1: cooking the response of type 'A' for wordpress.com to 192.0.2.3
[00:45:02] 127.0.0.1: proxying the response of type 'A' for slashdot.org
*google.com* 和 *www.google.com* 都匹配了 *\*.google.com* 条目,并正确解析为 *192.0.2.1*。另一方面,*www.thesprawl.org* 请求没有被修改,而是被简单地代理了。最后,*wordpress.com*、*www.wordpress.org* 等的所有变体都匹配了 *\*.wordpress.\** 掩码,并正确解析为 *192.0.2.3*。最后,一个未定义的 *slashdot.org* 查询被简单地代理并返回了真实响应。
你可以为所有其他受支持的 DNS 记录类型指定节标题,包括那些未在命令行中显式暴露的类型:[A]、[AAAA]、[MX]、[NS]、[CNAME]、[PTR]、[NAPTR] 和 [SOA]。例如,让我们在 `dnschef.toml` 文件中定义一个新的 [PTR] 节:```toml
[PTR]
"*.2.0.192.in-addr.arpa"="fake.com"
让我们观察 DNSChef 对这种新记录类型的表现:
./dnschef.py --file dnschef.toml -q
[sudo] password for iphelix:
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[+] Cooking PTR replies for domain *.2.0.192.in-addr.arpa with 'fake.com'
[00:11:34] 127.0.0.1: cooking the response of type 'PTR' for 1.2.0.192.in-addr.arpa to fake.com
以下是客户端在执行反向 DNS 查询时可能看到的结果:
$ host 192.0.2.1 localhost
1.2.0.192.in-addr.arpa domain name pointer fake.com.
某些记录需要精确的格式。SOA 和 NAPTR 就是很好的例子。```toml [SOA] "*.thesprawl.org" = "ns.fake.com. hostmaster.fake.com. 1 10800 3600 604800 3600"
[NAPTR] ".thesprawl.org" = "100 10 U E2U+sip !^.$!sip:[email protected]! ."
参见示例 `dnschef.toml` 文件获取更多示例。
## 文件暂存
DNSChef 可以通过 DNS“暂存”任何文件。目前文件暂存仅支持 `A`、`AAAA` 和 `TXT` 记录(后续将添加更多)。要指示 DNSChef 暂存文件,请在您的 `dnschef.toml` 中添加以下部分:```toml
[A]
"*.wat.org" = { file = "/home/payload.exe", chunk_size = 4 }
[AAAA]
"*.gorgetowngeronimos.org" = { file = "/home/payload.exe", chunk_size = 16 }
[!NOTE]
chunk_size设置是可选的,其行为高度依赖于查询类型。例如:由于A查询返回一个 IPv4 地址,允许的最大chunk_size为 4 字节。将chunk_size设置为超过 4 的数值将被忽略。
现在,对 *.wat.org 发出的 A 查询(DNS 名称中包含数字)将返回文件的相应块。例如,查询 ns0.wat.org 将返回一个包含文件第一个块(4 字节)的 IPv4 地址。查询 test1.wat.org 将返回文件的第二个块,以此类推……
使用上述类似的通配符域名时,“块”编号可以放置在任意位置,不必放在一起。例如,对 1aliens2.wat.org 发出的 A 查询将返回文件的第 12 个块。
TXT 记录支持额外的文件暂存选项,因为它们提供更大的灵活性:```toml
[TXT]
"ns*.dungbeetle.org" = { file = "~/payload.exe", chunk_size = 189, response_format = "{prefix}test-{chunk}", response_prefix_pool = ["atlassian-domain-verification=", "onetrust-domain-verification=", "docusign=" ] }
使用此配置后,任何对 `ns*.dungbeetle.org` 的 `TXT` 查询都会返回存储在本地文件系统 `~/payload.exe` 中的文件分块。
`response_format` 和 `response_prefix_pool` 设置是可选的,但允许你进一步自定义 DNS `TXT` 响应。
`response_format` 设置定义了 `TXT` 响应的格式:
- `{prefix}` 变量将被随机替换为 `response_prefix_pool` 数组中定义的某个值。
- `{chunk}` 变量将被替换为文件分块。
使用上述配置,对 `ns1.dungbeetle.org` 的 `TXT` 查询将返回以下响应:```
docusign=test-<BASE64_ENCODED_FILE_CHUNK_N1>
如果你再执行一个 TXT 查询(例如 ns10.dungbeetle.org),你会发现前缀会改变:```
atlassian-domain-verification=test-<BASE64_ENCODED_FILE_CHUNK_N10>
## 高级过滤
你可以混合使用来自文件和命令行的输入。例如,以下命令同时使用了 `--file` 和 `--fakedomains` 参数:
# ./dnschef.py --file dnschef.toml --fakeip 6.6.6.6 --fakedomains=thesprawl.org,slashdot.org -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[+] Cooking A replies for domain *.google.com with '192.0.2.1'
[+] Cooking A replies for domain thesprawl.org with '192.0.2.2'
[+] Cooking A replies for domain *.wordpress.* with '192.0.2.3'
[*] Cooking A replies to point to 6.6.6.6 matching: *.wordpress.*, *.google.com, thesprawl.org
[*] Cooking A replies to point to 6.6.6.6 matching: slashdot.org, *.wordpress.*, *.google.com, thesprawl.org
[00:49:05] 127.0.0.1: cooking the response of type 'A' for google.com to 192.0.2.1
[00:49:15] 127.0.0.1: cooking the response of type 'A' for slashdot.org to 6.6.6.6
[00:49:31] 127.0.0.1: cooking the response of type 'A' for thesprawl.org to 6.6.6.6
[00:50:08] 127.0.0.1: proxying the response of type 'A' for tor.com
请注意,命令行参数中针对 *thesprawl.org* 的定义优先于 *dnschef.toml*。如果你想覆盖配置文件中的值,这会很有用。slashdot.org 仍然解析到假 IP 地址,因为它是在 *--fakedomains* 参数中指定的。tor.com 请求则被直接代理,因为它既未在命令行中指定,也未在配置文件中指定。
## 其他配置
出于安全原因,DNSChef 默认监听本地 127.0.0.1(IPv6 为 ::1)接口。你可以使用 *--interface* 参数让 DNSChef 监听其他接口:
# ./dnschef.py --interface 0.0.0.0 -q
[*] DNSChef started on interface: 0.0.0.0
[*] Using the following nameservers: 8.8.8.8
[*] No parameters were specified. Running in full proxy mode
[00:50:53] 192.0.2.105: proxying the response of type 'A' for thesprawl.org
或用于 IPv6:
# ./dnschef.py -6 --interface :: -q
[*] Using IPv6 mode.
[*] DNSChef started on interface: ::
[*] Using the following nameservers: 2001:4860:4860::8888
[*] No parameters were specified. Running in full proxy mode
[00:57:46] 2001:db8::105: proxying the response of type 'A' for thesprawl.org
默认情况下,DNSChef 使用 Google 的公共 DNS 服务器来发起代理请求。不过,你可以使用 *--nameservers* 参数定义自定义的域名服务器列表:
# ./dnschef.py --nameservers 4.2.2.1,4.2.2.2 -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 4.2.2.1, 4.2.2.2
[*] No parameters were specified. Running in full proxy mode
[00:55:08] 127.0.0.1: proxying the response of type 'A' for thesprawl.org
可以使用 IP#PORT 表示法指定非标准域名服务器端口:
# ./dnschef.py --nameservers 192.0.2.2#5353 -q
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 192.0.2.2#5353
[*] No parameters were specified. Running in full proxy mode
[02:03:12] 127.0.0.1: proxying the response of type 'A' for thesprawl.org
同时,也可以使用 `-p port#` 参数让 DNSChef 本身在替代端口上启动:
# ./dnschef.py -p 5353 -q
[*] Listening on an alternative port 5353
[*] DNSChef started on interface: 127.0.0.1
[*] Using the following nameservers: 8.8.8.8
[*] No parameters were specified. Running in full proxy mode
DNS 协议可通过 UDP(默认)或 TCP 使用。DNSChef 实现了 TCP 模式,可以使用 `--tcp` 标志激活。
| Record | Description | Argument | Example |
|---|
| A | IPv4 address | --fakeip | --fakeip 192.0.2.1 |
| AAAA | IPv6 address | --fakeipv6 | --fakeipv6 2001:db8::1 |
| MX | Mail server | --fakemail | --fakemail mail.fake.com |
| CNAME | CNAME record | --fakealias | --fakealias www.fake.com |
| NS | Name server | --fakens | --fakens ns.fake.com |