Documentation
¶
Index ¶
- Constants
- func AddScopeTargets(logger scanUtils.Logger, scanScope *managerdb.T_scan_scope, ...) error
- func AutoMigrate() error
- func CleanExceeded(scanScope *managerdb.T_scan_scope, label string, startedBefore time.Time) (int64, error)
- func CleanScopeTargets(remainingScopeIds []uint64) error
- func Close() error
- func DeleteTarget(subTarget *T_sub_input) error
- func GetScopeSize(idTScanScope uint64) (int64, error)
- func Init() error
- func SetTargetsStarted(subTargets []T_sub_input, subTargetIds []uint64, startTime sql.NullTime) error
- type T_sub_input
Constants ¶
const MaxBatchSizeSubInput = 76 // 999 (SQLITE) / 13
MaxBatchSizeSubInput defines the maximum number T_sub_input instances that can be batched together during an insert. This is calculated dividing 999 (SQLITE) by the number of fields (that are actually written to the db).
Variables ¶
This section is empty.
Functions ¶
func AddScopeTargets ¶
func AddScopeTargets(logger scanUtils.Logger, scanScope *managerdb.T_scan_scope, subTargets []*T_sub_input) error
AddScopeTargets checks which submodule targets can be created from discovery results and writes them to the brokerdb.
func AutoMigrate ¶
func AutoMigrate() error
AutoMigrate ScopeDb migrates the broker database's tables to the latest structure
func CleanExceeded ¶
func CleanExceeded(scanScope *managerdb.T_scan_scope, label string, startedBefore time.Time) (int64, error)
CleanExceeded removes started scan tasks from the brokerdb that seem to be timed out
func CleanScopeTargets ¶
CleanScopeTargets removes all scan targets that do not belong to an existing scan scope anymore
func DeleteTarget ¶
func DeleteTarget(subTarget *T_sub_input) error
DeleteTarget removes a given sub target from the brokerdb
func GetScopeSize ¶
GetScopeSize checks whether the maximum backlog size of submodule targets (for a given scan scope) is reached
func SetTargetsStarted ¶
func SetTargetsStarted(subTargets []T_sub_input, subTargetIds []uint64, startTime sql.NullTime) error
SetTargetsStarted updates defined submodule targets in the brokerdb setting the scan_started timestamp
Types ¶
type T_sub_input ¶
type T_sub_input struct { Id uint64 `gorm:"column:id;primaryKey"` // Id autoincrement IdTScanScope uint64 `gorm:"column:id_t_scan_scope;uniqueIndex:uix_sub_input_multi_column"` // Scope ID this input target belongs to (two indexes, a multi column combined one and a dedicated one) IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;uniqueIndex:uix_sub_input_multi_column"` // Id of the related t_discovery_services entry (two indexes, a multi column combined one and a dedicated one) Module string `gorm:"column:module;uniqueIndex:uix_sub_input_multi_column"` // Module that does the scan ScanStarted sql.NullTime `gorm:"column:scan_started"` // Timestamp when scan was started (or nil) Address string `gorm:"column:address"` // The address of the target (Dns name over IP) Ip string `gorm:"column:ip"` // The IP address of the target DnsName string `gorm:"column:dns_name"` // The Dns name of the target (if available) OtherNames string `gorm:"column:other_names;type:text"` // Potential other hostnames of the target (symbol separated string) Protocol string `gorm:"column:protocol"` // The protocol of the target service. Usually tcp. Port int `gorm:"column:port"` // The port of the target service Service string `gorm:"column:service;type:text"` // The service type discovered by the version detection ServiceProduct string `gorm:"column:service_product;type:text"` // The service product discovered by the version detection }
T_sub_input contains details of a queued submodule scan target (scan module, input data,...) and a reference to the scan scope it belongs. Scan submodules will be fed from this table.
func GetScopeTargets ¶
func GetScopeTargets(idTScanScope uint64, subModule string, amount int) ([]T_sub_input, error)
GetScopeTargets queries a given amount of submodule targets from brokerdb for the defined scan scope and module
func GetTarget ¶
func GetTarget(targetId uint64) (*T_sub_input, error)
GetTarget queries a target from brokerdb by ID, across all scopes