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)
| |