planisphere

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 19 Imported by: 1

Documentation

Overview

Package planisphere implents a client for interacting with the Planisphere API

Index

Constants

View Source
const ActionabilityHelp = `This should be one of: "any", "actionable", "unactionable"`

ActionabilityHelp describes the actionability bits

View Source
const ResponsibilityHelp = `This should be one of: "any", "os", "app"`

ResponsibilityHelp describes how to use responsibilities

View Source
const RiskHelp = `This should be one of: "any", "accepted", "unaccepted"`

RiskHelp describes the type of risk

Variables

This section is empty.

Functions

func ValidateSelfReportKey

func ValidateSelfReportKey(key string) error

ValidateSelfReportKey makes sure the key we are passing is an actual key

func VulnFilterActionability added in v0.8.8

func VulnFilterActionability(p VulnFilterParams, v Vulnerability) bool

VulnFilterActionability filters based off if if the vulnerability is actionable

func VulnFilterResponsibility added in v0.8.8

func VulnFilterResponsibility(p VulnFilterParams, v Vulnerability) bool

VulnFilterResponsibility filters on the responsible party

func VulnFilterRisk added in v0.8.8

func VulnFilterRisk(p VulnFilterParams, v Vulnerability) bool

VulnFilterRisk filters based off of risk

func VulnerabilityCriticalityNames added in v0.8.3

func VulnerabilityCriticalityNames() []string

VulnerabilityCriticalityNames Return a list of criticality names.

func WithAcceptedRisk added in v0.8.5

func WithAcceptedRisk(s Risk) func(*ReportParams)

WithAcceptedRisk is just accepted Risk stuff

func WithActiveSince added in v0.8.3

func WithActiveSince(i int) func(*ReportParams)

WithActiveSince sets the active_since parameter in the request

func WithBaseURL added in v0.8.0

func WithBaseURL(b string) func(*Client)

WithBaseURL sets the base url of the planisphere url

func WithCmd added in v0.8.8

func WithCmd(cmd cobra.Command) func(*ReportParams)

WithCmd uses options from a cobra.Command to set up the report

func WithEnvAuth added in v0.9.1

func WithEnvAuth() func(*Client)

WithEnvAuth sets the username and password using environment variables

func WithHTTPClient added in v0.8.0

func WithHTTPClient(hc *http.Client) func(*Client)

WithHTTPClient sets the http.Client for the planisphere client

func WithResponsibilityType added in v0.8.5

func WithResponsibilityType(t string) func(*ReportParams)

WithResponsibilityType filters by responsibility_type

func WithScopedSupportGroups added in v0.8.0

func WithScopedSupportGroups(sgs SupportGroupList) func(*Client)

WithScopedSupportGroups sets the scoped support groups

func WithSupportGroupScope added in v0.8.0

func WithSupportGroupScope(s SupportGroupScope) func(*Client)

WithSupportGroupScope sets the support group strategy for the client

func WithToken added in v0.8.0

func WithToken(t string) func(*Client)

WithToken sets the token for authentication

func WithUsername added in v0.8.0

func WithUsername(u string) func(*Client)

WithUsername sets the username for authentication

func WithVulnerabilityData added in v0.8.3

func WithVulnerabilityData() func(*ReportParams)

WithVulnerabilityData will include vulnerability data with all the hosts

Types

type Actionability added in v0.8.8

type Actionability int

Actionability is whether or not a vulnerability is actionable

const (
	AnyActionability Actionability = iota
	Actionable
	UnActionable
)

Actionable is only Actionable Actionablities

func GetActionabilities added in v0.8.8

func GetActionabilities() []Actionability

GetActionabilities returns all actionabilities

func (Actionability) ReqBool added in v0.8.8

func (a Actionability) ReqBool() *bool

ReqBool return the pointer to the bool that should be used in the request

type AllExemptions added in v0.9.1

type AllExemptions struct {
	StaticIPs       ExemptStaticIPs
	Subnets         ExemptSubnets
	WirelessSubnets ExemptWirelessSubnets
}

AllExemptions represents all of the different exemption type data

func (AllExemptions) All added in v0.9.1

func (e AllExemptions) All() []string

All returns a string array of all exempted items

type Client

type Client struct {

	// Token for requests
	Username string
	Token    string

	// Base URL for API requests.
	BaseURL *url.URL

	// User agent for client
	UserAgent string

	Department     DepartmentService
	SupportGroup   SupportGroupService
	Device         DeviceService
	Subnet         SubnetService
	Report         ReportService
	ScanExemptions ScanExemptionsService
	// contains filtered or unexported fields
}

Client is the beefy part of this SDK. It provides the methods used to interact with the API

func MustNew added in v0.9.1

func MustNew(options ...func(*Client)) *Client

MustNew returns a new client object, or panics

func New added in v0.8.0

func New(options ...func(*Client)) (*Client, error)

New uses functional arguments to generate a new client

func NewClient

func NewClient(username string, token string, httpClient *http.Client) *Client

NewClient generates a new Client object with the given username and password

func (*Client) AddScopedSupportGroup added in v0.8.0

func (c *Client) AddScopedSupportGroup(sg SupportGroup)

AddScopedSupportGroup will add a support group to the relevant list

func (*Client) NewReportParams added in v0.8.0

func (c *Client) NewReportParams(opts ...func(*ReportParams)) *ReportParams

NewReportParams returns a new DeviceParams object with some good defaults

type DataSource

