audit

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareGrades added in v0.11.0

func CompareGrades(grade1, grade2 string) bool

CompareGrades checks whether grade1 is less than "<" grade2. Returns true if grade1 < grade2 else return false.

Example:

CompareGrades("B", "A+") => true since Grade B < Grade A+
CompareGrades("A", "C") => false since Grade A > Grade C
CompareGrades("A", "A") => false since Grade B == Grade B
CompareGrades("B+", "A-") => true since Grade B+ < Grade A-

func EnabledAudits added in v0.11.0

func EnabledAudits() map[string]AuditInterface

Types

type Audit

type Audit struct {
	// contains filtered or unexported fields
}

func (*Audit) GetDescription

func (audit *Audit) GetDescription() string

func (*Audit) GetFlagSet

func (audit *Audit) GetFlagSet() *flag.FlagSet

func (*Audit) GetHelpFlag

func (audit *Audit) GetHelpFlag() *bool

func (*Audit) GetName

func (audit *Audit) GetName() string

func (*Audit) GetSubCommands

func (audit *Audit) GetSubCommands() []cli.Command

func (*Audit) Init

func (audit *Audit) Init(helpFlagName string, helpFlagDescription string)

func (*Audit) Process

func (audit *Audit) Process()

type AuditInterface added in v0.11.0

type AuditInterface interface {
	Load(input interface{}) error
	Scan() ([]*AuditResult, error)
}

type AuditResult added in v0.11.0

type AuditResult struct {
	Type          string // type of audit e.g. "SSL", "SSH"
	Status        Status // status of the audit e.g "PASS", "ERROR", "FAIL"
	StatusMessage string // message of the audit
}

func Run added in v0.11.0

func Run(inputFile string) ([]*AuditResult, error)

type AuditScanHandler added in v0.11.0

type AuditScanHandler func(results []*AuditResult, err error)

type AuditType added in v0.11.0

type AuditType int
const (
	Standard AuditType = iota
	Policy
)

func (AuditType) String added in v0.11.0

func (a AuditType) String() string

type Discovery added in v0.11.0

type Discovery struct {
	Type           string            `mapstructure:"type"`
	Targets        []string          `mapstructure:"targets"`
	ResourceTypes  []string          `mapstructure:"resource_types"`
	Regions        []string          `mapstructure:"regions"`
	Tags           map[string]string `mapstructure:"tags"`
	Properties     map[string]string `mapstructure:"properties"`
	TargetProperty string            `mapstructure:"target_property"`
	DNSZones       []string          `mapstructure:"dns_zones"`
	DNSRecordTypes []string          `mapstructure:"dns_record_types"`
}

func (*Discovery) GetHosts added in v0.11.0

func (d *Discovery) GetHosts() ([]string, error)

type Host added in v0.11.0

type Host struct {
	Host           string               `mapstructure:"host"`
	Public         bool                 `mapstructure:"public"`
	StartNew       bool                 `mapstructure:"start_new"`
	FromCache      bool                 `mapstructure:"from_cache"`
	MaxAge         int                  `mapstructure:"max_age"`
	IgnoreMismatch bool                 `mapstructure:"ignore_mismatch"`
	Threshold      string               `mapstructure:"threshold"`
	ScanInfo       *sslscan.AnalyzeInfo // scan information
	ScanInfoError  error                // contains an error if an error occured while scanning host
}

func (*Host) Result added in v0.11.0

func (host *Host) Result() []*AuditResult

func (*Host) Scan added in v0.11.0

func (host *Host) Scan(api *sslscan.API)

type PortScan added in v0.11.0

type PortScan struct {
	PortTargetGroups []*PortTargetGroup
}

func (*PortScan) Load added in v0.11.0

func (ps *PortScan) Load(input interface{}) error

Load decodes yaml into struct

func (*PortScan) Scan added in v0.11.0

func (ps *PortScan) Scan() ([]*AuditResult, error)

Scan scans hosts

type PortTarget added in v0.11.0

