| 1 | package filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.18 `encoding/json`/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/" |
| 6 | "strconvscip-go gomod github.com/golang/go/src go1.18 strconv/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.18 strings/" |
| 8 | |
| 9 | "github.com/ffuf/ffuf/v2/pkg/ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/" |
| 10 | ) |
| 11 | |
| 12 | type LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter# struct { |
| 13 | Valuescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Value. []ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.ValueRangescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange# |
| 14 | } |
| 15 | |
| 16 | func NewLineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewLineFilter().(value string) (ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.FilterProviderscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FilterProvider#, error) { |
| 17 | var intranges []ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.ValueRangescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange# |
| 18 | for _, sv := range stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Splitscip-go gomod github.com/golang/go/src go1.18 strings/Split().(value, ",") { |
| 19 | vr, err := ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.ValueRangeFromStringscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRangeFromString().(sv) |
| 20 | if err != nil { |
| 21 | return &LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#{}, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.18 fmt/Errorf().("Line filter or matcher (-fl / -ml): invalid value: %s", sv) |
| 22 | } |
| 23 | intranges = append(intranges, vr) |
| 24 | } |
| 25 | return &LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#{Valuescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Value.: intranges}, nil |
| 26 | } |
| 27 | |
| 28 | func (f *LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#) MarshalJSONscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#MarshalJSON().() ([]byte, error) { |
| 29 | value := make([]string, 0) |
| 30 | for _, v := range f.Valuescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Value. { |
| 31 | if v.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min. == v.Maxscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Max. { |
| 32 | value = append(value, strconvscip-go gomod github.com/golang/go/src go1.18 strconv/.FormatIntscip-go gomod github.com/golang/go/src go1.18 strconv/FormatInt().(v.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min., 10)) |
| 33 | } else { |
| 34 | value = append(value, fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("%d-%d", v.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min., v.Maxscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Max.)) |
| 35 | } |
| 36 | } |
| 37 | return jsonscip-go gomod github.com/golang/go/src go1.18 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.18 `encoding/json`/Marshal().(&struct { |
| 38 | Value string `json:"value"` |
| 39 | }{ |
| 40 | Value: stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Joinscip-go gomod github.com/golang/go/src go1.18 strings/Join().(value, ","), |
| 41 | }) |
| 42 | } |
| 43 | |
| 44 | func (f *LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#) Filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Filter().(response *ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#) (bool, error) { |
| 45 | linesSize := len(stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Splitscip-go gomod github.com/golang/go/src go1.18 strings/Split().(string(response.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Data.), "\n")) |
| 46 | for _, iv := range f.Valuescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Value. { |
| 47 | if iv.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min. <= int64(linesSize) && int64(linesSize) <= iv.Maxscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Max. { |
| 48 | return true, nil |
| 49 | } |
| 50 | } |
| 51 | return false, nil |
| 52 | } |
| 53 | |
| 54 | func (f *LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#) Reprscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Repr().() string { |
| 55 | var strval []string |
| 56 | for _, iv := range f.Valuescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Value. { |
| 57 | if iv.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min. == iv.Maxscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Max. { |
| 58 | strval = append(strval, strconvscip-go gomod github.com/golang/go/src go1.18 strconv/.Itoascip-go gomod github.com/golang/go/src go1.18 strconv/Itoa().(int(iv.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min.))) |
| 59 | } else { |
| 60 | strval = append(strval, strconvscip-go gomod github.com/golang/go/src go1.18 strconv/.Itoascip-go gomod github.com/golang/go/src go1.18 strconv/Itoa().(int(iv.Minscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Min.))+"-"+strconvscip-go gomod github.com/golang/go/src go1.18 strconv/.Itoascip-go gomod github.com/golang/go/src go1.18 strconv/Itoa().(int(iv.Maxscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/ValueRange#Max.))) |
| 61 | } |
| 62 | } |
| 63 | return stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Joinscip-go gomod github.com/golang/go/src go1.18 strings/Join().(strval, ",") |
| 64 | } |
| 65 | |
| 66 | func (f *LineFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#) ReprVerbosescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#ReprVerbose().() string { |
| 67 | return fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("Response lines: %s", f.Reprscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/LineFilter#Repr().()) |
| 68 | } |