mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-22 18:35:25 +00:00
change spm flag to work at template level instead of global for interactsh (#1466)
This commit is contained in:
parent
0e8270c7b5
commit
1faddf4723
@ -148,9 +148,6 @@ func (c *Client) firstTimeInitializeClient() error {
|
|||||||
c.interactsh = interactsh
|
c.interactsh = interactsh
|
||||||
|
|
||||||
interactsh.StartPolling(c.pollDuration, func(interaction *server.Interaction) {
|
interactsh.StartPolling(c.pollDuration, func(interaction *server.Interaction) {
|
||||||
if c.options.StopAtFirstMatch && c.matched {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if c.options.Debug {
|
if c.options.Debug {
|
||||||
debugPrintInteraction(interaction)
|
debugPrintInteraction(interaction)
|
||||||
}
|
}
|
||||||
@ -172,7 +169,7 @@ func (c *Client) firstTimeInitializeClient() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := request.Event.InternalEvent["stop-at-first-match"]; ok {
|
if _, ok := request.Event.InternalEvent["stop-at-first-match"]; ok || c.options.StopAtFirstMatch {
|
||||||
gotItem := c.matchedTemplates.Get(hash(request.Event.InternalEvent["template-id"].(string), request.Event.InternalEvent["host"].(string)))
|
gotItem := c.matchedTemplates.Get(hash(request.Event.InternalEvent["template-id"].(string), request.Event.InternalEvent["host"].(string)))
|
||||||
if gotItem != nil {
|
if gotItem != nil {
|
||||||
return
|
return
|
||||||
@ -208,7 +205,7 @@ func (c *Client) processInteractionForRequest(interaction *server.Interaction, d
|
|||||||
|
|
||||||
if writer.WriteResult(data.Event, c.options.Output, c.options.Progress, c.options.IssuesClient) {
|
if writer.WriteResult(data.Event, c.options.Output, c.options.Progress, c.options.IssuesClient) {
|
||||||
c.matched = true
|
c.matched = true
|
||||||
if _, ok := data.Event.InternalEvent["stop-at-first-match"]; ok {
|
if _, ok := data.Event.InternalEvent["stop-at-first-match"]; ok || c.options.StopAtFirstMatch {
|
||||||
c.matchedTemplates.Set(hash(data.Event.InternalEvent["template-id"].(string), data.Event.InternalEvent["host"].(string)), true, defaultInteractionDuration)
|
c.matchedTemplates.Set(hash(data.Event.InternalEvent["template-id"].(string), data.Event.InternalEvent["host"].(string)), true, defaultInteractionDuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,8 +272,11 @@ type RequestData struct {
|
|||||||
// RequestEvent is the event for a network request sent by nuclei.
|
// RequestEvent is the event for a network request sent by nuclei.
|
||||||
func (c *Client) RequestEvent(interactshURLs []string, data *RequestData) {
|
func (c *Client) RequestEvent(interactshURLs []string, data *RequestData) {
|
||||||
for _, interactshURL := range interactshURLs {
|
for _, interactshURL := range interactshURLs {
|
||||||
if c.options.StopAtFirstMatch && c.matched {
|
if _, ok := data.Event.InternalEvent["stop-at-first-match"]; ok || c.options.StopAtFirstMatch {
|
||||||
break
|
gotItem := c.matchedTemplates.Get(hash(data.Event.InternalEvent["template-id"].(string), data.Event.InternalEvent["host"].(string)))
|
||||||
|
if gotItem != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
id := strings.TrimSuffix(interactshURL, c.dotHostname)
|
id := strings.TrimSuffix(interactshURL, c.dotHostname)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user