yellow.git


yellow

~ opinionated web scanning pipeline for pentesters in a hurry
git clone https://github.com/djnnvx/yellow.git
log | files | refs | archive | README | LICENSE

httpx.go (1602B)

      1 package scan
      2 
      3 import (
      4 	"fmt"
      5 	"time"
      6 
      7 	"evil.djnn.sh/djnn/yellow/core"
      8 	helper "evil.djnn.sh/djnn/yellow/helpers"
      9 	"github.com/projectdiscovery/goflags"
     10 	"github.com/projectdiscovery/httpx/runner"
     11 )
     12 
     13 type Httpx struct{}
     14 
     15 func (*Httpx) Name() string { return "httpx" }
     16 
     17 func (*Httpx) Run(ctx *core.Context) error {
     18 	fmt.Println("[+] Running httpx on ", ctx.Domain)
     19 	if ctx.DryRun {
     20 		return nil
     21 	}
     22 
     23 	domain := ctx.Domain
     24 	options := runner.Options{
     25 		Methods:                   "GET",
     26 		InputTargetHost:           goflags.StringSlice{domain},
     27 		HTTPProxy:                 ctx.Proxy,
     28 		StoreResponseDir:          fmt.Sprintf("%s/httpx", ctx.ScanPath),
     29 		Screenshot:                true,
     30 		ScreenshotTimeout:         10 * time.Second,
     31 		ScreenshotIdle:            1 * time.Second,
     32 		RandomAgent:               true,
     33 		UseInstalledChrome:        helper.SystemChromePath() != "",
     34 		HeadlessOptionalArguments: nil,
     35 		NoHeadlessBody:            false,
     36 		RateLimit:                 int(ctx.RateLimit),
     37 
     38 		// httpx only defaults these via its flag parser. At 0: unbounded read, nothing saved.
     39 		MaxResponseBodySizeToRead: helper.MaxBodySize,
     40 		MaxResponseBodySizeToSave: helper.MaxBodySize,
     41 	}
     42 
     43 	if err := options.ValidateOptions(); err != nil {
     44 		fmt.Printf("[!] httpx: invalid options for %s: %v\n", domain, err)
     45 		return nil
     46 	}
     47 
     48 	httpxRunner, err := runner.New(&options)
     49 	if err != nil {
     50 		fmt.Printf("[!] httpx: could not create runner for %s: %v\n", domain, err)
     51 		return nil
     52 	}
     53 	defer httpxRunner.Close()
     54 
     55 	httpxRunner.RunEnumeration()
     56 	fmt.Printf("[SCAN %s] httpx completed.\n\n", domain)
     57 	return nil
     58 }