Skip to content
Open
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
11 changes: 10 additions & 1 deletion args.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type config struct {
paths string
hosts string
output string
regexignore string
noHeaders bool

requester requester
Expand Down Expand Up @@ -115,6 +116,12 @@ func processArgs() config {
flag.BoolVar(&verbose, "verbose", false, "")
flag.BoolVar(&verbose, "v", false, "")

regexignore := ""
flag.StringVar(&regexignore, "regexignore", "", "")
flag.StringVar(&regexignore, "x", "", "")



flag.Parse()

// paths might be in a file, or it might be a single value
Expand Down Expand Up @@ -156,6 +163,7 @@ func processArgs() config {
hosts: hosts,
output: output,
noHeaders: noHeaders,
regexignore: regexignore,
}
}

Expand All @@ -176,7 +184,8 @@ func init() {
h += " -s, --savestatus <status> Save only responses with specific status code\n"
h += " -t, --timeout <millis> Set the HTTP timeout (default: 10000)\n"
h += " -v, --verbose Verbose mode\n"
h += " -X, --method <method> HTTP method (default: GET)\n\n"
h += " -X, --method <method> HTTP method (default: GET)\n"
h += " -x, --regexignore <string> Ignore results where the body matches a regex pattern\n\n"

h += "Defaults:\n"
h += " pathsFile: ./paths\n"
Expand Down
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"sync"
"time"
"regexp"
)

const (
Expand Down Expand Up @@ -93,6 +94,14 @@ func main() {
continue
}

if c.regexignore != "" {
matched, _ := regexp.MatchString(c.regexignore,res.String())

if matched {
continue
}
}

path, err := res.save(c.output, c.noHeaders)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to save file: %s\n", err)
Expand Down