From 31c3ad1367cfe39807ea32045a389c74a92e3b5b Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:05:09 +0000 Subject: [PATCH 1/7] create BuildDomains function --- gosearch.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gosearch.go b/gosearch.go index a1c9649..1123ea3 100644 --- a/gosearch.go +++ b/gosearch.go @@ -262,6 +262,45 @@ func BuildEmail(username string) []string { return emails } + +func BuildDomains(username string) []string { + tlds := []string{ + ".com", + ".net", + ".org", + ".biz", + ".info", + ".name", + ".pro", + ".cat", + ".co", + ".me", + ".io", + ".tech", + ".dev", + ".app", + ".shop", + ".fail", + ".xyz", + ".blog", + ".portfolio", + ".store", + ".online", + ".about", + ".space", + ".lol", + ".fun", + ".social", + } + + var domains []string + + for _, tld := range tlds { + domains = append(domains, username + tld) + } + + return domains +} func SearchBreachDirectory(emails []string, apikey string, wg *sync.WaitGroup) { defer wg.Done() From 312bc4cea58932b7c8cd5984486764b8f3eeefa0 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:13:05 +0000 Subject: [PATCH 2/7] create SearchDomains function --- gosearch.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gosearch.go b/gosearch.go index 1123ea3..9882d31 100644 --- a/gosearch.go +++ b/gosearch.go @@ -31,6 +31,7 @@ var ASCII string = ` ` var VERSION string = "v1.0.0" var count uint16 = 0 // Maximum value for count is 65,535 +var domaincount uint8 = 0 // Maximum value for domaincount is 255 type Website struct { Name string `json:"name"` @@ -301,6 +302,42 @@ func BuildDomains(username string) []string { return domains } + +func SearchDomains(username string, domains []string, wg *sync.WaitGroup) { + defer wg.Done() + + client := &http.Client{} + + + fmt.Println(Yellow + "[*] Searching", len(domains), "with the username", username + Reset) + + for _, domain := range domains { + + req, err := http.NewRequest("GET", domain, nil) + if err != nil { + fmt.Printf("Error creating request in function SearchDomains: %v\n", err) + return + } + req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0") + + resp, err := client.Do(req) + if err != nil { + fmt.Printf("Error sending request in function SearchDomains: %v\n", err) + return + } + + if resp.StatusCode == 200 { + fmt.Println(Green + "[+] 200 OK:", domain + Reset) + domaincount++ + } + + if domaincount > 0 { + fmt.Println(Green + "[+] Found", domaincount, "domains with the username", username + Reset) + } else { + fmt.Println(Red + "[-] No domains found with the username", username + Reset) + } +}} + func SearchBreachDirectory(emails []string, apikey string, wg *sync.WaitGroup) { defer wg.Done() From a80b76ee6a51bb132a4c69a395787e7f1c1eba95 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:15:03 +0000 Subject: [PATCH 3/7] add logic to search domains --- gosearch.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gosearch.go b/gosearch.go index 9882d31..8db2a59 100644 --- a/gosearch.go +++ b/gosearch.go @@ -624,6 +624,12 @@ func main() { wg.Wait() } + domains := BuildDomains(username) + fmt.Println(strings.Repeat("⎯", 85)) + wg.Add(1) + go SearchDomains(username, domains, &wg) + wg.Wait() + elapsed := time.Since(start) fmt.Println(strings.Repeat("⎯", 85)) fmt.Println(":: Number of profiles found : ", count) From a975afb674e80a38f1441f866233453127383dfb Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:18:45 +0000 Subject: [PATCH 4/7] add protocol to url --- gosearch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gosearch.go b/gosearch.go index 8db2a59..777183b 100644 --- a/gosearch.go +++ b/gosearch.go @@ -313,7 +313,7 @@ func SearchDomains(username string, domains []string, wg *sync.WaitGroup) { for _, domain := range domains { - req, err := http.NewRequest("GET", domain, nil) + req, err := http.NewRequest("GET", "http" + domain, nil) if err != nil { fmt.Printf("Error creating request in function SearchDomains: %v\n", err) return From 4b0680f85bbb9f5256c2a276a0aa2df4e33a32ca Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:19:13 +0000 Subject: [PATCH 5/7] add domains to len(domains) --- gosearch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gosearch.go b/gosearch.go index 777183b..f05af01 100644 --- a/gosearch.go +++ b/gosearch.go @@ -309,7 +309,7 @@ func SearchDomains(username string, domains []string, wg *sync.WaitGroup) { client := &http.Client{} - fmt.Println(Yellow + "[*] Searching", len(domains), "with the username", username + Reset) + fmt.Println(Yellow + "[*] Searching", len(domains), "domains with the username", username + Reset) for _, domain := range domains { From 560fa91265c345f5ec6da8d806118dc17017eff1 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:20:17 +0000 Subject: [PATCH 6/7] add missing :// to http protocol in url --- gosearch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gosearch.go b/gosearch.go index f05af01..fc3dbde 100644 --- a/gosearch.go +++ b/gosearch.go @@ -313,7 +313,7 @@ func SearchDomains(username string, domains []string, wg *sync.WaitGroup) { for _, domain := range domains { - req, err := http.NewRequest("GET", "http" + domain, nil) + req, err := http.NewRequest("GET", "http://" + domain, nil) if err != nil { fmt.Printf("Error creating request in function SearchDomains: %v\n", err) return From 909b61ad3e5cb071f50407aa92a9880003bccf3f Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 25 Dec 2024 20:24:25 +0000 Subject: [PATCH 7/7] add ... to the end of the print --- gosearch.go | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/gosearch.go b/gosearch.go index fc3dbde..72573c3 100644 --- a/gosearch.go +++ b/gosearch.go @@ -8,6 +8,7 @@ import ( "time" "sync" "strings" + "net" "net/http" "crypto/tls" "encoding/json" @@ -307,36 +308,45 @@ func SearchDomains(username string, domains []string, wg *sync.WaitGroup) { defer wg.Done() client := &http.Client{} + fmt.Println(Yellow + "[*] Searching", len(domains), "domains with the username", username, "..." + Reset) - - fmt.Println(Yellow + "[*] Searching", len(domains), "domains with the username", username + Reset) + domaincount := 0 for _, domain := range domains { + url := "http://" + domain - req, err := http.NewRequest("GET", "http://" + domain, nil) + req, err := http.NewRequest("GET", url, nil) if err != nil { - fmt.Printf("Error creating request in function SearchDomains: %v\n", err) - return + fmt.Printf("Error creating request for %s: %v\n", domain, err) + continue } req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0") resp, err := client.Do(req) if err != nil { - fmt.Printf("Error sending request in function SearchDomains: %v\n", err) - return + if strings.Contains(err.Error(), "no such host") { + continue // this means the domain doesn't exist + } else if netErr, ok := err.(net.Error); ok && netErr.Timeout() { + continue // this also means the domain doesn't exist + } else { + fmt.Printf("Error sending request for %s: %v\n", domain, err) + } + continue } + defer resp.Body.Close() if resp.StatusCode == 200 { fmt.Println(Green + "[+] 200 OK:", domain + Reset) domaincount++ } + } - if domaincount > 0 { - fmt.Println(Green + "[+] Found", domaincount, "domains with the username", username + Reset) - } else { - fmt.Println(Red + "[-] No domains found with the username", username + Reset) - } -}} + if domaincount > 0 { + fmt.Println(Green + "[+] Found", domaincount, "domains with the username", username + Reset) + } else { + fmt.Println(Red + "[-] No domains found with the username", username + Reset) + } +} func SearchBreachDirectory(emails []string, apikey string, wg *sync.WaitGroup) {