Skip to content

Commit

Permalink
Fix linter workflow and autocalibration for lines & words match (#614)
Browse files Browse the repository at this point in the history
* Fix autocalibration for lines & words match

* Fix golangci-lint workflow
  • Loading branch information
joohoi committed Dec 7, 2022
1 parent 5c489ae commit 3328a28
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/golangci-lint.yml
Expand Up @@ -11,9 +11,12 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: 1.17
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.29
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@
- master
- New
- Changed
- Fixed issue with autocalibration of line & words filter

- v1.5.0
- New
Expand Down
13 changes: 7 additions & 6 deletions pkg/ffuf/autocalibration.go
Expand Up @@ -54,7 +54,7 @@ func (j *Job) calibrationRequest(inputs map[string][]byte) (Response, error) {
return resp, fmt.Errorf("Response wouldn't be matched")
}

//CalibrateForHost runs autocalibration for a specific host
// CalibrateForHost runs autocalibration for a specific host
func (j *Job) CalibrateForHost(host string, baseinput map[string][]byte) error {
if j.Config.MatcherManager.CalibratedForDomain(host) {
return nil
Expand Down Expand Up @@ -86,7 +86,7 @@ func (j *Job) CalibrateForHost(host string, baseinput map[string][]byte) error {
return nil
}

//CalibrateResponses returns slice of Responses for randomly generated filter autocalibration requests
// CalibrateResponses returns slice of Responses for randomly generated filter autocalibration requests
func (j *Job) Calibrate(input map[string][]byte) error {
if j.Config.MatcherManager.Calibrated() {
return nil
Expand All @@ -112,8 +112,9 @@ func (j *Job) Calibrate(input map[string][]byte) error {
return nil
}

//CalibrateIfNeeded runs a self-calibration task for filtering options (if needed) by requesting random resources and
// configuring the filters accordingly
// CalibrateIfNeeded runs a self-calibration task for filtering options (if needed) by requesting random resources and
//
// configuring the filters accordingly
func (j *Job) CalibrateIfNeeded(host string, input map[string][]byte) error {
j.calibMutex.Lock()
defer j.calibMutex.Unlock()
Expand Down Expand Up @@ -192,7 +193,7 @@ func (j *Job) calibrateFilters(responses []Response, perHost bool) error {
return nil
}
}
_ = j.Config.MatcherManager.AddFilter("word", strconv.FormatInt(baselineSize, 10), false)
_ = j.Config.MatcherManager.AddFilter("word", strconv.FormatInt(baselineWords, 10), false)
return nil
}
}
Expand Down Expand Up @@ -226,7 +227,7 @@ func (j *Job) calibrateFilters(responses []Response, perHost bool) error {
return nil
}
}
_ = j.Config.MatcherManager.AddFilter("line", strconv.FormatInt(baselineSize, 10), false)
_ = j.Config.MatcherManager.AddFilter("line", strconv.FormatInt(baselineLines, 10), false)
return nil
}
}
Expand Down

0 comments on commit 3328a28

Please sign in to comment.