Documentation
¶
Index ¶
- Variables
- func ConnReadNWithTimeout(conn net.Conn, n int64, timeout time.Duration) ([]byte, error)
- type Input
- type NetworkInputType
- type NetworkInputTypeHolder
- func (holder NetworkInputTypeHolder) GetType() NetworkInputType
- func (holder NetworkInputTypeHolder) JSONSchema() *jsonschema.Schema
- func (holder *NetworkInputTypeHolder) MarshalJSON() ([]byte, error)
- func (holder NetworkInputTypeHolder) MarshalYAML() (interface{}, error)
- func (holder NetworkInputTypeHolder) String() string
- func (holder *NetworkInputTypeHolder) UnmarshalJSON(data []byte) error
- func (holder *NetworkInputTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Request
- func (request *Request) Compile(options *protocols.ExecutorOptions) error
- func (request *Request) ExecuteWithResults(target *contextargs.Context, metadata, previous output.InternalEvent, ...) error
- func (request *Request) Extract(data map[string]interface{}, extractor *extractors.Extractor) map[string]struct{}
- func (request *Request) GetCompiledOperators() []*operators.Operators
- func (request *Request) GetID() string
- func (request *Request) MakeResultEvent(wrapped *output.InternalWrappedEvent) []*output.ResultEvent
- func (request *Request) MakeResultEventItem(wrapped *output.InternalWrappedEvent) *output.ResultEvent
- func (request *Request) Match(data map[string]interface{}, matcher *matchers.Matcher) (bool, []string)
- func (request *Request) Requests() int
- func (request *Request) Type() templateTypes.ProtocolType
Constants ¶
This section is empty.
Variables ¶
var NetworkInputMapping = map[NetworkInputType]string{ // contains filtered or unexported fields }
NetworkInputMapping is a table for conversion of method from string.
var RequestPartDefinitions = map[string]string{
"template-id": "ID of the template executed",
"template-info": "Info Block of the template executed",
"template-path": "Path of the template executed",
"host": "Host is the input to the template",
"matched": "Matched is the input which was matched upon",
"type": "Type is the type of request made",
"request": "Network request made from the client",
"body,all,data": "Network response received from server (default)",
"raw": "Full Network protocol data",
}
RequestPartDefinitions 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 & suffixed by <>.
Functions ¶
Types ¶
type Input ¶
type Input struct {
// description: |
// Data is the data to send as the input.
//
// It supports DSL Helper Functions as well as normal expressions.
// examples:
// - value: "\"TEST\""
// - value: "\"hex_decode('50494e47')\""
Data string `` /* 160-byte string literal not displayed */
// description: |
// Type is the type of input specified in `data` field.
//
// Default value is text, but hex can be used for hex formatted data.
// values:
// - "hex"
// - "text"
Type NetworkInputTypeHolder `` /* 162-byte string literal not displayed */
// description: |
// Read is the number of bytes to read from socket.
//
// This can be used for protocols which expect an immediate response. You can
// read and write responses one after another and eventually perform matching
// on every data captured with `name` attribute.
//
// The [network docs](https://nuclei.projectdiscovery.io/templating-guide/protocols/network/) highlight more on how to do this.
// examples:
// - value: "1024"
Read int `` /* 136-byte string literal not displayed */
// description: |
// Name is the optional name of the data read to provide matching on.
// examples:
// - value: "\"prefix\""
Name string `` /* 156-byte string literal not displayed */
}
Input is the input to send on the network
type NetworkInputType ¶
type NetworkInputType int
NetworkInputType is the type of the network input specified
func GetSupportedNetworkInputTypes ¶
func GetSupportedNetworkInputTypes() []NetworkInputType
GetSupportedNetworkInputTypes returns list of supported types
func (NetworkInputType) String ¶
func (t NetworkInputType) String() string
type NetworkInputTypeHolder ¶
type NetworkInputTypeHolder struct {
NetworkInputType NetworkInputType `mapping:"true"`
}
NetworkInputTypeHolder is used to hold internal type of the Network type
func (NetworkInputTypeHolder) GetType ¶
func (holder NetworkInputTypeHolder) GetType() NetworkInputType
func (NetworkInputTypeHolder) JSONSchema ¶
func (holder NetworkInputTypeHolder) JSONSchema() *jsonschema.Schema
func (*NetworkInputTypeHolder) MarshalJSON ¶
func (holder *NetworkInputTypeHolder) MarshalJSON() ([]byte, error)
func (NetworkInputTypeHolder) MarshalYAML ¶
func (holder NetworkInputTypeHolder) MarshalYAML() (interface{}, error)
func (NetworkInputTypeHolder) String ¶
func (holder NetworkInputTypeHolder) String() string
func (*NetworkInputTypeHolder) UnmarshalJSON ¶
func (holder *NetworkInputTypeHolder) UnmarshalJSON(data []byte) error
func (*NetworkInputTypeHolder) UnmarshalYAML ¶
func (holder *NetworkInputTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error) error
type Request ¶
type Request struct {
// ID is the optional id of the request
ID string `yaml:"id,omitempty" json:"id,omitempty" jsonschema:"title=id of the request,description=ID of the network request"`
// description: |
// Host to send network requests to.
//
// Usually it's set to `{{Hostname}}`. If you want to enable TLS for
// TCP Connection, you can use `tls://{{Hostname}}`.
// examples:
// - value: |
// []string{"{{Hostname}}"}
Address []string `` /* 132-byte string literal not displayed */
// description: |
// Attack is the type of payload combinations to perform.
//
// Batteringram is inserts the same payload into all defined payload positions at once, pitchfork combines multiple payload sets and clusterbomb generates
// permutations and combinations for all payloads.
AttackType generators.AttackTypeHolder `` /* 216-byte string literal not displayed */
// description: |
// Payloads contains any payloads for the current request.
//
// Payloads support both key-values combinations where a list
// of payloads is provided, or optionally a single file can also
// be provided as payload which will be read on run-time.
Payloads map[string]interface{} `` /* 170-byte string literal not displayed */
// description: |
// Threads specifies number of threads to use sending requests. This enables Connection Pooling.
//
// Connection: Close attribute must not be used in request while using threads flag, otherwise
// pooling will fail and engine will continue to close connections after requests.
// examples:
// - name: Send requests using 10 concurrent threads
// value: 10
Threads int `` /* 202-byte string literal not displayed */
// description: |
// Inputs contains inputs for the network socket
Inputs []*Input `` /* 166-byte string literal not displayed */
// description: |
// Port is the port to send network requests to. this acts as default port but is overriden if target/input contains
// non-http(s) ports like 80,8080,8081 etc
Port string `` /* 158-byte string literal not displayed */
// description: |
// ExcludePorts is the list of ports to exclude from being scanned . It is intended to be used with `Port` field and contains a list of ports which are ignored/skipped
ExcludePorts string `` /* 158-byte string literal not displayed */
// description: |
// ReadSize is the size of response to read at the end
//
// Default value for read-size is 1024.
// examples:
// - value: "2048"
ReadSize int `` /* 176-byte string literal not displayed */
// description: |
// ReadAll determines if the data stream should be read till the end regardless of the size
//
// Default value for read-all is false.
// examples:
// - value: false
ReadAll bool `` /* 162-byte string literal not displayed */
// description: |
// SelfContained specifies if the request is self-contained.
SelfContained bool `yaml:"-" json:"-"`
// Operators for the current request go here.
operators.Operators `yaml:",inline,omitempty"`
CompiledOperators *operators.Operators `yaml:"-" json:"-"`
// contains filtered or unexported fields
}
Request contains a Network protocol request to be made from a template
func (*Request) Compile ¶
func (request *Request) Compile(options *protocols.ExecutorOptions) error
Compile compiles the protocol request for further execution.
func (*Request) ExecuteWithResults ¶
func (request *Request) ExecuteWithResults(target *contextargs.Context, metadata, previous output.InternalEvent, callback protocols.OutputEventCallback) error
ExecuteWithResults executes the protocol requests and returns results instead of writing them.
func (*Request) Extract ¶
func (request *Request) Extract(data map[string]interface{}, extractor *extractors.Extractor) map[string]struct{}
Extract performs extracting operation for an extractor on model and returns true or false.
func (*Request) GetCompiledOperators ¶
func (*Request) MakeResultEvent ¶
func (request *Request) MakeResultEvent(wrapped *output.InternalWrappedEvent) []*output.ResultEvent
MakeResultEvent creates a result event from internal wrapped event
func (*Request) MakeResultEventItem ¶
func (request *Request) MakeResultEventItem(wrapped *output.InternalWrappedEvent) *output.ResultEvent
func (*Request) Match ¶
func (request *Request) Match(data map[string]interface{}, matcher *matchers.Matcher) (bool, []string)
Match matches a generic data response again a given matcher
func (*Request) Type ¶
func (request *Request) Type() templateTypes.ProtocolType
Type returns the type of the protocol request