type DataSource struct {
	Data struct {
		DeviceType   string  `json:"device_type,omitempty" yaml:"device_type,omitempty"`
		MacAddresses Strings `json:"mac_addresses,omitempty" yaml:"mac_addresses,omitempty"`
		Manufacturer string  `json:"manufacturer,omitempty" yaml:"manufacturer,omitempty"`
	} `json:"data,omitempty" yaml:"data,omitempty"`
	DataSourceID       float64        `json:"data_source_id,omitempty" yaml:"data_source_id,omitempty"`
	DataSourceName     string         `json:"data_source_name,omitempty" yaml:"data_source_name,omitempty"`
	DataSourcePriority float64        `json:"data_source_priority,omitempty" yaml:"data_source_priority,omitempty"`
	DataTimestamp      string         `json:"data_timestamp,omitempty" yaml:"data_timestamp,omitempty"`
	ExtraData          map[string]any `json:"extra_data,omitempty" yaml:"extra_data,omitempty" csv:"-"`
	Key                string         `json:"key,omitempty" yaml:"key,omitempty"`
	LastActive         string         `json:"last_active,omitempty" yaml:"last_active,omitempty"`
	LastUpdated        string         `json:"last_updated,omitempty" yaml:"last_updated,omitempty"`
	Legacy             bool           `json:"legacy" yaml:"legacy"`
	Name               string         `json:"name" yaml:"name"`
	Quarantined        bool           `json:"quarantined" yaml:"quarantined"`
	ReferencedObjectID float64        `json:"referenced_object_id,omitempty" yaml:"reference_object_id,omitempty"`
	SupportGroupLabel  interface{}    `json:"support_group_label,omitempty" yaml:"support_group_label,omitempty" csv:"-"`
	Type               string         `json:"type,omitempty" yaml:"type,omitempty"`
	URL                string         `json:"url,omitempty" yaml:"url,omitempty"`
}

DataSource represents a source of data for devices to feed from inside of Planisphere

type Department

type Department struct {
	Key  string `json:"key,omitempty"`
	Name string `json:"name,omitempty"`
}

Department represents a department with a key and a name

func (Department) MarshalCSV added in v0.8.1

func (d Department) MarshalCSV() ([]byte, error)

MarshalCSV handles marshaling for CSV encoding

type DepartmentList

type DepartmentList []Department

DepartmentList is a...list of Departments

type DepartmentService

type DepartmentService interface {
	List(context.Context) (*DepartmentList, *Response, error)
}

DepartmentService is an interface to the Department methods

type DepartmentServiceOp

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

DepartmentServiceOp is the operator for the DepartmentService

func (*DepartmentServiceOp) List

List returns a list of all departments

type Device

