Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger error message updates: #401

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions common/customports/customport.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,29 @@ 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 {
// expand range
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
}
Expand Down
2 changes: 1 addition & 1 deletion runner/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
4 changes: 2 additions & 2 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -279,19 +279,19 @@ 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
}
}
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
}
Expand All @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
Expand Down