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 ¶
- func GenerateVariables(ctx *Context) map[string]interface{}
- type Context
- func (ctx *Context) Add(key string, v interface{})
- func (ctx *Context) Clone() *Context
- func (ctx *Context) Context() context.Context
- func (ctx *Context) ForEach(f func(string, interface{}))
- func (ctx *Context) Get(key string) (interface{}, bool)
- func (ctx *Context) GetAll() map[string]interface{}
- func (ctx *Context) Has(key string) bool
- func (ctx *Context) HasArgs() bool
- func (ctx *Context) Merge(args map[string]interface{})
- func (ctx *Context) Port() string
- func (ctx *Context) Set(key string, value interface{})
- func (ctx *Context) UseNetworkPort(port string, excludePorts string) error
- type MetaInput
- func (metaInput *MetaInput) Address() string
- func (metaInput *MetaInput) Clone() *MetaInput
- func (metaInput *MetaInput) GetScanHash(templateId string) string
- func (metaInput *MetaInput) ID() string
- func (metaInput *MetaInput) MarshalBytes() ([]byte, error)
- func (metaInput *MetaInput) MarshalString() (string, error)
- func (metaInput *MetaInput) MustMarshalBytes() []byte
- func (metaInput *MetaInput) MustMarshalString() string
- func (metaInput *MetaInput) Port() string
- func (metaInput *MetaInput) PrettyPrint() string
- func (metaInput *MetaInput) Target() string
- func (metaInput *MetaInput) URL() (*urlutil.URL, error)
- func (metaInput *MetaInput) Unmarshal(data string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateVariables ¶
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 GetCopyIfHostOutdated ¶
GetCopyIfHostOutdated returns a new contextargs if the host is outdated
func NewWithInput ¶
Create a new contextargs instance with input string
func NewWithMetaInput ¶
NewWithMetaInput creates a new contextargs instance with meta input
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 NewMetaInput ¶
func NewMetaInput() *MetaInput
func (*MetaInput) Address ¶
Address return the remote address of target Note: it does not resolve the domain to ip it is meant to be used by hosterrorsCache if invalid metainput is provided then it uses a random ksuid as hostname to avoid skipping valid targets
func (*MetaInput) GetScanHash ¶
GetScanHash returns a unique hash that represents a scan by hashing (metainput + templateId)
func (*MetaInput) MarshalBytes ¶
func (*MetaInput) MarshalString ¶
func (*MetaInput) MustMarshalBytes ¶
func (*MetaInput) MustMarshalString ¶
func (*MetaInput) Port ¶
Port returns the port of the target if port is not present then empty string is returned