yellow.git


yellow

~ opinionated web scanning pipeline for pentesters in a hurry
git clone https://github.com/djnnvx/yellow.git
log | files | refs | archive | README | LICENSE

commit aa21182759c5a7c7154ab77a534a422043b11e37
parent 051913a1d891f4755da967e94609ffd61b9bb458
Author: djnn <[email protected]>
Date: Tue, 3 Dec 2024 21:56:44 +0900

fix(osint): fuck you it works

Diffstat:
Mcli/parser.go | 2+-
Mhelpers/strings.go | 21+++++++++++++++++++++
Mosint/assetfinder.go | 2+-
Mosint/dorks.go | 4++--
Dosint/gowitness.go | 20--------------------
Mosint/httpx.go | 2+-
Mosint/run.go | 16+++++++++-------
Mosint/subfinder.go | 4++--

8 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/cli/parser.go b/cli/parser.go
@@ -42,7 +42,7 @@ func GetParser(opts *StandardOptions) *cobra.Command {
 
 			// if used create subcommand, put the results in scans
 			if helper.Exists(opts.OutDirName + "/scans/") {
-				osintOpts.SetScanPath(opts.OutDirName + "/scans/")
+				osintOpts.SetScanPath(opts.OutDirName + "/scans")
 			}
 
 			if opts.TargetFilePath == "" {
diff --git a/helpers/strings.go b/helpers/strings.go
@@ -17,3 +17,24 @@ func ReplaceWithHyphen(input string) string {
 
 	return result.String()
 }
+
+// if its not a valid domain in the end, not too big of a deal,
+// we just want an approximate response
+func StringHasUnwantedCharacters(url string) bool {
+	badChars := ";\t\n, +\\\"[]{}()"
+	for _, b := range badChars {
+		if strings.Contains(url, string(b)) {
+			return true
+		}
+	}
+
+	if strings.HasSuffix(url, ".") {
+		return true
+	}
+
+	if strings.HasPrefix(url, "Name") {
+		return true
+	}
+
+	return false
+}
diff --git a/osint/assetfinder.go b/osint/assetfinder.go
@@ -94,5 +94,5 @@ func (a *Assetfinder) Run(url string) {
 		file.WriteString(n + string('\n'))
 	}
 
-	fmt.Printf("[OSINT %s] Assetfinder done.\n", url, a.outfile)
+	fmt.Printf("[OSINT %s] Assetfinder done.\n\n", url, a.outfile)
 }
diff --git a/osint/dorks.go b/osint/dorks.go
@@ -12,7 +12,7 @@ type Dorks struct {
 }
 
 func (d *Dorks) Info(url string) {
-	fmt.Println("[+] Running dorks on ", url)
+	fmt.Println("[+] Running dorks on", url)
 }
 
 func (d *Dorks) Configure(c interface{}) {
@@ -32,5 +32,5 @@ func (d *Dorks) Run(domain string) {
 	}
 
 	dorks.Run(opts)
-	fmt.Printf("[OSINT %s] Dorks are stored in %s\n", domain, d.outfile)
+	fmt.Printf("[OSINT %s] Dorks are stored in %s\n\n", domain, d.outfile)
 }
diff --git a/osint/gowitness.go b/osint/gowitness.go
@@ -1,20 +0,0 @@
-package osint
-
-import (
-	"fmt"
-)
-
-type Gowitness struct {
-}
-
-func (h *Gowitness) Info(url string) {
-	fmt.Println("[+] Running gowitness on %s", url)
-}
-
-func (h *Gowitness) Configure(c interface{}) {
-
-}
-
-func (h *Gowitness) Run(domain string) {
-	fmt.Printf("[OSINT %s] gowitness completed.", domain)
-}
diff --git a/osint/httpx.go b/osint/httpx.go
@@ -45,5 +45,5 @@ func (h *Httpx) Run(domain string) {
 	defer httpxRunner.Close()
 
 	httpxRunner.RunEnumeration()
-	fmt.Printf("[OSINT %s] httpx completed.\n", domain)
+	fmt.Printf("[OSINT %s] httpx completed.\n\n", domain)
 }
diff --git a/osint/run.go b/osint/run.go
@@ -7,6 +7,8 @@ import (
 	"net"
 	"slices"
 	"strings"
+
+	"evil.djnn.sh/djnn/yellow/helpers"
 )
 
 type OsintOpts struct {
@@ -144,25 +146,25 @@ func (opts OsintOpts) Run() {
 			panic(err)
 		}
 
-		/* FIXME(djnn): parsing from dnsx is fucked, need to fix it tomorrow */
-
 		/* check if valid IP address / domain & if it's already in the list */
 		lines := strings.Split(strings.ReplaceAll(string(newDomains), "\r\n", "\n"), "\n")
 		for _, domain := range lines {
 
+			parsedDomain := strings.Trim(domain, "\t \",")
+
 			// already exists in list
-			if slices.Contains(domains, domain) {
+			if slices.Contains(domains, parsedDomain) {
 				continue
 			}
 
 			// is IP address ?
-			addr := net.ParseIP(domain)
+			addr := net.ParseIP(parsedDomain)
 
 			// does it look like a domain name ? at least one .
 			// (hacky, but no need to make it better for now)
-			if addr != nil || strings.Contains(domain, ".") {
-				domains = append(domains, domain)
-				domainBuffer.Write([]byte(string(domain) + "\n"))
+			if addr != nil || !helper.StringHasUnwantedCharacters(parsedDomain) {
+				domains = append(domains, parsedDomain)
+				domainBuffer.Write([]byte(string(parsedDomain) + "\n"))
 			}
 		}
 	}
diff --git a/osint/subfinder.go b/osint/subfinder.go
@@ -16,7 +16,7 @@ type Subfinder struct {
 }
 
 func (s *Subfinder) Info(url string) {
-	fmt.Println("[+] Running subfinder on %s", url)
+	fmt.Println("[+] Running subfinder on", url)
 }
 
 func (s *Subfinder) Configure(c interface{}) {
@@ -59,5 +59,5 @@ func (s *Subfinder) Run(domain string) {
 		panic(err)
 	}
 
-	fmt.Printf("[OSINT %s] Subfinder are stored in %s", domain, s.outfile)
+	fmt.Printf("[OSINT %s] Subfinder are stored in %s\n\n", domain, s.outfile)
 }