Skip to content

Commit def7ae7

Browse files
authored
Merge pull request #712 from projectdiscovery/dev
v2.5.5
2 parents 6efe556 + 16ecbfb commit def7ae7

File tree

17 files changed

+334
-184
lines changed

17 files changed

+334
-184
lines changed

.github/workflows/lint-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
go-version: 1.18
1616
- name: Run golangci-lint
17-
uses: golangci/golangci-lint-action@v3.2.0
17+
uses: golangci/golangci-lint-action@v3.3.1
1818
with:
1919
version: latest
2020
args: --timeout 5m

DISCLAIMER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Subfinder leverages multiple open APIs, it is developed for individuals to help them for research or internal work. If you wish to incorporate this tool into a commercial offering or purposes, you must agree to the Terms of the leveraged services:
44

5-
- Project Sonar / Bufferover: https://opendata.rapid7.com/about / [https://tls.bufferover.run](https://tls.bufferover.run/dns?q)
5+
- Bufferover: https://tls.bufferover.run
66
- CommonCrawl: https://commoncrawl.org/terms-of-use/full
77
- certspotter: https://sslmate.com/terms
88
- dnsdumpster: https://hackertarget.com/terms

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Build
2+
23
FROM golang:1.19.2-alpine AS build-env
34
RUN apk add build-base
45
RUN go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
56

67
# Release
7-
FROM alpine:3.16.2
8+
FROM alpine:3.16.3
89
RUN apk -U upgrade --no-cache \
910
&& apk add --no-cache bind-tools ca-certificates
1011
COPY --from=build-env /go/bin/subfinder /usr/local/bin/subfinder

README.md

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1 align="center">
2-
<img src="static/subfinder-logo.png" alt="subfinder" width="200px"></a>
2+
<img src="static/subfinder-logo.png" alt="subfinder" width="200px">
33
<br>
44
</h1>
55

@@ -13,7 +13,7 @@
1313
<a href="https://twitter.com/pdiscoveryio"><img src="https://img.shields.io/twitter/follow/pdiscoveryio.svg?logo=twitter"></a>
1414
<a href="https://discord.gg/projectdiscovery"><img src="https://img.shields.io/discord/695645237418131507.svg?logo=discord"></a>
1515
</p>
16-
16+
1717
<p align="center">
1818
<a href="#features">Features</a> •
1919
<a href="#installation">Install</a> •
@@ -26,10 +26,11 @@
2626
---
2727

2828

29-
Subfinder is a subdomain discovery tool that discovers valid subdomains for websites by using passive online sources. It has a simple modular architecture and is optimized for speed. subfinder is built for doing one thing only - passive subdomain enumeration, and it does that very well.
30-
31-
We have designed `subfinder` to comply with all passive sources licenses, and usage restrictions, as well as maintained a consistently passive model to make it useful to both penetration testers and bug bounty hunters alike.
29+
`subfinder` is a subdomain discovery tool that returns valid subdomains for websites, using passive online sources. It has a simple, modular architecture and is optimized for speed. `subfinder` is built for
30+
doing one thing only - passive subdomain enumeration, and it does that very well.
3231

32+
We have made it to comply with all the used passive source licenses and usage restrictions. The passive model guarantees speed and stealthiness that can be leveraged by both penetration testers and bug bounty
33+
hunters alike.
3334

3435
# Features
3536

@@ -38,89 +39,93 @@ We have designed `subfinder` to comply with all passive sources licenses, and us
3839
<br>
3940
</h1>
4041

41-
42-
- Fast and powerful resolution and wildcard elimination module
43-
- **Curated** passive sources to maximize results
44-
- Multiple Output formats supported (Json, File, Stdout)
45-
- Optimized for speed, very fast and **lightweight** on resources
46-
- **STDIN/OUT** support for integrating in workflows
47-
42+
- Fast and powerful resolution and wildcard elimination modules
43+
- **Curated** passive sources to maximize results
44+
- Multiple output formats supported (JSON, file, stdout)
45+
- Optimized for speed and **lightweight** on resources
46+
- **STDIN/OUT** support enables easy integration into workflows
4847

