am

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: 6 Imported by: 31

Documentation

Index

Constants

View Source
const (
	RNAddressAddresses = "lrn:service:address:feature:addresses"
	AddressServiceKey  = "addressservice"
)
View Source
const (
	FilterIgnored                = "ignored"
	FilterWildcard               = "wildcard"
	FilterHosted                 = "hosted"
	FilterDiscoveredBy           = "discovered_by"
	FilterAfterScannedTime       = "after_scanned_time"
	FilterBeforeScannedTime      = "before_scanned_time"
	FilterAfterSeenTime          = "after_seen_time"
	FilterBeforeSeenTime         = "before_seen_time"
	FilterAfterDiscoveredTime    = "after_discovered_time"
	FilterBeforeDiscoveredTime   = "before_discovered_time"
	FilterAboveConfidence        = "above_confidence"
	FilterBelowConfidence        = "below_confidence"
	FilterEqualsConfidence       = "equals_confidence"
	FilterAboveUserConfidence    = "above_user_confidence"
	FilterBelowUserConfidence    = "below_user_confidence"
	FilterEqualsUserConfidence   = "equals_user_confidence"
	FilterEqualsNSRecord         = "ns_record"
	FilterNotNSRecord            = "not_ns_record"
	FilterIPAddress              = "ip_address"
	FilterNotIPAddress           = "not_ip_address"
	FilterHostAddress            = "host_address"
	FilterNotHostAddress         = "not_host_address"
	FilterEndsHostAddress        = "ends_host_address"
	FilterNotEndsHostAddress     = "not_ends_host_address"
	FilterStartsHostAddress      = "starts_host_address"
	FilterNotStartsHostAddress   = "not_starts_host_address"
	FilterContainsHostAddress    = "contains_host_address"
	FilterNotContainsHostAddress = "not_contains_host_address"
	FilterTCPPortOpen            = "tcp_port_open"
	FiltetTCPPortClosed          = "tcp_port_closed"
	FilterUDPPortOpen            = "udp_port_open"
	FiltetUDPPortClosed          = "udp_port_closed"
)
View Source
const (
	DiscoveryNSInputList     = "input_list"
	DiscoveryNSManual        = "manual"
	DiscoveryNSQueryOther    = "ns_query_other"
	DiscoveryNSQueryIPToName = "ns_query_ip_to_name"
	DiscoveryNSQueryNameToIP = "ns_query_name_to_ip"
	DiscoveryNSAXFR          = "ns_query_axfr"
	DiscoveryNSSECWalk       = "ns_query_nsec_walk"
	DiscoveryBruteSubDomain  = "dns_brute_forcer"
	DiscoveryBruteMutator    = "dns_mutator"
	DiscoveryWebCrawler      = "web_crawler"
	DiscoveryGitHooks        = "git_hooks"
	DiscoveryBigData         = "bigdata"
	DiscoveryBigDataCT       = "bigdata_certificate_transparency"
)

1 "input_list" 2 "manual" 3 "other" 100 "ns_query_other" 101 "ns_query_ip_to_name" 102 "ns_query_name_to_ip" 103 "ns_query_axfr" 200 "dns_brute_forcer" 201 "dns_mutator" 300 "web_crawler" 1000 "git_hooks" 400 "bigdata" 401 "bigdata_certificate_transparency" 104 "ns_query_nsec_walk"

View Source
const (
	BigDataServiceKey = "bigdataservice"
	RNBigData         = "lrn:service:bigdata:feature:bigdata"
)
View Source
const (
	RNEventService  = "lrn:service:eventservice:feature:events"
	EventServiceKey = "eventservice"
)
View Source
const (
	NSModule                 ModuleType = 1
	BruteModule              ModuleType = 2
	PortScanModule           ModuleType = 3
	WebModule                ModuleType = 4
	KeywordModule            ModuleType = 5
	BigDataCTSubdomainModule ModuleType = 6

	NSModuleServiceKey       = "nsmoduleservice"
	BruteModuleServiceKey    = "brutemoduleservice"
	PortScanModuleServiceKey = "portscanmoduleservice"
	WebModuleServiceKey      = "webmoduleservice"
	KeywordModuleServiceKey  = "keywordmoduleservice"
	BigDataModuleServiceKey  = "bigdatamoduleservice"
)
View Source
const (
	// RNOrganizationSystem system only access (create/delete)
	RNOrganizationSystem = "lrn:service:organization:feature:system"
	// RNOrganizationManage organization specific management
	RNOrganizationManage   = "lrn:service:organization:feature:manage"
	OrganizationServiceKey = "orgservice"
)
View Source
const (
	OrgStatusDisabledPendingPayment = 1
	OrgStatusDisabledClosed         = 2
	OrgStatusDisabledLocked         = 3
	OrgStatusAwaitActivation        = 100
	OrgStatusActive                 = 1000

	SubscriptionPending       = 1
	SubscriptionOneTime       = 10
	SubscriptionMonthly       = 100
	SubscriptionMonthlySmall  = 101
	SubscriptionMonthlyMedium = 102
	SubscriptionEnterprise    = 1000
	SubscriptionSystem        = 9999
)
View Source
const (
	SystemRole        = "role:system"
	SystemSupportRole = "role:system_support"
	OwnerRole         = "role:owner"
	AdminRole         = "role:administrator"
	AuditorRole       = "role:auditor"
	EditorRole        = "role:editor"
	ReviewerRole      = "role:reviewer"
)

Definition of roles

View Source
const (
	RNScanGroupGroups    = "lrn:service:scangroup:feature:groups"
	RNScanGroupAllGroups = "lrn:service:scangroup:feature:allgroups"
	ScanGroupServiceKey  = "scangroupservice"
)
View Source
const (
	RNTagServiceStacks  = "lrn:service:tagservice:feature:stacks"
	RNTagServiceGroups  = "lrn:service:tagservice:feature:groups"
	RNTagServiceTagging = "lrn:service:tagservice:feature:tagging"
	RNTagServiceCustom  = "lrn:service:tagservice:feature:custom"
)
View Source
const (
	// RNUserSystem system only access
	RNUserSystem = "lrn:service:user:feature:system"
	// RNUserManage organization specific management
	RNUserManage   = "lrn:service:user:feature:manage"
	RNUserSelf     = "lrn:service:user:feature:self"
	UserServiceKey = "userservice"
)
View Source
const (
	UserStatusDisabled        = 1
	UserStatusAwaitActivation = 100
	UserStatusActive          = 1000
	UserStatusSystem          = 9999
)
View Source
const (
	RNWebData             = "lrn:service:webdata:feature:"
	RNWebDataResponses    = "lrn:service:webdata:feature:responses"
	RNWebDataCertificates = "lrn:service:webdata:feature:certificates"
	RNWebDataSnapshots    = "lrn:service:webdata:feature:snapshots"
	WebDataServiceKey     = "webdataservice"
)
View Source
const (
	FilterDeleted                  = "deleted"
	FilterWebTechType              = "tech_type"
	FilterWebTechTypeVersion       = "tech_type_version"
	FilterWebDependentHostAddress  = "dependent_host_address"
	FilterWebEqualsHostAddress     = "host_address"
	FilterWebAfterResponseTime     = "after_response_time"
	FilterWebBeforeResponseTime    = "before_response_time"
	FilterWebLatestOnly            = "latest_only"
	FilterWebMimeType              = "mime_type"
	FilterWebHeaderNames           = "header_names"
	FilterWebNotHeaderNames        = "not_header_names"
	FilterWebHeaderPairNames       = "header_pair_names"
	FilterWebHeaderPairValues      = "header_pair_values"
	FilterWebAfterURLRequestTime   = "after_request_time"
	FilterWebBeforeURLRequestTime  = "before_request_time"
	FilterWebEqualsURLRequestTime  = "url_request_timestamp"
	FilterWebEqualsResponseTime    = "response_timestamp"
	FilterWebEqualsIPAddress       = "ip_address"
	FilterWebEndsHostAddress       = "ends_host_address"
	FilterWebStartsHostAddress     = "starts_host_address"
	FilterWebEqualsLoadIPAddress   = "load_ip_address"
	FilterWebEqualsLoadHostAddress = "load_host_address"
	FilterWebEndsLoadHostAddress   = "ends_load_host_address"
	FilterWebStartsLoadHostAddress = "starts_load_host_address"
	FilterWebEqualsServerType      = "server_type"
	FilterWebEqualsURL             = "url"
	FilterWebAfterValidTo          = "after_valid_to"
	FilterWebBeforeValidTo         = "before_valid_to"
	FilterWebAfterValidFrom        = "after_valid_from"
	FilterWebBeforeValidFrom       = "before_valid_from"
)
View Source
const (
	CoordinatorServiceKey = "coordinatorservice"
)
View Source
const (
	DefaultArchiveDays = 7
)