type PortTarget struct {
	Host          string
	Group         *PortTargetGroup
	ScanInfo      []nmap.Port
	ScanInfoError error
}

PortTarget holds information about a host to be scanned

func (*PortTarget) Result added in v0.11.0

func (t *PortTarget) Result() []*AuditResult

Result constructs results output for a given port scan

func (*PortTarget) Scan added in v0.11.0

func (t *PortTarget) Scan()

Scan performs a port scan on a host

type PortTargetGroup added in v0.11.0

type PortTargetGroup struct {
	Timeout         string     `mapstructure:"timeout"`
	AllowList       []string   `mapstructure:"allowlist"`
	BlockList       []string   `mapstructure:"blocklist"`
	Discovery       *Discovery `mapstructure:"discovery"`
	CommonPortsPath struct {
		TCP string `mapstructure:"tcp"`
		UDP string `mapstructure:"udp"`
	} `mapstructure:"common_ports_path"`
}

func (*PortTargetGroup) Scan added in v0.11.0

func (tg *PortTargetGroup) Scan() ([]*AuditResult, error)

type SSHAudit added in v0.11.0

type SSHAudit struct {
	TargetGroups []*TargetGroup
}

func (*SSHAudit) Load added in v0.11.0

func (ssh *SSHAudit) Load(input interface{}) error

func (*SSHAudit) Scan added in v0.11.0

func (ssh *SSHAudit) Scan() ([]*AuditResult, error)

type SSLAudit added in v0.11.0

type SSLAudit struct {
	Hosts []*Host
}

func (*SSLAudit) Load added in v0.11.0

func (ssl *SSLAudit) Load(input interface{}) error

func (*SSLAudit) Scan added in v0.11.0

func (ssl *SSLAudit) Scan() ([]*AuditResult, error)

type ScanType added in v0.11.0

type ScanType func(ctx context.Context, target *PortTarget) ([]nmap.Port, error)

type Status added in v0.11.0

type Status int
const (
	Pass Status = iota
	Fail
	Error
)

func (Status) String added in v0.11.0

func (s Status) String() string

type Target added in v0.11.0

type Target struct {
	Host             string
	Group            *TargetGroup
	StandardScanInfo *sshaudit.StandardServerAuditInfo
	PolicyScanInfo   *sshaudit.PolicyServerAuditInfo
	ScanInfoError    error
}

func (*Target) Result added in v0.11.0

func (target *Target) Result() []*AuditResult

func (*Target) Scan added in v0.11.0

func (target *Target) Scan(api *sshaudit.Client)

type TargetGroup added in v0.11.0

type TargetGroup struct {
	Port       int        `mapstructure:"port"`
	AuditType  string     `mapstructure:"audit_type"`
	PolicyName string     `mapstructure:"policy_name"`
	Threshold  string     `mapstructure:"threshold"`
	Discovery  *Discovery `mapstructure:"discovery"`
}

func (*TargetGroup) Scan added in v0.11.0

func (tg *TargetGroup) Scan(api *sshaudit.Client) ([]*AuditResult, error)

type Vulnerability added in v0.14.0

type Vulnerability struct {
	// contains filtered or unexported fields
}

func (*Vulnerability) Load added in v0.14.0

func (vs *Vulnerability) Load(input interface{}) error

func (*Vulnerability) Scan added in v0.14.0

func (vs *Vulnerability) Scan() ([]*AuditResult, error)

type VulnerabilityTargetGroup added in v0.14.0

type VulnerabilityTargetGroup struct {
	Discovery              *Discovery `mapstructure:"discovery"`
	VulnerabilityTemplates []string   `mapstructure:"vulnerability_templates"`
	Threshold              string     `mapstructure:"threshold`
}

func (*VulnerabilityTargetGroup) Result added in v0.14.0

func (*VulnerabilityTargetGroup) Scan added in v0.14.0

func (tg *VulnerabilityTargetGroup) Scan() ([]*AuditResult, error)

Jump to

Keyboard shortcuts

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