4948
# Usage
5049

5150
```sh
5251
subfinder -h
5352
```
53+
5454
This will display help for the tool. Here are all the switches it supports.
5555

5656
```yaml
57+
Usage:
58+
./subfinder [flags]
59+
5760
Flags:
5861
INPUT:
59-
-d, -domain string[] domains to find subdomains for
60-
-dL, -list string file containing list of domains for subdomain discovery
62+
-d, -domain string[] domains to find subdomains for
63+
-dL, -list string file containing list of domains for subdomain discovery
6164

6265
SOURCE:
63-
-s, -sources string[] specific sources to use for discovery (-s crtsh,github). Use -ls to display all available sources.
64-
-recursive use only sources that can handle subdomains recursively (e.g. subdomain.domain.tld vs domain.tld)
65-
-all use all sources for enumeration (slow)
66-
-es, -exclude-sources string[] sources to exclude from enumeration (-es alienvault,zoomeye)
66+
-s, -sources string[] specific sources to use for discovery (-s crtsh,github). Use -ls to display all available sources.
67+
-recursive use only sources that can handle subdomains recursively (e.g. subdomain.domain.tld vs domain.tld)
68+
-all use all sources for enumeration (slow)
69+
-es, -exclude-sources string[] sources to exclude from enumeration (-es alienvault,zoomeye)
6770

6871
FILTER:
69-
-m, -match string[] subdomain or list of subdomain to match (file or comma separated)
70-
-f, -filter string[] subdomain or list of subdomain to filter (file or comma separated)
72+
-m, -match string[] subdomain or list of subdomain to match (file or comma separated)
73+
-f, -filter string[] subdomain or list of subdomain to filter (file or comma separated)
7174

7275
RATE-LIMIT:
73-
-rl, -rate-limit int maximum number of http requests to send per second
74-
-t int number of concurrent goroutines for resolving (-active only) (default 10)
76+
-rl, -rate-limit int maximum number of http requests to send per second
77+
-t int number of concurrent goroutines for resolving (-active only) (default 10)
7578

7679
OUTPUT:
77-
-o, -output string file to write output to
78-
-oJ, -json write output in JSONL(ines) format
79-
-oD, -output-dir string directory to write output (-dL only)
80-
-cs, -collect-sources include all sources in the output (-json only)
81-
-oI, -ip include host IP in output (-active only)
80+
-o, -output string file to write output to
81+
-oJ, -json write output in JSONL(ines) format
82+
-oD, -output-dir string directory to write output (-dL only)
83+
-cs, -collect-sources include all sources in the output (-json only)
84+
-oI, -ip include host IP in output (-active only)
8285

8386
CONFIGURATION:
84-
-config string flag config file (default "$HOME/.config/subfinder/config.yaml")
85-
-pc, -provider-config string provider config file (default "$HOME/.config/subfinder/provider-config.yaml")
86-
-r string[] comma separated list of resolvers to use
87-
-rL, -rlist string file containing list of resolvers to use
88-
-nW, -active display active subdomains only
89-
-proxy string http proxy to use with subfinder
90-
-ei, -exclude-ip exclude IPs from the list of domains
87+
-config string flag config file (default "$HOME/.config/subfinder/config.yaml")
88+
-pc, -provider-config string provider config file (default "$HOME/.config/subfinder/provider-config.yaml")
89+
-r string[] comma separated list of resolvers to use
90+
-rL, -rlist string file containing list of resolvers to use
91+
-nW, -active display active subdomains only
92+
-proxy string http proxy to use with subfinder
93+
-ei, -exclude-ip exclude IPs from the list of domains
9194

9295
DEBUG:
93-
-silent show only subdomains in output
94-
-version show version of subfinder
95-
-v show verbose output
96-
-nc, -no-color disable color in output
97-
-ls, -list-sources list all available sources
96+
-silent show only subdomains in output
97+
-version show version of subfinder
98+
-v show verbose output
99+
-nc, -no-color disable color in output
100+
-ls, -list-sources list all available sources
98101

99102
OPTIMIZATION:
100-
-timeout int seconds to wait before timing out (default 30)
101-
-max-time int minutes to wait for enumeration results (default 10)
103+
-timeout int seconds to wait before timing out (default 30)
104+
-max-time int minutes to wait for enumeration results (default 10)
102105
```
103106

