modules

package
v0.0.0-...-abed891 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: GPL-3.0 Imports: 4 Imported by: 27

Documentation

Overview

Package modules provides functionality for loading, configuring and running gorp modules

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetModuleOption

func GetModuleOption(p []Option, name string) (string, error)

GetModuleOptionValue is used for obtaining the value of a given module option. It returns the value for the option name requested and an error if the option cannot be found.

Types

type Inspector

type Inspector interface {
	Init()                         // Init Initializes module data
	GetOptions() []Option          // GetOptions returns a list of available options for the module
	GetRegistry() Registry         // GetRegistry returns an object with meta data describing the module
	Inspect(webData WebData) error // Inspect inspects web content for discovery and recon purposes
}

Inspector identifies the functions that all inspector modules must implement.

type InspectorModule

type InspectorModule struct {
	Inspect  func(webData WebData) error
	Registry Registry
	Options  []Option
}

InspectorModule represents an inspector module. Inspectors analyse responses to answer questions about the application or to discover different types of information found in HTML documents, JavaScript comments and code

func (*InspectorModule) SetOption

func (i *InspectorModule) SetOption(name string, value string) error

SetOption is used to change and set an inspector module option. Used when a user is configuring an inspector module. It returns an error if not set successfully.

func (*InspectorModule) ShowInfo

func (i *InspectorModule) ShowInfo()

ShowInfo displays the information for the given inspector module

type Modules

type Modules struct {
	Processors []ProcessorModule
	Inspectors []InspectorModule
}

Modules holds selected processors and inspectors to be used in a gorp session

func (*Modules) GetInspector

func (m *Modules) GetInspector(path string) (*InspectorModule, error)

GetInspector looks up and loads an inspector module as Go plugins. It returns a pointer to the inspector module

func (*Modules) GetProcessor

func (m *Modules) GetProcessor(path string) (*ProcessorModule, error)

GetProcessor looks up and loads a processor module as Go plugins. It returns a pointer to the processor module

func (*Modules) InitInspectors

func (m *Modules) InitInspectors(mods []base.ModuleConfig) error

InitInspectors loads a list of inspector modules.

func (*Modules) InitProcessors

func (m *Modules) InitProcessors(mods []base.ModuleConfig) error

InitProcessors initializes modules selected for a gorp session

type Option

type Option struct {
	Name        string `json:"name"`        // Name of the option
	Value       string `json:"value"`       // Value of the option
	Required    bool   `json:"required"`    // Is this a required option?
	Description string `json:"description"` // A description of the option
}

Option contains options specific to modules

type Processor

type Processor interface {
	Init()                                   // Init Initializes module data
	GetOptions() []Option                    // GetOptions returns a list of available options for the module
	GetRegistry() Registry                   // GetRegistry returns an object with meta data describing the module
	Process(webData WebData) (string, error) // Process alters the body of a request
}

Processor identifies the functions that all processor modules must implement.

type ProcessorModule

type ProcessorModule struct {
	Process  func(webData WebData) (string, error)
	Registry Registry
	Options  []Option `json:"options"` // A list of configurable options/arguments for the module
}

ProcessorModule represents a processor module. Processor modules alter the body of a request or response

func (*ProcessorModule) SetOption

func (p *ProcessorModule) SetOption(name string, value string) error

SetOption is used to change and set a processor module option. Used when a user is configuring a processor module. It returns an error if not set successfully.

func (*ProcessorModule) ShowInfo

func (p *ProcessorModule) ShowInfo()

ShowInfo displays the information for the given processor module

type Registry

type Registry struct {
	Name        string   `json:"name"`        // Name of the module
	DocTypes    []string `json:"docTypes"`    // Type of document
	Author      []string `json:"author"`      // A list of module authors
	Credits     []string `json:"credits"`     // A list of people to credit for underlying tool or techniques
	Path        string   `json:"path"`        // Path to the module
	Description string   `json:"description"` // A description of what the module does
	Notes       string   `json:"notes"`       // Additional information or notes about the module
}

Registry holds meta data for modules

type WebData

type WebData struct {
	Body    string
	Headers map[string]interface{}
	Type    string
	Url     string
	Method  string
}

WebData identifies a web request or response object. The type can be either "Document," "Script," or "Request"

Jump to

Keyboard shortcuts

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