Skip to content

Commit

Permalink
recheck was added
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhatcck committed Oct 17, 2024
1 parent d29646f commit 7871c32
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ func main() {
flagSet.StringVar(&options.ParamValue, "param-value", "test", "Value for parameter fuzzing")
flagSet.BoolVar(&options.Pipe, "pipe", false, "For pipe usage")
flagSet.StringVar(&options.FilterCode, "fc", "", "Filter response HTTP status code, only one code allowed")
flagSet.StringVar(&options.ProxyUrl, "p", "", "Proxy URL for all ongoing requests")
flagSet.StringVar(&options.ProxyUrl, "proxy", "", "Proxy URL for all ongoing requests")
flagSet.BoolVar(&options.XFFHeader, "xff", false, "Use X-F-F headers")
flagSet.StringVar(&options.XFFValue, "xff-val", "127.0.0.1", "Value for X-F-F headers (e.g., localhost 127.0.0.1)")
flagSet.Int64Var(&options.MaxBodyLengthForCompare, "max-compare-size", 3000, "To address the CPU performance issue with the diff operation, the isSimilar() function compares the HTTP response bodies. However, comparing large HTML files negatively impacts performance. To mitigate this performance problem, a size limit has been imposed on the files to be compared. This way, large files will not undergo comparison, reducing CPU strain.​")
flagSet.BoolVar(&options.Recheck, "recheck", false, "Recheck ")
flagSet.IntVar(&options.RateLimit, "rt-limit", 0, "Rate limit (for unlimited rate limit use 0)")
// Parse the flags

flagSet.Usage = func() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/hidden_fuzzer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Config struct {
ParamValue string
ProxyUrl string
MaxBodyLengthForCompare int64
Recheck bool
}

func (c *Config) Build(options Options) error {
Expand Down Expand Up @@ -98,6 +99,7 @@ func (c *Config) Build(options Options) error {
c.ParamValue = options.ParamValue
c.ProxyUrl = options.ProxyUrl
c.MaxBodyLengthForCompare = options.MaxBodyLengthForCompare
c.Recheck = options.Recheck

//if param fuzzing is true do not handle 403 or directories.
//do not process sub directory depth
Expand Down
1 change: 1 addition & 0 deletions pkg/hidden_fuzzer/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ type Options struct {
XFFValue string
WordlistStringArray []string
MaxBodyLengthForCompare int64
Recheck bool
}
33 changes: 28 additions & 5 deletions pkg/hidden_fuzzer/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,37 @@ func (w *Worker) Start() error {
return subFulderErr
}
}

if w.Config.Recheck {
WriteStr(w, "Recheck starting....")
time.Sleep(5 * time.Second)
w.recheck()
}

w.isrunning = false
return nil
}

func (w *Worker) recheck() {
w.WorkQueue = nil
for _, url := range w.FoundUrls {
w.WorkQueue = append(w.WorkQueue, getRequestForQueue(url.Response.URL, *w.Config))
}

w.FoundUrls = nil

w.startExecution()
}

func getRequestForQueue(url string, conf Config) WorkQueue {

return WorkQueue{Url: url, Req: Request{
URL: url,
Headers: conf.Headers,
Method: conf.Method,
}, RedirectConter: 0}
}

func (w *Worker) start(path string) error {
err := w.doMainReq(path)

Expand All @@ -123,11 +150,7 @@ func (w *Worker) start(path string) error {
newUrl = makeUrl(path, newUrl)
}

w.WorkQueue = append(w.WorkQueue, WorkQueue{Url: newUrl, Req: Request{
URL: newUrl,
Headers: w.Config.Headers,
Method: w.Config.Method,
}, RedirectConter: 0})
w.WorkQueue = append(w.WorkQueue, getRequestForQueue(newUrl, *w.Config))
}
execErr := w.startExecution()
if execErr != nil {
Expand Down
6 changes: 6 additions & 0 deletions pkg/hidden_fuzzer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func WriteFound(worker *Worker, queue WorkQueue, response Response) {
}
}

func WriteStr(worker *Worker, str string) {
if !worker.Config.Silent {
fmt.Fprintf(os.Stderr, "%s%s\n", Clear_Terminal, str)
}
}

func WriteFailure(worker *Worker, data string) {
if !worker.Config.Silent {
fmt.Fprintf(os.Stderr, "%s %d. %s\n", Clear_Terminal, worker.Config.FailureCounter, data)
Expand Down

0 comments on commit 7871c32

Please sign in to comment.