Default number of days for a scan group to have records automatically archived to archive tables

View Source
const (
	DispatcherServiceKey = "dispatcherservice"
)
View Source
const (
	FilterEventGroupID = "group_id"
)
View Source
const (
	RNFindingsFindings = "lrn:service:findings:feature:findings"
)

Variables

View Source
var (
	ErrEmptyDBConfig     = errors.New("empty database connection string")
	ErrInvalidDBString   = errors.New("invalid db connection string")
	ErrOrgIDMismatch     = errors.New("org id does not match user context org id")
	ErrUserNotAuthorized = errors.New("user is not authorized to perform this action")
	ErrLimitTooLarge     = errors.New("requested number of records too large")
	ErrNoResults         = errors.New("no results")

	// Scan Group Specific
	ErrScanGroupNotExists     = errors.New("scan group name does not exist")
	ErrScanGroupExists        = errors.New("scan group name already exists")
	ErrScanGroupVersionLinked = errors.New("scan group version is linked to this scan group")
	ErrAddressCopyCount       = errors.New("copy count of addresses did not match expected amount")
	ErrEmptyAddress           = errors.New("address data was nil")
	ErrEmptyModuleConfig      = errors.New("module configuration was nil")

	// Organization Specific
	ErrOrganizationExists    = errors.New("organization already exists")
	ErrOrganizationNotExists = errors.New("organization does not exist")

	// User Specific
	ErrUserExists      = errors.New("user already exists")
	ErrUserCIDEmpty    = errors.New("user cid is empty")
	ErrUserIDMismatch  = errors.New("user id does not match user context user id")
	ErrUserNotAccepted = errors.New("user did not accept agreement")

	// Events & Notifications
	ErrEventCopyCount = errors.New("copy count of events did not match expected amount")

	// Module related
	ErrEmptyIP                 = errors.New("ip address was empty")
	ErrBannedIP                = errors.New("ip address was found in banned list")
	ErrWithPortsNotImplemented = errors.New("AnalyzeWithPorts is not implemented for this module")
)
View Source
var (
	EventInitialGroupCompleteID int32 = 1
	EventMaxHostPricingID       int32 = 2
	EventNewHostID              int32 = 10
	EventNewRecordID            int32 = 11
	EventNewOpenPortID          int32 = 12
	EventClosedPortID           int32 = 13
	EventNewWebsiteID           int32 = 100
	EventWebHTMLUpdatedID       int32 = 101
	EventNewWebTechID           int32 = 102
	EventWebJSChangedID         int32 = 103
	EventCertExpiringID         int32 = 150
	EventCertExpiredID          int32 = 151
	EventAXFRID                 int32 = 200
	EventNSECID                 int32 = 201
)

DefaultOrgRoles is a slice of all roles an organiation has

View Source
var DefaultTCPPorts = []int32{21, 22, 23, 25, 53, 80, 135, 139, 443, 445, 1443, 1723, 3306, 3389, 5432, 5900, 6379, 8000, 8080, 8443, 8500, 9500, 27017}

DefaultTCPPorts are the list of default ports for port scanning

View Source
var DefaultUDPPorts = []int32{500, 1194}

DefaultUDPPorts are the list of default udp ports for port scanning

View Source
var EventTypes = map[int32]string{
	1:   "initial scan group analysis completed",
	2:   "maximum number of hostnames reached for pricing plan",
	10:  "new hostname",
	11:  "new record",
	12:  "new port open",
	13:  "port closed",
	100: "new website detected",
	101: "website's html updated",
	102: "website's technology changed or updated",
	103: "website's javascript changed",
	150: "certificate expiring",
	151: "certificate expired",
	200: "dns server exposing records via zone transfer",
	201: "dns server exposing records via NSEC walking",
}
View Source
var GroupStatusMap = map[GroupStatus]string{
	1: "started",
	2: "stopped",
}
View Source
var NSRecords = map[string]int16{"NA": 0,
	"A":          1,
	"NS":         2,
	"MD":         3,
	"MF":         4,
	"CNAME":      5,
	"SOA":        6,
	"MB":         7,
	"MG":         8,
	"MR":         9,
	"NULL":       10,
	"PTR":        12,
	"HINFO":      13,
	"MINFO":      14,
	"MX":         15,
	"TXT":        16,
	"RP":         17,
	"AFSDB":      18,
	"X25":        19,
	"ISDN":       20,
	"RT":         21,
	"NSAPPTR":    23,
	"SIG":        24,
	"KEY":        25,
	"PX":         26,
	"GPOS":       27,
	"AAAA":       28,
	"LOC":        29,
	"NXT":        30,
	"EID":        31,
	"NIMLOC":     32,
	"SRV":        33,
	"ATMA":       34,
	"NAPTR":      35,
	"KX":         36,
	"CERT":       37,
	"DNAME":      39,
	"OPT":        41,
	"DS":         43,
	"SSHFP":      44,
	"RRSIG":      46,
	"NSEC":       47,
	"DNSKEY":     48,
	"DHCID":      49,
	"NSEC3":      50,
	"TLSA":       52,
	"SMIMEA":     53,
	"HIP":        55,
	"NINFO":      56,
	"RKEY":       57,
	"TALINK":     58,
	"CDS":        59,
	"CDNSKEY":    60,
	"OPENPGPKEY": 61,
	"CSYNC":      62,
	"SPF":        99,
	"UINFO":      100,
	"UID":        101,
	"GID":        102,
	"UNSPEC":     103,
	"NID":        104,
	"L32":        105,
	"L64":        106,
	"LP":         107,
	"EUI48":      108,
	"EUI64":      109,
	"URI":        256,
	"CAA":        257,
	"AVC":        258,
	"IXFR":       251,
	"AXFR":       252,
	"ANY":        255,
}

NSrecords is a map of record names to values

View Source
var RNSystem = "lrn:service:<.*>"

RNSystem System Resource Name for allowing system/support access to all services

Functions

func KeyFromModuleType

func KeyFromModuleType(moduleType ModuleType) string

Types

type AddressService

