mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-20 16:25:24 +00:00
adding burp collaborator support
This commit is contained in:
parent
88d187baf1
commit
53e4b45479
@ -3,6 +3,7 @@ module github.com/projectdiscovery/nuclei/v2
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/projectdiscovery/collaborator v0.0.0
|
||||||
github.com/Knetic/govaluate v3.0.0+incompatible
|
github.com/Knetic/govaluate v3.0.0+incompatible
|
||||||
github.com/blang/semver v3.5.1+incompatible
|
github.com/blang/semver v3.5.1+incompatible
|
||||||
github.com/d5/tengo/v2 v2.6.2
|
github.com/d5/tengo/v2 v2.6.2
|
||||||
|
|||||||
@ -42,6 +42,7 @@ type Options struct {
|
|||||||
Templates multiStringFlag // Signature specifies the template/templates to use
|
Templates multiStringFlag // Signature specifies the template/templates to use
|
||||||
ExcludedTemplates multiStringFlag // Signature specifies the template/templates to exclude
|
ExcludedTemplates multiStringFlag // Signature specifies the template/templates to exclude
|
||||||
CustomHeaders requests.CustomHeaders // Custom global headers
|
CustomHeaders requests.CustomHeaders // Custom global headers
|
||||||
|
BurpCollaboratorBiid string // Burp Collaborator BIID for polling
|
||||||
}
|
}
|
||||||
|
|
||||||
type multiStringFlag []string
|
type multiStringFlag []string
|
||||||
@ -86,6 +87,7 @@ func ParseOptions() *Options {
|
|||||||
flag.IntVar(&options.BulkSize, "bulk-size", 150, "Number of hosts analyzed in parallel per template")
|
flag.IntVar(&options.BulkSize, "bulk-size", 150, "Number of hosts analyzed in parallel per template")
|
||||||
flag.BoolVar(&options.NoMeta, "no-meta", false, "Don't display metadata for the matches")
|
flag.BoolVar(&options.NoMeta, "no-meta", false, "Don't display metadata for the matches")
|
||||||
flag.BoolVar(&options.TemplatesVersion, "templates-version", false, "Shows the installed nuclei-templates version")
|
flag.BoolVar(&options.TemplatesVersion, "templates-version", false, "Shows the installed nuclei-templates version")
|
||||||
|
flag.StringVar(&options.BurpCollaboratorBiid, "burp-collaborator-biid", "", "Burp Collaborator BIID")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// Check if stdin pipe was given
|
// Check if stdin pipe was given
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/projectdiscovery/nuclei/v2/internal/bufwriter"
|
"github.com/projectdiscovery/nuclei/v2/internal/bufwriter"
|
||||||
"github.com/projectdiscovery/nuclei/v2/internal/progress"
|
"github.com/projectdiscovery/nuclei/v2/internal/progress"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/atomicboolean"
|
"github.com/projectdiscovery/nuclei/v2/pkg/atomicboolean"
|
||||||
|
"github.com/projectdiscovery/nuclei/v2/pkg/collaborator"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/colorizer"
|
"github.com/projectdiscovery/nuclei/v2/pkg/colorizer"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/globalratelimiter"
|
"github.com/projectdiscovery/nuclei/v2/pkg/globalratelimiter"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
|
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
|
||||||
@ -164,6 +165,11 @@ func New(options *Options) (*Runner, error) {
|
|||||||
// Creates the progress tracking object
|
// Creates the progress tracking object
|
||||||
runner.progress = progress.NewProgress(runner.colorizer.Colorizer, options.EnableProgressBar)
|
runner.progress = progress.NewProgress(runner.colorizer.Colorizer, options.EnableProgressBar)
|
||||||
|
|
||||||
|
// Enable Polling
|
||||||
|
if options.BurpCollaboratorBiid != "" {
|
||||||
|
collaborator.DefaultCollaborator.Collab.AddBIID(options.BurpCollaboratorBiid)
|
||||||
|
}
|
||||||
|
|
||||||
return runner, nil
|
return runner, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +235,9 @@ func (r *Runner) RunEnumeration() {
|
|||||||
} // nolint:wsl // comment
|
} // nolint:wsl // comment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Starts polling or ignore
|
||||||
|
collaborator.DefaultCollaborator.Poll()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
wgtemplates sync.WaitGroup
|
wgtemplates sync.WaitGroup
|
||||||
results atomicboolean.AtomBool
|
results atomicboolean.AtomBool
|
||||||
|
|||||||
57
v2/pkg/collaborator/collaborator.go
Normal file
57
v2/pkg/collaborator/collaborator.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package collaborator
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/projectdiscovery/collaborator"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultMaxBufferLimit = 150
|
||||||
|
DefaultPollInterval = time.Second * time.Duration(5)
|
||||||
|
)
|
||||||
|
|
||||||
|
var DefaultCollaborator BurpCollaborator = BurpCollaborator{Collab: collaborator.NewBurpCollaborator()}
|
||||||
|
|
||||||
|
type BurpCollaborator struct {
|
||||||
|
options *Options
|
||||||
|
Collab *collaborator.BurpCollaborator
|
||||||
|
}
|
||||||
|
|
||||||
|
type Options struct {
|
||||||
|
BIID string
|
||||||
|
PollInterval time.Duration
|
||||||
|
MaxBufferLimit int
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(options Options) *BurpCollaborator {
|
||||||
|
collab := collaborator.NewBurpCollaborator()
|
||||||
|
collab.AddBIID(options.BIID)
|
||||||
|
collab.MaxBufferLimit = options.MaxBufferLimit
|
||||||
|
return &BurpCollaborator{Collab: collab}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BurpCollaborator) Poll() {
|
||||||
|
// if no valid biids were provided just return
|
||||||
|
if len(b.Collab.BIIDs) > 0 {
|
||||||
|
go b.Collab.PollEach(DefaultPollInterval)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BurpCollaborator) Has(s string) bool {
|
||||||
|
for _, r := range b.Collab.RespBuffer {
|
||||||
|
for _, rr := range r.Responses {
|
||||||
|
// search in dns
|
||||||
|
if strings.Contains(rr.Data.RawRequestDecoded, s) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// search in http
|
||||||
|
if strings.Contains(rr.Data.RequestDecoded, s) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
@ -13,8 +13,10 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Knetic/govaluate"
|
"github.com/Knetic/govaluate"
|
||||||
|
"github.com/projectdiscovery/nuclei/v2/pkg/collaborator"
|
||||||
"github.com/spaolacci/murmur3"
|
"github.com/spaolacci/murmur3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -277,5 +279,18 @@ func HelperFunctions() (functions map[string]govaluate.ExpressionFunction) {
|
|||||||
return rand.Intn(max-min) + min, nil
|
return rand.Intn(max-min) + min, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Time Functions
|
||||||
|
functions["waitfor"] = func(args ...interface{}) (interface{}, error) {
|
||||||
|
seconds := args[0].(float64)
|
||||||
|
time.Sleep(time.Duration(seconds) * time.Second)
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collaborator
|
||||||
|
functions["collab"] = func(args ...interface{}) (interface{}, error) {
|
||||||
|
// check if collaborator contains a specific pattern
|
||||||
|
return collaborator.DefaultCollaborator.Has(args[0].(string)), nil
|
||||||
|
}
|
||||||
|
|
||||||
return functions
|
return functions
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user