├── .github
└── workflows
│ └── go.yml
├── .idea
├── .gitignore
├── AutoDomain.iml
├── modules.xml
└── vcs.xml
├── LICENSE
├── Makefile
├── README.md
├── cmd
├── all
│ └── all.go
├── daydaymap
│ └── daydaymap.go
├── fofa
│ └── fofa.go
├── hunter
│ └── hunter.go
├── netlas
│ └── netlas.go
├── pulsedive
│ └── pulsedive.go
├── quake
│ └── quake.go
├── root.go
├── virustotal
│ └── virustotal.go
└── zoomeye
│ └── zoomeye.go
├── config
└── config.go
├── define
└── var.go
├── go.mod
├── go.sum
├── main
└── main.go
├── pkg
├── client.go
├── data.go
├── daydaymap
│ ├── data.go
│ ├── output.go
│ └── req.go
├── fofa
│ ├── data.go
│ ├── output.go
│ └── req.go
├── hunter
│ ├── data.go
│ ├── output.go
│ └── req.go
├── netlas
│ ├── data.go
│ ├── output.go
│ └── req.go
├── output.go
├── pulsedive
│ ├── data.go
│ ├── output.go
│ └── req.go
├── quake
│ ├── data.go
│ ├── output.go
│ └── req.go
├── virustotal
│ ├── data.go
│ ├── output.go
│ └── req.go
└── zoomeye
│ ├── data.go
│ ├── output.go
│ └── req.go
└── utils
├── Compare
└── StringInStringArray.go
├── Error
└── errorHandle.go
├── File
└── exist.go
├── log
└── logger.go
└── response
└── responseHandle.go
/.github/workflows/go.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a golang project
2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3 |
4 | name: Go
5 |
6 | on:
7 | push:
8 | branches: [ "main" ]
9 | pull_request:
10 | branches: [ "main" ]
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-20.04
15 | steps:
16 | - uses: actions/checkout@v3
17 |
18 | - name: Set up Go
19 | uses: actions/setup-go@v4
20 | with:
21 | go-version: '1.20.1'
22 |
23 | - name: Install dependencies
24 | run: |
25 | go mod tidy
26 | - name: Get Set
27 | run: |
28 | go env -w GO111MODULE=on
29 | go env -w CGO_ENABLED=0
30 | - name: Checkout code
31 | uses: actions/checkout@v2
32 | with:
33 | fetch-depth: 0 # 拉取所有历史记录
34 |
35 | - name: Build LINUX
36 | run: |
37 | env GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o AutoDomain_linux_amd64 main/main.go
38 | env GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o AutoDomain_linux_arm64 main/main.go
39 | - name: Build WINDOWS
40 | run: |
41 | env GOOS=windows GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o AutoDomain_windows_amd64.exe main/main.go
42 | env GOOS=windows GOARCH=386 go build -trimpath -ldflags "-s -w" -o AutoDomain_windows_386.exe main/main.go
43 | - name: Create Zip Archive
44 | run: |
45 | zip -r Serverless_PortScan_linux_amd64.zip AutoDomain_linux_amd64
46 | zip -r Serverless_PortScan_linux_arm64.zip AutoDomain_linux_arm64
47 | zip -r Serverless_PortScan_windows_amd64.zip AutoDomain_windows_amd64.exe
48 | zip -r Serverless_PortScan_windows_386.zip AutoDomain_windows_386.exe
49 |
50 | - name: Fetch all tags
51 | run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
52 |
53 | - name: Get latest tag
54 | id: latest-tag
55 | run: |
56 | # 获取最新的 tag
57 | LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
58 | echo "Latest tag: $LATEST_TAG"
59 | echo ::set-output name=tag::${LATEST_TAG}
60 | - name: Increment tag
61 | id: increment-tag
62 | run: |
63 | # 解析 tag 并递增
64 | LATEST_TAG=${{ steps.latest-tag.outputs.tag }}
65 | BASE_TAG=$(echo "$LATEST_TAG" | sed 's/\(.*\)\.\([0-9]*\)$/\1/')
66 | VERSION=$(echo "$LATEST_TAG" | sed 's/.*\.\([0-9]*\)$/\1/')
67 | NEW_VERSION=$((VERSION + 1))
68 | NEW_TAG="$BASE_TAG.$NEW_VERSION"
69 | echo ::set-output name=new-tag::${NEW_TAG}
70 | echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
71 | - name: Create and Upload Release
72 | env:
73 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74 | run: |
75 | # 创建 Release
76 | gh release create $NEW_TAG --title "Release $NEW_TAG" --notes "github action自动构建"
77 |
78 | # 上传当前目录下所有 zip 文件为 Release 附件
79 | for zip_file in *.zip; do
80 | gh release upload $NEW_TAG "$zip_file" --clobber
81 | done
82 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # 默认忽略的文件
2 | /shelf/
3 | /workspace.xml
4 | # 基于编辑器的 HTTP 客户端请求
5 | /httpRequests/
6 | # Datasource local storage ignored files
7 | /dataSources/
8 | /dataSources.local.xml
9 |
--------------------------------------------------------------------------------
/.idea/AutoDomain.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | BUILD_FLAG = -trimpath -ldflags "-s -w"
2 | BUILD_DIR = bin
3 |
4 | default: build
5 |
6 | tidy:
7 | go mod tidy
8 |
9 | build linux: tidy
10 | env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(BUILD_FLAG) -o $(BUILD_DIR)/AutoDomain main/main.go
11 |
12 | build windows: tidy
13 | env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(BUILD_FLAG) -o $(BUILD_DIR)/AutoDomain.exe main/main.go
14 |
15 | clean:
16 | rm -rf ./$(BUILD_DIR)
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AutoDomain
2 | 自动提取域名/IP,并调用 fofa、quake、hunter 等测绘工具搜集子域名,可配合指纹扫描工具达到快速资产整理
3 |
4 | 本项目所使用的 fofa、quake API 参考自https://github.com/EASY233/Finger
5 | hunter API 参考自https://github.com/W01fh4cker/hunter-to-excel/
6 |
7 |
8 | ## 安装
9 |
10 | 下载 release 中的二进制文件使用
11 |
12 | 或使用 Makefile 进行编译二进制文件后使用
13 |
14 |
15 | ## 配置
16 |
17 | 当首次运行 AutoDomain 时,会检测 config.yaml 文件是否存在,不存在则会自动创建
18 |
19 | 填入的对应内容可使用对应的指定模块
20 |
21 | ## 用法
22 |
23 | ```
24 | Usage:
25 |
26 | AutoDomain [flags]
27 | AutoDomain [command]
28 |
29 |
30 | Available Commands:
31 |
32 | all search domain from all engine
33 | daydaymap search domain from daydaymap
34 | fofa search domain from fofa
35 | help Help about any command
36 | hunter search domain from hunter
37 | netlas search domain from netlas
38 | pulsedive search domain from pulsedive
39 | quake search domain from quake
40 | virustotal search domain from virustotal
41 | zoomeye search domain from zoomeye
42 |
43 |
44 | Flags:
45 |
46 | -f, --file string 从文件中读取目标地址 (Input FILENAME)
47 | -h, --help help for AutoDomain
48 | --logLevel string 设置日志等级 (Set log level) [trace|debug|info|warn|error|fatal|panic] (default "info")
49 | -o, --output string 指定输出位置和格式 [result.txt|result.json] (Specify output location and format [result.txt|result.json]) (default "result.txt")
50 | -t, --timeout int 输入每个 http 请求的超时时间 (Enter the timeout period for every http request) (default 15)
51 | -u, --url string 输入目标地址 (Input [ip|domain|url])
52 |
53 |
54 | Use "AutoDomain [command] --help" for more information about a command.
55 | ```
56 |
57 |
58 | ## 功能列表
59 |
60 | 1. 多种网络资产测绘,自动识别 ip 和域名,分别采用对应语法
61 | 2. 文件输出时为:http(s):// + ip(域名)+端口号格式,方便指纹识别
62 | 3. 可识别 URL,自动提取域名、ip
63 | 4. 自动去重(http 与 https 不去重)
64 | 5. 阶段性保存,当使用 all 模块时,每完成一个模块均会自动写入到文件,防止结果丢失
65 | 6. 自动识别输出格式,支持 txt 和 json 格式
66 |
67 | ## 旧版本
68 |
69 | python 版本在 old 分支
70 |
71 | 旧的 go 版本在 go-old 分支
72 |
--------------------------------------------------------------------------------
/cmd/all/all.go:
--------------------------------------------------------------------------------
1 | package all
2 |
3 | import (
4 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
5 | "github.com/shadowabi/AutoDomain_rebuild/cmd/daydaymap"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd/fofa"
7 | "github.com/shadowabi/AutoDomain_rebuild/cmd/hunter"
8 | "github.com/shadowabi/AutoDomain_rebuild/cmd/netlas"
9 | "github.com/shadowabi/AutoDomain_rebuild/cmd/pulsedive"
10 | "github.com/shadowabi/AutoDomain_rebuild/cmd/quake"
11 | "github.com/shadowabi/AutoDomain_rebuild/cmd/virustotal"
12 | "github.com/shadowabi/AutoDomain_rebuild/cmd/zoomeye"
13 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
14 | "github.com/spf13/cobra"
15 | "sync"
16 | )
17 |
18 | func init() {
19 | cmd.RootCmd.AddCommand(AllCmd)
20 | AllCmd.AddCommand(fofa.FofaCmd)
21 | AllCmd.AddCommand(hunter.HunterCmd)
22 | AllCmd.AddCommand(netlas.NetlasCmd)
23 | AllCmd.AddCommand(pulsedive.PulsediveCmd)
24 | AllCmd.AddCommand(quake.QuakeCmd)
25 | AllCmd.AddCommand(virustotal.VirusTotalCmd)
26 | AllCmd.AddCommand(zoomeye.ZoomeyeCmd)
27 | AllCmd.AddCommand(daydaymap.DaydayMapCmd)
28 | }
29 |
30 | var AllCmd = &cobra.Command{
31 | Use: "all",
32 | Short: "search domain from all engine",
33 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
34 | return nil
35 | },
36 | Run: func(cmd *cobra.Command, args []string) {
37 | var wg sync.WaitGroup
38 | pkg.GlobalRun()
39 | wg.Add(len(cmd.Commands()))
40 | for _, child := range cmd.Commands() {
41 | if child.Use != "" {
42 | err := child.PersistentPreRunE(cmd, args)
43 | if err != nil {
44 | wg.Done()
45 | continue
46 | }
47 |
48 | go func(child *cobra.Command) {
49 | child.Run(cmd, args)
50 |
51 | wg.Done()
52 | }(child)
53 | }
54 | }
55 | wg.Wait()
56 | },
57 | }
58 |
--------------------------------------------------------------------------------
/cmd/daydaymap/daydaymap.go:
--------------------------------------------------------------------------------
1 | package daydaymap
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
10 | "github.com/shadowabi/AutoDomain_rebuild/pkg/daydaymap"
11 | "github.com/spf13/cobra"
12 | )
13 |
14 | func init() {
15 | cmd.RootCmd.AddCommand(DaydayMapCmd)
16 | }
17 |
18 | var DaydayMapCmd = &cobra.Command{
19 | Use: "daydaymap",
20 | Short: "search domain from daydaymap",
21 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
22 | if config.C.DaydaymapKey == "" {
23 | return errors.New("未配置 daydaymap 相关的凭证")
24 | }
25 | return nil
26 | },
27 | Run: func(cmd *cobra.Command, args []string) {
28 | define.Once.Do(pkg.GlobalRun)
29 | fmt.Printf("[+] daydaymap is working...\n")
30 |
31 | client := pkg.GenerateHTTPClient(define.TimeOut)
32 | reqStringList := pkg.MergeReqListToReqStringList("daydaymap", define.ReqIpList, define.ReqDomainList)
33 | reqBody := daydaymap.DayDayMapRequest(client, 1, 1, reqStringList...)
34 | reqResult := daydaymap.ParseDaydaymapResult(reqBody...)
35 |
36 | for i, _ := range reqResult {
37 | if int(reqResult[i].Data.Total) == 0 {
38 | continue
39 | }
40 | if int(reqResult[i].Data.Total) > 10000 {
41 | for j := 1; i <= reqResult[i].Data.Total/10000; j++ {
42 | reqBody = daydaymap.DayDayMapRequest(client, j, 10000, reqStringList[i])
43 | reqResult = append(reqResult, daydaymap.ParseDaydaymapResult(reqBody...)...)
44 | }
45 | } else {
46 | reqBody = daydaymap.DayDayMapRequest(client, 1, reqResult[i].Data.Total, reqStringList[i])
47 | reqResult = append(reqResult, daydaymap.ParseDaydaymapResult(reqBody...)...)
48 | }
49 | }
50 |
51 | chanNum := cap(reqResult)
52 | if chanNum != 0 {
53 | resultChannel := make(chan []string, chanNum)
54 | resultChannel <- daydaymap.PurgeDomainResult(reqResult...)
55 | close(resultChannel)
56 |
57 | pkg.FetchResultFromChanel(resultChannel)
58 | }
59 | fmt.Printf("[+] daydaymap search complete\n")
60 | },
61 | }
62 |
--------------------------------------------------------------------------------
/cmd/fofa/fofa.go:
--------------------------------------------------------------------------------
1 | package fofa
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
10 | "github.com/shadowabi/AutoDomain_rebuild/pkg/fofa"
11 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
12 | "github.com/spf13/cobra"
13 | )
14 |
15 | func init() {
16 | cmd.RootCmd.AddCommand(FofaCmd)
17 | }
18 |
19 | var FofaCmd = &cobra.Command{
20 | Use: "fofa",
21 | Short: "search domain from fofa",
22 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
23 | if config.C.FofaKey == "" {
24 | return errors.New("未配置 fofa 相关的凭证")
25 | }
26 | return nil
27 | },
28 | Run: func(cmd *cobra.Command, args []string) {
29 | define.Once.Do(pkg.GlobalRun)
30 | fmt.Printf("[+] fofa is working...\n")
31 |
32 | client := pkg.GenerateHTTPClient(define.TimeOut)
33 | reqStringList := pkg.MergeReqListToReqStringList("fofa", define.ReqIpList, define.ReqDomainList)
34 | reqBody := fofa.FofaRequest(client, 1, reqStringList...)
35 | reqResult := fofa.ParseFofaResult(reqBody...)
36 |
37 | for i, _ := range reqResult {
38 | if int(reqResult[i].Size) > 1000 {
39 | pageList := net2.GeneratePageList(reqResult[i].Size)
40 | for _, v := range pageList {
41 | reqBody2 := fofa.FofaRequest(client, v, reqStringList[i])
42 | reqResult2 := fofa.ParseFofaResult(reqBody2...)
43 | reqResult = append(reqResult, reqResult2...)
44 | }
45 | }
46 | }
47 |
48 | chanNum := cap(reqResult)
49 | if chanNum != 0 {
50 | resultChannel := make(chan []string, chanNum)
51 | resultChannel <- fofa.PurgeDomainResult(reqResult...)
52 | close(resultChannel)
53 |
54 | pkg.FetchResultFromChanel(resultChannel)
55 | }
56 |
57 | fmt.Printf("[+] fofa search complete\n")
58 | },
59 | }
60 |
--------------------------------------------------------------------------------
/cmd/hunter/hunter.go:
--------------------------------------------------------------------------------
1 | package hunter
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
10 | "github.com/shadowabi/AutoDomain_rebuild/pkg/hunter"
11 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
12 | "github.com/spf13/cobra"
13 | )
14 |
15 | func init() {
16 | cmd.RootCmd.AddCommand(HunterCmd)
17 | }
18 |
19 | var HunterCmd = &cobra.Command{
20 | Use: "hunter",
21 | Short: "search domain from hunter",
22 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
23 | if config.C.HunterKey == "" {
24 | return errors.New("未配置 hunter 相关的凭证")
25 | }
26 | return nil
27 | },
28 | Run: func(cmd *cobra.Command, args []string) {
29 | define.Once.Do(pkg.GlobalRun)
30 | fmt.Printf("[+] hunter is working...\n")
31 |
32 | client := pkg.GenerateHTTPClient(define.TimeOut)
33 |
34 | reqStringList := pkg.MergeReqListToReqStringList("hunter", define.ReqIpList, define.ReqDomainList)
35 | reqBody := hunter.HunterRequest(client, 1, reqStringList...)
36 | reqResult := hunter.ParseHunterResult(reqBody...)
37 |
38 | for i, _ := range reqResult {
39 | if int(reqResult[i].Data.Total) > 1000 {
40 | pageList := net2.GeneratePageList(reqResult[i].Data.Total)
41 | for _, v := range pageList {
42 | reqBody2 := hunter.HunterRequest(client, v, reqStringList[i])
43 | reqResult2 := hunter.ParseHunterResult(reqBody2...)
44 | reqResult = append(reqResult, reqResult2...)
45 | }
46 | }
47 | }
48 |
49 | chanNum := cap(reqResult)
50 | if chanNum != 0 {
51 | resultChannel := make(chan []string, chanNum)
52 | resultChannel <- hunter.PurgeDomainResult(reqResult...)
53 | close(resultChannel)
54 |
55 | pkg.FetchResultFromChanel(resultChannel)
56 | }
57 |
58 | fmt.Printf("[+] hunter search complete\n")
59 | },
60 | }
61 |
--------------------------------------------------------------------------------
/cmd/netlas/netlas.go:
--------------------------------------------------------------------------------
1 | package netlas
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
8 | "github.com/shadowabi/AutoDomain_rebuild/pkg/netlas"
9 | "github.com/spf13/cobra"
10 | )
11 |
12 | func init() {
13 | cmd.RootCmd.AddCommand(NetlasCmd)
14 | }
15 |
16 | var NetlasCmd = &cobra.Command{
17 | Use: "netlas",
18 | Short: "search domain from netlas",
19 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
20 | return nil
21 | },
22 | Run: func(cmd *cobra.Command, args []string) {
23 | define.Once.Do(pkg.GlobalRun)
24 | fmt.Printf("[+] netlas is working...\n")
25 |
26 | client := pkg.GenerateHTTPClient(define.TimeOut)
27 |
28 | reqDomainBody := netlas.NetlasDomainRequest(client, define.ReqDomainList...)
29 | reqDomainResultList := netlas.ParseNetlasDomainResult(reqDomainBody...)
30 |
31 | reqIpBody := netlas.NetlasIpRequest(client, define.ReqIpList...)
32 | reqIpResultList := netlas.ParseNetlasIpResult(reqIpBody...)
33 |
34 | chanNum := cap(reqDomainResultList) + cap(reqIpResultList)
35 | if chanNum != 0 {
36 | resultChannel := make(chan []string, chanNum)
37 | if len(reqDomainResultList) != 0 {
38 | resultChannel <- netlas.PurgeDomainResult(reqDomainResultList...)
39 | }
40 |
41 | if len(reqIpResultList) != 0 {
42 | resultChannel <- netlas.PurgeIpResult(reqIpResultList...)
43 | }
44 |
45 | close(resultChannel)
46 |
47 | pkg.FetchResultFromChanel(resultChannel)
48 | }
49 |
50 | fmt.Printf("[+] netlas search complete\n")
51 | },
52 | }
53 |
--------------------------------------------------------------------------------
/cmd/pulsedive/pulsedive.go:
--------------------------------------------------------------------------------
1 | package pulsedive
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
10 | "github.com/shadowabi/AutoDomain_rebuild/pkg/pulsedive"
11 | "github.com/spf13/cobra"
12 | )
13 |
14 | func init() {
15 | cmd.RootCmd.AddCommand(PulsediveCmd)
16 | }
17 |
18 | var PulsediveCmd = &cobra.Command{
19 | Use: "pulsedive",
20 | Short: "search domain from pulsedive",
21 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
22 | if config.C.PulsediveKey == "" {
23 | return errors.New("未配置 pulsedive 相关的凭证")
24 | }
25 | return nil
26 | },
27 | Run: func(cmd *cobra.Command, args []string) {
28 | pkg.GlobalRun()
29 | fmt.Printf("[+] pulsedive is working...\n")
30 |
31 | client := pkg.GenerateHTTPClient(define.TimeOut)
32 |
33 | reqDomainBody := pulsedive.PulsediveDomainRequest(client, define.ReqDomainList...)
34 | reqDomainResultList := pulsedive.ParsePulsediveDomainResult(reqDomainBody...)
35 |
36 | chanNum := cap(reqDomainResultList)
37 | if chanNum != 0 {
38 | resultChannel := make(chan []string, chanNum)
39 | resultChannel <- pulsedive.PurgeDomainResult(reqDomainResultList...)
40 | close(resultChannel)
41 |
42 | pkg.FetchResultFromChanel(resultChannel)
43 | }
44 |
45 | fmt.Printf("[+] pulsedive search complete\n")
46 | },
47 | }
48 |
--------------------------------------------------------------------------------
/cmd/quake/quake.go:
--------------------------------------------------------------------------------
1 | package quake
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
10 | "github.com/shadowabi/AutoDomain_rebuild/pkg/quake"
11 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
12 | "github.com/spf13/cobra"
13 | )
14 |
15 | func init() {
16 | cmd.RootCmd.AddCommand(QuakeCmd)
17 | }
18 |
19 | var QuakeCmd = &cobra.Command{
20 | Use: "quake",
21 | Short: "search domain from quake",
22 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
23 | if config.C.QuakeKey == "" {
24 | return errors.New("未配置 quake 相关的凭证")
25 | }
26 | return nil
27 | },
28 | Run: func(cmd *cobra.Command, args []string) {
29 | define.Once.Do(pkg.GlobalRun)
30 | fmt.Printf("[+] quake is working...\n")
31 |
32 | client := pkg.GenerateHTTPClient(define.TimeOut)
33 |
34 | reqStringList := pkg.MergeReqListToReqStringList("quake", define.ReqIpList, define.ReqDomainList)
35 | reqBody := quake.QuakeRequest(client, 1, reqStringList...)
36 | reqResult := quake.ParseQuakeResult(reqBody...)
37 |
38 | for i, _ := range reqResult {
39 | if int(reqResult[i].Meta.Pagination.Total) > 100 {
40 | pageList := net2.GeneratePageList(reqResult[i].Meta.Pagination.Total)
41 | for _, v := range pageList {
42 | reqBody2 := quake.QuakeRequest(client, v, reqStringList[i])
43 | reqResult2 := quake.ParseQuakeResult(reqBody2...)
44 | reqResult = append(reqResult, reqResult2...)
45 | }
46 | }
47 | }
48 |
49 | chanNum := cap(reqResult)
50 | if chanNum != 0 {
51 | resultChannel := make(chan []string, chanNum)
52 | resultChannel <- quake.PurgeDomainResult(reqResult...)
53 | close(resultChannel)
54 |
55 | pkg.FetchResultFromChanel(resultChannel)
56 | }
57 |
58 | fmt.Printf("[+] quake search complete\n")
59 | },
60 | }
61 |
--------------------------------------------------------------------------------
/cmd/root.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "errors"
5 | cc "github.com/ivanpirog/coloredcobra"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
8 | "github.com/spf13/cobra"
9 | "os"
10 | "runtime"
11 | )
12 |
13 | var RootCmd = &cobra.Command{
14 | Use: "AutoDomain",
15 | Short: "AutoDomain is a web mapping domain name tool",
16 | Long: " _ _ ____ _ \n" +
17 | " / \\ _ _| |_ ___ | _ \\ ___ _ __ ___ __ _(_)_ __ \n" +
18 | " / _ \\| | | | __/ _ \\| | | |/ _ \\| '_ ` _ \\ / _` | | '_ \\ \n" +
19 | " / ___ \\ |_| | || (_) | |_| | (_) | | | | | | (_| | | | | | \n" +
20 | " /_/ \\_\\__,_|\\__\\___/|____/ \\___/|_| |_| |_|\\__,_|_|_| |_| \n" +
21 | `
22 | github.com/shadowabi/AutoDomain
23 |
24 | AutoDomain是一个集成网络空间测绘系统的工具。
25 | AutoDomain is a tool for integrating cyberspace mapping systems.
26 | `,
27 | PersistentPostRun: func(cmd *cobra.Command, args []string) {
28 | if define.Url != "" && define.File != "" {
29 | Error.HandleFatal(errors.New("参数不可以同时存在"))
30 | return
31 | }
32 | if define.Url == "" && define.File == "" {
33 | Error.HandleFatal(errors.New("必选参数为空,请输入 -u 参数或 -f 参数"))
34 | return
35 | }
36 | },
37 | Run: func(cmd *cobra.Command, args []string) {
38 | },
39 | }
40 |
41 | var logLevel string
42 |
43 | func init() {
44 | RootCmd.PersistentFlags().StringVar(&logLevel, "logLevel", "info", "设置日志等级 (Set log level) [trace|debug|info|warn|error|fatal|panic]")
45 | RootCmd.CompletionOptions.DisableDefaultCmd = true
46 | RootCmd.SetHelpFunc(customHelpFunc)
47 | RootCmd.PersistentFlags().StringVarP(&define.File, "file", "f", "", "从文件中读取目标地址 (Input FILENAME)")
48 | RootCmd.PersistentFlags().StringVarP(&define.Url, "url", "u", "", "输入目标地址 (Input [ip|domain|url])")
49 | RootCmd.PersistentFlags().IntVarP(&define.TimeOut, "timeout", "t", 15, "输入每个 http 请求的超时时间 (Enter the timeout period for every http request)")
50 | RootCmd.PersistentFlags().StringVarP(&define.OutPut, "output", "o", "result.txt", "指定输出位置和格式 [result.txt|result.json] (Specify output location and format [result.txt|result.json])")
51 | }
52 |
53 | func Execute() {
54 | if runtime.GOOS != "windows" {
55 | cc.Init(&cc.Config{
56 | RootCmd: RootCmd,
57 | Headings: cc.HiGreen + cc.Underline,
58 | Commands: cc.Cyan + cc.Bold,
59 | Example: cc.Italic,
60 | ExecName: cc.Bold,
61 | Flags: cc.Cyan + cc.Bold,
62 | })
63 | }
64 | err := RootCmd.Execute()
65 | if err != nil {
66 | os.Exit(1)
67 | }
68 | }
69 |
70 | func customHelpFunc(cmd *cobra.Command, args []string) {
71 | cmd.Usage()
72 | }
73 |
--------------------------------------------------------------------------------
/cmd/virustotal/virustotal.go:
--------------------------------------------------------------------------------
1 | package virustotal
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
8 | "github.com/shadowabi/AutoDomain_rebuild/pkg/virustotal"
9 | "github.com/spf13/cobra"
10 | )
11 |
12 | func init() {
13 | cmd.RootCmd.AddCommand(VirusTotalCmd)
14 | }
15 |
16 | var VirusTotalCmd = &cobra.Command{
17 | Use: "virustotal",
18 | Short: "search domain from virustotal",
19 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
20 | return nil
21 | },
22 | Run: func(cmd *cobra.Command, args []string) {
23 | define.Once.Do(pkg.GlobalRun)
24 | fmt.Printf("[+] virustotal is working...\n")
25 |
26 | client := pkg.GenerateHTTPClient(define.TimeOut)
27 |
28 | reqDomainBody := virustotal.VirusTotalDomainRequest(client, define.ReqDomainList...)
29 | reqDomainResultList := virustotal.ParseVirusTotalDomainResult(reqDomainBody...)
30 |
31 | chanNum := cap(reqDomainResultList)
32 | if chanNum != 0 {
33 | resultChannel := make(chan []string, chanNum)
34 | resultChannel <- virustotal.PurgeDomainResult(reqDomainResultList...)
35 | close(resultChannel)
36 |
37 | pkg.FetchResultFromChanel(resultChannel)
38 | }
39 |
40 | fmt.Printf("[+] virustotal search complete\n")
41 | },
42 | }
43 |
--------------------------------------------------------------------------------
/cmd/zoomeye/zoomeye.go:
--------------------------------------------------------------------------------
1 | package zoomeye
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
10 | "github.com/shadowabi/AutoDomain_rebuild/pkg/zoomeye"
11 | "github.com/spf13/cobra"
12 | )
13 |
14 | func init() {
15 | cmd.RootCmd.AddCommand(ZoomeyeCmd)
16 | }
17 |
18 | var ZoomeyeCmd = &cobra.Command{
19 | Use: "zoomeye",
20 | Short: "search domain from zoomeye",
21 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
22 | if config.C.ZoomeyeKey == "" {
23 | return errors.New("未配置 zoomeye 相关的凭证")
24 | }
25 | return nil
26 | },
27 | Run: func(cmd *cobra.Command, args []string) {
28 | define.Once.Do(pkg.GlobalRun)
29 | fmt.Printf("[+] zoomeye is working...\n")
30 |
31 | client := pkg.GenerateHTTPClient(define.TimeOut)
32 |
33 | reqIpBody := zoomeye.ZoomeyeIpRequest(client, define.ReqIpList...)
34 | reqIpResultList := zoomeye.ParseZoomeyeIpResult(reqIpBody...)
35 |
36 | reqDomainBody := zoomeye.ZoomeyeDomainRequest(client, define.ReqDomainList...)
37 | reqDomainResultList := zoomeye.ParseZoomeyeDomainResult(reqDomainBody...)
38 |
39 | chanNum := cap(reqDomainResultList) + cap(reqIpResultList)
40 | if chanNum != 0 {
41 | resultChannel := make(chan []string, chanNum)
42 | if len(reqDomainResultList) != 0 {
43 | resultChannel <- zoomeye.PurgeDomainResult(reqDomainResultList...)
44 | }
45 |
46 | if len(reqIpResultList) != 0 {
47 | resultChannel <- zoomeye.PurgeIpResult(reqIpResultList...)
48 | }
49 |
50 | close(resultChannel)
51 |
52 | pkg.FetchResultFromChanel(resultChannel)
53 | }
54 |
55 | fmt.Printf("[+] zoomeye search complete\n")
56 | },
57 | }
58 |
--------------------------------------------------------------------------------
/config/config.go:
--------------------------------------------------------------------------------
1 | package config
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/define"
6 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
7 | "github.com/spf13/viper"
8 | )
9 |
10 | // Config struct is a wrapper of viper
11 | type Config struct {
12 | *viper.Viper
13 | }
14 |
15 | var GlobalConfig *viper.Viper
16 |
17 | var C define.Configure
18 |
19 | //// DefaultInit func is default Init Config file without config file information
20 | //func DefaultInit() {
21 | // GlobalConfig = &Config{
22 | // viper.New(),
23 | // }
24 | //
25 | // // Config filename (no suffix)
26 | // GlobalConfig.SetConfigName("config")
27 | //
28 | // // Config Type
29 | // GlobalConfig.SetConfigType("yaml")
30 | //
31 | // // Searching Path
32 | // GlobalConfig.AddConfigPath(".")
33 | // GlobalConfig.AddConfigPath("../") // For Debug
34 | // GlobalConfig.AddConfigPath("./config")
35 | //
36 | // // Reading Config
37 | // err := GlobalConfig.ReadInConfig()
38 | // Error.HandleFatal(err)
39 | //}
40 |
41 | func InitConfigure(file string) {
42 | GlobalConfig = viper.New()
43 | GlobalConfig.SetConfigFile(file)
44 | GlobalConfig.SetConfigType("yaml")
45 | err := GlobalConfig.ReadInConfig()
46 | if err != nil {
47 | SaveConfig(file)
48 | Error.HandleFatal(fmt.Errorf("不存在 config.yaml,已生成"))
49 | }
50 | Error.HandleError(GlobalConfig.Unmarshal(&C))
51 | }
52 |
53 | func SaveConfig(file string) {
54 | GlobalConfig.Set("FofaKey", "")
55 | GlobalConfig.Set("QuakeKey", "")
56 | GlobalConfig.Set("HunterKey", "")
57 | GlobalConfig.Set("ZoomeyeKey", "")
58 | GlobalConfig.Set("PulsediveKey", "")
59 | GlobalConfig.Set("DaydaymapKey", "")
60 | GlobalConfig.SetConfigFile(file)
61 | err := GlobalConfig.WriteConfig()
62 | Error.HandleFatal(err)
63 | }
64 |
--------------------------------------------------------------------------------
/define/var.go:
--------------------------------------------------------------------------------
1 | package define
2 |
3 | import "sync"
4 |
5 | var (
6 | File string
7 | Url string
8 | TimeOut int
9 | OutPut string
10 | )
11 |
12 | var (
13 | HostList []string
14 | ReqIpList []string
15 | ReqDomainList []string
16 | ResultList []string
17 | )
18 |
19 | var (
20 | UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4621.0 Safari/537.36"
21 | )
22 |
23 | type Configure struct {
24 | FofaKey string `mapstructure:"FofaKey" json:"FofaKey" yaml:"FofaKey"`
25 | QuakeKey string `mapstructure:"QuakeKey" json:"QuakeKey" yaml:"QuakeKey"`
26 | HunterKey string `mapstructure:"HunterKey" json:"HunterKey" yaml:"HunterKey"`
27 | ZoomeyeKey string `mapstructure:"ZoomeyeKey" json:"ZoomeyeKey" yaml:"ZoomeyeKey"`
28 | PulsediveKey string `mapstructure:"PulsediveKey" json:"PulsediveKey" yaml:"PulsediveKey"`
29 | DaydaymapKey string `mapstructure:"DaydaymapKey" json:"DaydaymapKey" yaml:"DaydaymapKey"`
30 | }
31 |
32 | var ModeToGrammar = map[string]string{
33 | "fofa": "=",
34 | "hunter": "=",
35 | "quake": ":",
36 | "daydaymap": ":",
37 | }
38 |
39 | var Once sync.Once
40 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/shadowabi/AutoDomain_rebuild
2 |
3 | go 1.20
4 |
5 | require (
6 | github.com/ivanpirog/coloredcobra v1.0.1
7 | github.com/shadowabi/AutoDomain v0.0.0-20231222090410-e76571bd34c4
8 | github.com/sirupsen/logrus v1.9.3
9 | github.com/spf13/cobra v1.8.0
10 | github.com/spf13/viper v1.18.2
11 | github.com/x-cray/logrus-prefixed-formatter v0.5.2
12 | )
13 |
14 | require (
15 | github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
16 | github.com/fatih/color v1.14.1 // indirect
17 | github.com/fsnotify/fsnotify v1.7.0 // indirect
18 | github.com/hashicorp/hcl v1.0.0 // indirect
19 | github.com/inconshreveable/mousetrap v1.1.0 // indirect
20 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
21 | github.com/magiconair/properties v1.8.7 // indirect
22 | github.com/mattn/go-colorable v0.1.13 // indirect
23 | github.com/mattn/go-isatty v0.0.17 // indirect
24 | github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
25 | github.com/mitchellh/mapstructure v1.5.0 // indirect
26 | github.com/onsi/ginkgo v1.16.5 // indirect
27 | github.com/onsi/gomega v1.32.0 // indirect
28 | github.com/pelletier/go-toml/v2 v2.1.0 // indirect
29 | github.com/sagikazarmark/locafero v0.4.0 // indirect
30 | github.com/sagikazarmark/slog-shim v0.1.0 // indirect
31 | github.com/sourcegraph/conc v0.3.0 // indirect
32 | github.com/spf13/afero v1.11.0 // indirect
33 | github.com/spf13/cast v1.6.0 // indirect
34 | github.com/spf13/pflag v1.0.5 // indirect
35 | github.com/subosito/gotenv v1.6.0 // indirect
36 | go.uber.org/atomic v1.9.0 // indirect
37 | go.uber.org/multierr v1.9.0 // indirect
38 | golang.org/x/crypto v0.16.0 // indirect
39 | golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
40 | golang.org/x/sys v0.16.0 // indirect
41 | golang.org/x/term v0.15.0 // indirect
42 | golang.org/x/text v0.14.0 // indirect
43 | gopkg.in/ini.v1 v1.67.0 // indirect
44 | gopkg.in/yaml.v3 v3.0.1 // indirect
45 | )
46 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
2 | github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
3 | github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
4 | github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
5 | github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
6 | github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
7 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
10 | github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
11 | github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
12 | github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
13 | github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
14 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
15 | github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
16 | github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
17 | github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
18 | github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
19 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
20 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
21 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
22 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
23 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
24 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
25 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
26 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
27 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
28 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
29 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
30 | github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
31 | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
32 | github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
33 | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
34 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
35 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
36 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
37 | github.com/ivanpirog/coloredcobra v1.0.1 h1:aURSdEmlR90/tSiWS0dMjdwOvCVUeYLfltLfbgNxrN4=
38 | github.com/ivanpirog/coloredcobra v1.0.1/go.mod h1:iho4nEKcnwZFiniGSdcgdvRgZNjxm+h20acv8vqmN6Q=
39 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
40 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
41 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
42 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
43 | github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
44 | github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
45 | github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
46 | github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
47 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
48 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
49 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
50 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
51 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
52 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
53 | github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
54 | github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
55 | github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
56 | github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
57 | github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
58 | github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
59 | github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
60 | github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
61 | github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
62 | github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
63 | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
64 | github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
65 | github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
66 | github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
67 | github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
68 | github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
69 | github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk=
70 | github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg=
71 | github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
72 | github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
73 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
74 | github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
75 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
76 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
77 | github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
78 | github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
79 | github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
80 | github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
81 | github.com/shadowabi/AutoDomain v0.0.0-20231222090410-e76571bd34c4 h1:FMbSaw1B8BqDHW73ODxqLXOahWpwDoJzc64x9LQFJY8=
82 | github.com/shadowabi/AutoDomain v0.0.0-20231222090410-e76571bd34c4/go.mod h1:52JuL8MRU6nMlVZNwsT9YVzi21qxhtmx6x3toy8gp84=
83 | github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
84 | github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
85 | github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
86 | github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
87 | github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
88 | github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
89 | github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
90 | github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
91 | github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
92 | github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
93 | github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
94 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
95 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
96 | github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
97 | github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
98 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
99 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
100 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
101 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
102 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
103 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
104 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
105 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
106 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
107 | github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
108 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
109 | github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
110 | github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
111 | github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=
112 | github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
113 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
114 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
115 | go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
116 | go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
117 | go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
118 | go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
119 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
120 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
121 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
122 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
123 | golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
124 | golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
125 | golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
126 | golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
127 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
128 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
129 | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
130 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
131 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
132 | golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
133 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
134 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
135 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
136 | golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
137 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
138 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
139 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
140 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
141 | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
142 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
143 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
144 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
145 | golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
146 | golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
147 | golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
148 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
149 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
150 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
151 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
152 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
153 | golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
154 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
155 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
156 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
157 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
158 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
159 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
160 | golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
161 | golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
162 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
163 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
164 | golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
165 | golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
166 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
167 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
168 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
169 | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
170 | golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
171 | golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
172 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
173 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
174 | golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
175 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
176 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
177 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
178 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
179 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
180 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
181 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
182 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
183 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
184 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
185 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
186 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
187 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
188 | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
189 | gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
190 | gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
191 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
192 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
193 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
194 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
195 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
196 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
197 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
198 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
199 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
200 |
--------------------------------------------------------------------------------
/main/main.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright © 2023 NAME HERE
3 | */
4 | package main
5 |
6 | import (
7 | "fmt"
8 | "github.com/shadowabi/AutoDomain_rebuild/cmd"
9 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/all"
10 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/daydaymap"
11 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/fofa"
12 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/hunter"
13 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/netlas"
14 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/pulsedive"
15 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/quake"
16 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/virustotal"
17 | _ "github.com/shadowabi/AutoDomain_rebuild/cmd/zoomeye"
18 | "github.com/shadowabi/AutoDomain_rebuild/config"
19 | "github.com/shadowabi/AutoDomain_rebuild/define"
20 | "github.com/shadowabi/AutoDomain_rebuild/pkg"
21 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
22 | )
23 |
24 | func init() {
25 | config.InitConfigure("config.yaml")
26 | }
27 |
28 | func main() {
29 | if pkg.IsEmptyConfig(config.C) {
30 | Error.HandleFatal(fmt.Errorf("请配置 config.yaml"))
31 | return
32 | }
33 |
34 | fmt.Println(cmd.RootCmd.Long)
35 | cmd.Execute()
36 |
37 | fmt.Printf("[+] The output is in %s\n", define.OutPut)
38 | }
39 |
--------------------------------------------------------------------------------
/pkg/client.go:
--------------------------------------------------------------------------------
1 | package pkg
2 |
3 | import (
4 | "crypto/tls"
5 | "github.com/shadowabi/AutoDomain_rebuild/define"
6 | "net/http"
7 | "time"
8 | )
9 |
10 | func GenerateHTTPClient(timeOut int) *http.Client {
11 | client := &http.Client{
12 | Timeout: time.Duration(timeOut) * time.Second,
13 | Transport: &http.Transport{
14 | TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
15 | },
16 | }
17 | return client
18 | }
19 |
20 | func IsEmptyConfig(c define.Configure) bool {
21 | return c.FofaKey == "" &&
22 | c.QuakeKey == "" &&
23 | c.HunterKey == "" &&
24 | c.ZoomeyeKey == "" &&
25 | c.PulsediveKey == ""
26 | }
27 |
28 | func GlobalRun() {
29 | if define.File != "" {
30 | define.HostList = ParseFileParameter(define.File)
31 | } else {
32 | define.HostList = append(define.HostList, define.Url)
33 | }
34 | define.ReqIpList = ConvertToReqIpList(define.HostList...)
35 | define.ReqDomainList = ConvertToReqDomainList(define.HostList...)
36 |
37 | define.TimeOut = (len(define.ReqIpList) + len(define.ReqDomainList)) * define.TimeOut
38 | }
39 |
--------------------------------------------------------------------------------
/pkg/data.go:
--------------------------------------------------------------------------------
1 | package pkg
2 |
3 | import (
4 | "bufio"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | "github.com/shadowabi/AutoDomain_rebuild/utils/Compare"
8 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
9 | "os"
10 | "regexp"
11 | "strings"
12 | "sync"
13 | )
14 |
15 | func ParseFileParameter(fileName string) (fileHostList []string) {
16 | file, err := os.Open(fileName)
17 | Error.HandlePanic(err)
18 | scan := bufio.NewScanner(file)
19 | for scan.Scan() {
20 | line := strings.TrimSpace(scan.Text())
21 | fileHostList = append(fileHostList, line)
22 | }
23 | file.Close()
24 | return fileHostList
25 | }
26 |
27 | func TripProtocolString(param string) string {
28 | if strings.Contains(param, "http://") || strings.Contains(param, "https://") {
29 | param = strings.Replace(param, "http://", "", 1)
30 | param = strings.Replace(param, "https://", "", 1)
31 | if strings.Contains(param, "/") || strings.Contains(param, "\\") {
32 | param = param[:strings.IndexAny(param, "/\\")]
33 | }
34 | }
35 | return param
36 | }
37 |
38 | func ConvertToReqIpList(param ...string) (reqIpList []string) {
39 | if len(param) != 0 {
40 | for _, host := range param {
41 | host := TripProtocolString(host)
42 | ipRegex := regexp.MustCompile(`\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:/\d{1,2}|)`)
43 | ip := ipRegex.FindString(host)
44 | if ip != "" && !Compare.IsStringInStringArray(ip, reqIpList) {
45 | reqIpList = append(reqIpList, ip)
46 | }
47 | }
48 | }
49 | return reqIpList
50 | }
51 |
52 | func ConvertToReqDomainList(param ...string) (reqDomainList []string) {
53 | if len(param) != 0 {
54 | for _, host := range param {
55 | host := TripProtocolString(host)
56 | domainRegex := regexp.MustCompile(`^([a-zA-Z0-9]([a-zA-Z0-9-_]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,11}$`)
57 | domain := domainRegex.FindString(host)
58 | if domain != "" {
59 | subDomainRegex := regexp.MustCompile(`([a-z0-9][a-z0-9\-]*?\.(?:\w{2,4})(?:\.(?:cn|hk))?)$`)
60 | subDomain := subDomainRegex.FindString(domain)
61 | if subDomain != "" && !Compare.IsStringInStringArray(subDomain, reqDomainList) {
62 | reqDomainList = append(reqDomainList, subDomain)
63 | }
64 | }
65 | }
66 | }
67 | return reqDomainList
68 | }
69 |
70 | func MergeReqListToReqStringList(mode string, reqIpList []string, reqDomainList []string) (reqStringList []string) {
71 | grammar := define.ModeToGrammar[mode]
72 | if grammar != "" {
73 | for _, host := range reqIpList {
74 | reqStringList = append(reqStringList, fmt.Sprintf("ip%v\"%v\"", grammar, host))
75 | }
76 | for _, host := range reqDomainList {
77 | switch mode {
78 | case "fofa":
79 | reqStringList = append(reqStringList, fmt.Sprintf("domain%v\"%v\"||cert.subject.cn%v\"%v\"", grammar, host, grammar, host))
80 | case "hunter":
81 | reqStringList = append(reqStringList, fmt.Sprintf("domain%v\"%v\"||cert.subject%v\"%v\"", grammar, host, grammar, host))
82 | case "quake":
83 | reqStringList = append(reqStringList, fmt.Sprintf("domain%v\"%v\" OR cert%v\"%v\"", grammar, host, grammar, host))
84 | default:
85 | reqStringList = append(reqStringList, fmt.Sprintf("domain%v\"%v\"", grammar, host))
86 | }
87 | }
88 | }
89 | return reqStringList
90 | }
91 |
92 | func FetchResultFromChanel(resultChannel chan []string) {
93 | var mu sync.Mutex
94 | for v := range resultChannel {
95 | mu.Lock()
96 | define.ResultList = append(define.ResultList, v...)
97 | mu.Unlock()
98 | }
99 |
100 | mu.Lock()
101 | define.ResultList = Compare.RemoveDuplicates(define.ResultList)
102 | WriteToFile(define.ResultList, define.OutPut)
103 | mu.Unlock()
104 | }
105 |
--------------------------------------------------------------------------------
/pkg/daydaymap/data.go:
--------------------------------------------------------------------------------
1 | package daydaymap
2 |
3 | import (
4 | "encoding/base64"
5 | "encoding/json"
6 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
7 | "strings"
8 | )
9 |
10 | func MergeReqListToReqString(reqIpList []string, reqDomainList []string) (reqString string) {
11 | for _, host := range reqIpList {
12 | reqString += "ip:" + "\"" + host + "\"" + " || "
13 | }
14 | for _, host := range reqDomainList {
15 | reqString += "domain:" + "\"" + host + "\"" + " || "
16 | }
17 | reqString = strings.TrimSuffix(reqString, " || ")
18 | reqString = base64.URLEncoding.EncodeToString([]byte(reqString))
19 | return reqString
20 | }
21 |
22 | type ArrElement struct {
23 | Domain string `json:"domain"`
24 | Port int `json:"port"`
25 | Ip string `json:"ip"`
26 | Service string `json:"service"`
27 | }
28 |
29 | type Data struct {
30 | List []ArrElement `json:"list"`
31 | Total int `json:"total"`
32 | }
33 |
34 | type DaydaymapResponse struct {
35 | Data Data `json:"data"`
36 | }
37 |
38 | func ParseDaydaymapResult(reqBody ...string) (daydaymapRespList []DaydaymapResponse) {
39 | if len(reqBody) != 0 {
40 | for _, response := range reqBody {
41 | var daydaymapResponse DaydaymapResponse
42 | Error.HandleError(json.Unmarshal([]byte(response), &daydaymapResponse))
43 | daydaymapRespList = append(daydaymapRespList, daydaymapResponse)
44 | }
45 | }
46 | return daydaymapRespList
47 | }
48 |
--------------------------------------------------------------------------------
/pkg/daydaymap/output.go:
--------------------------------------------------------------------------------
1 | package daydaymap
2 |
3 | import (
4 | "fmt"
5 | )
6 |
7 | func PurgeDomainResult(daydaymapResponse ...DaydaymapResponse) (daydaymapDomainResult []string) {
8 | if len(daydaymapResponse) != 0 {
9 | for _, response := range daydaymapResponse {
10 | for _, v := range response.Data.List {
11 | if v.Service == "http" || v.Service == "https" {
12 | result := ""
13 | if v.Domain != "" {
14 | result = fmt.Sprintf("%s://%s:%v", v.Service, v.Domain, v.Port)
15 | } else {
16 | result = fmt.Sprintf("%s://%v:%v", v.Service, v.Ip, v.Port)
17 | }
18 | daydaymapDomainResult = append(daydaymapDomainResult, result)
19 | }
20 | }
21 | }
22 | }
23 | return daydaymapDomainResult
24 | }
25 |
--------------------------------------------------------------------------------
/pkg/daydaymap/req.go:
--------------------------------------------------------------------------------
1 | package daydaymap
2 |
3 | import (
4 | "bytes"
5 | "encoding/base64"
6 | "encoding/json"
7 | "github.com/shadowabi/AutoDomain_rebuild/config"
8 | "github.com/shadowabi/AutoDomain_rebuild/define"
9 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
10 | "net/http"
11 | "time"
12 | )
13 |
14 | type DaydaymapData struct {
15 | Page int `json:"page"`
16 | Size int `json:"page_size"`
17 | Keyword string `json:"keyword"`
18 | }
19 |
20 | func DayDayMapRequest(client *http.Client, page int, total int, reqStringList ...string) (respBody []string) {
21 | if len(reqStringList) != 0 {
22 | for _, reqString := range reqStringList {
23 | reqString = base64.URLEncoding.EncodeToString([]byte(reqString))
24 | data := DaydaymapData{Page: page, Size: total, Keyword: reqString}
25 | dataJson, _ := json.Marshal(data)
26 | dataReq := bytes.NewBuffer(dataJson)
27 | req, _ := http.NewRequest("POST", "https://www.daydaymap.com/api/v1/raymap/search/all", dataReq)
28 | req.Header.Set("User-Agent", define.UserAgent)
29 | req.Header.Set("Content-Type", "application/json")
30 | req.Header.Set("api-key", config.C.DaydaymapKey)
31 |
32 | resp, err := client.Do(req)
33 | time.Sleep(500 * time.Millisecond)
34 | if err != nil {
35 | continue
36 | }
37 | respBody = append(respBody, net2.HandleResponse(resp))
38 | resp.Body.Close()
39 | }
40 | }
41 | return respBody
42 | }
43 |
--------------------------------------------------------------------------------
/pkg/fofa/data.go:
--------------------------------------------------------------------------------
1 | package fofa
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type FofaResponse struct {
9 | Size int `json:"size"`
10 | Results [][]string `json:"results"`
11 | }
12 |
13 | func ParseFofaResult(reqBody ...string) (fofaRespList []FofaResponse) {
14 | if len(reqBody) != 0 {
15 | for _, response := range reqBody {
16 | var fofaResponse FofaResponse
17 | Error.HandleError(json.Unmarshal([]byte(response), &fofaResponse))
18 | fofaRespList = append(fofaRespList, fofaResponse)
19 | }
20 | }
21 | return fofaRespList
22 | }
23 |
--------------------------------------------------------------------------------
/pkg/fofa/output.go:
--------------------------------------------------------------------------------
1 | package fofa
2 |
3 | import (
4 | "strings"
5 | )
6 |
7 | func PurgeDomainResult(fofaResponse ...FofaResponse) (fofaDomainResult []string) {
8 | if len(fofaResponse) != 0 {
9 | for _, response := range fofaResponse {
10 | for _, v := range response.Results {
11 | if v[0] == "http" || v[1] == "https" {
12 | result := strings.Join([]string{v[0], "://", v[1]}, "")
13 | fofaDomainResult = append(fofaDomainResult, result)
14 | }
15 | }
16 | }
17 | }
18 | return fofaDomainResult
19 | }
20 |
--------------------------------------------------------------------------------
/pkg/fofa/req.go:
--------------------------------------------------------------------------------
1 | package fofa
2 |
3 | import (
4 | "encoding/base64"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/config"
7 | "github.com/shadowabi/AutoDomain_rebuild/define"
8 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
9 | "net/http"
10 | "time"
11 | )
12 |
13 | func FofaRequest(client *http.Client, page int, reqStringList ...string) (respBody []string) {
14 | if len(reqStringList) != 0 {
15 | for _, reqString := range reqStringList {
16 | reqString = base64.URLEncoding.EncodeToString([]byte(reqString))
17 | url := fmt.Sprintf("https://fofa.info/api/v1/search/all?key=%s&qbase64=%s&full=false&fields=protocol,host&size=1000&page=%v", config.C.FofaKey, reqString, page)
18 | req, _ := http.NewRequest("GET", url, nil)
19 | req.Header.Set("User-Agent", define.UserAgent)
20 |
21 | resp, err := client.Do(req)
22 | time.Sleep(500 * time.Millisecond)
23 | if err != nil {
24 | continue
25 | }
26 | respBody = append(respBody, net2.HandleResponse(resp))
27 | resp.Body.Close()
28 | }
29 | }
30 | return respBody
31 | }
32 |
--------------------------------------------------------------------------------
/pkg/hunter/data.go:
--------------------------------------------------------------------------------
1 | package hunter
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type ArrElement struct {
9 | Url string `json:"url"`
10 | }
11 |
12 | type Data struct {
13 | Total int `json:"time"`
14 | Arr []ArrElement `json:"arr"`
15 | }
16 |
17 | type HunterResponse struct {
18 | Data Data `json:"data"`
19 | }
20 |
21 | func ParseHunterResult(reqBody ...string) (hunterRespList []HunterResponse) {
22 | if len(reqBody) != 0 {
23 | for _, response := range reqBody {
24 | var hunterResponse HunterResponse
25 | Error.HandleError(json.Unmarshal([]byte(response), &hunterResponse))
26 | hunterRespList = append(hunterRespList, hunterResponse)
27 | }
28 | }
29 | return hunterRespList
30 | }
31 |
--------------------------------------------------------------------------------
/pkg/hunter/output.go:
--------------------------------------------------------------------------------
1 | package hunter
2 |
3 | func PurgeDomainResult(hunterResponse ...HunterResponse) (hunterDomainResult []string) {
4 | if len(hunterResponse) != 0 {
5 | for _, response := range hunterResponse {
6 | for _, v := range response.Data.Arr {
7 | hunterDomainResult = append(hunterDomainResult, v.Url)
8 | }
9 | }
10 | }
11 | return hunterDomainResult
12 | }
13 |
--------------------------------------------------------------------------------
/pkg/hunter/req.go:
--------------------------------------------------------------------------------
1 | package hunter
2 |
3 | import (
4 | "encoding/base64"
5 | "fmt"
6 | "github.com/shadowabi/AutoDomain_rebuild/config"
7 | "github.com/shadowabi/AutoDomain_rebuild/define"
8 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
9 | "net/http"
10 | "time"
11 | )
12 |
13 | func HunterRequest(client *http.Client, page int, reqStringList ...string) (respBody []string) {
14 | if len(reqStringList) != 0 {
15 | for _, reqString := range reqStringList {
16 | reqString = base64.URLEncoding.EncodeToString([]byte(reqString))
17 | url := fmt.Sprintf("https://hunter.qianxin.com/openApi/search?api-key=%s&search=%s&page=%v&page_size=100&is_web=3",
18 | config.C.HunterKey, reqString, page)
19 | req, _ := http.NewRequest("GET", url, nil)
20 | req.Header.Set("User-Agent", define.UserAgent)
21 |
22 | resp, err := client.Do(req)
23 | time.Sleep(500 * time.Millisecond)
24 | if err != nil {
25 | continue
26 | }
27 | respBody = append(respBody, net2.HandleResponse(resp))
28 | resp.Body.Close()
29 | }
30 | }
31 | return respBody
32 | }
33 |
--------------------------------------------------------------------------------
/pkg/netlas/data.go:
--------------------------------------------------------------------------------
1 | package netlas
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type NetlasDomainResponse struct {
9 | Items []DomainData `json:"items"`
10 | Took int `json:"took"`
11 | Timestamp int64 `json:"timestamp"`
12 | }
13 |
14 | type DomainData struct {
15 | Data Domain `json:"data"`
16 | }
17 |
18 | type Domain struct {
19 | Domain string `json:"domain"`
20 | }
21 |
22 | func ParseNetlasDomainResult(reqBody ...string) (netlasDomainRespList []NetlasDomainResponse) {
23 | if len(reqBody) != 0 {
24 | for _, response := range reqBody {
25 | var netlasDomainResponse NetlasDomainResponse
26 | Error.HandleError(json.Unmarshal([]byte(response), &netlasDomainResponse))
27 | netlasDomainRespList = append(netlasDomainRespList, netlasDomainResponse)
28 | }
29 | }
30 | return netlasDomainRespList
31 | }
32 |
33 | type NetlasIpResponse struct {
34 | Domains []string `json:"domains"`
35 | }
36 |
37 | func ParseNetlasIpResult(reqBody ...string) (netlasIpRespList []NetlasIpResponse) {
38 | if len(reqBody) != 0 {
39 | for _, response := range reqBody {
40 | var netlasDomainResponse NetlasIpResponse
41 | Error.HandleError(json.Unmarshal([]byte(response), &netlasDomainResponse))
42 | netlasIpRespList = append(netlasIpRespList, netlasDomainResponse)
43 | }
44 | }
45 | return netlasIpRespList
46 | }
47 |
--------------------------------------------------------------------------------
/pkg/netlas/output.go:
--------------------------------------------------------------------------------
1 | package netlas
2 |
3 | import "strings"
4 |
5 | func PurgeDomainResult(netlasDomainResponse ...NetlasDomainResponse) (netlasDomainResult []string) {
6 | if len(netlasDomainResponse) != 0 {
7 | for _, response := range netlasDomainResponse {
8 | for _, v := range response.Items {
9 | result := strings.Join([]string{"http://", v.Data.Domain}, "")
10 | netlasDomainResult = append(netlasDomainResult, result)
11 | }
12 | }
13 | }
14 | return netlasDomainResult
15 | }
16 |
17 | func PurgeIpResult(netlasIpesponse ...NetlasIpResponse) (netlasIpResult []string) {
18 | if len(netlasIpesponse) != 0 {
19 | for _, response := range netlasIpesponse {
20 | for _, v := range response.Domains {
21 | result := strings.Join([]string{"http://", v}, "")
22 | netlasIpResult = append(netlasIpResult, result)
23 | }
24 | }
25 | }
26 | return netlasIpResult
27 | }
28 |
--------------------------------------------------------------------------------
/pkg/netlas/req.go:
--------------------------------------------------------------------------------
1 | package netlas
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/define"
6 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
7 | "net/http"
8 | "time"
9 | )
10 |
11 | func NetlasDomainRequest(client *http.Client, reqDomainList ...string) (responseDomainList []string) {
12 | if len(reqDomainList) != 0 {
13 | for _, host := range reqDomainList {
14 | url := fmt.Sprintf("https://app.netlas.io/api/domains/?q=*.%s&source_type=include&fields=domain", host)
15 | req, _ := http.NewRequest("GET", url, nil)
16 | req.Header.Set("User-Agent", define.UserAgent)
17 |
18 | resp, err := client.Do(req)
19 | time.Sleep(500 * time.Millisecond)
20 | if err != nil {
21 | continue
22 | }
23 | responseDomainList = append(responseDomainList, net2.HandleResponse(resp))
24 | }
25 | }
26 | return responseDomainList
27 | }
28 |
29 | func NetlasIpRequest(client *http.Client, reqIpList ...string) (responseIpList []string) {
30 | if len(reqIpList) != 0 {
31 | for _, host := range reqIpList {
32 | url := fmt.Sprintf("https://app.netlas.io/api/host/%s/?fields=domains", host)
33 | req, _ := http.NewRequest("GET", url, nil)
34 |
35 | resp, err := client.Do(req)
36 | time.Sleep(500 * time.Millisecond)
37 | if err != nil {
38 | continue
39 | }
40 | responseIpList = append(responseIpList, net2.HandleResponse(resp))
41 | }
42 | }
43 | return responseIpList
44 | }
45 |
--------------------------------------------------------------------------------
/pkg/output.go:
--------------------------------------------------------------------------------
1 | package pkg
2 |
3 | import (
4 | "bufio"
5 | "encoding/json"
6 | "fmt"
7 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
8 | "os"
9 | "sort"
10 | "strings"
11 | )
12 |
13 | func WriteToFile(writeResultList []string, output string) {
14 |
15 | file, err := os.OpenFile(output, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
16 | Error.HandlePanic(err)
17 | defer file.Close()
18 |
19 | writer := bufio.NewWriter(file)
20 | defer writer.Flush()
21 |
22 | sort.Strings(writeResultList)
23 |
24 | if strings.HasSuffix(output, ".json") {
25 | jsonData := OutputJson(writeResultList)
26 | fmt.Fprintln(writer, string(jsonData))
27 | } else if len(writeResultList) != 0 {
28 | for _, i := range writeResultList {
29 | fmt.Fprintln(writer, i)
30 | }
31 | }
32 | }
33 |
34 | func OutputJson(writeResultList []string) (jsonData []byte) {
35 | data := make(map[string][]string)
36 | data["url"] = writeResultList
37 |
38 | jsonData, err := json.Marshal(data)
39 | Error.HandlePanic(err)
40 | return jsonData
41 | }
42 |
--------------------------------------------------------------------------------
/pkg/pulsedive/data.go:
--------------------------------------------------------------------------------
1 | package pulsedive
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type Result struct {
9 | Indicator string `json:"indicator"`
10 | }
11 |
12 | type PulsediveDomainResponse struct {
13 | Results []Result
14 | }
15 |
16 | func ParsePulsediveDomainResult(reqBody ...string) (pulsediveDomainResult []PulsediveDomainResponse) {
17 | if len(reqBody) != 0 {
18 | for _, response := range reqBody {
19 | var pulsediveDomainResponse PulsediveDomainResponse
20 | Error.HandleError(json.Unmarshal([]byte(response), &pulsediveDomainResponse))
21 | pulsediveDomainResult = append(pulsediveDomainResult, pulsediveDomainResponse)
22 | }
23 | }
24 | return pulsediveDomainResult
25 | }
26 |
--------------------------------------------------------------------------------
/pkg/pulsedive/output.go:
--------------------------------------------------------------------------------
1 | package pulsedive
2 |
3 | import "strings"
4 |
5 | func PurgeDomainResult(pulsediveDomainResponse ...PulsediveDomainResponse) (pulsediveDomainResult []string) {
6 | if len(pulsediveDomainResponse) != 0 {
7 | for _, response := range pulsediveDomainResponse {
8 | for _, v := range response.Results {
9 | result := strings.Join([]string{"http://", v.Indicator}, "")
10 | pulsediveDomainResult = append(pulsediveDomainResult, result)
11 | }
12 | }
13 | }
14 | return pulsediveDomainResult
15 | }
16 |
--------------------------------------------------------------------------------
/pkg/pulsedive/req.go:
--------------------------------------------------------------------------------
1 | package pulsedive
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/config"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
8 | "net/http"
9 | "time"
10 | )
11 |
12 | func PulsediveDomainRequest(client *http.Client, reqDomainList ...string) (responseDomainList []string) {
13 | if len(reqDomainList) != 0 {
14 | for _, host := range reqDomainList {
15 | url := fmt.Sprintf("https://pulsedive.com/api/explore.php?q=ioc%%3d*.%s%%20%%20retired%%3d0&limit=50&key=%v", host, config.C.PulsediveKey)
16 | req, _ := http.NewRequest("GET", url, nil)
17 | req.Header.Set("User-Agent", define.UserAgent)
18 |
19 | resp, err := client.Do(req)
20 | time.Sleep(500 * time.Millisecond)
21 | if err != nil {
22 | continue
23 | }
24 | responseDomainList = append(responseDomainList, net2.HandleResponse(resp))
25 | }
26 | }
27 | return responseDomainList
28 | }
29 |
--------------------------------------------------------------------------------
/pkg/quake/data.go:
--------------------------------------------------------------------------------
1 | package quake
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type PortService struct {
9 | Port int `json:"port"`
10 | Service ServiceInfo `json:"service"`
11 | }
12 |
13 | type ServiceInfo struct {
14 | Name string `json:"name"`
15 |
16 | // HTTP-specific fields, only present when service is 'http' or related
17 | HTTP struct {
18 | Host string `json:"host"`
19 | } `json:"http,omitempty"`
20 |
21 | // Additional fields for other specific services can be added here if needed
22 | }
23 |
24 | type QuakeResponse struct {
25 | Data []PortService `json:"data"`
26 | Meta Meta `json:"meta"`
27 | }
28 |
29 | type Meta struct {
30 | Pagination Pagination `json:"pagination"`
31 | }
32 |
33 | type Pagination struct {
34 | Total int `json:"total"` // This is the field you asked for
35 | }
36 |
37 | func ParseQuakeResult(reqBody ...string) (quakeRespList []QuakeResponse) {
38 | if len(reqBody) != 0 {
39 | for _, response := range reqBody {
40 | var quakeResponse QuakeResponse
41 | Error.HandleError(json.Unmarshal([]byte(response), &quakeResponse))
42 | quakeRespList = append(quakeRespList, quakeResponse)
43 | }
44 | }
45 |
46 | return quakeRespList
47 | }
48 |
--------------------------------------------------------------------------------
/pkg/quake/output.go:
--------------------------------------------------------------------------------
1 | package quake
2 |
3 | import (
4 | "fmt"
5 | "strings"
6 | )
7 |
8 | func PurgeDomainResult(quakeResponse ...QuakeResponse) (quakeDomainResult []string) {
9 | if len(quakeResponse) != 0 {
10 | for _, response := range quakeResponse {
11 | for _, v := range response.Data {
12 | if v.Service.Name == "http" || v.Service.Name == "http/ssl" {
13 | if v.Service.Name == "http/ssl" {
14 | v.Service.Name = "https"
15 | }
16 | if v.Service.HTTP.Host == "" { // error data
17 | continue
18 | }
19 | result := strings.Join([]string{v.Service.Name, "://", v.Service.HTTP.Host, ":", fmt.Sprintf("%v", v.Port)}, "")
20 | quakeDomainResult = append(quakeDomainResult, result)
21 | }
22 | }
23 | }
24 | }
25 | return quakeDomainResult
26 | }
27 |
--------------------------------------------------------------------------------
/pkg/quake/req.go:
--------------------------------------------------------------------------------
1 | package quake
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/config"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
8 | "net/http"
9 | "strings"
10 | "time"
11 | )
12 |
13 | func QuakeRequest(client *http.Client, page int, reqStringList ...string) (respBody []string) {
14 | if len(reqStringList) != 0 {
15 | for _, reqString := range reqStringList {
16 | data := strings.NewReader(fmt.Sprintf("query=%s&start=%v&size=100&include=service.name&include=port&include=service.http.host", reqString, page))
17 | req, _ := http.NewRequest("POST", "https://quake.360.net/api/v3/search/quake_service", data)
18 | req.Header.Set("User-Agent", define.UserAgent)
19 | req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
20 | req.Header.Set("X-QuakeToken", config.C.QuakeKey)
21 |
22 | resp, err := client.Do(req)
23 | time.Sleep(500 * time.Millisecond)
24 | if err != nil {
25 | continue
26 | }
27 | respBody = append(respBody, net2.HandleResponse(resp))
28 | resp.Body.Close()
29 | }
30 | }
31 | return respBody
32 | }
33 |
--------------------------------------------------------------------------------
/pkg/virustotal/data.go:
--------------------------------------------------------------------------------
1 | package virustotal
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type VirusTotalDomain struct {
9 | ID string `json:"id"`
10 | }
11 |
12 | type VirusTotalDomainResponse struct {
13 | Data []VirusTotalDomain `json:"data"`
14 | Meta Meta `json:"meta"`
15 | }
16 |
17 | type Meta struct {
18 | Count int `json:"count"`
19 | }
20 |
21 | func ParseVirusTotalDomainResult(reqBody ...string) (virusTotalDomainRespList []VirusTotalDomainResponse) {
22 | if len(reqBody) != 0 {
23 | for _, response := range reqBody {
24 | var virusTotalDomainResponse VirusTotalDomainResponse
25 | Error.HandleError(json.Unmarshal([]byte(response), &virusTotalDomainResponse))
26 | virusTotalDomainRespList = append(virusTotalDomainRespList, virusTotalDomainResponse)
27 | }
28 | }
29 | return virusTotalDomainRespList
30 | }
31 |
--------------------------------------------------------------------------------
/pkg/virustotal/output.go:
--------------------------------------------------------------------------------
1 | package virustotal
2 |
3 | import "strings"
4 |
5 | func PurgeDomainResult(virusTotalDomainResponse ...VirusTotalDomainResponse) (virusTotalDomainResult []string) {
6 | if len(virusTotalDomainResponse) != 0 {
7 | for _, response := range virusTotalDomainResponse {
8 | for _, v := range response.Data {
9 | result := strings.Join([]string{"http://", v.ID}, "")
10 | virusTotalDomainResult = append(virusTotalDomainResult, result)
11 | }
12 | }
13 | }
14 | return virusTotalDomainResult
15 | }
16 |
--------------------------------------------------------------------------------
/pkg/virustotal/req.go:
--------------------------------------------------------------------------------
1 | package virustotal
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/define"
6 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
7 | "net/http"
8 | "time"
9 | )
10 |
11 | func VirusTotalDomainRequest(client *http.Client, reqDomainList ...string) (responseDomainList []string) {
12 | if len(reqDomainList) != 0 {
13 | for _, host := range reqDomainList {
14 | url := fmt.Sprintf("https://www.virustotal.com/ui/domains/%s/subdomains?relationships=resolutions&cursor=eyJsaW1pdCI6IDIwMCwgIm9mZnNldCI6IDB9&limit=200", host)
15 | req, _ := http.NewRequest("GET", url, nil)
16 | req.Header.Set("User-Agent", define.UserAgent)
17 | req.Header.Set("X-Vt-Anti-Abuse-Header", "1")
18 | req.Header.Set("X-Tool", "vt-ui-main")
19 | req.Header.Set("Accept-Ianguage", "en-US,en;q=0.9,es;q=0.8")
20 |
21 | resp, err := client.Do(req)
22 | time.Sleep(500 * time.Millisecond)
23 | if err != nil {
24 | continue
25 | }
26 | responseDomainList = append(responseDomainList, net2.HandleResponse(resp))
27 | }
28 | }
29 | return responseDomainList
30 | }
31 |
--------------------------------------------------------------------------------
/pkg/zoomeye/data.go:
--------------------------------------------------------------------------------
1 | package zoomeye
2 |
3 | import (
4 | "encoding/json"
5 | "github.com/shadowabi/AutoDomain_rebuild/utils/Error"
6 | )
7 |
8 | type ZoomeyeIpResponse struct {
9 | Matches []MatchInfo `json:"matches"`
10 | }
11 |
12 | type MatchInfo struct {
13 | Ip string `json:"ip"`
14 | PortInfo PortInfo `json:"portinfo"`
15 | Honeypot int `json:"honeypot"`
16 | }
17 |
18 | type PortInfo struct {
19 | Port int `json:"port"`
20 | Service string `json:"service"`
21 | }
22 |
23 | func ParseZoomeyeIpResult(reqBody ...string) (zoomeyeIpRespList []ZoomeyeIpResponse) {
24 | if len(reqBody) != 0 {
25 | for _, response := range reqBody {
26 | var zoomeyeIpResponse ZoomeyeIpResponse
27 | Error.HandleError(json.Unmarshal([]byte(response), &zoomeyeIpResponse))
28 | if len(zoomeyeIpResponse.Matches) != 0 {
29 | for _, match := range zoomeyeIpResponse.Matches {
30 | if match.Honeypot == 0 {
31 | zoomeyeIpRespList = append(zoomeyeIpRespList, zoomeyeIpResponse)
32 | }
33 | }
34 | }
35 | }
36 | }
37 | return zoomeyeIpRespList
38 | }
39 |
40 | type ZoomeyeDomainResponse struct {
41 | List []SiteInfo `json:"list"`
42 | }
43 |
44 | type SiteInfo struct {
45 | Name string `json:"name"`
46 | }
47 |
48 | func ParseZoomeyeDomainResult(reqBody ...string) (zoomeyeDomainRespList []ZoomeyeDomainResponse) {
49 | if len(reqBody) != 0 {
50 | for _, response := range reqBody {
51 | var zoomeyeDomainResponse ZoomeyeDomainResponse
52 | Error.HandleError(json.Unmarshal([]byte(response), &zoomeyeDomainResponse))
53 | zoomeyeDomainRespList = append(zoomeyeDomainRespList, zoomeyeDomainResponse)
54 | }
55 | }
56 | return zoomeyeDomainRespList
57 | }
58 |
--------------------------------------------------------------------------------
/pkg/zoomeye/output.go:
--------------------------------------------------------------------------------
1 | package zoomeye
2 |
3 | import (
4 | "fmt"
5 | "strings"
6 | )
7 |
8 | func PurgeIpResult(zoomeyeIpResponse ...ZoomeyeIpResponse) (zoomeyeDomainResult []string) {
9 | if len(zoomeyeIpResponse) != 0 {
10 | for _, response := range zoomeyeIpResponse {
11 | if len(response.Matches) != 0 {
12 | for _, v := range response.Matches {
13 | if v.PortInfo.Service == "http" || v.PortInfo.Service == "https" {
14 | result := strings.Join([]string{v.PortInfo.Service, "://", v.Ip, ":", fmt.Sprintf("%v", v.PortInfo.Port)}, "")
15 | zoomeyeDomainResult = append(zoomeyeDomainResult, result)
16 | }
17 | }
18 | }
19 | }
20 | }
21 | return zoomeyeDomainResult
22 | }
23 |
24 | func PurgeDomainResult(zoomeyeDomainResponse ...ZoomeyeDomainResponse) (zoomeyeDomainResult []string) {
25 | if len(zoomeyeDomainResponse) != 0 {
26 | for _, response := range zoomeyeDomainResponse {
27 | for _, v := range response.List {
28 | result := strings.Join([]string{"http://", v.Name}, "")
29 | zoomeyeDomainResult = append(zoomeyeDomainResult, result)
30 | }
31 | }
32 | }
33 | return zoomeyeDomainResult
34 | }
35 |
--------------------------------------------------------------------------------
/pkg/zoomeye/req.go:
--------------------------------------------------------------------------------
1 | package zoomeye
2 |
3 | import (
4 | "fmt"
5 | "github.com/shadowabi/AutoDomain_rebuild/config"
6 | "github.com/shadowabi/AutoDomain_rebuild/define"
7 | net2 "github.com/shadowabi/AutoDomain_rebuild/utils/response"
8 | "net/http"
9 | "time"
10 | )
11 |
12 | func ZoomeyeDomainRequest(client *http.Client, reqDomainList ...string) (responseDomainList []string) {
13 | if len(reqDomainList) != 0 {
14 | for _, host := range reqDomainList {
15 | url := fmt.Sprintf("https://api.zoomeye.org/domain/search?q=%s&type=1", host)
16 | req, _ := http.NewRequest("GET", url, nil)
17 | req.Header.Set("User-Agent", define.UserAgent)
18 | req.Header.Set("API-KEY", config.C.ZoomeyeKey)
19 |
20 | resp, err := client.Do(req)
21 | time.Sleep(500 * time.Millisecond)
22 | if err != nil {
23 | continue
24 | }
25 | responseDomainList = append(responseDomainList, net2.HandleResponse(resp))
26 | }
27 | }
28 | return responseDomainList
29 | }
30 |
31 | func ZoomeyeIpRequest(client *http.Client, reqIpList ...string) (responseIpList []string) {
32 | if len(reqIpList) != 0 {
33 | for _, host := range reqIpList {
34 | url := fmt.Sprintf("https://api.zoomeye.org/host/search?query=ip:%s&facets=port", host)
35 | req, _ := http.NewRequest("GET", url, nil)
36 | req.Header.Add("User-Agent", define.UserAgent)
37 | req.Header.Add("API-KEY", config.C.ZoomeyeKey)
38 |
39 | resp, err := client.Do(req)
40 | time.Sleep(500 * time.Millisecond)
41 | if err != nil {
42 | continue
43 | }
44 | responseIpList = append(responseIpList, net2.HandleResponse(resp))
45 | }
46 | }
47 | return responseIpList
48 | }
49 |
--------------------------------------------------------------------------------
/utils/Compare/StringInStringArray.go:
--------------------------------------------------------------------------------
1 | package Compare
2 |
3 | // IsStringInStringArray test if str string is contained in strArray []string
4 | // return true when contains
5 | func IsStringInStringArray(str string, strArray []string) bool {
6 | for _, v := range strArray {
7 | if v == str {
8 | return true
9 | }
10 | }
11 | return false
12 | }
13 |
14 | func RemoveDuplicates(reqList []string) []string {
15 | encountered := map[string]bool{}
16 | var result []string
17 | for v := range reqList {
18 | if !encountered[reqList[v]] {
19 | encountered[reqList[v]] = true
20 | result = append(result, reqList[v])
21 | }
22 | }
23 | return result
24 | }
25 |
--------------------------------------------------------------------------------
/utils/Error/errorHandle.go:
--------------------------------------------------------------------------------
1 | package Error
2 |
3 | import log "github.com/sirupsen/logrus"
4 |
5 | const ERRORMSG = "GET error != nil"
6 |
7 | // HandleError is a function to handle error using Errorln, do nothing if error is nil
8 | func HandleError(e error) {
9 | if e != nil {
10 | log.Errorln(ERRORMSG, e)
11 | }
12 | }
13 |
14 | // HandlePanic is a function to handle error using Panicln, do nothing if error is nil
15 | func HandlePanic(e error) {
16 | if e != nil {
17 | log.Panicln(ERRORMSG, e)
18 | }
19 | }
20 |
21 | // HandleFatal is a function to handle error using Fatalln, do nothing if error is nil
22 | func HandleFatal(e error) {
23 | if e != nil {
24 | log.Fatalln(ERRORMSG, e)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/utils/File/exist.go:
--------------------------------------------------------------------------------
1 | package File
2 |
3 | import (
4 | "errors"
5 | "os"
6 | )
7 |
8 | func DirNonExistCreate(dirpath string) error {
9 | exist, err := IsDirExist(dirpath)
10 | if exist {
11 | return nil
12 | }
13 | if err == nil {
14 | return os.MkdirAll(dirpath, 0755)
15 | }
16 | return err
17 | }
18 |
19 | func FileNonExistCreate(filepath string) error {
20 | exist, err := IsFileExist(filepath)
21 | if exist {
22 | return nil
23 | }
24 | if err == nil {
25 | f, err := os.Create(filepath)
26 | if err != nil {
27 | return err
28 | }
29 | return f.Close()
30 | }
31 | return err
32 | }
33 |
34 | func IsFileExist(filepath string) (bool, error) {
35 | if s, err := os.Stat(filepath); err == nil {
36 | // path/to/whatever exists
37 | if s.IsDir() {
38 | return false, errors.New(filepath + " is a dir")
39 | }
40 | return true, nil
41 | } else if errors.Is(err, os.ErrNotExist) {
42 | // path/to/whatever does *not* exist
43 | return false, nil
44 | } else {
45 | return false, err
46 | }
47 | }
48 |
49 | func IsDirExist(dirpath string) (bool, error) {
50 | if s, err := os.Stat(dirpath); err == nil {
51 | // path/to/whatever exists
52 | if s.IsDir() {
53 | return true, nil
54 | }
55 | return false, errors.New(dirpath + " is a file")
56 | } else if errors.Is(err, os.ErrNotExist) {
57 | // path/to/whatever does *not* exist
58 | return false, nil
59 | } else {
60 | return false, err
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/utils/log/logger.go:
--------------------------------------------------------------------------------
1 | package log
2 |
3 | import (
4 | log "github.com/sirupsen/logrus"
5 | prefixed "github.com/x-cray/logrus-prefixed-formatter"
6 | "os"
7 | )
8 |
9 | const (
10 | LogLevelTrace = "trace"
11 | LogLevelDebug = "debug"
12 | LogLevelInfo = "info"
13 | LogLevelWarn = "warn"
14 | LogLevelError = "error"
15 | LogLevelFatal = "fatal"
16 | LogLevelPanic = "panic"
17 | )
18 |
19 | // Init func is a function to init logrus with specific log level
20 | func Init(level string) {
21 | log.SetOutput(os.Stdout)
22 | log.SetFormatter(logFormat())
23 | log.SetLevel(logLevel(level))
24 | }
25 |
26 | // logLevel search level strings return correct Level
27 | func logLevel(level string) log.Level {
28 | switch level {
29 | case LogLevelTrace:
30 | return log.TraceLevel
31 | case LogLevelDebug:
32 | return log.DebugLevel
33 | case LogLevelInfo:
34 | return log.InfoLevel
35 | case LogLevelWarn:
36 | return log.WarnLevel
37 | case LogLevelError:
38 | return log.ErrorLevel
39 | case LogLevelFatal:
40 | return log.FatalLevel
41 | case LogLevelPanic:
42 | return log.PanicLevel
43 | default:
44 | return log.InfoLevel
45 | }
46 | }
47 |
48 | // logFormat sets log format by using prefixed "x-cray/logrus-prefixed-formatter"
49 | func logFormat() log.Formatter {
50 | formatter := new(prefixed.TextFormatter)
51 | formatter.FullTimestamp = true
52 | formatter.TimestampFormat = "2006-01-02 15:04:05"
53 | formatter.SetColorScheme(&prefixed.ColorScheme{
54 | PrefixStyle: "blue+b",
55 | TimestampStyle: "white+h",
56 | })
57 | return formatter
58 | }
59 |
--------------------------------------------------------------------------------
/utils/response/responseHandle.go:
--------------------------------------------------------------------------------
1 | package net2
2 |
3 | import (
4 | "bytes"
5 | "io"
6 | "net/http"
7 | )
8 |
9 | func HandleResponse(resp *http.Response) (bodyString string) {
10 | if resp == nil {
11 | return ""
12 | }
13 | bodyBuf := new(bytes.Buffer)
14 | _, err := io.Copy(bodyBuf, resp.Body)
15 | if err != nil {
16 | return ""
17 | }
18 | bodyString = bodyBuf.String()
19 | //print(bodyString)
20 | return bodyString
21 | }
22 |
23 | func GeneratePageList(pageSize int) (pageList []int) {
24 | startPage := 2
25 | pageCount := (pageSize-1)/1000 + 1 // 总共需要请求的页面数量
26 | pageList = make([]int, pageCount-1)
27 | for i := 0; i < pageCount-1; i++ {
28 | pageList[i] = startPage + i
29 | }
30 | return pageList
31 | }
32 |
--------------------------------------------------------------------------------