type Device struct {
	LastActive        *time.Time     `json:"last_active,omitempty" yaml:"last_active,omitempty" csv:"last_active,omitempty"`
	Names             DeviceNames    `json:"names,omitempty" yaml:"names,omitempty" csv:"last_active,omitempty"`
	PrimaryName       string         `json:"primary_name,omitempty" yaml:"primary_name,omitempty" csv:"last_active,omitempty"`
	Hostname          Strings        `json:"hostname" yaml:"hostname" csv:"hostname"`
	CustomFields      map[string]any `json:"custom_fields,omitempty" yaml:"custom_fields,omitempty" csv:"-"`
	CrowdstrikeStatus string         `json:"crowdstrike_status" yaml:"crowdstrike_status" csv:"crowdstrike_status"`
	DataSources       []DataSource   `json:"data_sources,omitempty" yaml:"data_sources,omitempty" csv:"-"`
	DepartmentKey     string         `json:"department_key,omitempty" yaml:"department_key,omitempty" csv:"department_key,omitempty"`
	DeviceType        string         `json:"device_type,omitempty" yaml:"device_type,omitempty" csv:"last_active,omitempty"`
	// DiskEncrypted []bool ... Not sure if we should include this...need to see how it looks in a bigger sample
	EndpointMgmtStatus string     `json:"endpoint_mgmt_status,omitempty" yaml:"endpoint_mgmt_status,omitempty" csv:"-"`
	HasUnsupportedOS   bool       `json:"has_unsupported_os" yaml:"has_unsupported_os" csv:"has_unsupported_os"`
	ID                 int64      `json:"id,omitempty" yaml:"id,omitempty" csv:"last_active,omitempty"`
	InEndpointMgmt     bool       `json:"in_endpoint_mgmt,omitempty" csv:"-"`
	LastInEndpointMgmt *time.Time `json:"last_in_endpoint_mgmt,omitempty" yaml:"last_in_endpoint_mgmt,omitempty" csv:",omitempty"`
	Legacy             bool       `json:"legacy" yaml:"legacy" csv:"legacy"`
	MacAddresses       []struct {
		Address    string     `json:"address,omitempty" yaml:"address,omitempty"`
		LastActive *time.Time `json:"last_active,omitempty" yaml:"last_active,omitempty"`
	} `json:"mac_addresses,omitempty" yaml:"mac_addresses,omitempty" csv:"-"`
	Manufacturer         string            `json:"manufacturer,omitempty" yaml:"manufacturer,omitempty" csv:"last_active,omitempty"`
	MemoryMb             float64           `json:"memory_mb,omitempty" yaml:"memory_mb,omitempty" csv:"last_active,omitempty"`
	Model                string            `json:"model,omitempty" yaml:"model,omitempty" csv:"last_active,omitempty"`
	Notes                string            `json:"notes,omitempty" yaml:"notes,omitempty" csv:"notes"`
	Oses                 []Os              `json:"oses,omitempty" yaml:"oses,omitempty" csv:"-"`
	OSFamily             Strings           `json:"os_family" yaml:"os_family" csv:"os_family"`
	OSName               Strings           `json:"os_name" yaml:"os_name" csv:"os_name"`
	OSFullName           Strings           `json:"os_fullname" yaml:"os_fullname" csv:"os_fullname"`
	OSStatus             string            `json:"os_status" yaml:"os_status" csv:"os_status"`
	OSUnsupportedDates   ShortTimestamps   `json:"os_unsupported_dates,omitempty" yaml:"os_unsupported_dates,omitempty" csv:"os_unsupported_dates,omitempty"`
	Owner                string            `json:"owner,omitempty" yaml:"owner,omitempty" csv:"owner,omitempty"`
	PurchaseDate         string            `json:"purchase_date,omitempty" yaml:"purchase_date,omitempty" csv:"purchase_date,omitempty"`
	QuarantineReasons    QuarantineReasons `json:"quarantine_reasons,omitempty" yaml:"quarantine_reasons,omitempty" csv:"-"`
	QuarantineRisks      QuarantineRisks   `json:"quarantine_risks,omitempty" yaml:"quarantine_risks,omitempty" csv:"quarantine_risks,omitempty"`
	Quarantined          bool              `json:"quarantined" yaml:"quarantined" csv:"quarantined"`
	RequiresEndpointMgmt bool              `json:"requires_endpoint_mgmt" yaml:"requires_endpoint_mgmt" csv:"requires_endpoint_management,omitempty"`
	Serial               string            `json:"serial,omitempty" yaml:"serial,omitempty" csv:"serial,omitempty"`
	SecurityScore        float64           `json:"security_score" yaml:"security_score" csv:"security_score,omitempty"`
	SSIDs                SSIDs             `json:"ssids,omitempty" yaml:"ssids,omitempty" csv:"-"`
	Status               string            `json:"status,omitempty" yaml:"status,omitempty" csv:"status,omitempty"`
	StaticIPs            StaticIPs         `json:"static_ips" yaml:"static_ips" csv:"static_ips"`
	Subnets              *DeviceSubnets    `json:"subnets,omitempty" yaml:"subnets,omitempty" csv:"-"`
	SupportGroup         SupportGroup      `json:"support_group,omitempty" yaml:"support_group,omitempty"`
	SupportGroupID       float64           `json:"support_group_id,omitempty" yaml:"support_group_id,omitempty" csv:"owner,omitempty"`
	SupportStaff         Strings           `json:"support_staff,omitempty" yaml:"support_staff,omitempty" csv:"-"`
	URL                  string            `json:"url,omitempty" yaml:"url,omitempty" csv:"owner,omitempty"`
	UsageType            string            `json:"usage_type,omitempty" yaml:"user_type,omitempty" csv:"-"`
	User                 User              `json:"user,omitempty" yaml:"user,omitempty" csv:"-"`
	UserID               int               `json:"user_id,omitempty" yaml:"user_id,omitempty" csv:"-"`
	Vrfs                 []struct {
		LastActive *time.Time `json:"last_active,omitempty" yaml:"last_active,omitempty"`
		Vrf        string     `json:"vrf,omitempty" yaml:"vrf,omitempty"`
	} `json:"vrfs,omitempty" yaml:"vrfs,omitempty" csv:"-"`
	// CollectedVulnerabilities is me hacking the Vulnerabilities endpoint and shoving it in to this field, pretending it's native
	// CollectedVulnerabilities  *VulnerabilityList   `json:"collected_vulnerabilities,omitempty" yaml:"collected_vulnerabilities,omitempty" csv:"-"`
	VulnerabilityDetections   *VulnerabilityList   `json:"vulnerability_detections,omitempty" yaml:"vulnerability_detections,omitempty" csv:"vulnerability_detections,omitempty"`
	Vulnerabilities           *VulnerabilityShorts `json:"vulnerabilities,omitempty" yaml:"vulnerabilities,omitempty" csv:"vulnerabilities,omitempty"`
	VulnerabilitiesActionable *VulnerabilityShorts `` /* 130-byte string literal not displayed */
	VulnerabilitiesIgnorable  *VulnerabilityShorts `` /* 139-byte string literal not displayed */
	WarrantyExpirationDate    *ShortTimestamp      `json:"warranty_expiration_date,omitempty" yaml:"warranty_expiration_date,omitempty" csv:"warranty_expiration_date,omitempty"`
}

Device represents all that Planisphere knows about a given device

func (Device) Summary added in v0.8.3

func (d Device) Summary() DeviceSummary

Summary returns a DeviceSummary from a given Device

type DeviceList

type DeviceList []Device

DeviceList is a type for multiple Devices

func (DeviceList) Len added in v0.8.0

func (l DeviceList) Len() int

Len needed to fulfill the sort.Interface

func (DeviceList) Less added in v0.8.0

func (l DeviceList) Less(i, j int) bool

Less needed to fulfill the sort.Interface

func (DeviceList) Swap added in v0.8.0

func (l DeviceList) Swap(i, j int)

Swap needed to fulfill the sort.Interface

type DeviceName added in v0.7.5

type DeviceName struct {
	Name       string     `json:"name,omitempty" yaml:"name,omitempty"`
	LastActive *time.Time `json:"last_active,omitempty" yaml:"last_active,omitempty"`
}

DeviceName represents a Unique name for a given devices

type DeviceNames added in v0.7.5

type DeviceNames []DeviceName

DeviceNames is a list of DeviceName items

func (DeviceNames) MarshalCSV added in v0.7.5

func (n DeviceNames) MarshalCSV() ([]byte, error)

MarshalCSV tells the csvutil how to marshal this

type DeviceParams

