address

package
v0.0.0-...-72c2bb7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilterMissingGroupID = errors.New("address filter missing GroupID")
	ErrAddressMissing       = errors.New("address did not have IPAddress or HostAddress set")
)
View Source
var (
	AddAddressesTempTableKey     = "sga_add_temp"
	AddAddressesTempTableColumns = []string{"organization_id", "scan_group_id", "host_address", "ip_address",
		"discovered_timestamp", "discovered_by", "last_scanned_timestamp", "last_seen_timestamp", "confidence_score",
		"user_confidence_score", "is_soa", "is_wildcard_zone", "is_hosted_service", "ignored", "found_from", "ns_record", "address_hash"}
	AddAddressesTempTable = `` /* 655-byte string literal not displayed */

	AddAddressesTempToAddress = `` /* 1318-byte string literal not displayed */

	DeleteAddressesTempTableKey     = "sga_del_temp"
	DeleteAddressesTempTableColumns = []string{"address_id"}
	DeleteAddressesTempTable        = `create temporary table sga_del_temp (
			address_id bigint not null
		) on commit drop;`

	DeleteAddressesTempToAddress = `` /* 177-byte string literal not displayed */

	IgnoreAddressesTempTableKey     = "sga_ignore_temp"
	IgnoreAddressesTempTableColumns = []string{"address_id"}
	IgnoreAddressesTempTable        = `create temporary table sga_ignore_temp (
			address_id bigint not null
		) on commit drop;`

	IgnoreAddressesTempToAddress = `` /* 177-byte string literal not displayed */

)

Functions

This section is empty.

Types

type Service

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

Service for interfacing with postgresql/rds

func New

func New(authorizer auth.Authorizer) *Service

New returns an empty Service

func (*Service) Archive

func (s *Service) Archive(ctx context.Context, userContext am.UserContext, group *am.ScanGroup, archiveTime time.Time) (oid int, count int, err error)

Archive records for a group.

func (*Service) Count

func (s *Service) Count(ctx context.Context, userContext am.UserContext, groupID int) (oid int, count int, err error)

Count returns the number of addresses for a specified scan group by id

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, userContext am.UserContext, groupID int, addressIDs []int64) (oid int, err error)

Delete the address from the scan group by setting the deleted column to true

func (*Service) Get

func (s *Service) Get(ctx context.Context, userContext am.UserContext, filter *am.ScanGroupAddressFilter) (oid int, addresses []*am.ScanGroupAddress, err error)

Get returns all addresses for a scan group that match the supplied filter

func (*Service) GetHostList

func (s *Service) GetHostList(ctx context.Context, userContext am.UserContext, filter *am.ScanGroupAddressFilter) (oid int, hosts []*am.ScanGroupHostList, err error)

GetHostList returns hostnames and a list of IP addresses for each host TODO: add filtering for start/limit

func (*Service) GetPorts

func (s *Service) GetPorts(ctx context.Context, userContext am.UserContext, filter *am.ScanGroupAddressFilter) (oid int, portResults []*am.PortResults, err error)

Get returns all addresses for a scan group that match the supplied filter

func (*Service) GroupStats

func (s *Service) GroupStats(ctx context.Context, userContext am.UserContext, groupID int) (oid int, groupStats *am.ScanGroupAddressStats, err error)

GroupStats is lazy and just does the whole org and returns the groupID if it exists... TODO: do it properly.

func (*Service) Ignore

func (s *Service) Ignore(ctx context.Context, userContext am.UserContext, groupID int, addressIDs []int64, value bool) (oid int, err error)

Ignore the addresses from the scan group.

func (*Service) Init

func (s *Service) Init(config []byte) error

Init by parsing the config and initializing the database pool

func (*Service) IsAuthorized

func (s *Service) IsAuthorized(ctx context.Context, userContext am.UserContext, resource, action string) bool

IsAuthorized checks if an action is allowed by a particular user

func (*Service) OrgStats

func (s *Service) OrgStats(ctx context.Context, userContext am.UserContext) (oid int, orgStats []*am.ScanGroupAddressStats, err error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, userContext am.UserContext, addresses map[string]*am.ScanGroupAddress) (oid int, count int, err error)

Update or insert new addresses

func (*Service) UpdateHostPorts

func (s *Service) UpdateHostPorts(ctx context.Context, userContext am.UserContext, address *am.ScanGroupAddress, portResults *am.PortResults) (oid int, err error)

UpdateHostPorts saves new port scan results

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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