From ad559f308eb37c443ee5cb00a7a39f8d970cc16b Mon Sep 17 00:00:00 2001 From: sullo Date: Tue, 14 Sep 2021 13:06:35 -0400 Subject: [PATCH] logger error message updates: - missing word in runner.go file errors - various consistency cleanup. --- common/customports/customport.go | 12 ++++++------ runner/banner.go | 2 +- runner/options.go | 4 ++-- runner/runner.go | 18 +++++++++--------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/common/customports/customport.go b/common/customports/customport.go index 7728b78..8c5a025 100644 --- a/common/customports/customport.go +++ b/common/customports/customport.go @@ -60,7 +60,7 @@ func (c *CustomPorts) Set(value string) error { } Ports[p] = protocol } else { - gologger.Warning().Msgf("Could not cast port to integer, your value: %s, resulting error %s. Skipping it\n", + gologger.Warning().Msgf("Could not cast port to integer from your value: %s. Resulting error: %s. Skipping it.\n", potentialPort, err.Error()) } } else { @@ -68,21 +68,21 @@ func (c *CustomPorts) Set(value string) error { var lowP, highP int lowP, err := strconv.Atoi(potentialRange[0]) if err != nil { - gologger.Warning().Msgf("Could not cast first port of your port range(%s) to integer, your value: %s, resulting error %s. Skipping it\n", + gologger.Warning().Msgf("Could not cast first port of your range(%s) to integer from your value: %s. Resulting error: %s. Skipping it.\n", potentialPort, potentialRange[0], err.Error()) continue } highP, err = strconv.Atoi(potentialRange[1]) if err != nil { - gologger.Warning().Msgf("Could not cast last port of your port range(%s) to integer, "+ - "your value: %s, resulting error %s. Skipping it\n", + gologger.Warning().Msgf("Could not cast last port of your port range(%s) to integer from "+ + "your value: %s. Resulting error %s. Skipping it\n", potentialPort, potentialRange[1], err.Error()) continue } if lowP > highP { - gologger.Warning().Msgf("first value of port range should be lower than the last part port "+ - "in that range, your range: [%d, %d]. Skipping it\n", + gologger.Warning().Msgf("First value of port range should be lower than the last port "+ + "from your range: [%d, %d]. Skipping it.\n", lowP, highP) continue } diff --git a/runner/banner.go b/runner/banner.go index 2beadea..9c361bc 100644 --- a/runner/banner.go +++ b/runner/banner.go @@ -19,6 +19,6 @@ func showBanner() { gologger.Print().Msgf("%s\n", banner) gologger.Print().Msgf("\t\tprojectdiscovery.io\n\n") - gologger.Print().Msgf("Use with caution. You are responsible for your actions\n") + gologger.Print().Msgf("Use with caution. You are responsible for your actions.\n") gologger.Print().Msgf("Developers assume no liability and are not responsible for any misuse or damage.\n") } diff --git a/runner/options.go b/runner/options.go index f0678b5..21f5501 100644 --- a/runner/options.go +++ b/runner/options.go @@ -292,11 +292,11 @@ func ParseOptions() *Options { func (options *Options) validateOptions() { if options.InputFile != "" && !fileutilz.FileNameIsGlob(options.InputFile) && !fileutil.FileExists(options.InputFile) { - gologger.Fatal().Msgf("File %s does not exist!\n", options.InputFile) + gologger.Fatal().Msgf("File %s does not exist.\n", options.InputFile) } if options.InputRawRequest != "" && !fileutil.FileExists(options.InputRawRequest) { - gologger.Fatal().Msgf("File %s does not exist!\n", options.InputRawRequest) + gologger.Fatal().Msgf("File %s does not exist.\n", options.InputRawRequest) } var err error diff --git a/runner/runner.go b/runner/runner.go index 0e12152..d71fa63 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -135,7 +135,7 @@ func New(options *Options) (*Runner, error) { var rawRequest []byte rawRequest, err = ioutil.ReadFile(options.InputRawRequest) if err != nil { - gologger.Fatal().Msgf("Could not read raw request from '%s': %s\n", options.InputRawRequest, err) + gologger.Fatal().Msgf("Could not read raw request from path '%s': %s\n", options.InputRawRequest, err) } rrMethod, rrPath, rrHeaders, rrBody, errParse := httputilz.ParseRequest(string(rawRequest), options.Unsafe) @@ -265,11 +265,11 @@ func (r *Runner) prepareInput() { if fileutil.FileExists(r.options.InputFile) { finput, err := os.Open(r.options.InputFile) if err != nil { - gologger.Fatal().Msgf("Could read input file '%s': %s\n", r.options.InputFile, err) + gologger.Fatal().Msgf("Could not read input file '%s': %s\n", r.options.InputFile, err) } numHosts, err = r.loadAndCloseFile(finput) if err != nil { - gologger.Fatal().Msgf("Could read input file '%s': %s\n", r.options.InputFile, err) + gologger.Fatal().Msgf("Could not read input file '%s': %s\n", r.options.InputFile, err) } } else if r.options.InputFile != "" { files, err := fileutilz.ListFilesWithPattern(r.options.InputFile) @@ -279,11 +279,11 @@ func (r *Runner) prepareInput() { for _, file := range files { finput, err := os.Open(file) if err != nil { - gologger.Fatal().Msgf("Could read input file '%s': %s\n", r.options.InputFile, err) + gologger.Fatal().Msgf("Could not read input file '%s': %s\n", r.options.InputFile, err) } numTargetsFile, err := r.loadAndCloseFile(finput) if err != nil { - gologger.Fatal().Msgf("Could read input file '%s': %s\n", r.options.InputFile, err) + gologger.Fatal().Msgf("Could not read input file '%s': %s\n", r.options.InputFile, err) } numHosts += numTargetsFile } @@ -291,7 +291,7 @@ func (r *Runner) prepareInput() { if fileutil.HasStdin() { numTargetsStdin, err := r.loadAndCloseFile(os.Stdin) if err != nil { - gologger.Fatal().Msgf("Could read input from stdin: %s\n", err) + gologger.Fatal().Msgf("Could not read input from stdin: %s\n", err) } numHosts += numTargetsStdin } @@ -303,7 +303,7 @@ func (r *Runner) prepareInput() { r.stats.AddCounter("requests", 0) err := r.stats.Start(makePrintCallback(), time.Duration(statsDisplayInterval)*time.Second) if err != nil { - gologger.Warning().Msgf("Could not create statistic: %s\n", err) + gologger.Warning().Msgf("Could not create statistics: %s\n", err) } } } @@ -1026,14 +1026,14 @@ retry: } writeErr := ioutil.WriteFile(responsePath, []byte(respRaw), 0644) if writeErr != nil { - gologger.Warning().Msgf("Could not write response, at path '%s', to disk: %s", responsePath, writeErr) + gologger.Warning().Msgf("Could not write response at path '%s', to disk: %s", responsePath, writeErr) } if scanopts.StoreChain && resp.HasChain() { domainFile = strings.ReplaceAll(domainFile, ".txt", ".chain.txt") responsePath := path.Join(scanopts.StoreResponseDirectory, domainFile) writeErr := ioutil.WriteFile(responsePath, []byte(resp.GetChain()), 0644) if writeErr != nil { - gologger.Warning().Msgf("Could not write response, at path '%s', to disk: %s", responsePath, writeErr) + gologger.Warning().Msgf("Could not write response at path '%s', to disk: %s", responsePath, writeErr) } } }