Misc changes / fixes

dev
Ice3man543 2021-03-06 14:31:21 +05:30
parent 908889ccb5
commit 0dd2e10fd2
3 changed files with 14 additions and 6 deletions

View File

@ -82,7 +82,7 @@ func validateOptions(options *types.Options) error {
if !options.TemplateList { if !options.TemplateList {
// Check if a list of templates was provided and it exists // Check if a list of templates was provided and it exists
if len(options.Templates) == 0 && len(options.Workflows) == 0 && len(options.Tags) == 0 && !options.UpdateTemplates { if len(options.Templates) == 0 && !options.NewTemplates && len(options.Workflows) == 0 && len(options.Tags) == 0 && !options.UpdateTemplates {
return errors.New("no template/templates provided") return errors.New("no template/templates provided")
} }
} }

View File

@ -244,7 +244,9 @@ func (p *Page) Screenshot(act *Action, out map[string]string) error {
to := act.GetArg("to") to := act.GetArg("to")
if to == "" { if to == "" {
to = ksuid.New().String() to = ksuid.New().String()
out[act.Name] = to if act.Name != "" {
out[act.Name] = to
}
} }
var data []byte var data []byte
var err error var err error
@ -354,7 +356,9 @@ func (p *Page) GetResource(act *Action, out map[string]string) error {
if err != nil { if err != nil {
return errors.Wrap(err, "could not get src for element") return errors.Wrap(err, "could not get src for element")
} }
out[act.Name] = string(resource) if act.Name != "" {
out[act.Name] = string(resource)
}
return nil return nil
} }
@ -394,13 +398,17 @@ func (p *Page) ExtractElement(act *Action, out map[string]string) error {
if err != nil { if err != nil {
return errors.Wrap(err, "could not get attribute") return errors.Wrap(err, "could not get attribute")
} }
out[act.Name] = *attrValue if act.Name != "" {
out[act.Name] = *attrValue
}
default: default:
text, err := element.Text() text, err := element.Text()
if err != nil { if err != nil {
return errors.Wrap(err, "could not get element text node") return errors.Wrap(err, "could not get element text node")
} }
out[act.Name] = text if act.Name != "" {
out[act.Name] = text
}
} }
return nil return nil
} }

View File

@ -62,7 +62,7 @@ func (r *Request) Extract(data map[string]interface{}, extractor *extractors.Ext
} }
// responseToDSLMap converts a DNS response to a map for use in DSL matching // responseToDSLMap converts a DNS response to a map for use in DSL matching
func (r *Request) responseToDSLMap(resp, req, host, matched string) output.InternalEvent { func (r *Request) responseToDSLMap(resp, req string, host, matched string) output.InternalEvent {
data := make(output.InternalEvent, 5) data := make(output.InternalEvent, 5)
// Some data regarding the request metadata // Some data regarding the request metadata