Skip to content
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
2 changes: 1 addition & 1 deletion common/fileutil/fileutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func ListFilesWithPattern(rootpattern string) ([]string, error) {
if len(files) == 0 {
return nil, errors.New("no files found")
}
return files, err
return files, nil
}

// FileNameIsGlob check if the filanem is a pattern
Expand Down
7 changes: 5 additions & 2 deletions common/hashes/jarm/jarmhash.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ func Jarm(dialer *fastdialer.Dialer, host string, duration int) string {
return ""
}
t.Host = u.Hostname()
port, _ := strconv.Atoi(u.Port())
t.Port = port
if portStr := u.Port(); portStr != "" {
if p, err := strconv.Atoi(portStr); err == nil {
t.Port = p
}
}
}
if t.Port == 0 {
t.Port = defaultPort
Expand Down
7 changes: 4 additions & 3 deletions common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ get_response:

respbody, err = DecodeData(respbody, httpresp.Header)
if err != nil && !shouldIgnoreBodyErrors {
return nil, closeErr
return nil, err
}

respbodystr := string(respbody)
Expand All @@ -307,8 +307,9 @@ get_response:
if resp.ContentLength <= 0 {
// check if it's in the header and convert to int
if contentLength, ok := resp.Headers["Content-Length"]; ok && len(contentLength) > 0 {
contentLengthInt, _ := strconv.Atoi(contentLength[0])
resp.ContentLength = contentLengthInt
if contentLengthInt, err := strconv.Atoi(contentLength[0]); err == nil {
resp.ContentLength = contentLengthInt
}
}

// if we have a body, then use the number of bytes in the body if the length is still zero
Expand Down
9 changes: 7 additions & 2 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (r *Runner) IsInterrupted() bool {
}

// picked based on try-fail but it seems to close to one it's used https://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html#c1992
var hammingDistanceThreshold int = 22
const hammingDistanceThreshold = 22

// regex for stripping ANSI codes
var ansiRegex = regexp.MustCompile(`\x1b\[[0-9;]*m`)
Expand Down Expand Up @@ -2204,7 +2204,12 @@ retry:

pipeline := false
if scanopts.Pipeline {
port, _ := strconv.Atoi(URL.Port())
port := 0
if portStr := URL.Port(); portStr != "" {
if p, err := strconv.Atoi(portStr); err == nil {
port = p
}
}
r.ratelimiter.Take()
pipeline = hp.SupportPipeline(protocol, method, URL.Host, port)
if pipeline {
Expand Down
Loading