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 3bf4ba6e69bd971d2a5b77970c80abbf51f215b3
parent 5ca8f13e38a0f28ee1146c7d413625f83e521d2a
Author: djnn <[email protected]>
Date: Sun, 9 Mar 2025 20:12:26 +0900

feat(meta): cleaning up some code debt:)

Diffstat:
Mhelpers/file.go | 3+--
Mhelpers/net.go | 6+++---
Mosint/assetfinder.go | 6+++---
Mosint/dnsx.go | 6+++---
Mosint/dorks.go | 6+++---
Mosint/run.go | 14+++++++-------
Mosint/subfinder.go | 4++--
Mscan/gobuster.go | 12++++++------
Mscan/httpx.go | 10+++++-----
Mscan/naabu.go | 14+++++++-------
Mscan/robotstxt.go | 10+++++-----
Mscan/run.go | 12++++++------
Mscan/sitemap.go | 8++++----
Mscan/wappalyzergo.go | 8++++----

14 files changed, 59 insertions(+), 60 deletions(-)

diff --git a/helpers/file.go b/helpers/file.go
@@ -4,7 +4,6 @@ import (
 	"bufio"
 	"fmt"
 	"io"
-	"io/ioutil"
 	"os"
 )
 
@@ -20,7 +19,7 @@ func LoadTargetFile(targetPath string) *FileScanner {
 	}
 
 	scanner := bufio.NewScanner(file)
-	body, err := ioutil.ReadFile(targetPath)
+	body, err := os.ReadFile(targetPath)
 	if err != nil {
 		fmt.Printf("%v, %+v", err, targetPath)
 	}