type DeviceParams struct {
	ActiveSince           string `url:"active_since,omitempty"`
	DepartmentDetails     bool   `url:"department_details,omitempty"`
	MacAddress            string `url:"mac_address,omitempty"`
	ShowAll               bool   `url:"show_all,omitempty"`
	ShowCustomFields      bool   `url:"show_custom_fields,omitempty"`
	ShowDataSourceRecords bool   `url:"show_data_source_records,omitempty"`
	ShowEndpointMgmtInfo  bool   `url:"show_endpoint_mgmt_info,omitempty"`
	ShowMacAddress        bool   `url:"show_mac_addresses,omitempty"`
	ShowNames             bool   `url:"show_names,omitempty"`
	ShowNulls             bool   `url:"show_nulls,omitempty"`
	ShowOses              bool   `url:"show_oses,omitempty"`
	ShowQuarantineReasons bool   `url:"show_quarantine_reason,omitempty"`
	ShowSSIDs             bool   `url:"show_ssids,omitempty"`
	ShowSubnets           bool   `url:"show_subnets,omitempty"`
	ShowSupportStaff      bool   `url:"show_support_staff,omitempty"`
	ShowVRFs              bool   `url:"show_vrfs,omitempty"`
	ShowVulnerabilities   bool   `url:"-"`
	// Actionable            *bool  `url:"-"`
	Actionability       Actionability `url:"-"`
	Risk                Risk          `url:"-"`
	ResponsibilityType  string        `url:"-"`
	SupportGroupDetails bool          `url:"support_group_details,omitempty"`
	SupportGroupKey     string        `url:"support_group_key,omitempty"`
	SupportGroupID      int           `url:"support_group_id,omitempty"`
	UserDetails         bool          `url:"user_details,omitempty"`
}

DeviceParams contains options for Device listings. Full information on these can be found at https://planisphere.oit.duke.edu/api_info

type DeviceService

type DeviceService interface {
	Get(context.Context, int, *DeviceParams) (*Device, *Response, error)
	VulnerabilityDetections(context.Context, int64, *DeviceParams) (*VulnerabilityList, *Response, error)
	// ActionableVulnerabilities(context.Context, int) (*VulnerabilityList, *Response, error)
	List(context.Context, *DeviceParams) (*DeviceList, *Response, error)
}

DeviceService is an interface to the Device methods

type DeviceServiceOp

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

DeviceServiceOp is the operator for the Service

func (*DeviceServiceOp) Get

func (svc *DeviceServiceOp) Get(ctx context.Context, id int, params *DeviceParams) (*Device, *Response, error)

Get returns information on a single device

func (*DeviceServiceOp) List

func (svc *DeviceServiceOp) List(ctx context.Context, params *DeviceParams) (*DeviceList, *Response, error)

List returns multiple devices based on the given parameters

func (*DeviceServiceOp) VulnerabilityDetections added in v0.8.5

func (svc *DeviceServiceOp) VulnerabilityDetections(ctx context.Context, id int64, params *DeviceParams) (*VulnerabilityList, *Response, error)

VulnerabilityDetections gets a listing of found vulnerabilities on a given device that are classified as actionable

type DeviceSubnet added in v0.8.3

type DeviceSubnet struct {
	GuestNetwork bool       `json:"guest_network,omitempty" yaml:"guest_network" csv:"guest_network"`
	LastActive   *time.Time `json:"last_active,omitempty" yaml:"last_active,omitempty" csv:"last_active,omitempty"`
	Name         string     `json:"name,omitempty" yaml:"name,omitempty" csv:"name"`
	Subnet       string     `json:"subnet,omitempty" yaml:"subnet,omitempty" csv:"subnet"`
}

DeviceSubnet is the Subnet object returned in a device

type DeviceSubnets added in v0.8.3

type DeviceSubnets []DeviceSubnet

DeviceSubnets is a list of DeviceSubnet items

type DeviceSummary added in v0.8.3

type DeviceSummary struct {
	Name string `csv:"name"`
	URL  string `csv:"url"`
}

DeviceSummary is a subset of Device data, useful for briefly describing a device in various places

func (DeviceSummary) MarshalCSV added in v0.8.3

func (d DeviceSummary) MarshalCSV() ([]byte, error)

MarshalCSV makes the csv output correct

type ExemptStaticIPs added in v0.9.0

type ExemptStaticIPs []string

ExemptStaticIPs defines a list of ip addresses exempt from security scans

type ExemptSubnets added in v0.9.0

type ExemptSubnets []string

ExemptSubnets defines a list of subnets that are exempt from security scans

type ExemptWirelessSubnets added in v0.9.0

type ExemptWirelessSubnets []string

ExemptWirelessSubnets defines a list of wireless subnets that are exempt from security scans

type ExternalOSIdentifiers

type ExternalOSIdentifiers map[string]string

ExternalOSIdentifiers is a simple map[string]string for shortcuts to OS IDs

func (*ExternalOSIdentifiers) UnmarshalJSON

func (c *ExternalOSIdentifiers) UnmarshalJSON(data []byte) error

UnmarshalJSON is the custom unmarshaller

type NetID added in v0.8.1

type NetID string

NetID represents a unique user

type NetIDs added in v0.8.1

type NetIDs []NetID

NetIDs represents multiple NetID items

func (NetIDs) Contains added in v0.8.2

func (ns NetIDs) Contains(u NetID) bool

Contains returns true if a NetID is the member of a NetIDs

func (NetIDs) MarshalCSV added in v0.8.1

func (ns NetIDs) MarshalCSV() ([]byte, error)

MarshalCSV handles marshaling for CSV encoding

type Os

