Fixed verifying

This commit is contained in:
perp 2024-07-09 19:35:30 +01:00
parent b08e5c43c3
commit 81abf8706d
7 changed files with 23 additions and 16 deletions

View File

@ -67,6 +67,7 @@ func main() {
run := runner.New(opts) run := runner.New(opts)
fmt.Println(run.Wildcard("disney.com")) fmt.Println(run.Wildcard("disney.com"))
fmt.Println(dns.Verify("shop.disney.com"))
run.Start() run.Start()
} }
``` ```

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"slices" "slices"
@ -28,14 +29,16 @@ const banner = `___ _ _ _ _ _ _
// Runner options // Runner options
var opts runner.Options var opts runner.Options
// CLI flags
var ( var (
// CLI flags
wordlist string wordlist string
resolvers string resolvers string
output string output string
wildcard bool wildcard bool
verify bool
verbose bool verbose bool
// File mutex
mu sync.Mutex mu sync.Mutex
) )
@ -112,6 +115,15 @@ var rootCmd = &cobra.Command{
return return
} }
// Verify check
if verify {
if !dns.Verify(result.Subdomain) {
log.Err(errors.New(fmt.Sprintf("Could not verify %s", result.Subdomain))).
Msg("")
return
}
}
// Append domain // Append domain
domains[result.Domain] += 1 domains[result.Domain] += 1
@ -172,6 +184,10 @@ var rootCmd = &cobra.Command{
log.Warn().Msg("IPv4 is enabled") log.Warn().Msg("IPv4 is enabled")
} }
if verify {
log.Warn().Msg("Verify is enabled")
}
// Wildcard enabled // Wildcard enabled
if wildcard { if wildcard {
log.Warn().Msg("Wildcard is enabled") log.Warn().Msg("Wildcard is enabled")
@ -210,7 +226,7 @@ func init() {
rootCmd.Flags().BoolVarP(&opts.IPv6, "ipv6", "i", false, "Query for IPv6") rootCmd.Flags().BoolVarP(&opts.IPv6, "ipv6", "i", false, "Query for IPv6")
rootCmd.Flags().BoolVarP(&wildcard, "wildcard", "d", false, "Query for wildcard") rootCmd.Flags().BoolVarP(&wildcard, "wildcard", "d", false, "Query for wildcard")
rootCmd.Flags().IntVarP(&opts.Timeout, "timeout", "t", 5, "Query timeout") rootCmd.Flags().IntVarP(&opts.Timeout, "timeout", "t", 5, "Query timeout")
rootCmd.Flags().BoolVarP(&opts.Verify, "verify", "y", false, "Verify query") rootCmd.Flags().BoolVarP(&verify, "verify", "y", false, "Verify query")
rootCmd.Flags().IntVarP(&opts.Threads, "threads", "c", 1, "Concurrent threads") rootCmd.Flags().IntVarP(&opts.Threads, "threads", "c", 1, "Concurrent threads")
rootCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Verbose logging") rootCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Verbose logging")

View File

@ -11,7 +11,6 @@ import (
type Query struct { type Query struct {
Client *dns.Client // DNS client Client *dns.Client // DNS client
IPv6 bool // IPv6 mode IPv6 bool // IPv6 mode
Verify bool // Verify mode
Resolvers []string // Target resolvers Resolvers []string // Target resolvers
Domain string // Target domain Domain string // Target domain
Subdomain string // Target subdomain Subdomain string // Target subdomain

View File

@ -45,15 +45,6 @@ func (q *Query) Lookup() {
return return
} }
// Verify check
if q.Verify {
if Verify(q.Subdomain) {
result.Error = errors.New(fmt.Sprintf("Could not verify %s", q.Subdomain))
q.Results <- result
return
}
}
// Store IPs // Store IPs
var ips []string var ips []string
@ -82,7 +73,9 @@ func (q *Query) Lookup() {
// No IPs found // No IPs found
if len(ips) < 1 { if len(ips) < 1 {
result.Error = errors.New(fmt.Sprintf("No IPs found for %s", q.Domain)) result.Error = errors.New(
fmt.Sprintf("No IPs found for %s (%s)", q.Domain, q.Subdomain),
)
q.Results <- result q.Results <- result
return return
} }

View File

@ -6,7 +6,7 @@ import (
// Verify subdomain // Verify subdomain
func Verify(subdomain string) bool { func Verify(subdomain string) bool {
_, err := http.Get(subdomain) _, err := http.Get("http://" + subdomain)
if err != nil { if err != nil {
return false return false
} }

View File

@ -12,7 +12,6 @@ type Options struct {
UDP bool // Query using UDP UDP bool // Query using UDP
IPv6 bool // Query for IPv6 IPv6 bool // Query for IPv6
Timeout int // Query timeout Timeout int // Query timeout
Verify bool // Verify query
Threads int // Concurrent threads Threads int // Concurrent threads
OnResult OnResultFunc // Result handler OnResult OnResultFunc // Result handler

View File

@ -64,7 +64,6 @@ func (r *Runner) Submit() {
query := &dns.Query{ query := &dns.Query{
Client: r.client, Client: r.client,
IPv6: r.options.IPv6, IPv6: r.options.IPv6,
Verify: r.options.Verify,
Resolvers: r.options.Resolvers, Resolvers: r.options.Resolvers,
Domain: domain, Domain: domain,
Subdomain: word + "." + domain, Subdomain: word + "." + domain,