type AddressService interface {
	Init(config []byte) error
	Get(ctx context.Context, userContext UserContext, filter *ScanGroupAddressFilter) (oid int, addresses []*ScanGroupAddress, err error)
	OrgStats(ctx context.Context, userContext UserContext) (oid int, orgStats []*ScanGroupAddressStats, err error)
	GroupStats(ctx context.Context, userContext UserContext, groupID int) (oid int, groupStats *ScanGroupAddressStats, err error)
	GetHostList(ctx context.Context, userContext UserContext, filter *ScanGroupAddressFilter) (oid int, hostList []*ScanGroupHostList, err error)
	Count(ctx context.Context, userContext UserContext, groupID int) (oid int, count int, err error)
	Update(ctx context.Context, userContext UserContext, addresses map[string]*ScanGroupAddress) (oid int, count int, err error)
	UpdateHostPorts(ctx context.Context, userContext UserContext, address *ScanGroupAddress, portResults *PortResults) (oid int, err error)
	GetPorts(ctx context.Context, userContext UserContext, filter *ScanGroupAddressFilter) (oid int, portList []*PortResults, err error)
	Delete(ctx context.Context, userContext UserContext, groupID int, addressIDs []int64) (oid int, err error)
	Ignore(ctx context.Context, userContext UserContext, groupID int, addressIDs []int64, ignoreValue bool) (oid int, err error)
	Archive(ctx context.Context, userContext UserContext, group *ScanGroup, archiveTime time.Time) (int, int, error)
}

AddressService manages all asset data

type Bag

type Bag struct {
	Int32Vals   map[string][]int32
	Int64Vals   map[string][]int64
	Float32Vals map[string][]float32
	BoolVals    map[string][]bool
	StringVals  map[string][]string
}

func (*Bag) AddBool

func (b *Bag) AddBool(key string, value bool)

func (*Bag) AddBools

func (b *Bag) AddBools(key string, values []bool)

func (*Bag) AddFloat32

func (b *Bag) AddFloat32(key string, value float32)

func (*Bag) AddFloat32s

func (b *Bag) AddFloat32s(key string, values []float32)

func (*Bag) AddInt32

func (b *Bag) AddInt32(key string, value int32)

func (*Bag) AddInt32s

func (b *Bag) AddInt32s(key string, values []int32)

func (*Bag) AddInt64

func (b *Bag) AddInt64(key string, value int64)

func (*Bag) AddInt64s

func (b *Bag) AddInt64s(key string, values []int64)

func (*Bag) AddString

func (b *Bag) AddString(key, value string)

func (*Bag) AddStrings

func (b *Bag) AddStrings(key string, values []string)

func (*Bag) Bool

func (b *Bag) Bool(key string) (bool, bool)

func (*Bag) Bools

func (b *Bag) Bools(key string) ([]bool, bool)

func (*Bag) Float32

func (b *Bag) Float32(key string) (float32, bool)

func (*Bag) Float32s

func (b *Bag) Float32s(key string) ([]float32, bool)

func (*Bag) Int32

func (b *Bag) Int32(key string) (int32, bool)

func (*Bag) Int32s

func (b *Bag) Int32s(key string) ([]int32, bool)

func (*Bag) Int64

func (b *Bag) Int64(key string) (int64, bool)

func (*Bag) Int64s

func (b *Bag) Int64s(key string) ([]int64, bool)

func (*Bag) String

func (b *Bag) String(key string) (string, bool)

func (*Bag) Strings

func (b *Bag) Strings(key string) ([]string, bool)

type BigDataService

type BigDataService interface {
	DeleteCT(ctx context.Context, userContext UserContext, etld string) error
	GetCT(ctx context.Context, userContext UserContext, etld string) (time.Time, map[string]*CTRecord, error)
	AddCT(ctx context.Context, userContext UserContext, etld string, queryTime time.Time, ctRecords map[string]*CTRecord) error
	GetETLDs(ctx context.Context, userContext UserContext) ([]*CTETLD, error)
	GetCTSubdomains(ctx context.Context, userContext UserContext, etld string) (time.Time, map[string]*CTSubdomain, error)
	AddCTSubdomains(ctx context.Context, userContext UserContext, etld string, queryTime time.Time, subdomains map[string]*CTSubdomain) error
	DeleteCTSubdomains(ctx context.Context, userContext UserContext, etld string) error
}

type BruteModuleConfig

type BruteModuleConfig struct {
	CustomSubNames    []string `json:"custom_subnames" redis:"-"`
	RequestsPerSecond int32    `json:"requests_per_second"`
	MaxDepth          int32    `json:"max_depth"`
}

BruteModuleConfig DNS subdomain brute forcer

type CTETLD

type CTETLD struct {
	ETLD_ID        int32  `json:"etld_id"`
	ETLD           string `json:"etld"`
	QueryTimestamp int64  `json:"query_timestamp"`
}

type CTRecord

type CTRecord struct {
	CertificateID      int64  `json:"certificate_id"`
	InsertedTime       int64  `json:"time"`
	ServerName         string `json:"server_name"`
	ServerIndex        int64  `json:"server_index"`
	CertHash           string `json:"cert_hash"`
	SerialNumber       string `json:"serial_number"`
	NotBefore          int64  `json:"not_before"`
	NotAfter           int64  `json:"not_after"`
	Country            string `json:"country"`
	Organization       string `json:"organization"`
	OrganizationalUnit string `json:"organizational_unit"`
	CommonName         string `json:"common_name"`
	VerifiedDNSNames   string `json:"verified_dns_names"`
	UnverifiedDNSNames string `json:"unverified_dns_names"`
	IPAddresses        string `json:"ip_addresses"`
	EmailAddresses     string `json:"email_addresses"`
	ETLD               string `json:"etld"`
}

type CTSubdomain

type CTSubdomain struct {
	SubdomainID  int64  `json:"subdomain_id"`
	ETLD         string `json:"etld"`
	Subdomain    string `json:"subdomain"`
	InsertedTime int64  `json:"inserted_timestamp"`
}

type CommonCrawlData

type CommonCrawlData struct {
}

type CoordinatorService

type CoordinatorService interface {
	Init(config []byte) error
	// externally accessable rpcs
	//GroupStats(ctx context.Context, userContext UserContext, scanGroupID int) (*ScanGroupStats, error)
	StartGroup(ctx context.Context, userContext UserContext, scanGroupID int) error
	StopGroup(ctx context.Context, userContext UserContext, orgID, scanGroupID int) (string, error)
}

type DispatcherService

type DispatcherService interface {
	Init(config []byte) error
	PushAddresses(ctx context.Context, userContext UserContext, scanGroupID int) error
}

DispatcherService handles dispatching scan group addresses to the analysis modules

type Event

type Event struct {
	NotificationID int64    `json:"notification_id"`
	OrgID          int      `json:"org_id"`
	GroupID        int      `json:"group_id"`
	TypeID         int32    `json:"type_id"`
	EventTimestamp int64    `json:"event_timestamp"`
	Data           []string `json:"data,omitempty"`
	JSONData       string   `json:"json_data,omitempty"`
	Read           bool     `json:"read"`
}

type EventAXFR

type EventAXFR struct {
	Servers []string `json:"servers"`
}

type EventCertExpired

type EventCertExpired struct {
	SubjectName string `json:"subject_name"`
	Port        int    `json:"port"`
	ValidTo     int64  `json:"valid_to"`
}

type EventCertExpiring

type EventCertExpiring struct {
	SubjectName   string `json:"subject_name"`
	Port          int    `json:"port"`
	ValidTo       int64  `json:"valid_to"`
	TimeRemaining string `json:"time_remaining"`
}

type EventClosedPort

type EventClosedPort struct {
	Host        string  `json:"hostname"`
	CurrentIP   string  `json:"current_ip"`
	PreviousIP  string  `json:"previous_ip"`
	ClosedPorts []int32 `json:"closed_ports"`
}

type EventFilter

type EventFilter struct {
	Start   int64       `json:"start"`
	Limit   int32       `json:"limit"`
	Filters *FilterType `json:"filter"`
}

type EventInitialGroupComplete

type EventInitialGroupComplete struct {
	Message string `json:"message"`
}

type EventNSEC

type EventNSEC struct {
	Servers []string `json:"servers"`
}