type Os struct {
	DiskEncrypted   bool       `json:"disk_encrypted,omitempty" yaml:"disk_encrypted,omitempty"`
	Hostname        string     `json:"hostname,omitempty" yaml:"hostname,omitempty"`
	LastActive      *time.Time `json:"last_active,omitempty" yaml:"last_active,omitempty"`
	OsFamily        string     `json:"os_family,omitempty" yaml:"os_family,omitempty"`
	OsFullname      string     `json:"os_fullname,omitempty" yaml:"os_fullname,omitempty"`
	OsName          string     `json:"os_name,omitempty" yaml:"os_name,omitempty"`
	UnsupportedDate string     `json:"unsupported_date,omitempty" yaml:"unsupported_date,omitempty"`
}

Os is an Operating System

type QuarantineReason added in v0.7.5

type QuarantineReason struct {
	ID    float64 `json:"id,omitempty"`
	Notes string  `json:"notes,omitempty"`
	Type  string  `json:"type,omitempty"`
}

QuarantineReason represents a reason why a host is under Quarantine

type QuarantineReasons added in v0.7.5

type QuarantineReasons []QuarantineReason

QuarantineReasons is multiple QuarantineReason items

type QuarantineRisk added in v0.7.5

type QuarantineRisk struct {
	Description          string `json:"description,omitempty"`
	NotifyOnly           bool   `json:"notify_only,omitempty"`
	TargetQuarantineDate string `json:"target_quarantine_date,omitempty"`
	Type                 string `json:"type,omitempty"`
}

QuarantineRisk describes why a device is at risk for Quarantining

type QuarantineRisks added in v0.7.5

type QuarantineRisks []QuarantineRisk

QuarantineRisks is a list of QuarantineRisk items

func (QuarantineRisks) MarshalCSV added in v0.7.5

func (q QuarantineRisks) MarshalCSV() ([]byte, error)

MarshalCSV marshals this when called to a csv

type ReportParams

type ReportParams struct {
	ActiveSince             int                         `url:"active_since,omitempty"`
	DepartmentKeys          []string                    `url:"department_key[],omitempty"`
	Hostname                string                      `url:"hostname,omitempty"`
	Names                   string                      `url:"names,omitempty"`
	OsNames                 []string                    `url:"os_name[],omitempty"`
	SupportGroupIDs         []float64                   `url:"support_group_id[],omitempty"`
	QuarantineRisks         []string                    `url:"quarantine_risks[],omitempty"`
	VRFs                    []string                    `url:"vrfs[],omitempty"`
	User                    string                      `url:"user,omitempty"`
	VulnerabilitySeverities *VulnerabilityCriticalities `url:"vulnerability_severity[],omitempty"`
	IncludeVulnerablityData bool                        `url:"-"`
	Actionability           Actionability               `url:"-"`
	Risk                    Risk                        `url:"-"`
	ResponsibilityType      string                      `url:"-"`
	HostnameFilters         []string                    `url:"-"`
	VulnFilters             []string                    `url:"-"`
}

ReportParams is the possible parameters to be passed along when looking at a report

type ReportService

type ReportService interface {
	// Maybe this should be called 'Build', as we are building it out
	Generate(context.Context, *ReportParams) (*DeviceList, *Response, error)
	// This can be a URL copy/paste'd from the 'API Equivalent' link at the bottom of the planisphere devices listing
	Get(context.Context, string) (*DeviceList, *Response, error)
}

ReportService is the interface for methods interacting with the report endpoint

type ReportServiceOp

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

ReportServiceOp is the operator for said service

func (*ReportServiceOp) Generate added in v0.8.3

func (svc *ReportServiceOp) Generate(ctx context.Context, params *ReportParams) (*DeviceList, *Response, error)

Generate returns a DeviceList of items matching the given ReportParams

func (*ReportServiceOp) Get added in v0.7.1

func (svc *ReportServiceOp) Get(ctx context.Context, report string) (*DeviceList, *Response, error)

Get returns a report using the url query parameters to /report

type Response

type Response struct {
	Response *http.Response
}

Response is just a holder for some response data we may want to examine later on

type Responsibility added in v0.8.8

type Responsibility string

Responsibility is a type for who is responsible for a given vuln

var (
	// AnyResponsibility brings all responsibilities in
	AnyResponsibility Responsibility = "any"
	// OSResponsibility lies on the OS admins
	OSResponsibility Responsibility = "os"
	// AppResponsibility lies on the App admins
	AppResponsibility Responsibility = "app"
)

func (*Responsibility) String added in v0.8.8

func (r *Responsibility) String() string

String is used both by fmt.Print and by Cobra in help text

type Risk added in v0.8.8

type Risk int

Risk is a type for risk acceptance

const (
	// AnyRisk is either accepted or unaccepted
	AnyRisk Risk = iota
	// AcceptedRisk is accepted
	AcceptedRisk
	// UnAcceptedRisk is not accepted
	UnAcceptedRisk
)

func (Risk) ReqBool added in v0.8.8

func (r Risk) ReqBool() *bool

ReqBool return the pointer to the bool that should be used in the request

type SSID added in v0.7.5

type SSID struct {
	SSID       string     `json:"ssid,omitempty" yaml:"ssid,omitempty"`
	LastActive *time.Time `json:"last_active,omitempty" yaml:"last_active,omitempty"`
}

SSID is an...SSID, I dunno

type SSIDs added in v0.7.5

type SSIDs []SSID

SSIDs represents multiple SSID items

type ScanExemptionsService added in v0.9.0

