-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from projectdiscovery/feature-burp-collaborator
adding burp collaborator support
- Loading branch information
Showing
6 changed files
with
136 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package collaborator | ||
|
||
import ( | ||
"strings" | ||
"time" | ||
|
||
"github.com/projectdiscovery/collaborator" | ||
) | ||
|
||
const ( | ||
PollSeconds = 5 | ||
DefaultMaxBufferLimit = 150 | ||
) | ||
|
||
var DefaultPollInterval time.Duration = time.Second * time.Duration(PollSeconds) | ||
|
||
var DefaultCollaborator BurpCollaborator = BurpCollaborator{Collab: collaborator.NewBurpCollaborator()} | ||
|
||
type BurpCollaborator struct { | ||
options *Options // unused | ||
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, options: options} | ||
} | ||
|
||
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 i := 0; i < len(r.Responses); i++ { | ||
// search in dns | ||
if strings.Contains(r.Responses[i].Data.RawRequestDecoded, s) { | ||
return true | ||
} | ||
// search in http | ||
if strings.Contains(r.Responses[i].Data.RequestDecoded, s) { | ||
return true | ||
} | ||
} | ||
} | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters