Documentation
¶
Index ¶
- Constants
- Variables
- func AutoMigrateScopeDb(scopeDb *gorm.DB) error
- func AutomigrateScanScopes(logger scanUtils.Logger) error
- func CloseManagerDb() error
- func CloseScopeDbs() []error
- func DeleteAgent(agentId uint64) error
- func DisableDatabaseCredentials(serverDb *gorm.DB, username string) error
- func EnableDatabaseCredentials(serverDb *gorm.DB, username string) error
- func GetProgress(scopeDb *gorm.DB) (total int64, done int64, running int64, failed int64, err error)
- func GetScopeDbHandle(logger scanUtils.Logger, scanScope *T_scan_scope) (*gorm.DB, error)
- func GetScopeEntryIds() ([]uint64, error)
- func GetServerDbHandle(logger scanUtils.Logger, dbServer *T_db_server) (*gorm.DB, error)
- func InstallTrigramIndices(scopeDb *gorm.DB) error
- func OpenManagerDb() error
- func RemoveDatabaseEntry(dbServerId uint64) error
- func ResetFailed(scopeDb *gorm.DB) error
- func SetConnectionName(name string)
- func SetMaxConnectionsDefault(amount int)
- func SetScopeDbComment(serverDb *gorm.DB, dbName string, dbComment string) error
- func SetTargets(scopeDb *gorm.DB, targets []T_discovery) (created uint64, removed uint64, updated uint64, err error)
- func UpdateDatabaseCredentials(serverDb *gorm.DB, username string, password string, expiry time.Time) error
- func UpdateDatabaseEntry(dbServer *T_db_server) error
- func UpdateScanAgents(scopeId uint64, scanAgents []T_scan_agent) error
- func ViewExists(scanScopeId uint64, viewName string) (bool, error)
- func XCycleScope(logger scanUtils.Logger, scopeDb *gorm.DB, scanScope *T_scan_scope) error
- func XDeleteScope(serverDb *gorm.DB, scopeDb *gorm.DB, scanScope *T_scan_scope) error
- func XDeleteView(scopeDb *gorm.DB, viewEntry *T_scope_view) error
- func XDeploySampleData(logger scanUtils.Logger, scanDefaults T_scan_setting) error
- func XGrantToken(scopeDb *gorm.DB, viewEntry *T_scope_view, grantedBy string, ...) (string, string, error)
- func XGrantUsers(scopeDb *gorm.DB, viewEntry *T_scope_view, grantedBy string, ...) error
- func XRevokeGrants(scopeDb *gorm.DB, scopeView *T_scope_view, usernames []string) error
- func XUpdateView(scopeDb *gorm.DB, viewEntry *T_scope_view) error
- type ColumnsAd
- type ColumnsAsset
- type ColumnsHost
- type ColumnsInput
- type ColumnsInputDetails
- type ColumnsOs
- type ColumnsScan
- type DbCredentials
- type ErrInvalidCharacter
- type T_banner
- type T_db_server
- type T_discovery
- type T_discovery_host
- type T_discovery_script
- type T_discovery_service
- type T_nfs
- type T_nfs_file
- type T_scan_agent
- type T_scan_scope
- func GetScopeEntries() ([]T_scan_scope, error)
- func GetScopeEntriesOf(groupIds []uint64) ([]T_scan_scope, error)
- func GetScopeEntry(scopeId uint64) (*T_scan_scope, error)
- func GetScopeEntryByName(dbName string) (T_scan_scope, error)
- func GetScopeEntryBySecret(secret string) (*T_scan_scope, error)
- func XCreateScope(serverDb *gorm.DB, dbServer *T_db_server, name string, dbName string, ...) (*T_scan_scope, error)
- type T_scan_setting
- func (scanSettings *T_scan_setting) AfterFind(tx *gorm.DB) (err error)
- func (scanSettings *T_scan_setting) BeforeSave(tx *gorm.DB) error
- func (scanSettings *T_scan_setting) MaxInstances(label string) (int, error)
- func (scanSettings *T_scan_setting) SaveAll(values *T_scan_setting) (int64, error)
- func (scanSettings *T_scan_setting) UnmarshalJSON(b []byte) error
- type T_scope_view
- func GetViewEntries() ([]T_scope_view, error)
- func GetViewEntriesOf(groupIds []uint64) ([]T_scope_view, error)
- func GetViewEntry(viewId uint64) (*T_scope_view, error)
- func GetViewsGranted(username string) ([]T_scope_view, error)
- func XCreateView(scopeDb *gorm.DB, scopeEntry *T_scan_scope, viewName string, createdBy string, ...) (*T_scope_view, error)
- type T_smb
- type T_smb_file
- type T_sql_log
- type T_ssh
- type T_ssl
- type T_ssl_certificate
- type T_ssl_cipher
- type T_ssl_issue
- type T_ssl_setting
- type T_view_grant
- type T_webcrawler
- type T_webcrawler_page
- type T_webcrawler_vhost
- type T_webenum
- type T_webenum_results
Constants ¶
const MaxBatchSizeBanner = 5461 // 65535 (Postgres) / 12
MaxBatchSizeBanner defines the maximum number T_banner instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeDiscovery = 2520 // 65535 (Postgres) / 26
MaxBatchSizeDiscovery defines the maximum number of T_discovery instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeDiscoveryHost = 1040 // 65535 (Postgres) / 63
MaxBatchSizeDiscoveryHost defines the maximum number T_discovery_host instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeDiscoveryScript = 978 // 65535 (Postgres) / 67
MaxBatchSizeDiscoveryScript defines the maximum number T_discovery_script instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeDiscoveryService = 923 // 65535 (Postgres) / 71
MaxBatchSizeDiscoveryService defines the maximum number T_discovery_service instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeNfs = 6553 // 65535 (Postgres) / 10
MaxBatchSizeNfs defines the maximum number T_nfs instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeNfsFile = 3855 // 65535 (Postgres) / 17
MaxBatchSizeNfsFile defines the maximum number T_nfs_file instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSmb = 6553 // 65535 (Postgres) / 10
MaxBatchSizeSmb defines the maximum number T_smb instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSmbFile = 4095 // 65535 (Postgres) / 16
MaxBatchSizeSmbFile defines the maximum number T_smb_file instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSsh = 4369 // 65535 (Postgres) / 15
MaxBatchSizeSsh defines the maximum number T_ssh instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSsl = 9362 // 65535 (Postgres) / 7
MaxBatchSizeSsl defines the maximum number T_ssl instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSslCertificate = 2047 // 65535 (Postgres) / 32
MaxBatchSizeSslCertificate defines the maximum number T_ssl_certificate instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSslCipher = 2047 // 65535 (Postgres) / 32
MaxBatchSizeSslCipher defines the maximum number T_ssl_cipher instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSslIssue = 2260 // 65535 (Postgres) / 29
MaxBatchSizeSslIssue defines the maximum number T_ssl_issue instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeSslSetting = 5461 // 65535 (Postgres) / 12
MaxBatchSizeSslSetting defines the maximum number T_ssl_prevention_measures instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeWebcrawler = 9362 // 65535 (Postgres) / 7
MaxBatchSizeWebcrawler defines the maximum number T_webcrawler instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeWebcrawlerPage = 3449 // 65535 (Postgres) / 19
MaxBatchSizeWebcrawlerPage defines the maximum number T_webcrawler_page instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeWebcrawlerVhost = 4681 // 65535 (Postgres) / 14
MaxBatchSizeWebcrawlerVhost defines the maximum number T_webcrawler_vhost instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeWebenum = 9362 // 65535 (Postgres) / 7
MaxBatchSizeWebenum defines the maximum number T_webenum instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
const MaxBatchSizeWebenumResult = 3449 // 65535 (Postgres) / 19
MaxBatchSizeWebenumResult defines the maximum number T_webenum_results instances that can be batched together during an insert. This is calculated dividing 65535 by the number of fields (that are actually written to the db).
Variables ¶
var ErrDbExists = errors.New("database already existing")
Functions ¶
func AutoMigrateScopeDb ¶
func AutomigrateScanScopes ¶
AutomigrateScanScopes initializes the scope databases
func CloseScopeDbs ¶
func CloseScopeDbs() []error
CloseScopeDbs will close all the open scope DB connections, it has to be called once(!) when the program finishes. This function will probably be called by the manager main routine on exit.
func DeleteAgent ¶
DeleteAgent removes a scan agent from the manager db
func DisableDatabaseCredentials ¶
DisableDatabaseCredentials disables a user, but leaves access rights untouched
func EnableDatabaseCredentials ¶
EnableDatabaseCredentials disables a user, but leaves access rights untouched
func GetProgress ¶
func GetProgress(scopeDb *gorm.DB) (total int64, done int64, running int64, failed int64, err error)
GetProgress queries a given scope db for completed, failed and running scan inputs (progress)
func GetScopeDbHandle ¶
GetScopeDbHandle establishes a database connection to a scan scope, configures and returns it. This type of connection is required to edit data of a specific scan scope.
func GetScopeEntryIds ¶
GetScopeEntryIds retrieves a list of remaining scan scope IDs. It returns an empty slice and NO error if no entry is found.
func GetServerDbHandle ¶
GetServerDbHandle establishes a database connection, independent of a scan scope, configures and returns it. This type of connection is required to administrate (create or remove) scan scope databases on a certain the database server.
func InstallTrigramIndices ¶
InstallTrigramIndices installs the trigram index database extension on a given database and applies it to selected table columns
func RemoveDatabaseEntry ¶
RemoveDatabaseEntry removes a database server from the manager db
func ResetFailed ¶
ResetFailed resets the scan status of failed scan inputs in order to trigger a rescan within the current scan cycle
func SetConnectionName ¶
func SetConnectionName(name string)
SetConnectionName allows to set the value to use as an application name. This will only affect new database handles.
func SetMaxConnectionsDefault ¶
func SetMaxConnectionsDefault(amount int)
SetMaxConnectionsDefault allows to change the default maximum database connections value. This will only affect new database handles.
func SetScopeDbComment ¶
SetScopeDbComment set a comment on a scope database, making it easier to distinguish databases
func SetTargets ¶
func SetTargets(scopeDb *gorm.DB, targets []T_discovery) (created uint64, removed uint64, updated uint64, err error)
SetTargets changes current scan scope targets to the given list (inserting new, deleting vanished and updating remaining ones)
func UpdateDatabaseCredentials ¶
func UpdateDatabaseCredentials(serverDb *gorm.DB, username string, password string, expiry time.Time) error
UpdateDatabaseCredentials updates a user's password on the database server
func UpdateDatabaseEntry ¶
func UpdateDatabaseEntry(dbServer *T_db_server) error
UpdateDatabaseEntry updates data of existing database servers in the database or creates new ones. None will be removed.
func UpdateScanAgents ¶
func UpdateScanAgents(scopeId uint64, scanAgents []T_scan_agent) error
UpdateScanAgents updates data of existing scan agents in the database or creates new ones. None will be removed.
func ViewExists ¶
ViewExists checks whether a given view name on a scan scope does already exist.
func XCycleScope ¶
XCycleScope initializes a new scan cycle by resetting the scan input states in the scope db and updating the scan progress attributes in the manager db. If a scan cycle retention is configured, this will also delete outdated scan results.
func XDeleteScope ¶
XDeleteScope deletes scope with given scopeId on scope db and manager db in a transactional manner. Views and access rights are removed along.
func XDeleteView ¶
func XDeleteView(scopeDb *gorm.DB, viewEntry *T_scope_view) error
XDeleteView deletes a view on scopeDb and manager db in a transactional manner. Access rights are removed along.
func XDeploySampleData ¶
func XDeploySampleData(logger scanUtils.Logger, scanDefaults T_scan_setting) error
XDeploySampleData applies a default configuration for development purposes to the manager db and some sample data to the scope db
func XGrantToken ¶
func XGrantToken( scopeDb *gorm.DB, viewEntry *T_scope_view, grantedBy string, expiry time.Duration, description string, dbConnectionsUser int, ) (string, string, error)
XGrantToken generates random access credentials and activates them on the defined scope view. Such access token are not user bound, valid for a prolonged time frame and only valid on a single scope view. A random username and password (representing the random access token) are generated and returned
func XGrantUsers ¶
func XGrantUsers( scopeDb *gorm.DB, viewEntry *T_scope_view, grantedBy string, dbCredentials []DbCredentials, dbConnectionsUser int, ) error
XGrantUsers grants view access rights for the given list of users by adding the rights to the scopeDb and adding the a grant entry to manager db in a transactional manner. List of users must be a DbCredentials struct, because the user
might need to be created on the database server if not existing yet.
func XRevokeGrants ¶
func XRevokeGrants(scopeDb *gorm.DB, scopeView *T_scope_view, usernames []string) error
XRevokeGrants revokes view access rights for the given list of users by removing the rights from scopeDb and the grant entry from manager db in a transactional manner
func XUpdateView ¶
func XUpdateView(scopeDb *gorm.DB, viewEntry *T_scope_view) error
XUpdateView updates a view on scopeDb and manager db in a transactional manner. If the view name changed, the prefix of scope db view table names has to be updated too.
Types ¶
type ColumnsAd ¶
type ColumnsAd struct {
AdName string `gorm:"column:ad_name;type:text"`
AdDistinguishedName string `gorm:"column:ad_distinguished_name;type:text"`
AdDnsName string `gorm:"column:ad_dns_name;type:text"`
AdCreated sql.NullTime `gorm:"column:ad_created"`
AdLastLogon sql.NullTime `gorm:"column:ad_last_logon"`
AdLastPassword sql.NullTime `gorm:"column:ad_last_password"`
AdDescription string `gorm:"column:ad_description;type:text"`
AdLocation string `gorm:"column:ad_location;type:text"`
AdManagedBy string `gorm:"column:ad_managed_by;type:text"`
AdManagedByGid string `gorm:"column:ad_managed_by_gid;type:text"`
AdManagedByDepartment string `gorm:"column:ad_managed_by_ou;type:text"`
AdOs string `gorm:"column:ad_os;type:text"`
AdOsVersion string `gorm:"column:ad_os_version;type:text"`
AdServicePrincipalName string `gorm:"column:ad_service_principal_name;type:text"`
}
ColumnsAd combines common AD columns and will be appended to selected database tables
type ColumnsAsset ¶
type ColumnsAsset struct {
AssetCompany string `gorm:"column:asset_company;type:text"`
AssetDepartment string `gorm:"column:asset_department;type:text"`
AssetOwner string `gorm:"column:asset_owner;type:text"`
}
ColumnsAsset combines optional columns that can be filled by the scan agent with information from external information repositories and will be appended to selected database tables
type ColumnsHost ¶
type ColumnsHost struct {
Address string `gorm:"column:address;type:text;not null;index"`
Ip string `gorm:"column:ip;type:text;not null;index"`
DnsName string `gorm:"column:dns_name;type:text"`
OtherNames string `gorm:"column:other_names;type:text"` // Custom trigram full text search index installed by InstallTrigramIndices()
OtherIps string `gorm:"column:other_ips;type:text"`
Hops string `gorm:"column:hops;type:text"`
Critical bool `gorm:"column:critical"`
ScanCycle uint `gorm:"column:scan_cycle;index"`
}
ColumnsHost combines common host columns and will be appended to selected database tables
type ColumnsInput ¶
type ColumnsInput struct {
Input string `gorm:"column:input;type:text" json:"input"`
InputSize uint `gorm:"column:input_size" json:"-"`
}
ColumnsInput contains input data used by the discovery module to discover initial network devices and ports
type ColumnsInputDetails ¶
type ColumnsInputDetails struct {
Timezone float32 `gorm:"column:timezone;type:float;default:0" json:"timezone"` // Float because timezones may be 11.5 in certain edge cases
Lat string `gorm:"column:lat;type:text" json:"lat"`
Lng string `gorm:"column:lng;type:text" json:"lng"`
PostalAddress string `gorm:"column:postal_address;type:text" json:"postal_address"`
InputNetwork string `gorm:"column:input_network;type:text" json:"input_network"` // Network the input address belongs to. Equals input if input is already a network range
InputCountry string `gorm:"column:input_country;type:text" json:"input_country"` // E.g. "DE"
InputLocation string `gorm:"column:input_location;type:text" json:"input_location"` // E.g. "Munich"
InputRoutingDomain string `gorm:"column:input_routing_domain;type:text" json:"input_routing_domain"` // E.g. "Global", "local", "Intranet", "Internet",...
InputZone string `gorm:"column:input_zone;type:text" json:"input_zone"` // E.g. "Office", "Production A", "Printer",...
InputPurpose string `gorm:"column:input_purpose;type:text" json:"input_purpose"` // E.g. network description, like, "transfer network", "office space",...
InputCompany string `gorm:"column:input_company;type:text" json:"input_company"` // E.g. company name, useful in a multi company network
InputDepartment string `gorm:"column:input_department;type:text" json:"input_department"` // E.g. company department, e.g. IT Services
InputManager string `gorm:"column:input_manager;type:text" json:"input_manager"` // E.g. the responsible manager
InputContact string `gorm:"column:input_contact;type:text" json:"input_contact"` // E.g. the responsible administrator
InputComment string `gorm:"column:input_comment;type:text" json:"input_comment"` // E.g. anything that helps
}
ColumnsInputDetails combines common detail related to an input and will be appended to selected database tables. Basically some optional/additional fields adding some story to t_discovery_input (a network, hostname or IP).
type ColumnsOs ¶
type ColumnsOs struct {
OsGuess string `gorm:"column:os_guess;type:text"`
OsSmb string `gorm:"column:os_smb;type:text"`
OsLastBoot sql.NullTime `gorm:"column:os_last_boot"`
OsUptime sql.NullInt64 `gorm:"column:os_uptime"`
OsAdminUsers string `gorm:"column:os_admin_users;type:text"`
OsRdpUsers string `gorm:"column:os_rdp_users;type:text"`
}
ColumnsOs combines common os columns and will be appended to selected database tables
type ColumnsScan ¶
type ColumnsScan struct {
ScanStarted sql.NullTime `gorm:"column:scan_started;index" json:"scan_started"`
ScanFinished sql.NullTime `gorm:"column:scan_finished;index" json:"scan_finished"`
ScanStatus string `gorm:"column:scan_status;type:text;default:'Waiting';index" json:"-"`
ScanIp string `gorm:"column:scan_ip;type:text;not null" json:"-"`
ScanHostname string `gorm:"column:scan_hostname;type:text;not null" json:"-"`
}
ColumnsScan combines common scan data columns and will be appended to selected database tables
type DbCredentials ¶
type DbCredentials struct {
Username string // Email address (primary key) of the user
Password string
}
DbCredentials contains credentials of a db user to scope db
type ErrInvalidCharacter ¶
ErrInvalidCharacter is a custom error for handling input parameters that contain characters that are not whitelisted
func (ErrInvalidCharacter) Error ¶
func (e ErrInvalidCharacter) Error() string
type T_banner ¶
type T_banner struct {
// data table not necessary for banner module, due to simple result structure
}
type T_db_server ¶
type T_db_server struct {
Id uint64 `gorm:"column:id;primaryKey" json:"id"` // Id autoincrement
Name string `gorm:"column:name;type:text" json:"name"` // Name of the database as a note for administrators
Dialect string `gorm:"column:dialect;type:text;uniqueIndex:uix_db_server_multi_column" json:"dialect"` // DB connection details...
Host string `gorm:"column:host;type:text;uniqueIndex:uix_db_server_multi_column" json:"host"` // ...
HostPublic string `gorm:"column:host_public;type:text" json:"host_public"` // Public endpoint for user access (might be different to the internally used one, e.g. load balancer)
Port int `gorm:"column:port;uniqueIndex:uix_db_server_multi_column" json:"port"` // ...
Admin string `gorm:"column:admin;type:text" json:"admin"` // ...
Password string `gorm:"column:password;type:text" json:"-"` // ...
Args string `gorm:"column:args;type:text" json:"args"` // Additional connection arguments
ScanScopes []T_scan_scope `gorm:"foreignKey:IdTDbServer"`
}
T_db_server contains connection details and credentials to a database hosting one or multiple scan scopes
func GetDatabaseEntries ¶
func GetDatabaseEntries() ([]T_db_server, error)
GetDatabaseEntries queries the manager db for all database servers
func GetDatabaseEntry ¶
func GetDatabaseEntry(dbServerId uint64) (*T_db_server, error)
GetDatabaseEntry queries the manager db for the database server by ID. It returns nil and a gorm.ErrRecordNotFound if no entry is found (check with errors.Is(...)).
func (*T_db_server) BeforeSave ¶
func (dbServer *T_db_server) BeforeSave(tx *gorm.DB) error
BeforeSave is a GORM hook that's executed every time the user object is written to the DB. This should be used to do some data sanitization, e.g. to strip illegal HTML tags in user attributes or to convert values to a certain format.
type T_discovery ¶
type T_discovery struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex" json:"-"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsInput
Enabled bool `gorm:"column:enabled;index" json:"enabled"`
Priority bool `gorm:"column:priority;default:false;index" json:"priority"`
ScanCount uint `gorm:"column:scan_count;default:0" json:"-"`
ColumnsScan // Insert scan data columns composition
ColumnsInputDetails // Insert input detail columns composition
}
func GetTargets ¶
func GetTargets(scopeDb *gorm.DB) ([]T_discovery, error)
GetTargets queries the current inputs from the scan scope
func (T_discovery) TableName ¶
func (T_discovery) TableName() string
type T_discovery_host ¶
type T_discovery_host struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscovery uint64 `gorm:"column:id_t_discovery;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsHost // Insert host data columns composition
PortsOpen int `gorm:"column:ports_open"`
ColumnsOs // Insert target columns composition
ColumnsAsset // Optional host information composition, that can be filled with external asset information
ColumnsScan // Insert scan data columns composition
ColumnsInput // Insert copy of input (original discovery) data, because t_discovery contents may change over time
ColumnsInputDetails // Insert input detail columns composition
ColumnsAd // Insert AD columns composition
TDiscovery *T_discovery `gorm:"foreignKey:IdTDiscovery;constraint:OnUpdate:SET NULL,OnDelete:SET NULL"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_discovery_script ¶
type T_discovery_script struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryHost uint64 `gorm:"column:id_t_discovery_host;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsHost // Insert host data columns composition
Port int `gorm:"column:port"` //
Protocol string `gorm:"column:protocol;type:text"` //
ScriptType string `gorm:"column:script_type;type:text"` //
ScriptName string `gorm:"column:script_name;type:text"` //
ScriptOutput string `gorm:"column:script_output;type:text"` //
ColumnsOs // Insert target columns composition
ColumnsAsset // Optional host information composition, that can be filled with external asset information
ColumnsScan // Insert scan data columns composition
ColumnsInput // Insert copy of input (original discovery) data, because t_discovery contents may change over time
ColumnsInputDetails // Insert input detail columns composition
ColumnsAd // Insert AD columns composition
TDiscoveryHost *T_discovery_host `gorm:"foreignKey:IdTDiscoveryHost;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_discovery_service ¶
type T_discovery_service struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryHost uint64 `gorm:"column:id_t_discovery_host;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsHost // Insert host data columns composition
Port int `gorm:"column:port"` //
Protocol string `gorm:"column:protocol;type:text"` //
Service string `gorm:"column:service;type:text"` //
ServiceProduct string `gorm:"column:service_product;type:text"` //
ServiceVersion string `gorm:"column:service_version;type:text"` //
ServiceDeviceType string `gorm:"column:service_device_type;type:text"` //
ServiceCpes string `gorm:"column:service_cpes;type:text"` //
ServiceFlavor string `gorm:"column:service_flavor;type:text"` //
ServiceTtl int `gorm:"column:service_ttl"` //
ColumnsOs // Insert target columns composition
ColumnsAsset // Optional host information composition, that can be filled with external asset information
ColumnsScan // Insert scan data columns composition
ColumnsInput // Insert copy of input (original discovery) data, because t_discovery contents may change over time
ColumnsInputDetails // Insert input detail columns composition
ColumnsAd // Insert AD columns composition
TDiscoveryHost *T_discovery_host `gorm:"foreignKey:IdTDiscoveryHost;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_nfs ¶
type T_nfs struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsScan // Insert scan data columns composition
FoldersReadable int `gorm:"column:folders_readable"`
FilesReadable int `gorm:"column:files_readable"`
FilesWritable int `gorm:"column:files_writable"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_nfs_file ¶
type T_nfs_file struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTNfs uint64 `gorm:"column:id_t_nfs;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Path string `gorm:"column:path;type:text"`
Name string `gorm:"column:name;type:text"`
Extension string `gorm:"column:extension;type:text"`
Mime string `gorm:"column:mime;type:text"`
Readable bool `gorm:"column:readable"`
Writable bool `gorm:"column:writable"`
Flags string `gorm:"column:flags;type:text"`
SizeKb int64 `gorm:"column:size_kb"`
LastModified sql.NullTime `gorm:"column:last_modified"`
Depth int `gorm:"column:depth"`
Properties string `gorm:"column:properties;type:text"`
IsSymlink bool `gorm:"column:is_symlink"`
Restrictions string `gorm:"column:restrictions;type:text"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TNfs *T_nfs `gorm:"foreignKey:IdTNfs;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_scan_agent ¶
type T_scan_agent struct {
Id uint64 `gorm:"column:id;primary_key" json:"id"` // Id autoincrement
IdTScanScope uint64 `gorm:"column:id_t_scan_scope;type:int;not null;uniqueIndex:idx_agent_identifier" json:"-"` // Unique index (across columns) to make sure the same view name only exists once per scan scope!
Name string `gorm:"column:name;type:text;not null;uniqueIndex:idx_agent_identifier" json:"name"`
Host string `gorm:"column:host;type:text;not null;uniqueIndex:idx_agent_identifier" json:"host"`
Ip string `gorm:"column:ip;type:text;not null" json:"ip"`
Limits bool `gorm:"column:limits;type:bool;default:false" json:"limits"`
LastSeen time.Time `gorm:"column:last_seen;default:CURRENT_TIMESTAMP" json:"last_seen"`
Tasks utils.JsonMap `gorm:"column:tasks;default:'{}'" json:"tasks"`
CpuRate float64 `gorm:"column:cpu_rate;type:float;default:0" json:"cpu_rate"`
MemoryRate float64 `gorm:"column:memory_rate;type:float;default:0" json:"memory_rate"`
Platform string `gorm:"column:platform;type:text;" json:"platform"`
PlatformFamily string `gorm:"column:platform_family;type:text;" json:"platform_family"`
PlatformVersion string `gorm:"column:platform_version;type:text;" json:"platform_version"`
BuildCommit string `gorm:"column:build_commit;type:text;" json:"build_commit"`
BuildTimestamp string `gorm:"column:build_timestamp;type:text;" json:"build_timestamp"`
ApiVersion string `gorm:"column:api_version;type:text;" json:"api_version"`
ScanScope T_scan_scope `gorm:"foreignKey:IdTScanScope" json:"-"` // Can be empty if the ID is set in turn
}
func GetAgentEntries ¶
func GetAgentEntries() ([]T_scan_agent, error)
GetAgentEntries queries the manager db for all scan agents, grouped by scan scope. It returns an empty slice and NO error if no entry is found.
func (*T_scan_agent) BeforeSave ¶
func (scanAgent *T_scan_agent) BeforeSave(tx *gorm.DB) error
BeforeSave is a GORM hook that's executed every time the user object is written to the DB. This should be used to do some data sanitization, e.g. to strip illegal HTML tags in user attributes or to convert values to a certain format.
func (*T_scan_agent) Save ¶
func (scanAgent *T_scan_agent) Save(columns ...string) (int64, error)
Save updates defined columns of a user entry in the database. It updates defined columns, to the currently set values, even if the values are empty ones, such as 0, false or "". ATTENTION: Only update required columns to avoid overwriting changes of parallel processes (with data in memory)
type T_scan_scope ¶
type T_scan_scope struct {
Id uint64 `gorm:"column:id;primaryKey" json:"id"` // Id autoincrement
IdTDbServer uint64 `gorm:"column:id_t_db_server;type:int;not null;index" json:"-"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTGroup uint64 `gorm:"column:id_t_group;type:int;not null;index" json:"-"` // Group reference this scan scope belongs to. Table "t_groups" is maintained by the web backend and not known to the manager.
Name string `gorm:"column:name;type:text" json:"name"` // Name of the scope selected by the user
DbName string `gorm:"column:db_name;type:text;uniqueIndex" json:"-"` // Database name (UID) to connect to on respective DB server. Unique across all DB servers to avoid future conflicts.
Created time.Time `gorm:"column:created;default:CURRENT_TIMESTAMP" json:"created"` // Timestamp of creation
CreatedBy string `gorm:"column:created_by;type:text;not null" json:"created_by"` // User who created this scope
Secret string `gorm:"column:secret;type:text;unique" json:"-"` // Random none-guessable scope secret used by agents to authenticate/associate. Value may change.
Enabled bool `gorm:"column:enabled;default:true" json:"enabled"` // Whether new target should be fed to scan agents for this scan scope
Type string `gorm:"column:type;type:text" json:"type"` // The kind of scope, there might be different ones initialized via different mechanisms. E.g. custom, remote repository,...
LastSync time.Time `gorm:"column:last_sync" json:"last_sync"` // Timestamp when the scan scope targets were set/updated/synchronized the last time
Size uint `gorm:"column:size;type:int;default:0" json:"size"` // Amount of IPs currently within this scan scope. Needs to be calculated/updated during population of the actual scan scope's t_discovery table.
Cycles bool `gorm:"column:cycles" json:"cycles"` // Scan in cycles
CyclesRetention int `gorm:"column:cycles_retention;type:int;default:-1" json:"cycles_retention"` // Amount of previous scan cycles to keep. Older ones will be cleaned up.
Attributes utils.JsonMap `gorm:"column:attributes;type:json;not null" json:"attributes"` // Scope arguments that can be arbitrary to your deployment environment, e.g., describing how to populate, import, refresh, synchronize scan inputs...
Cycle uint `gorm:"column:cycle;type:int;default:1" json:"cycle"` // The current cycle the scan is in. Relevant, if scanning in cycles is enabled
CycleStarted time.Time `gorm:"column:cycle_started;default:CURRENT_TIMESTAMP" json:"cycle_started"` // Timestamp of last cycle start
CycleDone float64 `gorm:"column:cycle_done;type:float;default:0" json:"cycle_done"` // Percentage of completed input scan tasks. Is updated in intervals and not a 100% current.
CycleActive float64 `gorm:"column:cycle_active;type:float;default:0" json:"cycle_active"` // Percentage of active input scan tasks. Is updated in intervals and not a 100% current.
CycleFailed float64 `gorm:"column:cycle_failed;type:float;default:0" json:"cycle_failed"` // Percentage of failed input scan tasks. Is updated in intervals and not a 100% current.
DbServer T_db_server `gorm:"foreignKey:IdTDbServer" json:"-"` // Database server connection details to connect to
ScanSettings T_scan_setting `gorm:"foreignKey:IdTScanScope;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`
ScanAgents []T_scan_agent `gorm:"foreignKey:IdTScanScope;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` // Scan agent data (cached data)
ScopeViews []T_scope_view `gorm:"foreignKey:IdTScanScope;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`
}
T_scan_scope contains available scan scopes and their configuration
func GetScopeEntries ¶
func GetScopeEntries() ([]T_scan_scope, error)
GetScopeEntries queries the manager db for all available scan scopes including their database server details and scan settings. It returns an empty slice and NO error if no entry is found.
func GetScopeEntriesOf ¶
func GetScopeEntriesOf(groupIds []uint64) ([]T_scan_scope, error)
GetScopeEntriesOf queries the manager db for scope entries of a given group by group ID. It returns an empty slice and NO error if no entry is found.
func GetScopeEntry ¶
func GetScopeEntry(scopeId uint64) (*T_scan_scope, error)
GetScopeEntry queries the manager db for the scope entry by ID. It returns an empty slice and a gorm.ErrRecordNotFound if no entry is found (check with errors.Is(...)).
func GetScopeEntryByName ¶
func GetScopeEntryByName(dbName string) (T_scan_scope, error)
GetScopeEntryByName returns the scan scope including its database server for a given scan scope database name
func GetScopeEntryBySecret ¶
func GetScopeEntryBySecret(secret string) (*T_scan_scope, error)
GetScopeEntryBySecret queries the manager db for the scope entry by secret. Returns nil and a gorm.ErrRecordNotFound if no scan scope could be found with the given secret (check with errors.Is(...)).
func XCreateScope ¶
func XCreateScope( serverDb *gorm.DB, dbServer *T_db_server, name string, dbName string, groupId uint64, createdBy string, secret string, scopeType string, cycles bool, cyclesRetention int, attributes utils.JsonMap, scanSettings T_scan_setting, ) (*T_scan_scope, error)
XCreateScope creates a new scope entry in the manager db and the associated scan database in the scope db. Unfortunately, this step cannot happen in a transactional manner.
func (*T_scan_scope) BeforeSave ¶
func (scanScope *T_scan_scope) BeforeSave(tx *gorm.DB) error
BeforeSave is a GORM hook that's executed every time the user object is written to the DB. This should be used to do some data sanitization, e.g. to strip illegal HTML tags in user attributes or to convert values to a certain format.
func (*T_scan_scope) Save ¶
func (scanScope *T_scan_scope) Save(columns ...string) (int64, error)
Save updates defined columns of a user entry in the database. It updates defined columns, to the currently set values, even if the values are empty ones, such as 0, false or "". ATTENTION: Only update required columns to avoid overwriting changes of parallel processes (with data in memory)
type T_scan_setting ¶
type T_scan_setting struct {
Id uint64 `gorm:"column:id;primaryKey" json:"-"` // Id autoincrement
IdTScanScope uint64 `gorm:"column:id_t_scan_scope;type:int;not null;uniqueIndex" json:"-"` // Index recommended on foreign keys for efficient update/delete cascaded actions
MaxInstancesDiscovery uint32 `gorm:"column:max_instances_discovery;type:int" json:"max_instances_discovery"` // Maximum parallel instances of discovery scans per agent.
MaxInstancesBanner uint32 `gorm:"column:max_instances_banner;type:int" json:"max_instances_banner"` // Maximum parallel instances of banner scans per agent.
MaxInstancesNfs uint32 `gorm:"column:max_instances_nfs;type:int" json:"max_instances_nfs"` // Maximum parallel instances of nfs scans per agent.
MaxInstancesSmb uint32 `gorm:"column:max_instances_smb;type:int" json:"max_instances_smb"` // Maximum parallel instances of smb scans per agent.
MaxInstancesSsh uint32 `gorm:"column:max_instances_ssh;type:int" json:"max_instances_ssh"` // Maximum parallel instances of ssh scans per agent.
MaxInstancesSsl uint32 `gorm:"column:max_instances_ssl;type:int" json:"max_instances_ssl"` // Maximum parallel instances of ssl scans per agent.
MaxInstancesWebcrawler uint32 `gorm:"column:max_instances_webcrawler;type:int" json:"max_instances_webcrawler"` // Maximum parallel instances of webcrawler scans per agent.
MaxInstancesWebenum uint32 `gorm:"column:max_instances_webenum;type:int" json:"max_instances_webenum"` // Maximum parallel instances of webenum scans per agent.
SensitivePorts string `gorm:"column:sensitive_ports;type:text" json:"-"` // Comma separated list of sensitive ports that shall not be scanned with submodules
SensitivePortsSlice []int `gorm:"-" json:"sensitive_ports"` //
NetworkTimeoutSeconds int `gorm:"column:network_timeout_seconds;type:int" json:"network_timeout_seconds"` //
HttpUserAgent string `gorm:"column:http_user_agent;type:text" json:"http_user_agent"` //
DiscoveryTimeEarliest string `gorm:"column:discovery_time_earliest;type:text" json:"discovery_time_earliest"` //
DiscoveryTimeLatest string `gorm:"column:discovery_time_latest;type:text" json:"discovery_time_latest"` //
DiscoverySkipDays string `gorm:"column:discovery_skip_days;type:text" json:"-"` // Comma separated list of integers (0=Sunday,..., 6=Saturday) where no scanning should take place
DiscoverySkipDaysSlice []time.Weekday `gorm:"-" json:"discovery_skip_days"`
DiscoveryNmapArgs string `gorm:"column:discovery_nmap_args;type:text" json:"discovery_nmap_args"`
DiscoveryNmapArgsPrescan string `gorm:"column:discovery_nmap_args_prescan;type:text" json:"discovery_nmap_args_prescan"` // A smaller scan executed before the main scan to at least retrieve some scan results, before a potential IDS kicks in
DiscoveryExcludeDomains string `gorm:"column:discovery_exclude_domains;type:text" json:"discovery_exclude_domains"`
NfsScanTimeoutMinutes int `gorm:"column:nfs_scan_timeout_minutes;type:int" json:"nfs_scan_timeout_minutes"`
NfsDepth int `gorm:"column:nfs_depth;type:int" json:"nfs_depth"`
NfsThreads int `gorm:"column:nfs_threads;type:int" json:"nfs_threads"`
NfsExcludeFolders string `gorm:"column:nfs_exclude_folders;type:text" json:"nfs_exclude_folders"`
NfsExcludeExtensions string `gorm:"column:nfs_exclude_extensions;type:text" json:"nfs_exclude_extensions"`
NfsExcludeFileSizeBelow int `gorm:"column:nfs_exclude_file_size_below;type:int" json:"nfs_exclude_file_size_below"`
NfsExcludeLastModifiedBelow time.Time `gorm:"column:nfs_exclude_last_modified_below;type:datetime" json:"nfs_exclude_last_modified_below"`
NfsAccessibleOnly bool `gorm:"column:nfs_accessible_only;type:bool" json:"nfs_accessible_only"`
SmbScanTimeoutMinutes int `gorm:"column:smb_scan_timeout_minutes;type:int" json:"smb_scan_timeout_minutes"`
SmbDepth int `gorm:"column:smb_depth;type:int" json:"smb_depth"`
SmbThreads int `gorm:"column:smb_threads;type:int" json:"smb_threads"`
SmbExcludeFolders string `gorm:"column:smb_exclude_folders;type:text" json:"smb_exclude_folders"`
SmbExcludeExtensions string `gorm:"column:smb_exclude_extensions;type:text" json:"smb_exclude_extensions"`
SmbExcludeFileSizeBelow int `gorm:"column:smb_exclude_file_size_below;type:int" json:"smb_exclude_file_size_below"`
SmbExcludeLastModifiedBelow time.Time `gorm:"column:smb_exclude_last_modified_below;type:datetime" json:"smb_exclude_last_modified_below"`
SmbAccessibleOnly bool `gorm:"column:smb_accessible_only;type:bool" json:"smb_accessible_only"`
SslScanTimeoutMinutes int `gorm:"column:ssl_scan_timeout_minutes;type:int" json:"ssl_scan_timeout_minutes"`
SshScanTimeoutMinutes int `gorm:"column:ssh_scan_timeout_minutes;type:int" json:"ssh_scan_timeout_minutes"`
WebcrawlerScanTimeoutMinutes int `gorm:"column:webcrawler_scan_timeout_minutes;type:int" json:"webcrawler_scan_timeout_minutes"`
WebcrawlerDepth int `gorm:"column:webcrawler_depth;type:int" json:"webcrawler_depth"`
WebcrawlerMaxThreads int `gorm:"column:webcrawler_max_threads;type:int" json:"webcrawler_max_threads"`
WebcrawlerFollowQueryStrings bool `gorm:"column:webcrawler_follow_query_strings;type:bool" json:"webcrawler_follow_query_strings"`
WebcrawlerAlwaysStoreRoot bool `gorm:"column:webcrawler_always_store_root;type:bool" json:"webcrawler_always_store_root"`
WebcrawlerFollowTypes string `gorm:"column:webcrawler_follow_types;type:text" json:"webcrawler_follow_types"`
WebenumScanTimeoutMinutes int `gorm:"column:webenum_scan_timeout_minutes;type:int" json:"webenum_scan_timeout_minutes"`
WebenumProbeRobots bool `gorm:"column:webenum_probe_robots;type:bool" json:"webenum_probe_robots"`
ScanScope *T_scan_scope `gorm:"foreignKey:IdTScanScope" json:"-"` // Has to be a pointer in order to prevent an invalid recursion. Can be nil if the id has been set
}
func (*T_scan_setting) AfterFind ¶
func (scanSettings *T_scan_setting) AfterFind(tx *gorm.DB) (err error)
AfterFind updates yet empty struct fields with the derived values. Some setting values are not stored in the database but derived from other fields in the database.
func (*T_scan_setting) BeforeSave ¶
func (scanSettings *T_scan_setting) BeforeSave(tx *gorm.DB) error
BeforeSave is a GORM hook that's executed every time the user object is written to the DB. This should be used to do some data sanitization, e.g. to strip illegal HTML tags in user attributes or to convert values to a certain format.
func (*T_scan_setting) MaxInstances ¶
func (scanSettings *T_scan_setting) MaxInstances(label string) (int, error)
MaxInstances extracts the set amount of maximum instances from a scan scope for a given scan module label
func (*T_scan_setting) SaveAll ¶
func (scanSettings *T_scan_setting) SaveAll(values *T_scan_setting) (int64, error)
SaveAll updates *all* columns of a user entry in the database. It overwrites existing values with the ones passed in
func (*T_scan_setting) UnmarshalJSON ¶
func (scanSettings *T_scan_setting) UnmarshalJSON(b []byte) error
type T_scope_view ¶
type T_scope_view struct {
// Unique index on IdTScanScope and Name to make sure the same view name only exists once per scan scope!
// Otherwise, they couldn't be created on the database!
Id uint64 `gorm:"column:id;primaryKey" json:"id"` // Id autoincrement
IdTScanScope uint64 `gorm:"column:id_t_scan_scope;type:int;not null;uniqueIndex:idx_scope_name" json:"-"` // Unique index (across columns) to make sure the same view name only exists once per scan scope!
Name string `gorm:"column:name;type:text;not null;uniqueIndex:idx_scope_name" json:"name"` // Name of the view to show to the user
Created time.Time `gorm:"column:created;default:CURRENT_TIMESTAMP" json:"created"` // Timestamp of creation
CreatedBy string `gorm:"column:created_by;type:text;not null" json:"created_by"` // User who created this view
Filters utils.JsonMap `gorm:"column:filters;type:json;default:'{}'" json:"filters"` // Applied filters restricting view on original data
ViewNames string `gorm:"column:view_names;type:text" json:"view_names"` // Comma separated list of view table names as created in the scope db
ScanScope T_scan_scope `gorm:"foreignKey:IdTScanScope" json:"-"`
Grants []T_view_grant `gorm:"foreignKey:IdTScopeView;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`
}
func GetViewEntries ¶
func GetViewEntries() ([]T_scope_view, error)
GetViewEntries queries the manager db for all view entries. It returns an empty slice and NO error if no view entry is found at all. ATTENTION: Contains sensitive information (e.g. DbServer details) which may not be yielded to clients!
func GetViewEntriesOf ¶
func GetViewEntriesOf(groupIds []uint64) ([]T_scope_view, error)
GetViewEntriesOf queries the manager db for all view entries of a given list of group IDs. It returns an empty slice and NO error if no view entry is found.
func GetViewEntry ¶
func GetViewEntry(viewId uint64) (*T_scope_view, error)
GetViewEntry queries the manager db for the view entry by ID. It returns nil and a gorm.ErrRecordNotFound if no entry is found (check with errors.Is(...)). ATTENTION: Contains sensitive information (e.g. DbServer details) which may not be yielded to clients!
func GetViewsGranted ¶
func GetViewsGranted(username string) ([]T_scope_view, error)
GetViewsGranted queries the manager db for all view entries a user has granted access. It returns an empty slice and NO error if no view entry is found. ATTENTION: Contains sensitive information (e.g. DbServer details) which may not be yielded to clients!
func XCreateView ¶
func XCreateView( scopeDb *gorm.DB, scopeEntry *T_scan_scope, viewName string, createdBy string, filters map[string][]string, ) (*T_scope_view, error)
XCreateView creates a view with given properties on scope db and manager db in a transactional manner
func (*T_scope_view) BeforeSave ¶
func (scopeView *T_scope_view) BeforeSave(tx *gorm.DB) error
BeforeSave is a GORM hook that's executed every time the user object is written to the DB. This should be used to do some data sanitization, e.g. to strip illegal HTML tags in user attributes or to convert values to a certain format.
func (*T_scope_view) Save ¶
func (scopeView *T_scope_view) Save(columns ...string) (int64, error)
Save updates defined columns of a user entry in the database. It updates defined columns, to the currently set values, even if the values are empty ones, such as 0, false or "". ATTENTION: Only update required columns to avoid overwriting changes of parallel processes (with data in memory)
type T_smb ¶
type T_smb struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsScan // Insert scan data columns composition
FoldersReadable int `gorm:"column:folders_readable"`
FilesReadable int `gorm:"column:files_readable"`
FilesWritable int `gorm:"column:files_writable"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_smb_file ¶
type T_smb_file struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTSmb uint64 `gorm:"column:id_t_smb;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Path string `gorm:"column:path;type:text"`
Name string `gorm:"column:name;type:text"`
Extension string `gorm:"column:extension;type:text"`
Mime string `gorm:"column:mime;type:text"`
Readable bool `gorm:"column:readable"`
Writable bool `gorm:"column:writable"`
SizeKb int64 `gorm:"column:size_kb"`
LastModified sql.NullTime `gorm:"column:last_modified"`
Depth int `gorm:"column:depth"`
Properties string `gorm:"column:properties;type:text"`
IsSymlink bool `gorm:"column:is_symlink"`
IsDfs bool `gorm:"column:is_dfs"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TSmb *T_smb `gorm:"foreignKey:IdTSmb;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_sql_log ¶
type T_sql_log struct {
Id uint64 `gorm:"column:id;primaryKey" json:"id"` // Id autoincrement
DbName string `gorm:"column:db_name;type:text" json:"db_name"`
DbUser string `gorm:"column:db_user;type:text" json:"db_user"`
DbTable string `gorm:"column:db_table;type:text" json:"db_table"`
Query string `gorm:"column:query;type:text" json:"query"`
QueryResults int `gorm:"column:query_results" json:"query_results"`
QueryTimestamp time.Time `gorm:"column:query_timestamp;default:CURRENT_TIMESTAMP" json:"query_timestamp"`
QueryDuration pqinterval.Duration `gorm:"column:query_duration;type:interval" json:"query_duration"` // Query duration is the time the database needed to execute the query
TotalDuration pqinterval.Duration `gorm:"column:total_duration;type:interval" json:"total_duration"` // Total duration = query duration + network transfer
ClientName string `gorm:"column:client_name;type:text" json:"client_name"` // Name of the client connected
QueryDurationString string `json:"query_duration_string"`
TotalDurationString string `json:"total_duration_string"`
}
T_sql_log stores log entries of queries executed by users
func CreateSqlLog ¶
func CreateSqlLog( logger scanUtils.Logger, dbName string, dbUser string, dbTable string, query string, queryResults int, queryTimestamp time.Time, queryDuration pqinterval.Duration, totalDuration pqinterval.Duration, clientName string, ) (*T_sql_log, error)
CreateSqlLog creates a new query log entry in the PgProxy db.
func GetSqlLogs ¶
func GetSqlLogs(logger scanUtils.Logger, scopeEntry *T_scan_scope, since time.Time) ([]T_sql_log, error)
GetSqlLogs returns a list of log entries for given search arguments
type T_ssh ¶
type T_ssh struct {
// data table not necessary for banner module, due to simple result structure
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsScan // Insert scan data columns composition
AuthenticationMechanisms string `gorm:"column:authentication_mechanisms;type:text"`
KeyExchangeAlgorithms string `gorm:"column:key_exchange_algos;type:text"`
ServerKeyAlgorithms string `gorm:"column:server_key_algos;type:text"`
ServerEncryptionAlgorithms string `gorm:"column:server_encrypt_algos;type:text"`
ServerMacAlgorithms string `gorm:"column:server_mac_algos;type:text"`
ServerCompressAlgorithms string `gorm:"column:server_compress_algos;type:text"`
UsesGuessedKeyExchange bool `gorm:"column:uses_guessed_key_exchange"`
ProtocolVersion string `gorm:"column:protocol_version;type:text"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_ssl ¶
type T_ssl struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsScan // Insert scan data columns composition
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_ssl_certificate ¶
type T_ssl_certificate struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTSsl uint64 `gorm:"column:id_t_ssl;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Vhost string `gorm:"column:vhost;type:text"`
DeploymentId uint64 `gorm:"column:deployment_id"` // Not a primary/foreign key nor an unique identifier!
Type string `gorm:"column:type;type:text"`
Version int `gorm:"column:version"`
Serial string `gorm:"column:serial_number;type:text"`
ValidChain bool `gorm:"column:valid_chain"`
ChainValidatedBy string `gorm:"column:chain_validated_by;type:text"`
ValidChainOrder bool `gorm:"column:valid_chain_order"`
Subject string `gorm:"column:subject;type:text"`
SubjectCN string `gorm:"column:subject_cn;type:text"`
Issuer string `gorm:"column:issuer;type:text"`
IssuerCN string `gorm:"column:issuer_cn;type:text"`
AlternativeNames string `gorm:"column:alternative_names;type:text"`
ValidFrom sql.NullTime `gorm:"column:valid_from"`
ValidTo sql.NullTime `gorm:"column:valid_to"`
PublicKeyAlgorithm string `gorm:"column:public_key_algorithm;type:text"`
PublicKeyInfo string `gorm:"column:public_key_info;type:text"`
PublicKeyBits uint64 `gorm:"column:public_key_bits"`
PublicKeyStrength int `gorm:"column:public_key_strength"`
SignatureAlgorithm string `gorm:"column:signature_algorithm;type:text"`
SignatureHashAlgorithm string `gorm:"column:signature_hash_algorithm;type:text"`
CrlUrls string `gorm:"column:crl_urls;type:text"`
OcspUrls string `gorm:"column:ocsp_urls;type:text"`
KeyUsage string `gorm:"column:key_usage;type:text"`
ExtendedKeyUsage string `gorm:"column:extended_key_usage;type:text"`
BasicConstraintsValid bool `gorm:"column:basic_constraints_valid"`
Ca bool `gorm:"column:ca"`
MaxPathLength int `gorm:"column:max_path_length"`
Sha1Fingerprint string `gorm:"column:sha1_fingerprint;type:text"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TSsl *T_ssl `gorm:"foreignKey:IdTSsl;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_ssl_cipher ¶
type T_ssl_cipher struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTSsl uint64 `gorm:"column:id_t_ssl;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Vhost string `gorm:"column:vhost;type:text"`
ProtocolVersion string `gorm:"column:protocol_version;type:text"`
CipherId string `gorm:"column:cipher_id;type:text"`
IanaName string `gorm:"column:iana_name;type:text"`
OpensslName string `gorm:"column:open_ssl_name;type:text"`
SupportsECDHKEyExchange bool `gorm:"column:support_ecdh_key_exchange"`
SupportedEllipticCurves string `gorm:"column:supported_elliptic_curves;type:text"`
RejectedEllipticCurves string `gorm:"column:rejected_elliptic_curves;type:text"`
KeyExchange string `gorm:"column:key_exchange;type:text"`
KeyExchangeBits int `gorm:"column:key_exchange_bits"`
KeyExchangeStrength int `gorm:"column:key_exchange_strength"`
KeyExchangeInfo string `gorm:"column:key_exchange_info"`
ForwardSecrecy bool `gorm:"column:forward_secrecy"`
Authentication string `gorm:"column:authentication;type:text"`
Encryption string `gorm:"column:encryption;type:text"`
EncryptionMode string `gorm:"column:encryption_mode;type:text"`
EncryptionBits int `gorm:"column:encryption_bits"`
EncryptionStrength int `gorm:"column:encryption_strength"`
BlockCipher bool `gorm:"column:block_cipher"`
BlockSize int `gorm:"column:block_size"`
StreamCipher bool `gorm:"column:stream_cipher"`
Mac string `gorm:"column:mac;type:text"`
MacBits int `gorm:"column:mac_bits"`
MacStrength int `gorm:"column:mac_strength"`
Prf string `gorm:"column:prf;type:text"`
PrfBits int `gorm:"column:prf_bits"`
PrfStrength int `gorm:"column:prf_strength"`
Export bool `gorm:"column:export"`
Draft bool `gorm:"column:draft"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TSsl *T_ssl `gorm:"foreignKey:IdTSsl;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_ssl_issue ¶
type T_ssl_issue struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTSsl uint64 `gorm:"column:id_t_ssl;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Vhost string `gorm:"column:vhost;type:text"`
LowEncryptionStrength bool `gorm:"column:low_encryption_strength"`
AnyChainInvalid bool `gorm:"column:any_chain_invalid"`
AnyChainInvalidOrder bool `gorm:"column:any_chain_invalid_order"`
ClientRenegotiationDos bool `gorm:"column:client_renegotiation_dos"`
CcsInjection bool `gorm:"column:ccs_injection"`
EarlyDataSupported bool `gorm:"column:early_data_supported"`
NoPerfectForwardSecrecy bool `gorm:"column:no_perfect_forward_secrecy"`
Sslv2Enabled bool `gorm:"column:sslv2_enabled"`
Sslv3Enabled bool `gorm:"column:sslv3_enabled"`
Tlsv1_0Enabled bool `gorm:"column:tlsv1_0_enabled"`
Tlsv1_1Enabled bool `gorm:"column:tlsv1_1_enabled"`
ExportSuite bool `gorm:"column:export_suite"`
DraftSuite bool `gorm:"column:draft_suite"`
Md2Enabled bool `gorm:"column:md2_enabled"`
Md5Enabled bool `gorm:"column:md5_enabled"`
Rc4Enabled bool `gorm:"column:rc4_enabled"`
Sha1Enabled bool `gorm:"column:sha1_enabled"`
Beast bool `gorm:"column:beast"`
Crime bool `gorm:"column:crime"`
Drown bool `gorm:"column:drown"`
Freak bool `gorm:"column:freak"`
Heartbleed bool `gorm:"column:heartbleed"`
Logjam bool `gorm:"column:logjam"`
Lucky13 bool `gorm:"column:lucky_13"`
Poodle bool `gorm:"column:poodle"`
Robot bool `gorm:"column:robot"`
Sweet32 bool `gorm:"column:sweet_32"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TSsl *T_ssl `gorm:"foreignKey:IdTSsl;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_ssl_setting ¶
type T_ssl_setting struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTSsl uint64 `gorm:"column:id_t_ssl;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Vhost string `gorm:"column:vhost;type:text"`
LowestProtocol string `gorm:"column:lowest_protocol;type:text"`
MinStrength int `gorm:"column:min_strength"`
Ems bool `gorm:"column:ems"`
TlsFallbackScsv bool `gorm:"column:tls_fallback_scsv"`
SecureRenegotiation bool `gorm:"column:secure_renegotiation"`
SessionResumptionWithId bool `gorm:"column:session_resumption_with_id"`
SessionResumptionWithTickets bool `gorm:"column:session_resumption_with_tickets"`
IsCompliantToMozillaConfig bool `gorm:"column:is_compliant_to_mozilla_config"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TSsl *T_ssl `gorm:"foreignKey:IdTSsl;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_view_grant ¶
type T_view_grant struct {
// A view grant is representing an access right to a certain scope view. It may represent a user specific
// access right, or a generic not user bound access token access right.
Id uint64 `gorm:"column:id;primaryKey;uniqueIndex" json:"-"` // Id autoincrement
IdTScopeView uint64 `gorm:"column:id_t_scope_view;type:int;not null;index" json:"-"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IsUser bool `gorm:"column:is_user;type:bool" json:"is_user"` // Flag indicating whether this entry is for a dedicated user, rather than a not user bound access token
Username string `gorm:"column:username;type:text" json:"username"` // The database user name this grant references. May be an e-mail address to reference certain user or random string for access tokens
Created time.Time `gorm:"column:created;default:CURRENT_TIMESTAMP" json:"created"` // Timestamp of grant creation
CreatedBy string `gorm:"column:created_by;type:text;not null" json:"created_by"` // User who created this grant
Expiry time.Time `gorm:"column:expiry;not null" json:"expiry"` // Timestamp when this access grant is scheduled to expire, should equal the values set on the database servers
Description string `gorm:"column:description;type:text" json:"description"` // Set by the creator, only necessary for access tokens
ScopeView T_scope_view `gorm:"foreignKey:IdTScopeView" json:"-"`
}
func (*T_view_grant) BeforeSave ¶
func (grantEntry *T_view_grant) BeforeSave(tx *gorm.DB) error
BeforeSave is a GORM hook that's executed every time the user object is written to the DB. This should be used to do some data sanitization, e.g. to strip illegal HTML tags in user attributes or to convert values to a certain format.
type T_webcrawler ¶
type T_webcrawler struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsScan // Insert scan data columns composition
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
func (T_webcrawler) TableName ¶
func (T_webcrawler) TableName() string
type T_webcrawler_page ¶
type T_webcrawler_page struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTWebcrawler uint64 `gorm:"column:id_t_webcrawler;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTWebcrawlerVhost uint64 `gorm:"column:id_t_webcrawler_vhost;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Depth int `gorm:"column:depth"`
Url string `gorm:"column:url;type:text"`
RedirectUrl string `gorm:"column:redirect_url;type:text"`
RedirectCount int `gorm:"column:redirect_count"`
AuthMethod string `gorm:"column:auth_method;type:text"`
AuthSuccess bool `gorm:"column:auth_success"`
ResponseCode int `gorm:"column:response_code"`
ResponseMessage string `gorm:"column:response_message;type:text"`
ResponseContentType string `gorm:"column:response_content_type;type:text"`
ResponseHeaders string `gorm:"column:response_headers;type:text"`
ResponseEncoding string `gorm:"column:response_encoding;type:text;default:''"`
HtmlTitle string `gorm:"column:html_title;type:text"`
HtmlContent string `gorm:"column:html_content;type:text"`
HtmlContentLength int `gorm:"column:html_content_length;"`
RawLinks string `gorm:"column:raw_links;type:text"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TWebcrawler *T_webcrawler `gorm:"foreignKey:IdTWebcrawler;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TWebcrawlerVhost *T_webcrawler_vhost `gorm:"foreignKey:IdTWebcrawlerVhost;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_webcrawler_vhost ¶
type T_webcrawler_vhost struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTWebcrawler uint64 `gorm:"column:id_t_webcrawler;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Status string `gorm:"column:status;type:text"`
Vhost string `gorm:"column:vhost;type:text"`
FaviconHash string `gorm:"column:favicon_hash;type:text"`
AuthMethod string `gorm:"column:auth_method;type:text"`
AuthSuccess bool `gorm:"column:auth_success"`
RequestsTotal int `gorm:"column:requests_total"`
RequestsRedirect int `gorm:"column:requests_redirect"`
RequestsPartial int `gorm:"column:requests_partial"`
RequestsComplete int `gorm:"column:requests_complete"`
DiscoveredVhosts string `gorm:"column:discovered_vhosts;type:text"`
DiscoveredDownloads string `gorm:"column:discovered_downloads;type:text"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TWebcrawler *T_webcrawler `gorm:"foreignKey:IdTWebcrawler;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_webenum ¶
type T_webenum struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
ColumnsScan // Insert scan data columns composition
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}
type T_webenum_results ¶
type T_webenum_results struct {
Id uint64 `gorm:"column:id;type:bigint;primaryKey;uniqueIndex"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTDiscoveryService uint64 `gorm:"column:id_t_discovery_service;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
IdTWebenum uint64 `gorm:"column:id_t_webenum;type:bigint;index"` // Index recommended on foreign keys for efficient update/delete cascaded actions
Name string `gorm:"column:name;type:text"`
Vhost string `gorm:"column:vhost;type:text"`
Url string `gorm:"column:url;type:text"`
RedirectUrl string `gorm:"column:redirect_url;type:text"`
RedirectCount int `gorm:"column:redirect_count"`
RedirectOut bool `gorm:"column:redirect_out"`
AuthMethod string `gorm:"column:auth_method;type:text"`
AuthSuccess bool `gorm:"column:auth_success"`
ResponseCode int `gorm:"column:response_code"`
ResponseMessage string `gorm:"column:response_message;type:text"`
ResponseContentType string `gorm:"column:response_content_type;type:text"`
ResponseHeaders string `gorm:"column:response_headers;type:text"`
ResponseEncoding string `gorm:"column:response_encoding;type:text;default:''"`
HtmlTitle string `gorm:"column:html_title;type:text"`
HtmlContent string `gorm:"column:html_content;type:text"`
HtmlContentLength int `gorm:"column:html_content_length"`
TDiscoveryService *T_discovery_service `gorm:"foreignKey:IdTDiscoveryService;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
TWebenum *T_webenum `gorm:"foreignKey:IdTWebenum;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Relation struct used for gorm configuration and batch inserts (where it can be used to keep track of the IDs) and to enforce constraints. Can be nil if the ID is set in turn
}