diff --git a/helpers/net.go b/helpers/net.go
@@ -3,7 +3,7 @@ package helper
 import (
 	"crypto/tls"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/url"
 
@@ -63,7 +63,7 @@ func GetCurrentIP() string {
 		return ""
 	}
 
-	result, err := ioutil.ReadAll(resp.Body)
+	result, err := io.ReadAll(resp.Body)
 	if err != nil {
 		fmt.Printf("[!] Could not IP address: %s\n", err.Error())
 		return ""
@@ -89,7 +89,7 @@ func CheckProxy(proxy string) {
 	os.Setenv("HTTPS_PROXY", proxy)
 
 	if proxy != "" {
-		fmt.Println("[+] Proxy configuration: %s", proxy)
+		fmt.Printf("[+] Proxy configuration: %s\n", proxy)
 	} else {
 		fmt.Println("[+] No proxy has been set")
 	}
diff --git a/osint/assetfinder.go b/osint/assetfinder.go
@@ -29,9 +29,9 @@ func (a *Assetfinder) Info(url string) {
 	fmt.Println("[+] Running Assetfinder on ", url)
 }
 
-func (a *Assetfinder) Configure(c interface{}) {
-	a.scanPath = c.(map[string]interface{})["scanPath"].(string)
-	a.outfile = c.(map[string]interface{})["outfile"].(string)
+func (a *Assetfinder) Configure(c any) {
+	a.scanPath = c.(map[string]any)["scanPath"].(string)
+	a.outfile = c.(map[string]any)["outfile"].(string)
 
 	a.functions = []fetchFn{
 		assetfinder.CertSpotter,
diff --git a/osint/dnsx.go b/osint/dnsx.go
@@ -18,9 +18,9 @@ func (d *Dnsx) Info(url string) {
 	fmt.Println("[+] Running dnsx on ", url)
 }
 
-func (d *Dnsx) Configure(c interface{}) {
-	d.outfile = c.(map[string]interface{})["outfile"].(string)
-	d.proxy = c.(map[string]interface{})["proxy"].(string)
+func (d *Dnsx) Configure(c any) {
+	d.outfile = c.(map[string]any)["outfile"].(string)
+	d.proxy = c.(map[string]any)["proxy"].(string)
 }
 
 func (d *Dnsx) Run(domain string) {
diff --git a/osint/dorks.go b/osint/dorks.go
@@ -15,9 +15,9 @@ func (d *Dorks) Info(url string) {
 	fmt.Println("[+] Running dorks on", url)
 }
 
-func (d *Dorks) Configure(c interface{}) {
-	d.outfile = c.(map[string]interface{})["outfile"].(string)
-	d.proxy = c.(map[string]interface{})["proxy"].(string)
+func (d *Dorks) Configure(c any) {
+	d.outfile = c.(map[string]any)["outfile"].(string)
+	d.proxy = c.(map[string]any)["proxy"].(string)
 }
 
 func (d *Dorks) Run(domain string) {
diff --git a/osint/run.go b/osint/run.go
@@ -3,8 +3,8 @@ package osint
 import (
 	"bytes"
 	"fmt"
-	"io/ioutil"
 	"net"
+	"os"
 	"slices"
 	"strings"
 
@@ -42,7 +42,7 @@ func (opts *OsintOpts) SetDryRun(data bool) {
 func (opts OsintOpts) runGoogleDorks() {
 
 	dorks := Dorks{}
-	dorksCfg := make(map[string]interface{})
+	dorksCfg := make(map[string]any)
 
 	dorksOutfile := fmt.Sprintf("%s/dorks_%s.txt", opts.scanPath, opts.domain)
 	dorksCfg["outfile"] = dorksOutfile
@@ -57,7 +57,7 @@ func (opts OsintOpts) runGoogleDorks() {
 
 func (opts OsintOpts) runSubfinder() {
 	sbf := Subfinder{}
-	sbfCfg := make(map[string]interface{})
+	sbfCfg := make(map[string]any)
 
 	sbfOutfile := fmt.Sprintf("%s/subfinder_%s.txt", opts.scanPath, opts.domain)
 	sbfCfg["outfile"] = sbfOutfile
@@ -73,7 +73,7 @@ func (opts OsintOpts) runSubfinder() {
 
 func (opts OsintOpts) runAssetfinder() {
 	asf := Assetfinder{}
-	asfCfg := make(map[string]interface{})
+	asfCfg := make(map[string]any)
 
 	asfOutfile := fmt.Sprintf("%s/assetfinder_%s.txt", opts.scanPath, opts.domain)
 
@@ -90,7 +90,7 @@ func (opts OsintOpts) runAssetfinder() {
 
 func (opts OsintOpts) runDnsx() {
 	dnsx := Dnsx{}
-	dnsxCfg := make(map[string]interface{})
+	dnsxCfg := make(map[string]any)
 
 	dnsxOutfile := fmt.Sprintf("%s/dnsx_%s.json", opts.scanPath, opts.domain)
 	dnsxCfg["outfile"] = dnsxOutfile
@@ -122,7 +122,7 @@ func (opts OsintOpts) Run() {
 	var domains []string
 	var domainBuffer bytes.Buffer
 	for _, file := range domainsFiles {
-		newDomains, err := ioutil.ReadFile(file)
+		newDomains, err := os.ReadFile(file)
 		if err != nil {
 			panic(err)
 		}
@@ -152,7 +152,7 @@ func (opts OsintOpts) Run() {
 
 	// now add all assets together, line by line
 	uniqueOutfile := fmt.Sprintf("%s/domains_%s.txt", opts.scanPath, opts.domain)
-	err := ioutil.WriteFile(uniqueOutfile, domainBuffer.Bytes(), 0644)
+	err := os.WriteFile(uniqueOutfile, domainBuffer.Bytes(), 0644)
 	if err != nil {
 		panic(err)
 	}
diff --git a/osint/subfinder.go b/osint/subfinder.go
@@ -19,8 +19,8 @@ func (s *Subfinder) Info(url string) {
 	fmt.Println("[+] Running subfinder on", url)
 }
 
-func (s *Subfinder) Configure(c interface{}) {
-	s.outfile = c.(map[string]interface{})["outfile"].(string)
+func (s *Subfinder) Configure(c any) {
+	s.outfile = c.(map[string]any)["outfile"].(string)
 }
 
 func (s *Subfinder) Run(domain string) {
diff --git a/scan/gobuster.go b/scan/gobuster.go
@@ -24,13 +24,13 @@ func (s *Gobuster) Info(website string) {
 	fmt.Println("Running gobuster on", website)
 }
 
-func (g *Gobuster) Configure(c interface{}) {
+func (g *Gobuster) Configure(c any) {
 
-	g.scanPath = c.(map[string]interface{})["scanPath"].(string)
-	g.proxy = c.(map[string]interface{})["proxy"].(string)
-	g.wordlist = c.(map[string]interface{})["wordlist"].(string)
-	g.insecure = c.(map[string]interface{})["insecure"].(bool)
-	g.rateLimit = c.(map[string]interface{})["rateLimit"].(int32)
+	g.scanPath = c.(map[string]any)["scanPath"].(string)
+	g.proxy = c.(map[string]any)["proxy"].(string)
+	g.wordlist = c.(map[string]any)["wordlist"].(string)
+	g.insecure = c.(map[string]any)["insecure"].(bool)
+	g.rateLimit = c.(map[string]any)["rateLimit"].(int32)
 }
 
 func (g *Gobuster) Run(url string) {
diff --git a/scan/httpx.go b/scan/httpx.go
@@ -19,11 +19,11 @@ func (h *Httpx) Info(url string) {
 	fmt.Println("[+] Running httpx on ", url)
 }
 
-func (h *Httpx) Configure(c interface{}) {
-	h.OutDirPath = c.(map[string]interface{})["OutDirPath"].(string)
-	h.Proxy = c.(map[string]interface{})["Proxy"].(string)
-	h.RateLimit = c.(map[string]interface{})["RateLimit"].(int32)
-	h.Insecure = c.(map[string]interface{})["Insecure"].(bool)
+func (h *Httpx) Configure(c any) {
+	h.OutDirPath = c.(map[string]any)["OutDirPath"].(string)
+	h.Proxy = c.(map[string]any)["Proxy"].(string)
+	h.RateLimit = c.(map[string]any)["RateLimit"].(int32)
+	h.Insecure = c.(map[string]any)["Insecure"].(bool)
 }
 
 func (h *Httpx) Run(domain string) {
diff --git a/scan/naabu.go b/scan/naabu.go
@@ -3,7 +3,7 @@ package scan
 import (
 	"context"
 	"fmt"
-	"io/ioutil"
+	"os"
 
 	"github.com/projectdiscovery/goflags"
 	"github.com/projectdiscovery/naabu/v2/pkg/result"
@@ -20,10 +20,10 @@ func (d *Naabu) Info(url string) {
 	fmt.Println("[+] Running Naabu on", url)
 }
 
-func (d *Naabu) Configure(c interface{}) {
-	d.Proxy = c.(map[string]interface{})["Proxy"].(string)
-	d.RateLimit = c.(map[string]interface{})["RateLimit"].(int32)
-	d.ScanPath = c.(map[string]interface{})["ScanPath"].(string)
+func (d *Naabu) Configure(c any) {
+	d.Proxy = c.(map[string]any)["Proxy"].(string)
+	d.RateLimit = c.(map[string]any)["RateLimit"].(int32)
+	d.ScanPath = c.(map[string]any)["ScanPath"].(string)
 }
 
 func (d *Naabu) Run(url string) {
@@ -55,10 +55,10 @@ func (d *Naabu) Run(url string) {
 	ctx := context.Background()
 	naabuRunner.RunEnumeration(ctx)
 
-	err = ioutil.WriteFile(d.ScanPath, []byte(fullScan), 0644)
+	err = os.WriteFile(d.ScanPath, []byte(fullScan), 0644)
 	if err != nil {
 		panic(err)
 	}
 
-	fmt.Printf("[SCAN %s] Naabu scan for %s completed\n\t=>(stored in %s)\n\n", url, d.ScanPath)
+	fmt.Printf("[SCAN %s] Naabu scan for %s completed\n\t=>(stored in %s)\n\n", url, url, d.ScanPath)
 }
diff --git a/scan/robotstxt.go b/scan/robotstxt.go
@@ -3,7 +3,7 @@ package scan
 import (
 	"crypto/tls"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"strings"
 
@@ -18,8 +18,8 @@ func (d *RobotsTxt) Info(url string) {
 	fmt.Println("[+] Running RobotsTxt on", url)
 }
 
-func (d *RobotsTxt) Configure(c interface{}) {
-	d.Proxy = c.(map[string]interface{})["Proxy"].(string)
+func (d *RobotsTxt) Configure(c any) {
+	d.Proxy = c.(map[string]any)["Proxy"].(string)
 }
 
 func (d *RobotsTxt) Run(domain string) {
@@ -43,7 +43,7 @@ func (d *RobotsTxt) Run(domain string) {
 		}
 
 		if resp != nil && resp.StatusCode != http.StatusNotFound {
-			body, err := ioutil.ReadAll(resp.Body)
+			body, err := io.ReadAll(resp.Body)
 			if err != nil {
 				fmt.Printf("%v", err)
 			}
@@ -55,5 +55,5 @@ func (d *RobotsTxt) Run(domain string) {
 		}
 	}
 
-	fmt.Printf("[SCAN %s] RobotsTxt scan for %s completed\n\n", domain)
+	fmt.Printf("[SCAN %s] RobotsTxt scan for %s completed\n\n", domain, domain)
 }
diff --git a/scan/run.go b/scan/run.go
@@ -51,7 +51,7 @@ func (opts *ScanOpts) SetDryRun(data bool) {
 func (opts ScanOpts) runRobots() {
 
 	rb := Sitemap{}
-	rbCfg := make(map[string]interface{})
+	rbCfg := make(map[string]any)
 
 	rbCfg["Proxy"] = opts.proxy
 
@@ -65,7 +65,7 @@ func (opts ScanOpts) runRobots() {
 func (opts ScanOpts) runWappalyzerGo() {
 
 	wp := WappalyzerGo{}
-	wpCfg := make(map[string]interface{})
+	wpCfg := make(map[string]any)
 
 	wpCfg["Proxy"] = opts.proxy
 
@@ -79,7 +79,7 @@ func (opts ScanOpts) runWappalyzerGo() {
 func (opts ScanOpts) runSitemap() {
 
 	sm := Sitemap{}
-	smCfg := make(map[string]interface{})
+	smCfg := make(map[string]any)
 
 	smCfg["Proxy"] = opts.proxy
 
@@ -93,7 +93,7 @@ func (opts ScanOpts) runSitemap() {
 func (opts ScanOpts) runNaabu() {
 
 	nb := Naabu{}
-	nbCfg := make(map[string]interface{})
+	nbCfg := make(map[string]any)
 
 	nbCfg["ScanPath"] = opts.scanPath
 	nbCfg["Proxy"] = opts.proxy
@@ -108,7 +108,7 @@ func (opts ScanOpts) runNaabu() {
 
 func (opts *ScanOpts) runHttpx() {
 	httpx := Httpx{}
-	httpxCfg := make(map[string]interface{})
+	httpxCfg := make(map[string]any)
 
 	httpxOutdir := fmt.Sprintf("%s/httpx", opts.scanPath)
 
@@ -128,7 +128,7 @@ func (opts *ScanOpts) runHttpx() {
 func (opts ScanOpts) runGobusterDir() {
 
 	nb := Gobuster{}
-	nbCfg := make(map[string]interface{})
+	nbCfg := make(map[string]any)
 
 	nbCfg["scanPath"] = opts.scanPath
 	nbCfg["proxy"] = opts.proxy
diff --git a/scan/sitemap.go b/scan/sitemap.go
@@ -3,7 +3,7 @@ package scan
 import (
 	"crypto/tls"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/url"
 	"strings"
@@ -21,8 +21,8 @@ func (d *Sitemap) Info(url string) {
 	fmt.Println("[+] Running Sitemap on", url)
 }
 
-func (d *Sitemap) Configure(c interface{}) {
-	d.Proxy = c.(map[string]interface{})["Proxy"].(string)
+func (d *Sitemap) Configure(c any) {
+	d.Proxy = c.(map[string]any)["Proxy"].(string)
 }
 
 func (d *Sitemap) Run(domain string) {
@@ -46,7 +46,7 @@ func (d *Sitemap) Run(domain string) {
 		}
 
 		if resp != nil && resp.StatusCode != http.StatusNotFound {
-			body, err := ioutil.ReadAll(resp.Body)
+			body, err := io.ReadAll(resp.Body)
 			if err != nil {
 				fmt.Printf("%v", err)
 			}
diff --git a/scan/wappalyzergo.go b/scan/wappalyzergo.go
@@ -3,7 +3,7 @@ package scan
 import (
 	"crypto/tls"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 
 	"evil.djnn.sh/djnn/yellow/helpers"
@@ -18,8 +18,8 @@ func (d *WappalyzerGo) Info(url string) {
 	fmt.Println("[+] Running WappalyzerGo on", url)
 }
 
-func (d *WappalyzerGo) Configure(c interface{}) {
-	d.Proxy = c.(map[string]interface{})["Proxy"].(string)
+func (d *WappalyzerGo) Configure(c any) {
+	d.Proxy = c.(map[string]any)["Proxy"].(string)
 }
 
 func (d *WappalyzerGo) Run(url string) {
@@ -40,7 +40,7 @@ func (d *WappalyzerGo) Run(url string) {
 	}
 
 	if resp != nil {
-		body, err := ioutil.ReadAll(resp.Body)
+		body, err := io.ReadAll(resp.Body)
 		if err != nil {
 			fmt.Printf("%v", err)
 		}