mirror of
https://github.com/lunchcat/sif.git
synced 2026-06-12 19:11:25 -07:00
133224c348
`strings.Split(url, "://")[1]` was copy-pasted in 18 spots and panics on a schemeless target (index out of range). add a small stripScheme helper in the scan package - and a guarded equivalent in logger, which cant import scan - so a bare host degrades gracefully instead of crashing the scan.
42 lines
1.8 KiB
Go
42 lines
1.8 KiB
Go
/*
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
: :
|
|
: █▀ █ █▀▀ · Blazing-fast pentesting suite :
|
|
: ▄█ █ █▀ · BSD 3-Clause License :
|
|
: :
|
|
: (c) 2022-2026 vmfunc, xyzeva, :
|
|
: lunchcat alumni & contributors :
|
|
: :
|
|
·━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━·
|
|
*/
|
|
|
|
package scan
|
|
|
|
import (
|
|
"github.com/charmbracelet/log"
|
|
"github.com/dropalldatabases/sif/internal/logger"
|
|
"github.com/dropalldatabases/sif/internal/output"
|
|
"github.com/likexian/whois"
|
|
)
|
|
|
|
func Whois(url string, logdir string) {
|
|
output.ScanStart("WHOIS lookup")
|
|
|
|
sanitizedURL := stripScheme(url)
|
|
if logdir != "" {
|
|
if err := logger.WriteHeader(sanitizedURL, logdir, " WHOIS scanning"); err != nil {
|
|
output.Error("Error creating log file: %v", err)
|
|
return
|
|
}
|
|
}
|
|
|
|
result, err := whois.Whois(sanitizedURL)
|
|
if err == nil {
|
|
log.Info(result)
|
|
logger.Write(sanitizedURL, logdir, result)
|
|
output.ScanComplete("WHOIS lookup", 1, "completed")
|
|
} else {
|
|
output.Error("WHOIS lookup failed: %v", err)
|
|
}
|
|
}
|