Skip to content

Commit

Permalink
Implement -silent flag
Browse files Browse the repository at this point in the history
  • Loading branch information
topscoder committed May 30, 2024
1 parent 5d588e9 commit 5cd8060
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ func main() {
domainsFile := flag.String("domains", "", "The file containing the domains to be checked")
fingerprintsArg := flag.String("fingerprints", "", "URL or local file path to the fingerprints.json file to be used")
threads := flag.Int("threads", 5, "The amount of threads to be used")
silent := flag.Bool("silent", false, "Only print vulnerable domains")

// Parse command-line flags
flag.Parse()

// Check if the domains file is provided
if *domainsFile == "" {
fmt.Println("Usage: subgomain -domains <filename> [-fingerprints <url_or_local_path>] [-threads <int>]")
fmt.Println("Usage: subgomain -domains <filename> [-fingerprints <url_or_local_path>] [-threads <int>] [-silent]")
os.Exit(1)
}

Expand Down Expand Up @@ -62,14 +63,18 @@ func main() {
for domain := range domainChan {
vulnerable, err := domainchecker.CheckDomain(domain, fps)
if err != nil {
fmt.Printf("[ERROR] [Domain %s: %v]\n", domain, err)
if !*silent {
fmt.Printf("[ERROR] [%s]: %v\n", domain, err)
}
continue
}

if vulnerable {
fmt.Printf("[vulnerable] [%s]\n", domain)
fmt.Printf("[VULNERABLE] [%s]\n", domain)
} else {
fmt.Printf("[not vulnerable] [%s]\n", domain)
if !*silent {
fmt.Printf("[NOT VULNERABLE] [%s]\n", domain)
}
}
}
}()
Expand Down

0 comments on commit 5cd8060

Please sign in to comment.