功能特性 • 安装 • 用法 • 运行 AlterX • 加入 Discord
使用 DSL 的快速且可自定义的子域名字典生成器。

要安装 alterx,你需要在系统上安装 Golang 1.26.10。你可以从这里下载 Golang。安装 Golang 后,你可以使用以下命令安装 alterx:
go install github.com/projectdiscovery/alterx/cmd/alterx@latest
# Clone the repository
git clone https://github.com/projectdiscovery/alterx.git
cd alterx
# Build using Makefile
make build
# Or build manually
go build ./cmd/alterx
可用的 Makefile 目标:
make help # Show all available targets
make build # Build the binary
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linter
make fmt # Format code
make clean # Clean build artifacts
make install # Install to $GOPATH/bin
你可以使用以下命令查看可用的标志和选项:
Fast and customizable subdomain wordlist generator using DSL.
Usage:
./alterx [flags]
Flags:
INPUT:
-l, -list string[] subdomains to use when creating permutations (stdin, comma-separated, file)
-p, -pattern string[] custom permutation patterns input to generate (comma-seperated, file)
-pp, -payload value custom payload pattern input to replace/use in key=value format (-pp 'word=words.txt')
OUTPUT:
-es, -estimate estimate permutation count without generating payloads
-o, -output string output file to write altered subdomain list
-ms, -max-size int Max export data size (kb, mb, gb, tb) (default mb)
-v, -verbose display verbose output
-silent display results only
-version display alterx version
CONFIG:
-config string alterx cli config file (default '$HOME/.config/alterx/config.yaml')
-en, -enrich enrich wordlist by extracting words from input
-ac string alterx permutation config file (default '$HOME/.config/alterx/permutation_v0.0.1.yaml')
-limit int limit the number of results to return (default 0)
UPDATE:
-up, -update update alterx to latest version
-duc, -disable-update-check disable automatic alterx update check
alterx ??alterx 与其他子域排列工具(如 goaltdns)的不同之处在于它的 脚本化 功能。alterx 将模式作为输入,并基于该模式生成子域排列字典,类似于 nuclei 使用 fuzzing-templates 所做的工作。
主动子域枚举 之所以困难,在于找到一个实际存在的域名的概率。如果将发现可能子域的过程表示在一个刻度上,它应该看起来像这样
Using Wordlist < generate permutations with subdomains (goaltdns) < alterx
几乎所有流行的子域名排列工具都使用硬编码模式,当运行这类工具时,它们会生成包含数百万个子域名的字典,这降低了使用 dnsx 等工具对其进行暴力破解的可行性。子域名命名并没有实际的约定,通常取决于注册子域名的人。使用 alterx 可以基于 passive subdomain enumeration(被动子域名枚举)的结果创建模式,这提高了发现子域名的概率以及对其进行暴力破解的可行性。
alterx 使用类似于 nuclei-templates 的变量式语法。可以使用这些变量编写自己的模式。当域名作为输入传入时,alterx 会评估输入并从中提取变量。
{{sub}} : subdomain prefix or left most part of a subdomain
{{suffix}} : everything except {{sub}} in subdomain name is suffix
{{tld}} : top level domain name (ex com,uk,in etc)
{{etld}} : also know as public suffix (ex co.uk , gov.in etc)
| 变量 | api.scanme.sh | admin.dev.scanme.sh | cloud.scanme.co.uk |
|---|---|---|---|
{{sub}} | api | admin | cloud |
{{suffix}} | scanme.sh | dev.scanme.sh | scanme.co.uk |
{{tld}} | sh | sh | uk |
{{etld}} | - | - | co.uk |
{{sld}} : second-level domain (ex for api.scanme.sh => {{sld}} is scanme)
{{root}} : also known as eTLD+1 i.e only root domain (ex for api.scanme.sh => {{root}} is scanme.sh)
{{subN}} : here N is an integer (ex {{sub1}} , {{sub2}} etc) .
// {{subN}} is advanced variable which exists depending on input
// lets say there is a multi level domain cloud.nuclei.scanme.sh
// in this case {{sub}} = cloud and {{sub1}} = nuclei`
| 变量 | api.scanme.sh | admin.dev.scanme.sh | cloud.scanme.co.uk |
|---|---|---|---|
{{sld}} | scanme | scanme | scanme |
{{root}} | scanme.sh | scanme.sh | scanme.co.uk |
{{sub1}} | - | dev | - |
{{sub2}} | - | - | - |
简单来说,模式可以被视为 template(模板),它描述了 alterx 应该生成哪些类型的模式。
// Below are some of example patterns which can be used to generate permutations
// assuming api.scanme.sh was given as input and variable {{word}} was given as input with only one value prod
// alterx generates subdomains for below patterns
"{{sub}}-{{word}}.{{suffix}}" // ex: api-prod.scanme.sh
"{{word}}-{{sub}}.{{suffix}}" // ex: prod-api.scanme.sh
"{{word}}.{{sub}}.{{suffix}}" // ex: prod.api.scanme.sh
"{{sub}}.{{word}}.{{suffix}}" // ex: api.prod.scanme.sh
以下是一个示例模式配置文件 - https://github.com/projectdiscovery/alterx/blob/main/permutations.yaml,可根据需要轻松自定义。
该配置文件使用可自定义的模式和动态载荷,为安全评估或渗透测试生成子域排列。模式包括基于短横线的、基于点的以及其他类型。用户可以创建自定义载荷部分,例如单词、区域标识符或数字,以满足其特定需求。
例如,用户可以定义一个新的载荷部分 env,其值为 prod 和 dev,然后在诸如 {{env}}-{{word}}.{{suffix}} 的模式中使用它,以生成类似 prod-app.example.com 和 dev-api.example.com 的子域。这种灵活性允许为独特的测试场景和目标环境定制子域列表。
用于生成的默认模式配置文件存储在 $HOME/.config/alterx/ 目录中,也可以使用 -ac 选项使用自定义配置文件。
在 tesla.com 的现有被动子域列表上运行 alterx 的一个示例,为我们产生了使用 dnsx 解析的 10 个额外的新 且 有效的子域。
$ chaos -d tesla.com | alterx | dnsx
___ ____ _ __
/ _ | / / /____ ____| |/_/
/ __ |/ / __/ -_) __/> <
/_/ |_/_/\__/\__/_/ /_/|_|
projectdiscovery.io
[INF] Generated 8312 permutations in 0.0740s
auth-global-stage.tesla.com
auth-stage.tesla.com
digitalassets-stage.tesla.com
errlog-stage.tesla.com
kronos-dev.tesla.com
mfa-stage.tesla.com
paymentrecon-stage.tesla.com
sso-dev.tesla.com
shop-stage.tesla.com
www-uat-dev.tesla.com
类似地,-enrich 选项可用于将已知子域填充为 world 输入,以生成目标感知排列。
$ chaos -d tesla.com | alterx -enrich
___ ____ _ __
/ _ | / / /____ ____| |/_/
/ __ |/ / __/ -_) __/> <
/_/ |_/_/\__/\__/_/ /_/|_|
projectdiscovery.io
[INF] Generated 662010 permutations in 3.9989s
你可以在运行时使用 -pattern CLI 选项更改默认模式。
$ chaos -d tesla.com | alterx -enrich -p '{{word}}-{{suffix}}'
___ ____ _ __
/ _ | / / /____ ____| |/_/
/ __ |/ / __/ -_) __/> <
/_/ |_/_/\__/\__/_/ /_/|_|
projectdiscovery.io