{"modulePath":"github.com/devilsfang/nuclei/v3","version":"v3.3.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package javascript\n\n## Variables\n\n```go\nvar RequestPartDefinitions = map[string]string{\n\t\"type\":     \"Type is the type of request made\",\n\t\"response\": \"Javascript protocol result response\",\n\t\"host\":     \"Host is the input to the template\",\n\t\"matched\":  \"Matched is the input which was matched upon\",\n}\n```\nRequestPartDefinitions contains a mapping of request part definitions and their description. Multiple definitions are separated by commas. Definitions not having a name (generated on runtime) are prefixed \u0026 suffixed by \\\u003c\u003e.\n\n## Types\n\n```go\ntype Request struct {\n\t// Operators for the current request go here.\n\toperators.Operators `yaml:\",inline,omitempty\" json:\",inline,omitempty\"`\n\tCompiledOperators   *operators.Operators `yaml:\"-\" json:\"-\"`\n\n\t// description: |\n\t// ID is request id in that protocol\n\tID string `yaml:\"id,omitempty\" json:\"id,omitempty\" jsonschema:\"title=id of the request,description=ID is the optional ID of the Request\"`\n\n\t// description: |\n\t//  Init is javascript code to execute after compiling template and before executing it on any target\n\t//  This is helpful for preparing payloads or other setup that maybe required for exploits\n\tInit string `yaml:\"init,omitempty\" json:\"init,omitempty\" jsonschema:\"title=init javascript code,description=Init is the javascript code to execute after compiling template\"`\n\n\t// description: |\n\t//   PreCondition is a condition which is evaluated before sending the request.\n\tPreCondition string `yaml:\"pre-condition,omitempty\" json:\"pre-condition,omitempty\" jsonschema:\"title=pre-condition for the request,description=PreCondition is a condition which is evaluated before sending the request\"`\n\n\t// description: |\n\t//   Args contains the arguments to pass to the javascript code.\n\tArgs map[string]interface{} `yaml:\"args,omitempty\" json:\"args,omitempty\"`\n\t// description: |\n\t//   Code contains code to execute for the javascript request.\n\tCode string `yaml:\"code,omitempty\" json:\"code,omitempty\" jsonschema:\"title=code to execute in javascript,description=Executes inline javascript code for the request\"`\n\t// description: |\n\t//   StopAtFirstMatch stops processing the request at first match.\n\tStopAtFirstMatch bool `yaml:\"stop-at-first-match,omitempty\" json:\"stop-at-first-match,omitempty\" jsonschema:\"title=stop at first match,description=Stop the execution after a match is found\"`\n\t// description: |\n\t//   Attack is the type of payload combinations to perform.\n\t//\n\t//   Sniper is each payload once, pitchfork combines multiple payload sets and clusterbomb generates\n\t//   permutations and combinations for all payloads.\n\tAttackType generators.AttackTypeHolder `yaml:\"attack,omitempty\" json:\"attack,omitempty\" jsonschema:\"title=attack is the payload combination,description=Attack is the type of payload combinations to perform,enum=sniper,enum=pitchfork,enum=clusterbomb\"`\n\t// description: |\n\t//   Payload concurreny i.e threads for sending requests.\n\t// examples:\n\t//   - name: Send requests using 10 concurrent threads\n\t//     value: 10\n\tThreads int `yaml:\"threads,omitempty\" json:\"threads,omitempty\" jsonschema:\"title=threads for sending requests,description=Threads specifies number of threads to use sending requests. This enables Connection Pooling\"`\n\t// description: |\n\t//   Payloads contains any payloads for the current request.\n\t//\n\t//   Payloads support both key-values combinations where a list\n\t//   of payloads is provided, or optionally a single file can also\n\t//   be provided as payload which will be read on run-time.\n\tPayloads map[string]interface{} `yaml:\"payloads,omitempty\" json:\"payloads,omitempty\" jsonschema:\"title=payloads for the webosocket request,description=Payloads contains any payloads for the current request\"`\n\t// contains filtered or unexported fields\n}\n```\nRequest is a request for the javascript protocol\n\n```go\nfunc (request *Request) Compile(options *protocols.ExecutorOptions) error\n```\nCompile compiles the request generators preparing any requests possible.\n\n```go\nfunc (request *Request) ExecuteWithResults(target *contextargs.Context, dynamicValues, previous output.InternalEvent, callback protocols.OutputEventCallback) error\n```\nExecuteWithResults executes the protocol requests and returns results instead of writing them.\n\n```go\nfunc (request *Request) Extract(data map[string]interface{}, matcher *extractors.Extractor) map[string]struct{}\n```\nExtract performs extracting operation for an extractor on model and returns true or false.\n\n```go\nfunc (request *Request) GetCompiledOperators() []*operators.Operators\n```\nGetCompiledOperators returns a list of the compiled operators\n\n```go\nfunc (request *Request) GetID() string\n```\nGetID returns the ID for the request if any.\n\n```go\nfunc (request *Request) MakeResultEvent(wrapped *output.InternalWrappedEvent) []*output.ResultEvent\n```\nMakeResultEvent creates a result event from internal wrapped event\n\n```go\nfunc (request *Request) MakeResultEventItem(wrapped *output.InternalWrappedEvent) *output.ResultEvent\n```\n\n```go\nfunc (request *Request) Match(data map[string]interface{}, matcher *matchers.Matcher) (bool, []string)\n```\nMatch performs matching operation for a matcher on model and returns: true and a list of matched snippets if the matcher type is supports it otherwise false and an empty string slice\n\n```go\nfunc (r *Request) Options() *protocols.ExecutorOptions\n```\nOptions returns executer options for http request\n\n```go\nfunc (request *Request) Requests() int\n```\nRequests returns the total number of requests the rule will perform\n\n```go\nfunc (request *Request) Type() templateTypes.ProtocolType\n```\nType returns the type of the protocol request\n\n","path":"github.com/devilsfang/nuclei/v3/pkg/protocols/javascript","name":"javascript","synopsis":"","isRedistributable":true}
