Documentation ¶
Overview ¶
Package definition maintains different datatypes used as input and their helper functions. Examples are service definitions, hosts or rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapServices ¶
func MapServices(results ResultHosts, services ServiceDefs, rules []RulesDef)
map serviceIds to the scan results
Types ¶
type HostDef ¶
type HostDef struct { Address string `json:"address"` // Adress, hostname or subnet in CIDR notation Description string `json:"description"` // Short text description of the hosts purpose Tags []string `json:"tags"` // Tags for referencing a service }
HostDef of the inventory
type HostDefs ¶
type HostDefs []HostDef
Collection of host definitions from json file
type PortDef ¶
type PortDef struct { Port int `json:"port"` // Port used by the service Protocol string `json:"protocol"` Description string `json:"description"` // Short text description what is handled at the specific port Uri string `json:"uri"` // Optional URI for reaching the service at the given port Rules []string `json:"rules"` // Rules which should be fulfilled by the service Hosts []string `json:"hosts"` // Hosts where the service is deployed. tag:tagvalue can also be used }
PortDef for a service
type RuleDef ¶
type RuleDef struct { Name string `json:"name"` // HTTP header with given name must exist Contains string `json:"contains"` // Optional, HTTP header must contain given value }
RuleDef which must be matched by a service
type Rules ¶
type Rules []RulesDef
Collection of rules definitions from json file
type RulesDef ¶
type RulesDef struct { Name string `json:"name"` // Identifier of the rule Type_ string `json:"type"` // Type, currently 'http' is the only supported type FollowRedirects bool `json:"follow-redirects"` // Type, currently 'http' is the only supported type Status int `json:"status"` // Optional, expected http status Rules []RuleDef `json:"rules"` // Optional, Rules which must match }
RulesDef can be referenced as one of the desired matching rules within a PortDef of a service
type ServiceDef ¶
type ServiceDef struct { Id string `json:"id"` // Identifier Description string `json:"description"` //Short text description of the services purpose Ports []PortDef `json:"ports"` // Port definitions of the service }
ServiceDef of a service
type ServiceDefs ¶
type ServiceDefs []ServiceDef
Collection of service definitions from json file
func (*ServiceDefs) Find ¶
func (defs *ServiceDefs) Find(port int, host Host) (ServiceDef, error)
Find returns a service definition for a given host and port or an error
func (*ServiceDefs) FindById ¶
func (defs *ServiceDefs) FindById(id string) (ServiceDef, error)
FindById returns the given service definition or an error
func (*ServiceDefs) Init ¶
func (defs *ServiceDefs) Init(servicesPath string) error
Init loads the ServiceDefs form a json file
func (*ServiceDefs) Remove ¶
func (defs *ServiceDefs) Remove(service ServiceDef) ServiceDefs
Return service definitions without the given service