type ScanExemptionsService interface {
	StaticIPs(context.Context) (*ExemptStaticIPs, *Response, error)
	Subnets(context.Context) (*ExemptSubnets, *Response, error)
	WirelessSubnets(context.Context) (*ExemptWirelessSubnets, *Response, error)
	All(context.Context) (*AllExemptions, *Response, error)
}

ScanExemptionsService is the interface that defines how the vulnerability_scan_exemptions calls behave

type ScanExemptionsServiceOp added in v0.9.0

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

ScanExemptionsServiceOp is the operator for the ScanExemptions interface

func (*ScanExemptionsServiceOp) All added in v0.9.1

All return all exemptions

func (*ScanExemptionsServiceOp) StaticIPs added in v0.9.0

StaticIPs returns the list of exempted static ips

func (*ScanExemptionsServiceOp) Subnets added in v0.9.0

Subnets returns the list of exempted subnets

func (*ScanExemptionsServiceOp) WirelessSubnets added in v0.9.0

WirelessSubnets returns a list of exempted wireless subnets

type SelfReportPayload

type SelfReportPayload struct {
	LastActive time.Time             `json:"last_active,omitempty"`
	Key        string                `json:"key,omitempty"`
	URL        string                `json:"url,omitempty"`
	Data       SelfReportPayloadData `json:"data,omitempty"`
	ExtraData  map[string]string     `json:"extra_data,omitempty"`
}

SelfReportPayload is the payload data plus some additional meta information

func (SelfReportPayload) Submit

func (p SelfReportPayload) Submit(key string) error

Submit pushes the report to the API endpoint

func (SelfReportPayload) SubmitTest

func (p SelfReportPayload) SubmitTest(key string) (*SelfReportTestPayload, error)

SubmitTest sends the payload to the test endpoint

func (SelfReportPayload) Summarize

func (p SelfReportPayload) Summarize() string

Summarize returns a string summary of the payload. This should be used where you want to print the info, but not necessarily the hundreds of lines of installed software

func (SelfReportPayload) Validate

func (p SelfReportPayload) Validate() error

Validate returns an error if the SelfReportPayload is invalid

type SelfReportPayloadData

type SelfReportPayloadData struct {
	OsFullname            string                `json:"os_fullname,omitempty"`
	OsFamily              string                `json:"os_family,omitempty"`
	Serial                string                `json:"serial,omitempty"`
	DepartmentKey         string                `json:"department_key,omitempty"`
	DeviceType            string                `json:"device_type,omitempty"`
	DiskEncrypted         bool                  `json:"disk_encrypted,omitempty"`
	Hostname              string                `json:"hostname,omitempty"`
	InstalledSoftware     [][]string            `json:"installed_software,omitempty"`
	MacAddresses          []string              `json:"mac_addresses,omitempty"`
	Manufacturer          string                `json:"manufacturer,omitempty"`
	MemoryMB              uint64                `json:"memory_mb,omitempty"`
	Model                 string                `json:"model,omitempty"`
	Status                string                `json:"status,omitempty"`
	SupportGroupID        uint64                `json:"support_group_id,omitempty"`
	SupportGroupName      string                `json:"support_group_name,omitempty"`
	UsageType             string                `json:"usage_type,omitempty"`
	Username              string                `json:"username,omitempty"`
	ExternalOSIdentifiers ExternalOSIdentifiers `json:"external_os_identifiers,omitempty"`
}

SelfReportPayloadData is the actual payload for the SelfReport endpoint

type SelfReportTestPayload

type SelfReportTestPayload struct {
	ProcessedRecord SelfReportPayload `json:"processed_record,omitempty"`
	Status          string            `json:"status,omitempty"`
}

SelfReportTestPayload is what we get back when using the test endpoint

type ShortTimestamp added in v0.8.4

type ShortTimestamp struct {
	time.Time
}

ShortTimestamp is just the date in yyyy-mm-dd format

func (*ShortTimestamp) UnmarshalJSON added in v0.8.4

func (t *ShortTimestamp) UnmarshalJSON(s []byte) error

UnmarshalJSON tells the json library how to handle this as a unix timestamp

type ShortTimestamps added in v0.8.4

type ShortTimestamps []ShortTimestamp

ShortTimestamps is a collection of ShortTimestamp objects

func (ShortTimestamps) MarshalCSV added in v0.8.4

func (n ShortTimestamps) MarshalCSV() ([]byte, error)

MarshalCSV tells the csvutil how to marshal this

type StaticIP added in v0.8.4

type StaticIP struct {
	LastActive *time.Time `json:"last_active" yaml:"last_active" csv:"last_active"`
	Canonical  string     `json:"canonical" yaml:"canonical" csv:"canonical"`
}

StaticIP is the static ip object for a given device

type StaticIPs added in v0.8.4

type StaticIPs []StaticIP

StaticIPs is a collections of StaticIP objects

func (StaticIPs) MarshalCSV added in v0.8.4

func (n StaticIPs) MarshalCSV() ([]byte, error)

MarshalCSV tells the csvutil how to marshal this

type Strings added in v0.8.4

type Strings []string

Strings is simple type for multiple strings

func (Strings) MarshalCSV added in v0.8.4

func (n Strings) MarshalCSV() ([]byte, error)

MarshalCSV tells the csvutil how to marshal this

type Subnet

type Subnet struct {
	Canonical                string        `json:"canonical,omitempty"`
	Department               *Department   `json:"department,omitempty"`
	ExcludedFromEndpointMgmt bool          `json:"excluded_from_endpoint_mgmt,omitempty"`
	GuestNetwork             bool          `json:"guest_network,omitempty"`
	Name                     string        `json:"name,omitempty"`
	SupportGroup             *SupportGroup `json:"support_group,omitempty"`
	VRFs                     *VRFList      `json:"vrfs,omitempty"`
}