type EventNewHost

type EventNewHost struct {
	Host string `json:"new_host"`
}

type EventNewOpenPort

type EventNewOpenPort struct {
	Host       string  `json:"hostname"`
	CurrentIP  string  `json:"current_ip"`
	PreviousIP string  `json:"previous_ip"`
	OpenPorts  []int32 `json:"open_ports"`
}

type EventNewWebTech

type EventNewWebTech struct {
	LoadURL  string `json:"load_url"`
	URL      string `json:"url"`
	Port     int    `json:"port"`
	TechName string `json:"tech_name"`
	Version  string `json:"tech_version"`
}

type EventNewWebsite

type EventNewWebsite struct {
	LoadURL string `json:"load_url"`
	URL     string `json:"url"`
	Port    int    `json:"port"`
}

type EventService

type EventService interface {
	Init(config []byte) error
	// Get events
	Get(ctx context.Context, userContext UserContext, filter *EventFilter) ([]*Event, error)
	// GetSettings user settings
	GetSettings(ctx context.Context, userContext UserContext) (*UserEventSettings, error)
	// MarkRead events
	MarkRead(ctx context.Context, userContext UserContext, notificationIDs []int64) error
	// Add events (system only?)
	Add(ctx context.Context, userContext UserContext, events []*Event) error
	// UpdateSettings for user
	UpdateSettings(ctx context.Context, userContext UserContext, settings *UserEventSettings) error
	// NotifyComplete that a scan group has completed
	NotifyComplete(ctx context.Context, userContext UserContext, startTime int64, groupID int) error
	// GetWebhooks returns all webhooks for an organization (max 10)
	GetWebhooks(ctx context.Context, userContext UserContext) ([]*WebhookEventSettings, error)
	// UpdateWebhooks adds or updates an existing webhook (by name)
	UpdateWebhooks(ctx context.Context, userContext UserContext, webhook *WebhookEventSettings) error
	// GetWebhook events
	GetWebhookEvents(ctx context.Context, userContext UserContext) ([]*WebhookEvent, error)
}

EventService handles adding events and returning them to users.

type EventSubscriptions

type EventSubscriptions struct {
	TypeID              int32 `json:"type_id"`
	SubscribedTimestamp int64 `json:"subscribed_since"`
	Subscribed          bool  `json:"subscribed"`
}

type FilterType

type FilterType struct {
	Int32Filters   map[string][]int32
	Int64Filters   map[string][]int64
	Float32Filters map[string][]float32
	BoolFilters    map[string][]bool
	StringFilters  map[string][]string
}

func (*FilterType) AddBool

func (f *FilterType) AddBool(key string, value bool)

func (*FilterType) AddBools

func (f *FilterType) AddBools(key string, values []bool)

func (*FilterType) AddFloat32

func (f *FilterType) AddFloat32(key string, value float32)

func (*FilterType) AddFloat32s

func (f *FilterType) AddFloat32s(key string, values []float32)

func (*FilterType) AddInt32

func (f *FilterType) AddInt32(key string, value int32)

func (*FilterType) AddInt32s

func (f *FilterType) AddInt32s(key string, values []int32)

func (*FilterType) AddInt64

func (f *FilterType) AddInt64(key string, value int64)

func (*FilterType) AddInt64s

func (f *FilterType) AddInt64s(key string, values []int64)

func (*FilterType) AddString

func (f *FilterType) AddString(key, value string)

func (*FilterType) AddStrings

func (f *FilterType) AddStrings(key string, values []string)

func (*FilterType) Bool

func (f *FilterType) Bool(key string) (bool, bool)

func (*FilterType) Bools

func (f *FilterType) Bools(key string) ([]bool, bool)

func (*FilterType) Float32

func (f *FilterType) Float32(key string) (float32, bool)

func (*FilterType) Float32s

func (f *FilterType) Float32s(key string) ([]float32, bool)

func (*FilterType) Int32

func (f *FilterType) Int32(key string) (int32, bool)

func (*FilterType) Int32s

func (f *FilterType) Int32s(key string) ([]int32, bool)

func (*FilterType) Int64

func (f *FilterType) Int64(key string) (int64, bool)

func (*FilterType) Int64s

func (f *FilterType) Int64s(key string) ([]int64, bool)

func (*FilterType) String

func (f *FilterType) String(key string) (string, bool)

func (*FilterType) Strings

func (f *FilterType) Strings(key string) ([]string, bool)

type GroupStats

type GroupStats struct {
	UserContext     UserContext `json:"-"`
	OrgID           int         `json:"org_id"`
	GroupID         int         `json:"group_id"`
	ActiveAddresses int32       `json:"active_addresses"`
	BatchSize       int32       `json:"batch_size"`
	LastUpdated     int64       `json:"last_updated"` // only comes back from DB
	BatchStart      int64       `json:"batch_start"`
	BatchEnd        int64       `json:"batch_end"`
}

GroupStats holds basic information on active groups running

func NewGroupStats

func NewGroupStats(userContext UserContext, orgID, groupID int) *GroupStats

NewGroupStats initializes with org/group ids

func (*GroupStats) GetActive

func (g *GroupStats) GetActive() int32

GetActive count of addresses

func (*GroupStats) IncActive

func (g *GroupStats) IncActive(count int32)

IncActive addresses by count ( can be negative to decrease)

func (*GroupStats) SetBatchSize

func (g *GroupStats) SetBatchSize(count int32)

SetBatchSize of how many addresses we analyzed this batch

func (*GroupStats) SetEndTime

func (g *GroupStats) SetEndTime()

SetEndTime for this batch

type GroupStatus

type GroupStatus int
var (
	GroupStarted GroupStatus = 1
	GroupStopped GroupStatus = 2
)

type HTTPResponse

type HTTPResponse struct {
	ResponseID          int64             `json:"response_id,omitempty"`
	OrgID               int               `json:"organization_id,omitempty"`
	GroupID             int               `json:"group_id,omitempty"`
	Scheme              string            `json:"scheme"`
	AddressHash         string            `json:"address_hash"`
	HostAddress         string            `json:"host_address"`
	IPAddress           string            `json:"ip_address"`
	ResponsePort        string            `json:"response_port"`
	RequestedPort       string            `json:"requested_port"`
	RequestID           string            `json:"request_id,omitempty"` // only used internally by browser package
	Status              int               `json:"status"`
	StatusText          string            `json:"status_text"`
	URL                 string            `json:"url"`
	Headers             map[string]string `json:"headers"`
	MimeType            string            `json:"mime_type"`
	RawBody             string            `json:"raw_body,omitempty"` // only used internally by browser package
	RawBodyLink         string            `json:"raw_body_link"`
	RawBodyHash         string            `json:"raw_body_hash"`
	ResponseTimestamp   int64             `json:"response_timestamp"`
	URLRequestTimestamp int64             `json:"url_request_timestamp"`
	IsDocument          bool              `json:"is_document"`
	WebCertificate      *WebCertificate   `json:"web_certificate,omitempty"`
	IsDeleted           bool              `json:"deleted"`
	LoadHostAddress     string            `json:"load_host_address"`
	LoadIPAddress       string            `json:"load_ip_address"`
}

HTTPResponse represents a captured network response

type KeywordModuleConfig

type KeywordModuleConfig struct {
	Keywords []string `json:"keywords" redis:"-"`
}

type Module

type Module interface {
	Name() string
	Config() map[string]interface{}
}

Module represents a module of work such as brute force, web scrape etc.

type ModuleConfiguration

type ModuleConfiguration struct {
	NSModule      *NSModuleConfig       `json:"ns_module"`
	BruteModule   *BruteModuleConfig    `json:"dnsbrute_module"`
	PortModule    *PortScanModuleConfig `json:"port_module"`
	WebModule     *WebModuleConfig      `json:"web_module"`
	KeywordModule *KeywordModuleConfig  `json:"keyword_module"`
}

