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 d99708439c9e5bc20530f9e78e14f37f51e1424a
parent d89f6002d202b01e19fcf5db47a5fb52cc6a611f
Author: djnn <[email protected]>
Date: Thu, 12 Mar 2026 12:22:44 +0900

fix(scan|osint): resolve IPs before passing it to shodan/port-scan

Diffstat:
Mosint/shodan.go | 12+++++++++++-
Mscan/portscan.go | 9+++++++++

2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/osint/shodan.go b/osint/shodan.go
@@ -6,6 +6,7 @@ import (
 	"encoding/json"
 	"fmt"
 	"io"
+	"net"
 	"net/http"
 	"os"
 	"path/filepath"
@@ -54,6 +55,15 @@ func (s *Shodan) Run(ip string) {
 		return
 	}
 
+	if net.ParseIP(ip) == nil {
+		addrs, err := net.LookupHost(ip)
+		if err != nil || len(addrs) == 0 {
+			fmt.Printf("err: could not resolve %s to an IP: %v\n", ip, err)
+			return
+		}
+		ip = addrs[0]
+	}
+
 	if s.apiKey == "" {
 		fmt.Println("err: shodan api key not configured (set SHODAN_API_KEY or provide apikey in Configure)")
 		return
@@ -131,7 +141,7 @@ func (s *Shodan) Run(ip string) {
 	fmt.Printf("[OSINT %s] Shodan summary appended to %s (json: %s)\n", ip, s.outfile, jsonPath)
 
 	// small sleep to be polite in case caller loops over many IPs
-	time.Sleep(200 * time.Millisecond)
+	time.Sleep(1 * time.Second)
 }
 
 func buildShodanSummaryFromJSON(r io.Reader, ip string) (string, error) {
diff --git a/scan/portscan.go b/scan/portscan.go
@@ -50,6 +50,15 @@ func (opts ScanOpts) runPortScan() {
 }
 
 func (p *PortScanner) Run(host string) {
+	if net.ParseIP(host) == nil {
+		addrs, err := net.LookupHost(host)
+		if err != nil || len(addrs) == 0 {
+			fmt.Printf("err: could not resolve %s to an IP: %v\n", host, err)
+			return
+		}
+		host = addrs[0]
+	}
+
 	ports, err := parsePorts(p.ports)
 	if err != nil {
 		fmt.Printf("[!] invalid ports spec: %v\n", err)