Subnet is what Planisphere calls a Subnet

type SubnetList

type SubnetList []Subnet

SubnetList is a list of Subnets

type SubnetService

type SubnetService interface {
	List(context.Context) (*SubnetList, *Response, error)
}

SubnetService is the interface to subnet methods

type SubnetServiceOp

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

SubnetServiceOp is the operator for the SubnetService

func (*SubnetServiceOp) List

func (svc *SubnetServiceOp) List(ctx context.Context) (*SubnetList, *Response, error)

List lists out all subnets known to Planisphere

type SupportGroup

type SupportGroup struct {
	ID                    float64 `json:"id,omitempty" yaml:"id"`
	Key                   string  `json:"key,omitempty" yaml:"key,omitempty"`
	Name                  string  `json:"name,omitempty" yaml:"name,omitempty"`
	ServiceNowDisplayName string  `json:"service_now_display_name,omitempty" yaml:"service_now_display_name,omitempty"`
	ServiceNowSysID       string  `json:"service_now_sys_id,omitempty" yaml:"service_now_sys_id,omitempty"`
	UserNetids            *NetIDs `json:"user_netids,omitempty" yaml:"user_netids,omitempty"`
}

SupportGroup represents information about the group that supports a given device

func (SupportGroup) MarshalCSV added in v0.8.1

func (s SupportGroup) MarshalCSV() ([]byte, error)

MarshalCSV handles marshaling for CSV encoding

type SupportGroupList

type SupportGroupList []SupportGroup

SupportGroupList contains multiple SupportGroup items

func (SupportGroupList) IDs added in v0.8.0

func (s SupportGroupList) IDs() []float64

IDs returns only the ids of the support group list

type SupportGroupScope added in v0.8.0

type SupportGroupScope int

SupportGroupScope is a type describing how a client should select support groups for querying

const (
	// SGScopeMine tells the client to use the support groups the client user is in
	SGScopeMine SupportGroupScope = iota
	// SGScopeAll tells the client to look at all support groups
	SGScopeAll
	// SGScopeSelected tells the client to use the selected support groups
	SGScopeSelected
)

type SupportGroupService

type SupportGroupService interface {
	List(context.Context) (*SupportGroupList, *Response, error)
	Get(context.Context, string) (*SupportGroup, *Response, error)
	Mine(context.Context) (*SupportGroupList, *Response, error)
	KeysWithUser(context.Context, string) ([]string, *Response, error)
	IDsWithUser(context.Context, string) ([]float64, *Response, error)
}

SupportGroupService is the interface providing methods for the support_group endpoint

type SupportGroupServiceOp

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

SupportGroupServiceOp is the Operator for the SupportGroupService endpoint

func (*SupportGroupServiceOp) Get added in v0.8.0

Get retrieves support groups with a given 'key', 'name' or 'id' (In that order)

func (*SupportGroupServiceOp) IDsWithUser added in v0.6.2

func (svc *SupportGroupServiceOp) IDsWithUser(ctx context.Context, user string) ([]float64, *Response, error)

IDsWithUser returns the support group ids when given a user name

func (*SupportGroupServiceOp) KeysWithUser added in v0.6.2

func (svc *SupportGroupServiceOp) KeysWithUser(ctx context.Context, user string) ([]string, *Response, error)

KeysWithUser retrieves support group keys using a username

func (*SupportGroupServiceOp) List

List lists out all SupportGroups

func (*SupportGroupServiceOp) Mine added in v0.8.0

Mine retrieves support groups that the authenticated user is a member of

type User added in v0.7.5

type User struct {
	Affiliation   string `json:"affiliation,omitempty"`
	DepartmentKey string `json:"department_key,omitempty"`
	DisplayName   string `json:"display_name,omitempty"`
	ID            int    `json:"id,omitempty"`
	Netid         string `json:"netid,omitempty"`
}

User is a user my friend

type VRF added in v0.8.1

type VRF struct {
	Department               *Department   `json:"department,omitempty"`
	ExcludedFromCrowdstrike  bool          `json:"excluded_from_crowdstrike,omitempty"`
	ExcludedFromEndpointMgmt bool          `json:"excluded_from_endpoint_mgmt,omitempty"`
	GuestNetwork             bool          `json:"guest_network,omitempty"`
	Name                     string        `json:"name,omitempty"`
	SupportGroup             *SupportGroup `json:"support_group,omitempty"`
}

VRF is a vrf

func (VRF) MarshalCSV added in v0.8.1

func (v VRF) MarshalCSV() ([]byte, error)

MarshalCSV handles marshaling for CSV encoding

type VRFList added in v0.8.1

type VRFList []VRF

VRFList represents multiple VRFs

func (VRFList) MarshalCSV added in v0.8.1

func (v VRFList) MarshalCSV() ([]byte, error)

MarshalCSV handles marshaling for CSV encoding

type VulnFilter added in v0.8.8

type VulnFilter func(VulnFilterParams, Vulnerability) bool

VulnFilter filters vulnerabilities

type VulnFilterParams added in v0.8.8

type VulnFilterParams struct {
	Actionability  Actionability
	Responsibility Responsibility
	Risk           Risk
}

VulnFilterParams describes how to filter the vulns

type Vulnerability