ModuleConfiguration contains all the module configurations

type ModuleService

type ModuleService interface {
	Analyze(ctx context.Context, userContext UserContext, address *ScanGroupAddress) (*ScanGroupAddress, map[string]*ScanGroupAddress, error)
}

ModuleService is the default interface for analyzing an address and spitting out potentially more addresses

type ModuleStats

type ModuleStats struct {
	Running   int64
	WorkCount int64
	Remaining int64
}

ModuleStats contains a

type ModuleType

type ModuleType int

type NSModuleConfig

type NSModuleConfig struct {
	RequestsPerSecond int32 `json:"requests_per_second"`
}

NSModuleConfig for NS module

type OrgFilter

type OrgFilter struct {
	Start   int         `json:"start"`
	Limit   int         `json:"limit"`
	Filters *FilterType `json:"filters"`
}

OrgFilter for filtering organization list results

type Organization

type Organization struct {
	OrgID                      int    `json:"org_id"`
	OrgCID                     string `json:"org_customer_id"`
	OrgName                    string `json:"org_name"`
	OwnerEmail                 string `json:"owner_email"`
	UserPoolID                 string `json:"user_pool_id"`
	UserPoolAppClientID        string `json:"user_pool_app_client_id"`
	UserPoolAppClientSecret    string `json:"user_pool_app_client_secret"`
	IdentityPoolID             string `json:"identity_pool_id"`
	UserPoolJWK                string `json:"user_pool_jwk"`
	FirstName                  string `json:"first_name"`
	LastName                   string `json:"last_name"`
	Phone                      string `json:"phone"`
	Country                    string `json:"country"`
	StatePrefecture            string `json:"state_prefecture"`
	Street                     string `json:"street"`
	Address1                   string `json:"address1"`
	Address2                   string `json:"address2"`
	City                       string `json:"city"`
	PostalCode                 string `json:"postal_code"`
	CreationTime               int64  `json:"creation_time"`
	StatusID                   int    `json:"status_id"`
	Deleted                    bool   `json:"deleted"`
	SubscriptionID             int32  `json:"subscription_id"`
	LimitTLD                   int32  `json:"limit_tld"`
	LimitTLDReached            bool   `json:"limit_tld_reached"`
	LimitHosts                 int32  `json:"limit_hosts"`
	LimitHostsReached          bool   `json:"limit_hosts_reached"`
	LimitCustomWebFlows        int32  `json:"limit_custom_web_flows"`
	LimitCustomWebFlowsReached bool   `json:"limit_custom_web_flows_reached"`
	PortScanEnabled            bool   `json:"port_scan_enabled"`
}

Organization represents an organization that has subscribed to our service

type OrganizationService

type OrganizationService interface {
	Init(config []byte) error
	Get(ctx context.Context, userContext UserContext, orgName string) (oid int, org *Organization, err error)
	GetByCID(ctx context.Context, userContext UserContext, orgCID string) (oid int, org *Organization, err error)
	GetByID(ctx context.Context, userContext UserContext, orgID int) (oid int, org *Organization, err error)
	GetByAppClientID(ctx context.Context, userContext UserContext, orgAppClientID string) (oid int, org *Organization, err error)
	List(ctx context.Context, userContext UserContext, filter *OrgFilter) (orgs []*Organization, err error)
	Create(ctx context.Context, userContext UserContext, org *Organization, userCID string) (oid int, uid int, ocid string, ucid string, err error)
	Update(ctx context.Context, userContext UserContext, org *Organization) (oid int, err error)
	Delete(ctx context.Context, userContext UserContext, orgID int) (oid int, err error)
}

OrganizationService manages access to organizations

type Policy

type Policy struct {
	Subjects  []string
	Actions   []string
	Resources []string
}

Policy to be applied to a role via policy service/role service

type PolicyService

type PolicyService interface {
	AddPolicy(ctx context.Context, orgID, requesterUserID int, policy Policy) error    // creates a new policy
	UpdatePolicy(ctx context.Context, orgID, requesterUserID int, policy Policy) error // updates a policy
	NewOrgPolicies(ctx context.Context, orgID int) error                               // creates the initial set of policies for different groups
}

PolicyService is for managing policies that can be applied to roles

type PortData

type PortData struct {
	IPAddress  string   `json:"ip_address"`
	TCPPorts   []int32  `json:"tcp_ports"`
	UDPPorts   []int32  `json:"udp_ports"`
	TCPBanners []string `json:"tcp_banners,omitempty"`
	UDPBanners []string `json:"udp_banners,omitempty"`
}

type PortModuleService

type PortModuleService interface {
	AnalyzeWithPorts(ctx context.Context, userContext UserContext, address *ScanGroupAddress, ports *PortResults) (*ScanGroupAddress, map[string]*ScanGroupAddress, *Bag, error)
}

PortModuleService is for modules which react/analyze open ports

type PortResults

type PortResults struct {
	PortID                   int64  `json:"port_id,omitempty"`
	OrgID                    int    `json:"org_id,omitempty"`
	GroupID                  int    `json:"group_id,omitempty"`
	HostAddress              string `json:"host_address,omitempty"` // could be IP address if hostname is empty from ScanGroupAddress
	Ports                    *Ports `json:"port_data,omitempty"`
	ScannedTimestamp         int64  `json:"scanned_timestamp,omitempty"`
	PreviousScannedTimestamp int64  `json:"previous_scanned_timestamp,omitempty"`
}

type PortScanModuleConfig

type PortScanModuleConfig struct {
	RequestsPerSecond int32    `json:"requests_per_second"`
	PortScanEnabled   bool     `json:"port_scan_enabled"`
	CustomWebPorts    []int32  `json:"custom_web_ports" redis:"-"`
	TCPPorts          []int32  `json:"tcp_ports" redis:"-"`
	UDPPorts          []int32  `json:"udp_ports" redis:"-"`
	AllowedTLDs       []string `json:"allowed_tlds" redis:"-"`
	AllowedHosts      []string `json:"allowed_hosts" redis:"-"`
	DisallowedTLDs    []string `json:"disallowed_tlds" redis:"-"`
	DisallowedHosts   []string `json:"disallowed_hosts" redis:"-"`
}

PortModuleConfig for simple port scanning module

func (*PortScanModuleConfig) CanPortScan

func (c *PortScanModuleConfig) CanPortScan(etld, host string) bool

CanPortScan takes the etld and host and determines if this host is allowed to be port scanned first check that it's enabled then check that the host is not in the disallowed list (return false if it is) then check that the host is in our allowed hosts (overrides TLD check) return true if it is then check taht the host is in our disallowed TLDs (return false if it is) finally check that the host is in our allowed TLDs (return true if it is) other wise return false

func (*PortScanModuleConfig) CanPortScanIP

func (c *PortScanModuleConfig) CanPortScanIP(ip string) bool

CanPortScanIP is similar to above, but for IP addresses (no ETLD checks) also we fail 'open' assuming if it's not in disallowed *or* allowed, then we are allowed to scan it.

type PortScannerService

type PortScannerService interface {
	AddGroup(ctx context.Context, userContext UserContext, group *ScanGroup) error
	RemoveGroup(ctx context.Context, userContext UserContext, orgID, groupID int) error
	Analyze(ctx context.Context, userContext UserContext, address *ScanGroupAddress) (*ScanGroupAddress, *PortResults, error)
}

type Ports

type Ports struct {
	Current  *PortData `json:"current"`
	Previous *PortData `json:"previous,omitempty"`
}

func (*Ports) TCPChanges

