mirror of https://github.com/daffainfo/nuclei.git
adding metadata for exact collab match
parent
e5d4c7a6d0
commit
bb277c70b0
|
@ -14,7 +14,7 @@ require (
|
||||||
github.com/miekg/dns v1.1.35
|
github.com/miekg/dns v1.1.35
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/projectdiscovery/clistats v0.0.5
|
github.com/projectdiscovery/clistats v0.0.5
|
||||||
github.com/projectdiscovery/collaborator v0.0.1
|
github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed
|
||||||
github.com/projectdiscovery/fastdialer v0.0.1
|
github.com/projectdiscovery/fastdialer v0.0.1
|
||||||
github.com/projectdiscovery/gologger v1.0.1
|
github.com/projectdiscovery/gologger v1.0.1
|
||||||
github.com/projectdiscovery/hmap v0.0.1
|
github.com/projectdiscovery/hmap v0.0.1
|
||||||
|
|
|
@ -57,6 +57,8 @@ github.com/projectdiscovery/clistats v0.0.5 h1:vcvOR9PrFRawO/7FWD6pER9nYVSoSTD2F
|
||||||
github.com/projectdiscovery/clistats v0.0.5/go.mod h1:lV6jUHAv2bYWqrQstqW8iVIydKJhWlVaLl3Xo9ioVGg=
|
github.com/projectdiscovery/clistats v0.0.5/go.mod h1:lV6jUHAv2bYWqrQstqW8iVIydKJhWlVaLl3Xo9ioVGg=
|
||||||
github.com/projectdiscovery/collaborator v0.0.1 h1:dbQ5BCL/a3c+BB9cGtrGgiLs23+EfSzoaTzX/pxqiTI=
|
github.com/projectdiscovery/collaborator v0.0.1 h1:dbQ5BCL/a3c+BB9cGtrGgiLs23+EfSzoaTzX/pxqiTI=
|
||||||
github.com/projectdiscovery/collaborator v0.0.1/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20=
|
github.com/projectdiscovery/collaborator v0.0.1/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20=
|
||||||
|
github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed h1:0B4ccP68IL6MNHz99dAFeh0E3AY7fU5wVYwZJVX8ZG4=
|
||||||
|
github.com/projectdiscovery/collaborator v0.0.2-0.20201122173402-7afbb52febed/go.mod h1:J1z0fC7Svutz3LJqoRyTHA3F0Suh4livmkYv8MnKw20=
|
||||||
github.com/projectdiscovery/fastdialer v0.0.1 h1:MgBkJ/zkciFu/PcbAz0DYGiZn2aqv6b39NvfXxfN8qg=
|
github.com/projectdiscovery/fastdialer v0.0.1 h1:MgBkJ/zkciFu/PcbAz0DYGiZn2aqv6b39NvfXxfN8qg=
|
||||||
github.com/projectdiscovery/fastdialer v0.0.1/go.mod h1:d24GUzSb93wOY7lu4gJmXAzfomqAGEcRrInEVrM6zbc=
|
github.com/projectdiscovery/fastdialer v0.0.1/go.mod h1:d24GUzSb93wOY7lu4gJmXAzfomqAGEcRrInEVrM6zbc=
|
||||||
github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ=
|
github.com/projectdiscovery/gologger v1.0.1 h1:FzoYQZnxz9DCvSi/eg5A6+ET4CQ0CDUs27l6Exr8zMQ=
|
||||||
|
|
|
@ -2,6 +2,7 @@ package collaborator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/projectdiscovery/collaborator"
|
"github.com/projectdiscovery/collaborator"
|
||||||
|
@ -17,6 +18,7 @@ var DefaultPollInterval time.Duration = time.Second * time.Duration(PollSeconds)
|
||||||
var DefaultCollaborator BurpCollaborator = BurpCollaborator{Collab: collaborator.NewBurpCollaborator()}
|
var DefaultCollaborator BurpCollaborator = BurpCollaborator{Collab: collaborator.NewBurpCollaborator()}
|
||||||
|
|
||||||
type BurpCollaborator struct {
|
type BurpCollaborator struct {
|
||||||
|
sync.RWMutex
|
||||||
options *Options // unused
|
options *Options // unused
|
||||||
Collab *collaborator.BurpCollaborator
|
Collab *collaborator.BurpCollaborator
|
||||||
}
|
}
|
||||||
|
@ -41,19 +43,23 @@ func (b *BurpCollaborator) Poll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BurpCollaborator) Has(s string) bool {
|
func (b *BurpCollaborator) Has(s string) (found bool) {
|
||||||
|
foundAt := 0
|
||||||
for _, r := range b.Collab.RespBuffer {
|
for _, r := range b.Collab.RespBuffer {
|
||||||
for i := 0; i < len(r.Responses); i++ {
|
for i := 0; i < len(r.Responses); i++ {
|
||||||
// search in dns
|
// search in dns - http - smtp
|
||||||
if strings.Contains(r.Responses[i].Data.RawRequestDecoded, s) {
|
b.RLock()
|
||||||
return true
|
found = strings.Contains(r.Responses[i].Data.RawRequestDecoded, s) || strings.Contains(r.Responses[i].Data.RequestDecoded, s) || strings.Contains(r.Responses[i].Data.MessageDecoded, s)
|
||||||
}
|
b.RUnlock()
|
||||||
// search in http
|
if found {
|
||||||
if strings.Contains(r.Responses[i].Data.RequestDecoded, s) {
|
b.Lock()
|
||||||
return true
|
r.Responses = removeMatch(r.Responses, foundAt)
|
||||||
|
b.Unlock()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package collaborator
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/projectdiscovery/collaborator"
|
||||||
|
)
|
||||||
|
|
||||||
|
func removeMatch(responses []collaborator.BurpResponse, index int) []collaborator.BurpResponse {
|
||||||
|
return append(responses[:index], responses[index+1:]...)
|
||||||
|
}
|
|
@ -530,6 +530,11 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest,
|
||||||
// hardcode stopping storing data after defaultMaxHistorydata items
|
// hardcode stopping storing data after defaultMaxHistorydata items
|
||||||
if len(result.historyData) < defaultMaxHistorydata {
|
if len(result.historyData) < defaultMaxHistorydata {
|
||||||
result.Lock()
|
result.Lock()
|
||||||
|
// update history data with current reqURL and hostname
|
||||||
|
result.historyData["reqURL"] = reqURL
|
||||||
|
if parsed, err := url.Parse(reqURL); err == nil {
|
||||||
|
result.historyData["Hostname"] = parsed.Host
|
||||||
|
}
|
||||||
result.historyData = generators.MergeMaps(result.historyData, matchers.HTTPToMap(resp, body, headers, duration, format))
|
result.historyData = generators.MergeMaps(result.historyData, matchers.HTTPToMap(resp, body, headers, duration, format))
|
||||||
result.Unlock()
|
result.Unlock()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue