mirror of https://github.com/daffainfo/nuclei.git
commit
2dfd245f54
|
@ -59,6 +59,7 @@ This will display help for the tool. Here are all the switches it supports.
|
||||||
| -t | Templates input file/files to check across hosts | nuclei -t nuclei-templates/cves/ |
|
| -t | Templates input file/files to check across hosts | nuclei -t nuclei-templates/cves/ |
|
||||||
| -nC | Don't Use colors in output | nuclei -nC |
|
| -nC | Don't Use colors in output | nuclei -nC |
|
||||||
| -json | Prints and write output in json format | nuclei -json |
|
| -json | Prints and write output in json format | nuclei -json |
|
||||||
|
| -json-requests | Write requests/responses for matches in JSON output | nuclei -json -json-requests |
|
||||||
| -o | File to save output result (optional) | nuclei -o output.txt |
|
| -o | File to save output result (optional) | nuclei -o output.txt |
|
||||||
| -pbar | Enable the progress bar (optional) | nuclei -pbar |
|
| -pbar | Enable the progress bar (optional) | nuclei -pbar |
|
||||||
| -silent | Show only found results in output | nuclei -silent |
|
| -silent | Show only found results in output | nuclei -silent |
|
||||||
|
|
|
@ -466,14 +466,15 @@ func (r *Runner) processTemplateWithList(p progress.IProgress, template *templat
|
||||||
switch value := request.(type) {
|
switch value := request.(type) {
|
||||||
case *requests.DNSRequest:
|
case *requests.DNSRequest:
|
||||||
dnsExecuter = executer.NewDNSExecuter(&executer.DNSOptions{
|
dnsExecuter = executer.NewDNSExecuter(&executer.DNSOptions{
|
||||||
Debug: r.options.Debug,
|
Debug: r.options.Debug,
|
||||||
Template: template,
|
Template: template,
|
||||||
DNSRequest: value,
|
DNSRequest: value,
|
||||||
Writer: writer,
|
Writer: writer,
|
||||||
JSON: r.options.JSON,
|
JSON: r.options.JSON,
|
||||||
ColoredOutput: !r.options.NoColor,
|
JSONRequests: r.options.JSONRequests,
|
||||||
Colorizer: r.colorizer,
|
ColoredOutput: !r.options.NoColor,
|
||||||
Decolorizer: r.decolorizer,
|
Colorizer: r.colorizer,
|
||||||
|
Decolorizer: r.decolorizer,
|
||||||
})
|
})
|
||||||
case *requests.BulkHTTPRequest:
|
case *requests.BulkHTTPRequest:
|
||||||
httpExecuter, err = executer.NewHTTPExecuter(&executer.HTTPOptions{
|
httpExecuter, err = executer.NewHTTPExecuter(&executer.HTTPOptions{
|
||||||
|
@ -609,18 +610,18 @@ func (r *Runner) ProcessWorkflow(p progress.IProgress, workflow *workflows.Workf
|
||||||
ProxySocksURL: r.options.ProxySocksURL,
|
ProxySocksURL: r.options.ProxySocksURL,
|
||||||
CustomHeaders: r.options.CustomHeaders,
|
CustomHeaders: r.options.CustomHeaders,
|
||||||
CookieJar: jar,
|
CookieJar: jar,
|
||||||
ColoredOutput: !r.options.NoColor,
|
ColoredOutput: !r.options.NoColor,
|
||||||
Colorizer: r.colorizer,
|
Colorizer: r.colorizer,
|
||||||
Decolorizer: r.decolorizer,
|
Decolorizer: r.decolorizer,
|
||||||
}
|
}
|
||||||
} else if len(t.RequestsDNS) > 0 {
|
} else if len(t.RequestsDNS) > 0 {
|
||||||
template.DNSOptions = &executer.DNSOptions{
|
template.DNSOptions = &executer.DNSOptions{
|
||||||
Debug: r.options.Debug,
|
Debug: r.options.Debug,
|
||||||
Template: t,
|
Template: t,
|
||||||
Writer: writer,
|
Writer: writer,
|
||||||
ColoredOutput: !r.options.NoColor,
|
ColoredOutput: !r.options.NoColor,
|
||||||
Colorizer: r.colorizer,
|
Colorizer: r.colorizer,
|
||||||
Decolorizer: r.decolorizer,
|
Decolorizer: r.decolorizer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if template.DNSOptions != nil || template.HTTPOptions != nil {
|
if template.DNSOptions != nil || template.HTTPOptions != nil {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import (
|
||||||
type DNSExecuter struct {
|
type DNSExecuter struct {
|
||||||
debug bool
|
debug bool
|
||||||
jsonOutput bool
|
jsonOutput bool
|
||||||
|
jsonRequest bool
|
||||||
Results bool
|
Results bool
|
||||||
dnsClient *retryabledns.Client
|
dnsClient *retryabledns.Client
|
||||||
template *templates.Template
|
template *templates.Template
|
||||||
|
@ -44,11 +45,12 @@ var DefaultResolvers = []string{
|
||||||
|
|
||||||
// DNSOptions contains configuration options for the DNS executer.
|
// DNSOptions contains configuration options for the DNS executer.
|
||||||
type DNSOptions struct {
|
type DNSOptions struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
JSON bool
|
JSON bool
|
||||||
Template *templates.Template
|
JSONRequests bool
|
||||||
DNSRequest *requests.DNSRequest
|
Template *templates.Template
|
||||||
Writer *bufio.Writer
|
DNSRequest *requests.DNSRequest
|
||||||
|
Writer *bufio.Writer
|
||||||
|
|
||||||
ColoredOutput bool
|
ColoredOutput bool
|
||||||
Colorizer aurora.Aurora
|
Colorizer aurora.Aurora
|
||||||
|
@ -63,6 +65,7 @@ func NewDNSExecuter(options *DNSOptions) *DNSExecuter {
|
||||||
executer := &DNSExecuter{
|
executer := &DNSExecuter{
|
||||||
debug: options.Debug,
|
debug: options.Debug,
|
||||||
jsonOutput: options.JSON,
|
jsonOutput: options.JSON,
|
||||||
|
jsonRequest: options.JSONRequests,
|
||||||
dnsClient: dnsClient,
|
dnsClient: dnsClient,
|
||||||
template: options.Template,
|
template: options.Template,
|
||||||
dnsRequest: options.DNSRequest,
|
dnsRequest: options.DNSRequest,
|
||||||
|
@ -127,7 +130,7 @@ func (e *DNSExecuter) ExecuteDNS(p progress.IProgress, URL string) (result Resul
|
||||||
// If the matcher has matched, and its an OR
|
// If the matcher has matched, and its an OR
|
||||||
// write the first output then move to next matcher.
|
// write the first output then move to next matcher.
|
||||||
if matcherCondition == matchers.ORCondition && len(e.dnsRequest.Extractors) == 0 {
|
if matcherCondition == matchers.ORCondition && len(e.dnsRequest.Extractors) == 0 {
|
||||||
e.writeOutputDNS(domain, matcher, nil)
|
e.writeOutputDNS(domain, compiledRequest, resp, matcher, nil)
|
||||||
result.GotResults = true
|
result.GotResults = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +150,7 @@ func (e *DNSExecuter) ExecuteDNS(p progress.IProgress, URL string) (result Resul
|
||||||
// Write a final string of output if matcher type is
|
// Write a final string of output if matcher type is
|
||||||
// AND or if we have extractors for the mechanism too.
|
// AND or if we have extractors for the mechanism too.
|
||||||
if len(e.dnsRequest.Extractors) > 0 || matcherCondition == matchers.ANDCondition {
|
if len(e.dnsRequest.Extractors) > 0 || matcherCondition == matchers.ANDCondition {
|
||||||
e.writeOutputDNS(domain, nil, extractorResults)
|
e.writeOutputDNS(domain, compiledRequest, resp, nil, extractorResults)
|
||||||
result.GotResults = true
|
result.GotResults = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package executer
|
package executer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/miekg/dns"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
@ -9,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// writeOutputDNS writes dns output to streams
|
// writeOutputDNS writes dns output to streams
|
||||||
func (e *DNSExecuter) writeOutputDNS(domain string, matcher *matchers.Matcher, extractorResults []string) {
|
func (e *DNSExecuter) writeOutputDNS(domain string, req *dns.Msg, resp *dns.Msg, matcher *matchers.Matcher, extractorResults []string) {
|
||||||
if e.jsonOutput {
|
if e.jsonOutput {
|
||||||
output := jsonOutput{
|
output := jsonOutput{
|
||||||
Template: e.template.ID,
|
Template: e.template.ID,
|
||||||
|
@ -25,6 +26,10 @@ func (e *DNSExecuter) writeOutputDNS(domain string, matcher *matchers.Matcher, e
|
||||||
if len(extractorResults) > 0 {
|
if len(extractorResults) > 0 {
|
||||||
output.ExtractedResults = extractorResults
|
output.ExtractedResults = extractorResults
|
||||||
}
|
}
|
||||||
|
if e.jsonRequest {
|
||||||
|
output.Request = req.String()
|
||||||
|
output.Response = resp.String()
|
||||||
|
}
|
||||||
data, err := jsoniter.Marshal(output)
|
data, err := jsoniter.Marshal(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
gologger.Warningf("Could not marshal json output: %s\n", err)
|
gologger.Warningf("Could not marshal json output: %s\n", err)
|
||||||
|
|
Loading…
Reference in New Issue