func (p *Ports) TCPChanges() (open []int32, closed []int32, change bool)

TCPChanges reports changes between current and previous

type Role

type Role struct {
	OrgID    int    `json:"org_id"`    // Organization ID
	RoleName string `json:"role_name"` // Friendly name of the role
	ID       string `json:"role_id"`   // ID is the role's unique id.
	Members  []int  `json:"member_id"` // Members who belong to the role.
}

Role represents roles to have policies applied to them

type ScanGroup

type ScanGroup struct {
	OrgID                int                  `json:"org_id"`
	GroupID              int                  `json:"group_id"`
	GroupName            string               `json:"group_name"`
	CreationTime         int64                `json:"creation_time"`
	CreatedBy            string               `json:"created_by"`
	CreatedByID          int                  `json:"created_by_id"`
	ModifiedBy           string               `json:"modified_by"`
	ModifiedByID         int                  `json:"modified_by_id"`
	ModifiedTime         int64                `json:"modified_time"`
	OriginalInputS3URL   string               `json:"original_input_s3_url"`
	ModuleConfigurations *ModuleConfiguration `json:"module_configurations" redis:"-"`
	Paused               bool                 `json:"paused"`
	Deleted              bool                 `json:"deleted"`
	LastPausedTime       int64                `json:"last_paused_timestamp"`
	ArchiveAfterDays     int32                `json:"archive_after_days"`
}

ScanGroup is a grouping configuration that has owner related information

func (*ScanGroup) PortScanEnabled

func (s *ScanGroup) PortScanEnabled() bool

type ScanGroupAddress

type ScanGroupAddress struct {
	AddressID           int64   `json:"address_id"`
	OrgID               int     `json:"org_id"`
	GroupID             int     `json:"group_id"`
	HostAddress         string  `json:"host_address"`
	IPAddress           string  `json:"ip_address"`
	DiscoveryTime       int64   `json:"discovery_time"`
	DiscoveredBy        string  `json:"discovered_by"`
	LastScannedTime     int64   `json:"last_scanned_time"`
	LastSeenTime        int64   `json:"last_seen_time"`
	ConfidenceScore     float32 `json:"confidence_score"`
	UserConfidenceScore float32 `json:"user_confidence_score"`
	IsSOA               bool    `json:"is_soa"`
	IsWildcardZone      bool    `json:"is_wildcard_zone"`
	IsHostedService     bool    `json:"is_hosted_service"`
	Ignored             bool    `json:"ignored"`
	FoundFrom           string  `json:"found_from"` // address hash it was discovered from
	NSRecord            int32   `json:"ns_record"`
	AddressHash         string  `json:"address_hash"`
	Deleted             bool    `json:"deleted"`
}

ScanGroupAddress contains details on addresses belonging to the scan group for scanning.

type ScanGroupAddressFilter

type ScanGroupAddressFilter struct {
	OrgID   int         `json:"org_id"`
	GroupID int         `json:"group_id"`
	Start   int64       `json:"start"`
	Limit   int         `json:"limit"`
	Filters *FilterType `json:"filters"`
}

ScanGroupAddressFilter filters the results of an Addresses search

type ScanGroupAddressStats

type ScanGroupAddressStats struct {
	OrgID             int                             `json:"org_id"`
	GroupID           int                             `json:"group_id"`
	DiscoveredBy      []string                        `json:"discovered_by"`
	DiscoveredByCount []int32                         `json:"discovered_by_count"`
	Aggregates        map[string]*ScanGroupAggregates `json:"aggregates"`
	Total             int32                           `json:"total"`
	ConfidentTotal    int32                           `json:"confident_total"`
}

ScanGroupAddressStats general statistics for scan group addresses

type ScanGroupAggregates

type ScanGroupAggregates struct {
	Time  []int64 `json:"time"`
	Count []int32 `json:"count"`
}

type ScanGroupEvent

type ScanGroupEvent struct {
	EventID          int64  `json:"event_id"`
	OrgID            int    `json:"org_id"`
	GroupID          int64  `json:"group_id"`
	EventUserID      int    `json:"event_user_id"`
	EventTime        int64  `json:"event_time"`
	EventDescription string `json:"event_description"`
	EventFrom        string `json:"event_from"`
}

type ScanGroupFilter

type ScanGroupFilter struct {
	Filters *FilterType `json:"filters"`
}

ScanGroupFilter for returning only select values from the AllGroups service method

type ScanGroupHostList

type ScanGroupHostList struct {
	OrgID       int          `json:"org_id"`
	GroupID     int          `json:"group_id"`
	ETLD        string       `json:"etld"`
	HostAddress string       `json:"host_address"` // or ip address if no hostname
	AddressIDs  []int64      `json:"address_ids"`
	IPAddresses []string     `json:"ip_addresses"`
	Ports       *PortResults `json:"ports,omitempty"`
}

type ScanGroupService

type ScanGroupService interface {
	Init(config []byte) error
	Get(ctx context.Context, userContext UserContext, groupID int) (oid int, group *ScanGroup, err error)
	GetByName(ctx context.Context, userContext UserContext, groupName string) (oid int, group *ScanGroup, err error)
	AllGroups(ctx context.Context, userContext UserContext, filter *ScanGroupFilter) (groups []*ScanGroup, err error)
	Groups(ctx context.Context, userContext UserContext) (oid int, groups []*ScanGroup, err error)
	Create(ctx context.Context, userContext UserContext, newGroup *ScanGroup) (oid int, gid int, err error)
	Update(ctx context.Context, userContext UserContext, group *ScanGroup) (oid int, gid int, err error)
	Delete(ctx context.Context, userContext UserContext, groupID int) (oid int, gid int, err error)
	Pause(ctx context.Context, userContext UserContext, groupID int) (oid int, gid int, err error)
	Resume(ctx context.Context, userContext UserContext, groupID int) (oid int, gid int, err error)
	GroupStats(ctx context.Context, userContext UserContext) (oid int, stats map[int]*GroupStats, err error)
	UpdateStats(ctx context.Context, userContext UserContext, stats *GroupStats) (oid int, err error)
}

ScanGroupService manages input lists and configurations for an organization and group. OrgIDs should always be returned for ensuring data integrity for requesters

type ScanGroupWebDataStats

type ScanGroupWebDataStats struct {
	OrgID               int      `json:"org_id"`
	GroupID             int      `json:"group_id"`
	ExpiringCerts15Days int32    `json:"expiring_certs_15"`
	ExpiringCerts30Days int32    `json:"expiring_certs_30"`
	UniqueWebServers    int32    `json:"unique_web_servers"`
	ServerTypes         []string `json:"server_types"`
	ServerCounts        []int32  `json:"server_counts"`
}

ScanGroupWebDataStats returns general statistics for web related asset data

type ScanGroupsStats

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

ScanGroupsStats stats of scan groups

func NewScanGroupsStats

func NewScanGroupsStats() *ScanGroupsStats

NewScanGroupsStats for holding statistics of our active scan groups

func (*ScanGroupsStats) AddGroup

func (s *ScanGroupsStats) AddGroup(userContext UserContext, orgID, groupID int)

AddGroup of addresses to have statistics collected for

func (*ScanGroupsStats) DeleteGroup

func (s *ScanGroupsStats) DeleteGroup(groupID int)

DeleteGroup from the stats container

func (*ScanGroupsStats) GetActive

func (s *ScanGroupsStats) GetActive(groupID int) int32

GetActive addresses being analyzed for this group

func (*ScanGroupsStats) GetGroup

func (s *ScanGroupsStats) GetGroup(groupID int) *GroupStats

GetGroup returns a copy of the group

func (*ScanGroupsStats) Groups

func (s *ScanGroupsStats) Groups() []*GroupStats

Groups returns a list of all groups

