blink/v1/pkg/runner/options.go
2024-07-08 02:04:54 +01:00

64 lines
1.3 KiB
Go

package runner
import (
"strings"
"git.supernets.org/perp/blink/v1/pkg/dns"
)
// Configuration options
type Options struct {
Domains []string // Target domains
Wordlist []string // Target wordlist
Resolvers []string // Target resolvers
// ENT bool // Query for ENT
UDP bool // Query using UDP
IPv6 bool // Query for IPv6
Wildcard bool // Detect wildcard
// Verify bool // Verify query
Timeout int // Query timeout
Threads int // Concurrent threads
OnResult OnResultFunc // Result handler
}
// Result handler function
type OnResultFunc func(*dns.Result)
// Check resolvers
func (o *Options) resolvers() {
// No resolvers found
if len(o.Resolvers) == 0 {
o.Resolvers = append(o.Resolvers, "1.1.1.1:53")
o.Resolvers = append(o.Resolvers, "9.9.9.9:53")
return
}
// Go through resolvers
for index, resolver := range o.Resolvers {
// Split
split := strings.Split(resolver, ":")
// No port found
if len(split) == 1 {
// Ignore empty & commented lines
if resolver != "" && !strings.HasPrefix(resolver, "#") {
o.Resolvers[index] = resolver + ":53"
}
}
}
}
// Check threads
func (o *Options) threads() {
// No threads found
if o.Threads == 0 {
o.Threads = 1
}
}
// Check options
func (o *Options) Check() {
o.resolvers()
o.threads()
}