Fixed some bugs introduced from merge

dev
Ice3man543 2021-02-08 02:07:19 +05:30
parent 2cc6b2283e
commit 99e8fe1601
8 changed files with 35 additions and 29 deletions

View File

@ -233,12 +233,13 @@ func (r *Runner) RunEnumeration() {
for _, cluster := range clusters {
if len(cluster) > 1 && !r.options.OfflineHTTP {
executerOpts := protocols.ExecuterOptions{
Output: r.output,
Options: r.options,
Progress: r.progress,
Catalogue: r.catalogue,
RateLimiter: r.ratelimiter,
ProjectFile: r.projectFile,
Output: r.output,
Options: r.options,
Progress: r.progress,
Catalogue: r.catalogue,
RateLimiter: r.ratelimiter,
IssuesClient: r.issuesClient,
ProjectFile: r.projectFile,
}
clusterID := fmt.Sprintf("cluster-%s", xid.New().String())

View File

@ -44,12 +44,13 @@ func (r *Runner) getParsedTemplatesFor(templatePaths []string, severities []stri
// parseTemplateFile returns the parsed template file
func (r *Runner) parseTemplateFile(file string) (*templates.Template, error) {
executerOpts := protocols.ExecuterOptions{
Output: r.output,
Options: r.options,
Progress: r.progress,
Catalogue: r.catalogue,
RateLimiter: r.ratelimiter,
ProjectFile: r.projectFile,
Output: r.output,
Options: r.options,
Progress: r.progress,
Catalogue: r.catalogue,
IssuesClient: r.issuesClient,
RateLimiter: r.ratelimiter,
ProjectFile: r.projectFile,
}
template, err := templates.Parse(file, executerOpts)
if err != nil {

View File

@ -111,6 +111,7 @@ func NewMockExecuterOptions(options *types.Options, info *TemplateInfo) *protoco
Options: options,
Progress: progress,
ProjectFile: nil,
IssuesClient: nil,
Catalogue: catalogue.New(options.TemplatesDirectory),
RateLimiter: ratelimit.New(options.RateLimit),
}

View File

@ -24,12 +24,13 @@ func TestHTTPRequestsCluster(t *testing.T) {
list := make(map[string]*templates.Template)
for _, template := range templatesList {
executerOpts := protocols.ExecuterOptions{
Output: &mockOutput{},
Options: &types.Options{},
Progress: nil,
Catalogue: catalogue,
RateLimiter: nil,
ProjectFile: nil,
Output: &mockOutput{},
Options: &types.Options{},
Progress: nil,
Catalogue: catalogue,
RateLimiter: nil,
IssuesClient: nil,
ProjectFile: nil,
}
t, err := templates.Parse(template, executerOpts)
if err != nil {

View File

@ -146,7 +146,7 @@ func (r *Request) makeResultEventItem(wrapped *output.InternalWrappedEvent) *out
}
if r.options.Options.JSONRequests {
data.Request = types.ToString(wrapped.InternalEvent["request"])
data.Response = types.ToString(wrapped.InternalEvent["raw"])
data.Response = types.ToString(wrapped.InternalEvent["response"])
}
return data
}

View File

@ -17,9 +17,9 @@ func Summary(output *output.ResultEvent) string {
builder.WriteString("[")
builder.WriteString(template)
builder.WriteString("] [")
builder.WriteString(output.Info["severity"])
builder.WriteString(types.ToString(output.Info["severity"]))
builder.WriteString("] ")
builder.WriteString(output.Info["name"])
builder.WriteString(types.ToString(output.Info["name"]))
builder.WriteString(" found on ")
builder.WriteString(output.Host)
data := builder.String()

View File

@ -10,6 +10,7 @@ import (
"github.com/projectdiscovery/nuclei/v2/pkg/reporting/issues/github"
"github.com/projectdiscovery/nuclei/v2/pkg/reporting/issues/gitlab"
"github.com/projectdiscovery/nuclei/v2/pkg/reporting/issues/jira"
"github.com/projectdiscovery/nuclei/v2/pkg/types"
"gopkg.in/yaml.v2"
)
@ -50,7 +51,7 @@ func (f *Filter) Compile() {
// GetMatch returns true if a filter matches result event
func (f *Filter) GetMatch(event *output.ResultEvent) bool {
severity := event.Info["severity"]
severity := types.ToString(event.Info["severity"])
if len(f.severity) > 0 {
if stringSliceContains(f.severity, severity) {
return true
@ -59,7 +60,7 @@ func (f *Filter) GetMatch(event *output.ResultEvent) bool {
}
tags := event.Info["tags"]
tagParts := strings.Split(tags, ",")
tagParts := strings.Split(types.ToString(tags), ",")
for i, tag := range tagParts {
tagParts[i] = strings.TrimSpace(tag)
}

View File

@ -152,12 +152,13 @@ func (t *Template) parseWorkflowTemplate(workflow *workflows.WorkflowTemplate, o
}
for _, path := range paths {
opts := protocols.ExecuterOptions{
Output: options.Output,
Options: options.Options,
Progress: options.Progress,
Catalogue: options.Catalogue,
RateLimiter: options.RateLimiter,
ProjectFile: options.ProjectFile,
Output: options.Output,
Options: options.Options,
Progress: options.Progress,
Catalogue: options.Catalogue,
RateLimiter: options.RateLimiter,
IssuesClient: options.IssuesClient,
ProjectFile: options.ProjectFile,
}
template, err := Parse(path, opts)
if err != nil {