func (*ScanGroupsStats) IncActive

func (s *ScanGroupsStats) IncActive(groupID int, count int32)

IncActive of how many addresses are being analyzed

func (*ScanGroupsStats) SetBatchSize

func (s *ScanGroupsStats) SetBatchSize(groupID int, count int32)

SetBatchSize of how many addresses will be analyzed for this group

func (*ScanGroupsStats) SetComplete

func (s *ScanGroupsStats) SetComplete(groupID int)

type SonarData

type SonarData struct {
}

type URLData

type URLData struct {
	ResponseID  int64  `json:"response_id"`
	URL         string `json:"url"`
	RawBodyLink string `json:"raw_body_link"`
	MimeType    string `json:"mime_type"`
}

type URLListResponse

type URLListResponse struct {
	OrgID               int        `json:"organization_id,omitempty"`
	GroupID             int        `json:"group_id,omitempty"`
	URLRequestTimestamp int64      `json:"url_request_timestamp"`
	HostAddress         string     `json:"host_address,omitempty"` // used for returning data to user
	IPAddress           string     `json:"ip_address,omitempty"`   // used for returning data to user
	URLs                []*URLData `json:"urls"`
}

URLListResponse is for holding a list of urls from an intial request

type User

type User struct {
	OrgID                      int    `json:"org_id"`
	OrgCID                     string `json:"org_customer_id"`
	UserCID                    string `json:"user_customer_id"`
	UserID                     int    `json:"user_id"`
	UserEmail                  string `json:"user_email"`
	FirstName                  string `json:"first_name"`
	LastName                   string `json:"last_name"`
	StatusID                   int    `json:"status_id"`
	CreationTime               int64  `json:"creation_time"`
	Deleted                    bool   `json:"deleted"`
	AgreementAccepted          bool   `json:"agreement_accepted"`
	AgreementAcceptedTimestamp int64  `json:"agreement_accepted_timestamp"`
	LastLoginTimestamp         int64  `json:"last_login_timestamp"`
}

User represents a user of an organization that has subscribed to our service

type UserContext

type UserContext interface {
	GetTraceID() string
	GetOrgID() int
	GetOrgCID() string
	GetUserID() int
	GetUserCID() string
	GetRoles() []string
	GetIPAddress() string
	GetSubscriptionID() int32
	GetOrgStatusID() int
}

UserContext interface for passing contextual data about a request for tracking & auth

type UserContextData

type UserContextData struct {
	TraceID        string   `json:"trace_id"`
	OrgID          int      `json:"org_id"`
	OrgCID         string   `json:"org_customer_id"`
	UserID         int      `json:"user_id"`
	UserCID        string   `json:"user_cid"`
	Roles          []string `json:"roles"`
	IPAddress      string   `json:"ip_address"`
	SubscriptionID int32    `json:"subscription_id"`
	OrgStatusID    int      `json:"org_status_id"`
}

UserContextData for contextual information about a user

func NewUserContext

func NewUserContext(orgID, userID int, orgCID, userCID, traceID, ipAddress string, roles []string, subscriptionID int32) *UserContextData

NewUserContext creates user contextual data

func (*UserContextData) GetIPAddress

func (u *UserContextData) GetIPAddress() string

GetIPAddress returns this context's user ip address

func (*UserContextData) GetOrgCID

func (u *UserContextData) GetOrgCID() string

GetOrgCID returns this context's org customer id (facing)

func (*UserContextData) GetOrgID

func (u *UserContextData) GetOrgID() int

GetOrgID returns this context's org id

func (*UserContextData) GetOrgStatusID

func (u *UserContextData) GetOrgStatusID() int

GetOrgStatusID returns this context's user organizational status (enabled/disabled)

func (*UserContextData) GetRoles

func (u *UserContextData) GetRoles() []string

GetRoles returns this context's roles

func (*UserContextData) GetSubscriptionID

func (u *UserContextData) GetSubscriptionID() int32

GetSubscriptionID returns this context's user subscription level

func (*UserContextData) GetTraceID

func (u *UserContextData) GetTraceID() string

GetTraceID returns the id used for tracking requests

func (*UserContextData) GetUserCID

func (u *UserContextData) GetUserCID() string

GetUserCID returns this context's user custom id

func (*UserContextData) GetUserID

func (u *UserContextData) GetUserID() int

GetUserID returns this context's user id

type UserEventSettings

type UserEventSettings struct {
	WeeklyReportSendDay int32                 `json:"weekly_report_day"`
	ShouldWeeklyEmail   bool                  `json:"should_weekly_email"`
	DailyReportSendHour int32                 `json:"daily_report_hour"`
	ShouldDailyEmail    bool                  `json:"should_daily_email"`
	UserTimezone        string                `json:"user_timezone"`
	Subscriptions       []*EventSubscriptions `json:"subscriptions"`
}

type UserFilter

type UserFilter struct {
	Start   int         `json:"start"`
	Limit   int         `json:"limit"`
	OrgID   int         `json:"org_id"`
	Filters *FilterType `json:"filters"`
}

UserFilter for limiting results from User List

type UserService

type UserService interface {
	Init(config []byte) error
	Get(ctx context.Context, userContext UserContext, userEmail string) (oid int, user *User, err error)
	GetWithOrgID(ctx context.Context, userContext UserContext, orgID int, userCID string) (oid int, user *User, err error)
	GetByID(ctx context.Context, userContext UserContext, userID int) (oid int, user *User, err error)
	GetByCID(ctx context.Context, userContext UserContext, userCID string) (oid int, user *User, err error)
	List(ctx context.Context, userContext UserContext, filter *UserFilter) (oid int, users []*User, err error)
	Create(ctx context.Context, userContext UserContext, user *User) (oid int, uid int, ucid string, err error)
	Update(ctx context.Context, userContext UserContext, user *User, userID int) (oid int, uid int, err error)
	Delete(ctx context.Context, userContext UserContext, userID int) (oid int, err error)
	AcceptAgreement(ctx context.Context, userContext UserContext, accepted bool) (oid int, uid int, err error)
}

UserService for managing access to users

type WebCertificate

type WebCertificate struct {
	OrgID                             int      `json:"organization_id,omitempty"`
	GroupID                           int      `json:"group_id,omitempty"`
	CertificateID                     int64    `json:"certificate_id,omitempty"` // from DB
	ResponseTimestamp                 int64    `json:"response_timestamp,omitempty"`
	HostAddress                       string   `json:"host_address"`
	IPAddress                         string   `json:"ip_address"`
	AddressHash                       string   `json:"address_hash"`
	Port                              string   `json:"port"`
	Protocol                          string   `json:"protocol"`                          // Protocol name (e.g. "TLS 1.2" or "QUIC").
	KeyExchange                       string   `json:"keyExchange"`                       // Key Exchange used by the connection, or the empty string if not applicable.
	KeyExchangeGroup                  string   `json:"keyExchangeGroup,omitempty"`        // (EC)DH group used by the connection, if applicable.
	Cipher                            string   `json:"cipher"`                            // Cipher name.
	Mac                               string   `json:"mac,omitempty"`                     // TLS MAC. Note that AEAD ciphers do not have separate MACs.
	CertificateValue                  int      `json:"certificateId"`                     // from browser                    // Certificate ID value.
	SubjectName                       string   `json:"subjectName"`                       // Certificate subject name.
	SanList                           []string `json:"sanList"`                           // Subject Alternative Name (SAN) DNS names and IP addresses.
	Issuer                            string   `json:"issuer"`                            // Name of the issuing CA.
	ValidFrom                         int64    `json:"validFrom"`                         // Certificate valid from date.
	ValidTo                           int64    `json:"validTo"`                           // Certificate valid to (expiration) date
	CertificateTransparencyCompliance string   `json:"certificateTransparencyCompliance"` // Whether the request complied with Certificate Transparency policy enum values: unknown, not-compliant, compliant
	IsDeleted                         bool     `json:"deleted"`
}

