contextargs

package
v3.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: MIT Imports: 14 Imported by: 22

Documentation

Overview

Package contextargs implements a generic entity for shared context within workflows

All templates within a workflow shares the same cookiejar and a key-value store with shared items

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateVariables

func GenerateVariables(ctx *Context) map[string]interface{}

GenerateVariables from context args

Types

type Context

type Context struct {

	// Meta is the target for the executor
	MetaInput *MetaInput

	// CookieJar shared within workflow's http templates
	CookieJar *cookiejar.Jar
	// contains filtered or unexported fields
}

Context implements a shared context struct to share information across multiple templates within a workflow

func New

func New(ctx context.Context) *Context

Create a new contextargs instance

func NewWithInput

func NewWithInput(ctx context.Context, input string) *Context

Create a new contextargs instance with input string

func (*Context) Add

func (ctx *Context) Add(key string, v interface{})

Add the specific key-value pair

func (*Context) Clone

func (ctx *Context) Clone() *Context

func (*Context) Context added in v3.2.5

func (ctx *Context) Context() context.Context

Context returns the context of the current contextargs

func (*Context) ForEach

func (ctx *Context) ForEach(f func(string, interface{}))

func (*Context) Get

func (ctx *Context) Get(key string) (interface{}, bool)

Get the value with specific key if exists

func (*Context) GetAll

func (ctx *Context) GetAll() map[string]interface{}

func (*Context) Has

func (ctx *Context) Has(key string) bool

Has check if the key exists

func (*Context) HasArgs

func (ctx *Context) HasArgs() bool

func (*Context) Merge

func (ctx *Context) Merge(args map[string]interface{})

Merge the key-value pairs

func (*Context) Port

func (ctx *Context) Port() string

Port returns the port of the target

func (*Context) Set

func (ctx *Context) Set(key string, value interface{})

Set the specific key-value pair

func (*Context) UseNetworkPort

func (ctx *Context) UseNetworkPort(port string, excludePorts string) error

UseNetworkPort updates input with required/default network port for that template but is ignored if input/target contains non-http ports like 80,8080,8081 etc

type MetaInput

type MetaInput struct {
	// Input represent the target
	Input string `json:"input,omitempty"`
	// CustomIP to use for connection
	CustomIP string `json:"customIP,omitempty"`

	// ReqResp is the raw request for the input
	ReqResp *types.RequestResponse `json:"raw-request,omitempty"`
	// contains filtered or unexported fields
}

MetaInput represents a target with metadata (TODO: replace with https://github.com/projectdiscovery/metainput)

func (*MetaInput) Clone

func (metaInput *MetaInput) Clone() *MetaInput

func (*MetaInput) GetScanHash

func (metaInput *MetaInput) GetScanHash(templateId string) string

GetScanHash returns a unique hash that represents a scan by hashing (metainput + templateId)

func (*MetaInput) ID

func (metaInput *MetaInput) ID() string

ID returns a unique id/hash for metainput

func (*MetaInput) MarshalBytes

func (metaInput *MetaInput) MarshalBytes() ([]byte, error)

func (*MetaInput) MarshalString

func (metaInput *MetaInput) MarshalString() (string, error)

func (*MetaInput) MustMarshalBytes

func (metaInput *MetaInput) MustMarshalBytes() []byte

func (*MetaInput) MustMarshalString

func (metaInput *MetaInput) MustMarshalString() string

func (*MetaInput) PrettyPrint

func (metaInput *MetaInput) PrettyPrint() string

func (*MetaInput) Target added in v3.2.0

func (metaInput *MetaInput) Target() string

Target returns the target of the metainput

func (*MetaInput) URL added in v3.2.0

func (metaInput *MetaInput) URL() (*urlutil.URL, error)

URL returns request url

func (*MetaInput) Unmarshal

func (metaInput *MetaInput) Unmarshal(data string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL