From aff6fea45d87ad2510c999744b5e99d63eb07efa Mon Sep 17 00:00:00 2001 From: vmfunc Date: Tue, 15 Oct 2024 02:32:48 +0200 Subject: [PATCH] chore: gofmt whitespace removal --- cmd/sif/main.go | 2 +- internal/nuclei/format/format.go | 2 +- internal/nuclei/templates/templates.go | 2 +- internal/styles/styles.go | 8 ++--- pkg/config/config.go | 42 +++++++++++++------------- pkg/logger/logger.go | 2 +- pkg/scan/cloudstorage.go | 11 +++---- pkg/scan/cms.go | 5 ++- pkg/scan/dirlist.go | 2 +- pkg/scan/dnslist.go | 2 +- pkg/scan/dork.go | 4 +-- pkg/scan/git.go | 2 +- pkg/scan/headers.go | 5 ++- pkg/scan/js/frameworks/next.go | 3 +- pkg/scan/js/scan.go | 2 +- pkg/scan/js/supabase.go | 2 +- pkg/scan/nuclei.go | 2 +- pkg/scan/ports.go | 2 +- pkg/scan/scan.go | 3 +- pkg/scan/subdomaintakeover.go | 16 +++++----- pkg/scan/whois.go | 2 +- pkg/utils/returnApiOutput.go | 2 +- sif.go | 4 +-- 23 files changed, 61 insertions(+), 66 deletions(-) diff --git a/cmd/sif/main.go b/cmd/sif/main.go index a83a622..b02da04 100644 --- a/cmd/sif/main.go +++ b/cmd/sif/main.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/internal/nuclei/format/format.go b/internal/nuclei/format/format.go index d85a333..235a893 100644 --- a/internal/nuclei/format/format.go +++ b/internal/nuclei/format/format.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/internal/nuclei/templates/templates.go b/internal/nuclei/templates/templates.go index 6ac52f5..5b3c766 100644 --- a/internal/nuclei/templates/templates.go +++ b/internal/nuclei/templates/templates.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/internal/styles/styles.go b/internal/styles/styles.go index 7790776..9a6b339 100644 --- a/internal/styles/styles.go +++ b/internal/styles/styles.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ @@ -66,13 +66,13 @@ var ( // Severity level styles for color-coding vulnerability severities var ( - SeverityLow = lipgloss.NewStyle(). + SeverityLow = lipgloss.NewStyle(). Foreground(lipgloss.Color("#00ff00")) - SeverityMedium = lipgloss.NewStyle(). + SeverityMedium = lipgloss.NewStyle(). Foreground(lipgloss.Color("#ffff00")) - SeverityHigh = lipgloss.NewStyle(). + SeverityHigh = lipgloss.NewStyle(). Foreground(lipgloss.Color("#ff8800")) SeverityCritical = lipgloss.NewStyle(). diff --git a/pkg/config/config.go b/pkg/config/config.go index 2bfbd3e..30bb8eb 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ @@ -32,26 +32,26 @@ import ( ) type Settings struct { - Dirlist string - Dnslist string - Debug bool - LogDir string - NoScan bool - Ports string - Dorking bool - Git bool - Whois bool - Threads int - Nuclei bool - JavaScript bool - Timeout time.Duration - URLs goflags.StringSlice - File string - ApiMode bool - Template string - CMS bool - Headers bool - CloudStorage bool + Dirlist string + Dnslist string + Debug bool + LogDir string + NoScan bool + Ports string + Dorking bool + Git bool + Whois bool + Threads int + Nuclei bool + JavaScript bool + Timeout time.Duration + URLs goflags.StringSlice + File string + ApiMode bool + Template string + CMS bool + Headers bool + CloudStorage bool SubdomainTakeover bool } diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index ba552ac..bbe7f64 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/cloudstorage.go b/pkg/scan/cloudstorage.go index 215c5ab..692036c 100644 --- a/pkg/scan/cloudstorage.go +++ b/pkg/scan/cloudstorage.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ @@ -27,9 +27,9 @@ package scan import ( "fmt" "net/http" + "os" "strings" "time" - "os" "github.com/charmbracelet/log" "github.com/dropalldatabases/sif/internal/styles" @@ -92,7 +92,7 @@ func CloudStorage(url string, timeout time.Duration, logdir string) ([]CloudStor } func extractPotentialBuckets(url string) []string { - // This is a simple implementation. + // This is a simple implementation. // TODO: add more cases parts := strings.Split(url, ".") var buckets []string @@ -100,11 +100,11 @@ func extractPotentialBuckets(url string) []string { buckets = append(buckets, part) buckets = append(buckets, part+"-s3") buckets = append(buckets, "s3-"+part) - + if i < len(parts)-1 { domainExtension := part + "-" + parts[i+1] buckets = append(buckets, domainExtension) - buckets = append(buckets, parts[i+1] + "-" + part) + buckets = append(buckets, parts[i+1]+"-"+part) } } return buckets @@ -121,4 +121,3 @@ func checkS3Bucket(bucket string, client *http.Client) (bool, error) { // If we can access the bucket listing, it's public return resp.StatusCode == http.StatusOK, nil } - diff --git a/pkg/scan/cms.go b/pkg/scan/cms.go index d7da521..9685aae 100644 --- a/pkg/scan/cms.go +++ b/pkg/scan/cms.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ @@ -28,9 +28,9 @@ import ( "fmt" "io" "net/http" + "os" "strings" "time" - "os" "github.com/charmbracelet/log" "github.com/dropalldatabases/sif/internal/styles" @@ -57,7 +57,6 @@ func CMS(url string, timeout time.Duration, logdir string) (*CMSResult, error) { cmslog := log.NewWithOptions(os.Stderr, log.Options{ Prefix: "CMS 🔍", }).With("url", url) - client := &http.Client{ Timeout: timeout, diff --git a/pkg/scan/dirlist.go b/pkg/scan/dirlist.go index 2f6b006..f15300d 100644 --- a/pkg/scan/dirlist.go +++ b/pkg/scan/dirlist.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/dnslist.go b/pkg/scan/dnslist.go index 6852c72..300bf24 100644 --- a/pkg/scan/dnslist.go +++ b/pkg/scan/dnslist.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/dork.go b/pkg/scan/dork.go index 1bc88fe..2d51a12 100644 --- a/pkg/scan/dork.go +++ b/pkg/scan/dork.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ @@ -132,4 +132,4 @@ func Dork(url string, timeout time.Duration, threads int, logdir string) ([]Dork wg.Wait() return dorkResults, nil -} \ No newline at end of file +} diff --git a/pkg/scan/git.go b/pkg/scan/git.go index 86372e7..d05cf79 100644 --- a/pkg/scan/git.go +++ b/pkg/scan/git.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/headers.go b/pkg/scan/headers.go index 9e35849..b2a18ba 100644 --- a/pkg/scan/headers.go +++ b/pkg/scan/headers.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ @@ -27,9 +27,9 @@ package scan import ( "fmt" "net/http" + "os" "strings" "time" - "os" "github.com/charmbracelet/log" "github.com/dropalldatabases/sif/internal/styles" @@ -81,4 +81,3 @@ func Headers(url string, timeout time.Duration, logdir string) ([]HeaderResult, return results, nil } - diff --git a/pkg/scan/js/frameworks/next.go b/pkg/scan/js/frameworks/next.go index bd8ea57..be72eb1 100644 --- a/pkg/scan/js/frameworks/next.go +++ b/pkg/scan/js/frameworks/next.go @@ -17,12 +17,11 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ - /* What we are doing is abusing a internal file in Next.js pages router called _buildManifest.js which lists all routes and script files ever referenced in diff --git a/pkg/scan/js/scan.go b/pkg/scan/js/scan.go index f9a9f8b..0b1df68 100644 --- a/pkg/scan/js/scan.go +++ b/pkg/scan/js/scan.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/js/supabase.go b/pkg/scan/js/supabase.go index e06e700..477d770 100644 --- a/pkg/scan/js/supabase.go +++ b/pkg/scan/js/supabase.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/nuclei.go b/pkg/scan/nuclei.go index 80a664a..862115f 100644 --- a/pkg/scan/nuclei.go +++ b/pkg/scan/nuclei.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/ports.go b/pkg/scan/ports.go index c02155c..d9c1be7 100644 --- a/pkg/scan/ports.go +++ b/pkg/scan/ports.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/scan/scan.go b/pkg/scan/scan.go index b9885e9..d58bf29 100644 --- a/pkg/scan/scan.go +++ b/pkg/scan/scan.go @@ -17,12 +17,11 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ - // The scan package provides a collection of security scanning functions. // // Each scanning function typically returns a slice of custom result structures and an error. diff --git a/pkg/scan/subdomaintakeover.go b/pkg/scan/subdomaintakeover.go index 81ce32a..e60921a 100644 --- a/pkg/scan/subdomaintakeover.go +++ b/pkg/scan/subdomaintakeover.go @@ -2,24 +2,24 @@ package scan import ( "fmt" + "github.com/charmbracelet/log" + "github.com/dropalldatabases/sif/internal/styles" + "github.com/dropalldatabases/sif/pkg/logger" "io" "net" "net/http" - "strings" - "time" "os" + "strings" "sync" - "github.com/charmbracelet/log" - "github.com/dropalldatabases/sif/internal/styles" - "github.com/dropalldatabases/sif/pkg/logger" + "time" ) // SubdomainTakeoverResult represents the outcome of a subdomain takeover vulnerability check. // It includes the subdomain tested, whether it's vulnerable, and the potentially vulnerable service. type SubdomainTakeoverResult struct { - Subdomain string `json:"subdomain"` - Vulnerable bool `json:"vulnerable"` - Service string `json:"service,omitempty"` + Subdomain string `json:"subdomain"` + Vulnerable bool `json:"vulnerable"` + Service string `json:"service,omitempty"` } // SubdomainTakeover checks for potential subdomain takeover vulnerabilities. diff --git a/pkg/scan/whois.go b/pkg/scan/whois.go index 6296591..87aa0da 100644 --- a/pkg/scan/whois.go +++ b/pkg/scan/whois.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/pkg/utils/returnApiOutput.go b/pkg/utils/returnApiOutput.go index 73787e0..1a477d2 100644 --- a/pkg/utils/returnApiOutput.go +++ b/pkg/utils/returnApiOutput.go @@ -17,7 +17,7 @@ ║ research or educational purposes must purchase a license ║ ║ from https://lunchcat.dev ║ ║ ║ -║ For more information, visit: https://github.com/lunchcat/sif ║ +║ For more information, visit: https://github.com/lunchcat/sif ║ ║ ║ ╚══════════════════════════════════════════════════════════════════════════════╝ */ diff --git a/sif.go b/sif.go index 54bf6ce..9020385 100644 --- a/sif.go +++ b/sif.go @@ -253,11 +253,11 @@ func (app *App) Run() error { if !app.settings.ApiMode { scansRunList := " • " + strings.Join(scansRun, "\n • ") if app.settings.LogDir != "" { - fmt.Println(styles.Box.Render(fmt.Sprintf("🌿 All scans completed!\n📂 Output saved to files: %s\n\n🔍 Ran scans:\n%s", + fmt.Println(styles.Box.Render(fmt.Sprintf("🌿 All scans completed!\n📂 Output saved to files: %s\n\n🔍 Ran scans:\n%s", strings.Join(app.logFiles, ", "), scansRunList))) } else { - fmt.Println(styles.Box.Render(fmt.Sprintf("🌿 All scans completed!\n\n🔍 Ran scans:\n%s", + fmt.Println(styles.Box.Render(fmt.Sprintf("🌿 All scans completed!\n\n🔍 Ran scans:\n%s", scansRunList))) } }