WebCertificate contains extracted certificate data from an HTTPResponse

type WebCertificateFilter

type WebCertificateFilter struct {
	OrgID   int         `json:"org_id"`
	GroupID int         `json:"group_id"`
	Start   int64       `json:"start"`
	Limit   int         `json:"limit"`
	Filters *FilterType `json:"filters"`
}

WebCertificateFilter used to filter results when searching web data.

type WebData

type WebData struct {
	Address             *ScanGroupAddress   `json:"address"`
	Responses           []*HTTPResponse     `json:"responses"`
	Snapshot            string              `json:"snapshot,omitempty"` // only used internally by browser package
	SnapshotLink        string              `json:"snapshot_link"`
	URL                 string              `json:"url"`
	Scheme              string              `json:"scheme"`
	AddressHash         string              `json:"address_hash"`
	HostAddress         string              `json:"host_address"`
	IPAddress           string              `json:"ip_address"`
	ResponsePort        int                 `json:"response_port"`
	RequestedPort       int                 `json:"requested_port"`
	SerializedDOM       string              `json:"serialized_dom,omitempty"` // only used internally by browser package
	SerializedDOMHash   string              `json:"serialized_dom_hash"`
	SerializedDOMLink   string              `json:"serialized_dom_link"`
	ResponseTimestamp   int64               `json:"response_timestamp"`
	URLRequestTimestamp int64               `json:"url_request_timestamp"`
	DetectedTech        map[string]*WebTech `json:"detected_tech"`
	LoadURL             string              `json:"load_url"`
}

WebData is the primary container of a scangroup address's http response data.

type WebDataService

type WebDataService interface {
	Init(config []byte) error
	Add(ctx context.Context, userContext UserContext, webData *WebData) (int, error)
	OrgStats(ctx context.Context, userContext UserContext) (oid int, orgStats []*ScanGroupWebDataStats, err error)
	GroupStats(ctx context.Context, userContext UserContext, groupID int) (oid int, groupStats *ScanGroupWebDataStats, err error)
	GetURLList(ctx context.Context, userContext UserContext, filter *WebResponseFilter) (int, []*URLListResponse, error)
	GetResponses(ctx context.Context, userContext UserContext, filter *WebResponseFilter) (int, []*HTTPResponse, error)
	GetCertificates(ctx context.Context, userContext UserContext, filter *WebCertificateFilter) (int, []*WebCertificate, error)
	GetSnapshots(ctx context.Context, userContext UserContext, filter *WebSnapshotFilter) (int, []*WebSnapshot, error)
	GetDomainDependency(ctx context.Context, userContext UserContext, filter *WebResponseFilter) (int, *WebDomainDependency, error)
	Archive(ctx context.Context, userContext UserContext, group *ScanGroup, archiveTime time.Time) (int, int, error)
}

WebDataService adds and returns all web responses

type WebDomainDependency

type WebDomainDependency struct {
	Status    string           `json:"status,omitempty"`
	OrgID     int              `json:"organization_id,omitempty"`
	GroupID   int              `json:"group_id,omitempty"`
	LastIndex int64            `json:"last_index"`
	Nodes     []*WebDomainNode `json:"nodes"`
	Links     []*WebDomainLink `json:"links"`
}
type WebDomainLink struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

type WebDomainNode

type WebDomainNode struct {
	ID     string `json:"id"`
	Origin int32  `json:"origin"`
}

type WebModuleConfig

type WebModuleConfig struct {
	TakeScreenShots       bool  `json:"take_screenshots"`
	RequestsPerSecond     int32 `json:"requests_per_second"`
	MaxLinks              int32 `json:"max_links"`
	ExtractJS             bool  `json:"extract_js"`
	FingerprintFrameworks bool  `json:"fingerprint_frameworks"`
}

WebModuleConfig for web related analysis module

type WebResponseFilter

type WebResponseFilter struct {
	OrgID   int         `json:"org_id"`
	GroupID int         `json:"group_id"`
	Filters *FilterType `json:"filters"`
	Start   int64       `json:"start"`
	Limit   int         `json:"limit"`
}

WebResponseFilter used to filter results when searching web data.

type WebSnapshot

type WebSnapshot struct {
	SnapshotID          int64    `json:"snapshot_id,omitempty"`
	OrgID               int      `json:"org_id,omitempty"`
	GroupID             int      `json:"group_id,omitempty"`
	SnapshotLink        string   `json:"snapshot_link"`
	SerializedDOMHash   string   `json:"serialized_dom_hash"`
	SerializedDOMLink   string   `json:"serialized_dom_link"`
	ResponseTimestamp   int64    `json:"response_timestamp"`
	IsDeleted           bool     `json:"deleted"`
	URL                 string   `json:"url"`
	AddressHash         string   `json:"address_hash"` // unfortunately we can't FK off address_id since we may get a new ip/host before it exists
	HostAddress         string   `json:"host_address"`
	IPAddress           string   `json:"ip_address"`
	ResponsePort        int      `json:"response_port"`
	RequestedPort       int      `json:"requested_port"`
	Scheme              string   `json:"scheme"`
	TechCategories      []string `json:"tech_categories"`
	TechNames           []string `json:"tech_names"`
	TechVersions        []string `json:"tech_versions"`
	TechMatchLocations  []string `json:"tech_match_locations"`
	TechMatchData       []string `json:"tech_match_data"`
	TechIcons           []string `json:"tech_icons"`
	TechWebsites        []string `json:"tech_websites"`
	LoadURL             string   `json:"load_url"`
	URLRequestTimestamp int64    `json:"request_timestamp"`
}

WebSnapshot for returning serialized dom and image snapshot links

type WebSnapshotFilter

type WebSnapshotFilter struct {
	OrgID   int         `json:"org_id"`
	GroupID int         `json:"group_id"`
	Start   int64       `json:"start"`
	Limit   int         `json:"limit"`
	Filters *FilterType `json:"filters"`
}

WebSnapshotFilter for filtering websnapshots

type WebTech

type WebTech struct {
	Matched  string `json:"matched"`
	Version  string `json:"version"`
	Location string `json:"location"`
}

type WebTechResults

type WebTechResults struct {
	WebTech
	CategoryName string `json:"category"`
	Icon         string `json:"icon"`
	Website      string `json:"website"`
}

type WebhookEvent

type WebhookEvent struct {
	WebhookEventID       int32 `json:"webhook_event_id"`
	OrgID                int32 `json:"org_id"`
	GroupID              int32 `json:"group_id"`
	NotificationID       int64 `json:"notification_id"`
	WebhookID            int32 `json:"webhook_id"`
	TypeID               int32 `json:"type_id"`
	LastAttemptTimestamp int64 `json:"last_attempt_timestamp"`
	LastAttemptStatus    int32 `json:"last_attempt_status"`
}

type WebhookEventSettings

type WebhookEventSettings struct {
	WebhookID     int32   `json:"webhook_id"`
	OrgID         int32   `json:"org_id"`
	GroupID       int32   `json:"group_id"`
	ScanGroupName string  `json:"scan_group_name,omitempty"`
	Name          string  `json:"name"`
	Events        []int32 `json:"events"`
	Enabled       bool    `json:"enabled"`
	Version       string  `json:"version"`
	URL           string  `json:"url"`
	Type          string  `json:"type"`
	CurrentKey    string  `json:"current_key"`
	PreviousKey   string  `json:"previous_key"`
	Deleted       bool    `json:"deleted"`
}

Jump to

Keyboard shortcuts

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