-
Notifications
You must be signed in to change notification settings - Fork 1
/
massdns.go
77 lines (66 loc) · 2.03 KB
/
massdns.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package massdns
import (
"sync"
"github.com/khulnasoft-lab/shuffledns/pkg/wildcards"
)
// Client is a client for running massdns on a target
type Client struct {
config Config
wildcardIPMap map[string]struct{}
wildcardIPMutex *sync.RWMutex
wildcardResolver *wildcards.Resolver
}
// Config contains configuration options for the massdns client
type Config struct {
// Domain is the domain specified for enumeration
Domain string
// Retries is the number of retries for dns
Retries int
// MassdnsPath is the path to the binary
MassdnsPath string
// Threads is the hashmap size for massdns
Threads int
// InputFile is the file to use for massdns input
InputFile string
// ResolversFile is the file with the resolvers
ResolversFile string
// TempDir is a temporary directory for storing massdns misc files
TempDir string
// OutputFile is the file to use for massdns output
OutputFile string
// Json is format ouput to ndjson format
Json bool
// WildcardsThreads is the number of wildcards concurrent threads
WildcardsThreads int
// MassdnsRaw perform wildcards filtering from an existing massdns output file
MassdnsRaw string
// StrictWildcard controls whether the wildcard check should be performed on each result
StrictWildcard bool
// WildcardOutputFile is the file where the list of wildcards is dumped
WildcardOutputFile string
// MassDnsCmd supports massdns flags
MassDnsCmd string
}
// excellentResolvers contains some resolvers used in dns verification step
var excellentResolvers = []string{
"1.1.1.1",
"1.0.0.1",
"8.8.8.8",
"8.8.4.4",
}
// New returns a new massdns client for running enumeration
// on a target.
func New(config Config) (*Client, error) {
// Create a resolver and load resolverrs from list
resolver, err := wildcards.NewResolver(config.Domain, config.Retries)
if err != nil {
return nil, err
}
resolver.AddServersFromList(excellentResolvers)
return &Client{
config: config,
wildcardIPMap: make(map[string]struct{}),
wildcardIPMutex: &sync.RWMutex{},
wildcardResolver: resolver,
}, nil
}