mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-24 03:15:26 +00:00
added dns support in workflow
This commit is contained in:
parent
d3ceb76585
commit
429369c971
@ -375,7 +375,12 @@ func (r *Runner) ProcessWorkflow(workflow *workflows.Workflow, URL string) error
|
|||||||
ProxySocksURL: r.options.ProxySocksURL,
|
ProxySocksURL: r.options.ProxySocksURL,
|
||||||
CustomHeaders: r.options.CustomHeaders,
|
CustomHeaders: r.options.CustomHeaders,
|
||||||
}
|
}
|
||||||
script.Add(name, &workflows.NucleiVar{Options: httpOptions, URL: URL})
|
dnsOptions := &executor.DNSOptions{
|
||||||
|
Debug: r.options.Debug,
|
||||||
|
Template: template,
|
||||||
|
Writer: writer,
|
||||||
|
}
|
||||||
|
script.Add(name, &workflows.NucleiVar{HTTPOptions: httpOptions, DNSOptions: dnsOptions, URL: URL})
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := script.RunContext(context.Background())
|
_, err := script.RunContext(context.Background())
|
||||||
@ -384,8 +389,6 @@ func (r *Runner) ProcessWorkflow(workflow *workflows.Workflow, URL string) error
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// OUTPUT - TODO - Any suggestion?
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,36 +1,39 @@
|
|||||||
package workflows
|
package workflows
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/d5/tengo/v2"
|
"github.com/d5/tengo/v2"
|
||||||
"github.com/projectdiscovery/nuclei/pkg/executor"
|
"github.com/projectdiscovery/nuclei/pkg/executor"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NucleiVar within the scripting engine
|
||||||
type NucleiVar struct {
|
type NucleiVar struct {
|
||||||
tengo.ObjectImpl
|
tengo.ObjectImpl
|
||||||
Options *executor.HTTPOptions
|
HTTPOptions *executor.HTTPOptions
|
||||||
URL string
|
DNSOptions *executor.DNSOptions
|
||||||
|
URL string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TypeName of the variable
|
||||||
func (n *NucleiVar) TypeName() string {
|
func (n *NucleiVar) TypeName() string {
|
||||||
return "nuclei-var"
|
return "nuclei-var"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CanCall can be called from within the scripting engine
|
||||||
func (n *NucleiVar) CanCall() bool {
|
func (n *NucleiVar) CanCall() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call logic - actually it doesn't require arguments
|
||||||
func (n *NucleiVar) Call(args ...tengo.Object) (ret tengo.Object, err error) {
|
func (n *NucleiVar) Call(args ...tengo.Object) (ret tengo.Object, err error) {
|
||||||
for _, request := range n.Options.Template.RequestsHTTP {
|
for _, request := range n.HTTPOptions.Template.RequestsHTTP {
|
||||||
n.Options.HTTPRequest = request
|
n.HTTPOptions.HTTPRequest = request
|
||||||
httpExecutor, err := executor.NewHTTPExecutor(n.Options)
|
httpExecutor, err := executor.NewHTTPExecutor(n.HTTPOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
err = httpExecutor.ExecuteHTTP(n.URL)
|
err = httpExecutor.ExecuteHTTP(n.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
if httpExecutor.GotResults() {
|
if httpExecutor.GotResults() {
|
||||||
return tengo.TrueValue, nil
|
return tengo.TrueValue, nil
|
||||||
@ -38,5 +41,18 @@ func (n *NucleiVar) Call(args ...tengo.Object) (ret tengo.Object, err error) {
|
|||||||
return tengo.FalseValue, nil
|
return tengo.FalseValue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, request := range n.DNSOptions.Template.RequestsDNS {
|
||||||
|
n.DNSOptions.DNSRequest = request
|
||||||
|
dnsExecutor := executor.NewDNSExecutor(n.DNSOptions)
|
||||||
|
err = dnsExecutor.ExecuteDNS(n.URL)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if dnsExecutor.GotResults() {
|
||||||
|
return tengo.TrueValue, nil
|
||||||
|
}
|
||||||
|
return tengo.FalseValue, nil
|
||||||
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user