104107
# Installation
105108

106-
Subfinder requires **go1.17** to install successfully. Run the following command to install the latest version:
109+
`subfinder` requires **go1.18** to install successfully. Run the following command to install the latest version:
107110

108111
```sh
109112
go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
110113
```
111114

112-
113115
## Post Installation Instructions
114116

115-
Subfinder will work after using the installation instructions however to configure Subfinder to work with certain services, you will need to have setup API keys. The following services do not work without an API key:
117+
`subfinder` can be used right after the installation, however the following services require configuring API keys to work:
118+
119+
[BeVigil](https://bevigil.com/osint-api), [BinaryEdge](https://binaryedge.io), [BufferOver](https://tls.bufferover.run), [C99](https://api.c99.nl/), [Censys](https://censys.io), [CertSpotter](https://sslmate.com/certspotter/api/), [Chaos](https://chaos.projectdiscovery.io), [Chinaz](http://my.chinaz.com/ChinazAPI/DataCenter/MyDataApi), [DnsDB](https://api.dnsdb.info), [Fofa](https://fofa.info/static_pages/api_help), [FullHunt](https://fullhunt.io), [GitHub](https://github.com), [Intelx](https://intelx.io), [PassiveTotal](http://passivetotal.org), [quake](https://quake.360.cn), [Robtex](https://www.robtex.com/api/), [SecurityTrails](http://securitytrails.com), [Shodan](https://shodan.io), [ThreatBook](https://x.threatbook.cn/en), [VirusTotal](https://www.virustotal.com), [WhoisXML API](https://whoisxmlapi.com/), [ZoomEye](https://www.zoomeye.org), [ZoomEye API](https://api.zoomeye.org), [dnsrepo](https://dnsrepo.noc.org), [Hunter](https://hunter.qianxin.com/)
116120

117-
[BeVigil](https://bevigil.com/osint-api), [Binaryedge](https://binaryedge.io), [C99](https://api.c99.nl/), [Certspotter](https://sslmate.com/certspotter/api/), [Chinaz](http://my.chinaz.com/ChinazAPI/DataCenter/MyDataApi), [Censys](https://censys.io), [Chaos](https://chaos.projectdiscovery.io), [DnsDB](https://api.dnsdb.info), [Fofa](https://fofa.info/static_pages/api_help), [Github](https://github.com), [Intelx](https://intelx.io), [Passivetotal](http://passivetotal.org), [Robtex](https://www.robtex.com/api/), [SecurityTrails](http://securitytrails.com), [Shodan](https://shodan.io), [Threatbook](https://x.threatbook.cn/en), [Virustotal](https://www.virustotal.com), [WhoisXML API](https://whoisxmlapi.com/), [Zoomeye](https://www.zoomeye.org)
121+
You can also use the `subfinder -ls` command to display all the available sources.
118122

119-
These values are stored in the `$HOME/.config/subfinder/provider-config.yaml` file which will be created when you run the tool for the first time. The configuration file uses the YAML format. Multiple API keys can be specified for each of these services from which one of them will be used for enumeration.
123+
These values are stored in the `$HOME/.config/subfinder/provider-config.yaml` file which will be created when you run the tool for the first time. The configuration file uses the YAML format. Multiple API keys
124+
can be specified for each of these services from which one of them will be used for enumeration.
120125

121-
For sources that require multiple keys, namely `Censys`, `Passivetotal`, they can be added by separating them via a colon (:).
126+
Composite keys for sources like, `Censys`, `PassiveTotal`, `Fofa`, `Intellix` and `ZoomEye`, need to be separated with a colon (`:`).
122127

123-
An example provider config file -
128+
An example provider config file:
124129

125130
```yaml
126131
binaryedge:
@@ -137,6 +142,8 @@ shodan:
137142
github:
138143
- ghp_lkyJGU3jv1xmwk4SDXavrLDJ4dl2pSJMzj4X
139144
- ghp_gkUuhkIYdQPj13ifH4KA3cXRn8JD2lqir2d4
145+
zoomeye:
146+
- zoomeye_username:zoomeye_password
140147
```
141148
142149
# Running Subfinder
@@ -182,7 +189,8 @@ events.hackerone.com
182189
[INF] Found 18 subdomains for hackerone.com in 3 seconds 672 milliseconds
183190
```
184191

185-
The subdomains discovered can be piped to other tools too. For example, you can pipe the subdomains discovered by subfinder to httpx [httpx](https://github.com/projectdiscovery/httpx) which will then find running http servers on the host.
192+
The subdomains discovered can be piped to other tools too. For example, you can pipe the discovered subdomains to [`httpx`](https://github.com/projectdiscovery/httpx) which will then find
193+
running HTTP servers on the host.
186194

187195
```console
188196
echo hackerone.com | subfinder -silent | httpx -silent
@@ -207,13 +215,13 @@ Pull the latest tagged [subfinder](https://hub.docker.com/r/projectdiscovery/sub
207215
docker pull projectdiscovery/subfinder:latest
208216
```
209217

210-
Running subfinder using docker image:
218+
Running `subfinder` using the docker image:
211219

212220
```sh
213221
docker run projectdiscovery/subfinder:latest -d hackerone.com
214222
```
215223

216-
Running subfinder using docker image with local config file:
224+
Running `subfinder` using the docker image, with a local config file:
217225

218226
```sh
219227
docker run -v $HOME/.config/subfinder:/root/.config/subfinder -t projectdiscovery/subfinder -d hackerone.com
@@ -236,30 +244,27 @@ package main
236244

237245
import (
238246
"bytes"
239-
"context"
240247
"fmt"
241248
"io"
242249
"log"
243250

244-
"github.com/projectdiscovery/subfinder/v2/pkg/passive"
245251
"github.com/projectdiscovery/subfinder/v2/pkg/resolve"
246252
"github.com/projectdiscovery/subfinder/v2/pkg/runner"
247253
)
248254

249255
func main() {
250256
runnerInstance, err := runner.NewRunner(&runner.Options{
251-
Threads: 10, // Thread controls the number of threads to use for active enumerations
252-
Timeout: 30, // Timeout is the seconds to wait for sources to respond
253-
MaxEnumerationTime: 10, // MaxEnumerationTime is the maximum amount of time in mins to wait for enumeration
257+
Threads: 10, // Thread controls the number of threads to use for active enumerations
258+
Timeout: 30, // Timeout is the seconds to wait for sources to respond
259+
MaxEnumerationTime: 10, // MaxEnumerationTime is the maximum amount of time in mins to wait for enumeration
254260
Resolvers: resolve.DefaultResolvers, // Use the default list of resolvers by marshaling it to the config
255-
Sources: passive.DefaultSources, // Use the default list of passive sources
256-
AllSources: passive.DefaultAllSources, // Use the default list of all passive sources
257-
Recursive: passive.DefaultRecursiveSources, // Use the default list of recursive sources
258-
Providers: &runner.Providers{}, // Use empty api keys for all providers
259-
})
261+
ResultCallback: func(s *resolve.HostEntry) { // Callback function to execute for available host
262+
log.Println(s.Host, s.Source)
263+
},
264+
})
260265

261266
buf := bytes.Buffer{}
262-
err = runnerInstance.EnumerateSingleDomain(context.Background(), "projectdiscovery.io", []io.Writer{&buf})
267+
err = runnerInstance.EnumerateSingleDomain("projectdiscovery.io", []io.Writer{&buf})
263268
if err != nil {
264269
log.Fatal(err)
265270
}
@@ -283,6 +288,7 @@ func main() {
283288

284289
# License
285290

286-
`subfinder` is made with 🖤 by the [projectdiscovery](https://projectdiscovery.io) team. Community contributions have made the project what it is. See the **[Thanks.md](https://github.com/projectdiscovery/subfinder/blob/master/THANKS.md)** file for more details.
291+
`subfinder` is made with 🖤 by the [projectdiscovery](https://projectdiscovery.io) team. Community contributions have made the project what it is. See
292+
the **[THANKS.md](https://github.com/projectdiscovery/subfinder/blob/master/THANKS.md)** file for more details.
287293

288-
Read the disclaimer for usage at [DISCLAIMER.md](https://github.com/projectdiscovery/subfinder/blob/master/DISCLAIMER.md) and [contact us](mailto:[email protected]) for any API removal.
294+
Read the usage disclaimer at [DISCLAIMER.md](https://github.com/projectdiscovery/subfinder/blob/master/DISCLAIMER.md) and [contact us](mailto:[email protected]) for any API removal.

v2/go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ require (
99
github.com/lib/pq v1.10.7
1010
github.com/projectdiscovery/chaos-client v0.3.0
1111
github.com/projectdiscovery/dnsx v1.1.1
12-
github.com/projectdiscovery/fdmax v0.0.3
13-
github.com/projectdiscovery/fileutil v0.0.1
12+
github.com/projectdiscovery/fdmax v0.0.4
13+
github.com/projectdiscovery/fileutil v0.0.3
1414
github.com/projectdiscovery/gologger v1.1.5-0.20220817095646-8663411b1b0b
1515
github.com/projectdiscovery/ratelimit v0.0.1
1616
github.com/rs/xid v1.4.0
17-
github.com/stretchr/testify v1.8.0
17+
github.com/stretchr/testify v1.8.1
1818
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
1919
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
2020
gopkg.in/yaml.v3 v3.0.1
@@ -27,7 +27,7 @@ require (
2727
github.com/golang/snappy v0.0.4 // indirect
2828
github.com/gorilla/css v1.0.0 // indirect
2929
github.com/mholt/archiver v3.1.1+incompatible // indirect
30-
github.com/microcosm-cc/bluemonday v1.0.20 // indirect
30+
github.com/microcosm-cc/bluemonday v1.0.21 // indirect
3131
github.com/nwaples/rardecode v1.1.0 // indirect
3232
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
3333
github.com/projectdiscovery/blackrock v0.0.0-20220628111055-35616c71b2dc // indirect
@@ -44,7 +44,7 @@ require (
4444
go.uber.org/atomic v1.9.0 // indirect
4545
go.uber.org/multierr v1.8.0 // indirect
4646
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
47-
golang.org/x/text v0.3.7 // indirect
47+
golang.org/x/text v0.4.0 // indirect
4848
golang.org/x/tools v0.1.12 // indirect
4949
gopkg.in/djherbis/times.v1 v1.2.0 // indirect
5050
)
@@ -58,9 +58,9 @@ require (
5858
github.com/modern-go/reflect2 v1.0.2 // indirect
5959
github.com/pkg/errors v0.9.1
6060
github.com/pmezard/go-difflib v1.0.0 // indirect
61-
github.com/projectdiscovery/goflags v0.1.1
61+
github.com/projectdiscovery/goflags v0.1.3
6262
github.com/projectdiscovery/retryabledns v1.0.15 // indirect
63-
github.com/projectdiscovery/stringsutil v0.0.1 // indirect
64-
golang.org/x/net v0.0.0-20220927171203-f486391704dc // indirect
65-
golang.org/x/sys v0.0.0-20220731174439-a90be440212d // indirect
63+
github.com/projectdiscovery/stringsutil v0.0.2 // indirect
64+
golang.org/x/net v0.1.0 // indirect
65+
golang.org/x/sys v0.2.0 // indirect
6666
)

0 commit comments

Comments
 (0)