Projects STRLCPY csprecon Commits 3c20cdc6
🤬
  • ■ ■ ■ ■ ■ ■
    pkg/csprecon/csp.go
    skipped 10 lines
    11 11   "github.com/edoardottt/golazy"
    12 12  )
    13 13   
    14  -var (
    15  - UserAgent = golazy.GenerateRandomUserAgent()
    16  -)
    17  - 
    18 14  const (
    19 15   TLSHandshakeTimeout = 10
    20 16   KeepAlive = 30
    21 17   DomainRegex = `.*[a-zA-Z\_\-0-9]+\.[a-z]+`
    22 18  )
    23 19   
    24  -func checkCSP(url string, rCSP *regexp.Regexp, client *http.Client) ([]string, error) {
     20 +func checkCSP(url, ua string, rCSP *regexp.Regexp, client *http.Client) ([]string, error) {
    25 21   var (
    26 22   result = []string{}
    27 23   headerCSP []string
    skipped 4 lines
    32 28   return result, err
    33 29   }
    34 30   
    35  - req.Header.Add("User-Agent", UserAgent)
     31 + req.Header.Add("User-Agent", ua)
    36 32   
    37 33   resp, err := client.Do(req)
    38 34   if err != nil {
    skipped 71 lines
  • ■ ■ ■ ■ ■ ■
    pkg/csprecon/csprecon.go
    skipped 14 lines
    15 15  )
    16 16   
    17 17  type Runner struct {
    18  - Input chan string
    19  - Output chan string
    20  - Result output.Result
    21  - InWg *sync.WaitGroup
    22  - OutWg *sync.WaitGroup
    23  - Options input.Options
     18 + Input chan string
     19 + Output chan string
     20 + Result output.Result
     21 + UserAgent string
     22 + InWg *sync.WaitGroup
     23 + OutWg *sync.WaitGroup
     24 + Options input.Options
    24 25  }
    25 26   
    26 27  func New(options *input.Options) Runner {
    27 28   return Runner{
    28  - Input: make(chan string, options.Concurrency),
    29  - Output: make(chan string, options.Concurrency),
    30  - Result: output.New(),
    31  - InWg: &sync.WaitGroup{},
    32  - OutWg: &sync.WaitGroup{},
    33  - Options: *options,
     29 + Input: make(chan string, options.Concurrency),
     30 + Output: make(chan string, options.Concurrency),
     31 + Result: output.New(),
     32 + UserAgent: golazy.GenerateRandomUserAgent(),
     33 + InWg: &sync.WaitGroup{},
     34 + OutWg: &sync.WaitGroup{},
     35 + Options: *options,
    34 36   }
    35 37  }
    36 38   
    skipped 50 lines
    87 89   for value := range r.Input {
    88 90   client := customClient(r.Options.Timeout)
    89 91   
    90  - result, err := checkCSP(value, dregex, client)
     92 + result, err := checkCSP(value, r.UserAgent, dregex, client)
    91 93   if err != nil {
    92 94   if r.Options.Verbose {
    93 95   gologger.Error().Msgf("%s", err)
    skipped 54 lines
Please wait...
Page is in error, reload to recover