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)
fmt.Println(run.Wildcard("disney.com"))
fmt.Println(dns.Verify("shop.disney.com"))
run.Start()
}
```

View File

@ -1,6 +1,7 @@
package main
import (
"errors"
"fmt"
"os"
"slices"
@ -28,14 +29,16 @@ const banner = `___ _ _ _ _ _ _
// Runner options
var opts runner.Options
// CLI flags
var (
// CLI flags
wordlist string
resolvers string
output string
wildcard bool
verify bool
verbose bool
// File mutex
mu sync.Mutex
)
@ -112,6 +115,15 @@ var rootCmd = &cobra.Command{
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
domains[result.Domain] += 1
@ -172,6 +184,10 @@ var rootCmd = &cobra.Command{
log.Warn().Msg("IPv4 is enabled")
}
if verify {
log.Warn().Msg("Verify is enabled")
}
// Wildcard enabled
if wildcard {
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(&wildcard, "wildcard", "d", false, "Query for wildcard")
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().BoolVarP(&verbose, "verbose", "v", false, "Verbose logging")

View File

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

View File

@ -45,15 +45,6 @@ func (q *Query) Lookup() {
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
var ips []string
@ -82,7 +73,9 @@ func (q *Query) Lookup() {
// No IPs found
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
return
}

View File

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

View File

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

View File

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