type Vulnerability struct {
	Description        string         `json:"description,omitempty" yaml:"description,omitempty" csv:"description,omitempty"`
	Severity           string         `json:"severity,omitempty" yaml:"severity,omitempty" csv:"severity,omitempty"`
	Details            string         `json:"details,omitempty" yaml:"details,omitempty" csv:"details,omitempty"`
	Solution           string         `json:"solution,omitempty" yaml:"solution,omitempty" csv:"solution,omitempty"`
	FirstSeen          *time.Time     `json:"first_seen,omitempty" yaml:"first_seen,omitempty" csv:"first_seen,omitempty"`
	LastSeen           *time.Time     `json:"last_seen,omitempty" yaml:"last_seen,omitempty" csv:"last_seen,omitempty"`
	ExploitAvailable   bool           `json:"exploit_available,omitempty" yaml:"exploit_available" csv:"exploit_available"`
	Actionable         bool           `json:"actionable" yaml:"actionable" csv:"actionable"`
	AcceptedRisk       bool           `json:"accepted_risk" yaml:"accepted_risk" csv:"accepted_risk"`
	ResponsibilityType string         `json:"responsibility_type" yaml:"responsibility_type" csv:"responsibility_type"`
	IP                 string         `json:"ip,omitempty" yaml:"ip,omitempty" csv:"ip,omitempty"`
	Port               int            `json:"port,omitempty" yaml:"port,omitempty" csv:"port,omitempty"`
	Protocol           string         `json:"protocol,omitempty" yaml:"protocol,omitempty" csv:"protocol,omitempty"`
	ExtraData          map[string]any `json:"extra_data,omitempty" yaml:"extra_data,omitempty" csv:"-"`
}

Vulnerability is a single instance of a found Vulnerability on a device

type VulnerabilityCriticalities added in v0.7.0

type VulnerabilityCriticalities []VulnerabilityCriticality

VulnerabilityCriticalities is multiple VulnerabilityCriticality items

type VulnerabilityCriticality added in v0.8.3

type VulnerabilityCriticality int

VulnerabilityCriticality lists the most severe vulnerability criticality for a given host

const (
	// VulnUnset means we don't have any data on the Criticality yet
	VulnUnset VulnerabilityCriticality = 0
	// VulnCritical is the highest criticality
	VulnCritical VulnerabilityCriticality = 50
	// VulnHigh isn't as bad as critical, but still pretty bad
	VulnHigh VulnerabilityCriticality = 40
	// VulnMedium still matters a lil, but we don't consider it to be something worth ticketing in general
	VulnMedium VulnerabilityCriticality = 30
	// VulnNone means no vulnerabilities found
	VulnNone VulnerabilityCriticality = -1
)

func GetVulnerabilityCriticality added in v0.8.3

func GetVulnerabilityCriticality(name string) (VulnerabilityCriticality, error)

GetVulnerabilityCriticality returns the criticality value from the name

type VulnerabilityData added in v0.7.0

type VulnerabilityData struct {
	Description           string                      `json:"description,omitempty" yaml:"description,omitempty" csv:"description,omitempty"`
	ExploitAvailable      bool                        `json:"exploit_available,omitempty" yaml:"exploit_available" csv:"exploit_available"`
	FirstObserved         *VulnerabilityDataTimestamp `json:"first_observed,omitempty" yaml:"first_observed,omitempty" csv:"first_observed,omitempty"`
	PendingNextPatchset   bool                        `json:"pending_next_patchset" yaml:"pending_next_patchset" csv:"pending_next_patchset"`
	IP                    string                      `json:"ip,omitempty" yaml:"ip,omitempty" csv:"ip,omitempty"`
	Port                  string                      `json:"port,omitempty" yaml:"port,omitempty" csv:"port,omitempty"`
	Protocol              string                      `json:"protocol,omitempty" yaml:"protocol,omitempty" csv:"protocol,omitempty"`
	Solution              string                      `json:"solution,omitempty" yaml:"solution,omitempty" csv:"solution,omitempty"`
	VulnerabilityDetails  string                      `json:"vulnerability_details,omitempty" yaml:"vulnerability_details,omitempty" csv:"vulnerability_details,omitempty"`
	VulnerabilitySeverity string                      `json:"vulnerability_severity,omitempty" yaml:"vulnerability_severity,omitempty" csv:"vulnerability_severity,omitempty"`
}

VulnerabilityData is the juicy data from a given Vulnerability

type VulnerabilityDataTimestamp added in v0.8.3

type VulnerabilityDataTimestamp struct {
	time.Time
}

VulnerabilityDataTimestamp is just the date in unixtime, it'll need to be unmarshalled specially though

func (*VulnerabilityDataTimestamp) UnmarshalJSON added in v0.8.3

func (t *VulnerabilityDataTimestamp) UnmarshalJSON(s []byte) error

UnmarshalJSON tells the json library how to handle this as a unix timestamp

type VulnerabilityList

type VulnerabilityList []*Vulnerability

VulnerabilityList is multiple vulnerabilities

func ApplyAllVulnFilters added in v0.8.8

func ApplyAllVulnFilters(params VulnFilterParams, records VulnerabilityList) VulnerabilityList

ApplyAllVulnFilters is a helper wrapper to check all the filters

type VulnerabilityShort added in v0.8.4

type VulnerabilityShort struct {
	Description string `json:"description" yaml:"description" csv:"description"`
	Severity    string `json:"severity" yaml:"severity" csv:"severity"`
}

VulnerabilityShort is a short representation of a vulnerability that shows up in the Device report

type VulnerabilityShorts added in v0.8.4

type VulnerabilityShorts []VulnerabilityShort

VulnerabilityShorts is multiple VulnerabilityShort objects

func (VulnerabilityShorts) MarshalCSV added in v0.8.4

func (n VulnerabilityShorts) MarshalCSV() ([]byte, error)

MarshalCSV tells the csvutil how to marshal this

Jump to

Keyboard shortcuts

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