api

package
v0.0.0-...-db01016 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Filter_CPE = "plugin.attributes.cpe"

	CPE_AppleMacOS       = "cpe:/o:apple:macos"
	CPE_AppleMacOSX      = "cpe:/o:apple:mac_os_x"
	CPE_MicrosoftWindows = "cpe:/o:microsoft:windows"

	CPE_GoogleChrome   = "cpe:/a:google:chrome"
	CPE_MozillaFirefox = "cpe:/a:mozilla:firefox"
	CPE_MicrosoftIE    = "cpe:/a:microsoft:ie"
	CPE_MicrosoftEdge  = "cpe:/a:microsoft:edge"
	CPE_AppleSafari    = "cpe:/a:apple:safari"

	CPE_OracleJRE = "cpe:/a:oracle:jre"
	CPE_OracleJDK = "cpe:/a:oracle:jdk"

	CPE_AdobeFlashPlayer = "cpe:/a:adobe:flash_player"
	CPE_AdobeAcrobat     = "cpe:/a:adobe:acrobat"
)

Note: these seem to be CPE v2.2 naming format

View Source
const (
	FilterSearchTypeAnd FilterSearchType = "and"
	FilterSearchTypeOr  FilterSearchType = "or"

	FilterSortTypeAsc  FilterSortType = "asc"
	FilterSortTypeDesc FilterSortType = "desc"
)
View Source
const (
	BaseUrl string = "https://cloud.tenable.com/"
)

Variables

This section is empty.

Functions

func FiltersToValues

func FiltersToValues(filters []Filter) url.Values

Types

type Agent

type Agent struct {
	ID   int    `json:"id"`
	UUID string `json:"uuid"`

	LinkedOn     int    `json:"linked_on"`
	LastConnect  int    `json:"last_connect"`
	LastScanned  int    `json:"last_scanned"`
	PluginFeedID string `json:"plugin_feed_id"`

	CoreBuild   string `json:"core_build"`
	CoreVersion string `json:"core_version"`

	Name     string          `json:"name"`
	Distro   string          `json:"distro"`
	Platform string          `json:"platform"`
	IP       string          `json:"ip"`
	Status   string          `json:"status"`
	Groups   []AgentGroupRef `json:"groups"`
}

The details of an agent connected to a scanner. Ref: https://cloud.tenable.com/api#/resources/agents

type AgentGroup

type AgentGroup struct {
	ID   int    `json:"id"`
	UUID string `json:"uuid"`

	CreationDate         int `json:"creation_date"`
	LastModificationDate int `json:"last_modification_date"`

	Name string `json:"name"`

	OwnerID   int    `json:"owner_id"`
	OwnerUUID string `json:"owner_uuid"`
	Owner     string `json:"owner"`
	OwnerName string `json:"owner_name"`

	AgentsCount int     `json:"agents_count"`
	Agents      []Agent `json:"agents"`

	Pagination Pagination `json:"pagination"`

	Shared          int `json:"shared"`
	UserPermissions int `json:"user_permissions"`
}

AgentGroup contains the details of an agent group. Not all fields may be returned unless Agent Enhancements are enabled for your account. Ref: https://cloud.tenable.com/api#/resources/agent-groups

type AgentGroupName

type AgentGroupName struct {
	Name string `json:"name"`
}

type AgentGroupRef

type AgentGroupRef struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type AgentGroups

type AgentGroups struct {
	Groups []AgentGroup `json:"groups"`
}

AgentGroups Ref: https://cloud.tenable.com/api#/resources/agent-groups/list

type AgentGroupsAPI

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

func (*AgentGroupsAPI) AddAgent

func (c *AgentGroupsAPI) AddAgent(scannerID int, groupID int, agentID int) (bool, error)

AddAgent adds an agent to the given agent group.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/add-agent

func (*AgentGroupsAPI) Configure

func (c *AgentGroupsAPI) Configure(scannerID int, groupID int, groupName string) (bool, error)

Configure changes the name of the given agent group.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/configure

func (*AgentGroupsAPI) Create

func (c *AgentGroupsAPI) Create(scannerID int, groupName string) (*AgentGroup, error)

Create creates an agent group on the given scanner.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/create

func (*AgentGroupsAPI) Delete

func (c *AgentGroupsAPI) Delete(scannerID int, groupID int) (bool, error)

Delete deletes an agent group from the given scanner.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/delete

func (*AgentGroupsAPI) DeleteAgent

func (c *AgentGroupsAPI) DeleteAgent(scannerID int, groupID int, agentID int) (bool, error)

DeleteAgent deletes an agent from the given agent group.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/delete-agent

func (*AgentGroupsAPI) Details

func (c *AgentGroupsAPI) Details(scannerID int, groupID int, opts ...FilterConfigShort) (*AgentGroup, error)

Details returns details for the given agent group. Agent records which belong to this group will also be returned. You can apply filtering, sorting, or pagination to the agent records.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/details

func (*AgentGroupsAPI) List

func (c *AgentGroupsAPI) List(scannerID int) ([]AgentGroup, error)

List returns the agent groups for the given scanner.

Ref: https://cloud.tenable.com/api#/resources/agent-groups/list

type AgentsAPI

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

func (*AgentsAPI) Delete

func (c *AgentsAPI) Delete(scannerID int, agentID int) (bool, error)

Delete deletes an agent.

Ref: https://cloud.tenable.com/api#/resources/agents/delete

func (*AgentsAPI) Get

func (c *AgentsAPI) Get(scannerID int, agentID int) (*Agent, error)

Get returns the specified agent for the given scanner.

Ref: https://cloud.tenable.com/api#/resources/agents/get

func (*AgentsAPI) List

func (c *AgentsAPI) List(scannerID int, opts ...FilterConfigShort) (*AgentsList, error)

List returns the agent list for the given scanner.

Ref: https://cloud.tenable.com/api#/resources/agents/list

type AgentsList

type AgentsList struct {
	Agents     []Agent    `json:"agents"`
	Pagination Pagination `json:"pagination"`
}

type Asset

type Asset struct {
	ID              string   `json:"id""`
	HasAgent        bool     `json:"has_agent"`
	LastSeen        string   `json:"last_seen"`
	Sources         []Source `json:"sources"`
	AgentName       []string `json:"agent_name"`
	IPv4            []string `json:"ipv4"`
	IPv6            []string `json:"ipv6"`
	FQDN            []string `json:"fqdn"`
	NetbiosName     []string `json:"netbios_name"`
	OperatingSystem []string `json:"operating_system"`
	MacAddress      []string `json:"mac_address"`
}

Ref: https://cloud.tenable.com/api#/resources/workbenches/assets

type AssetVulnOutput

type AssetVulnOutput struct {
	PluginOutput string      `json:"plugin_output"`
	States       interface{} `json:"states"`
}

Ref: https://cloud.tenable.com/api#/resources/workbenches/asset-vulnerability-output TODO: Finish the AssetVulnOutput struct

type AssetVulnOutputs

type AssetVulnOutputs struct {
	Outputs []AssetVulnOutput `json:"outputs"`
}

Ref: https://cloud.tenable.com/api#/resources/workbenches/asset-vulnerability-output

type AssetVulnerabilities

type AssetVulnerabilities struct {
	Vulnerabilities []Vulnerability `json:"vulnerabilities"`
}

Ref: https://cloud.tenable.com/api#/resources/workbenches/asset-vulnerabilities

type Assets

type Assets struct {
	Assets []Asset `json:"assets"`
}

Ref: https://cloud.tenable.com/api#/resources/workbenches/assets

type Client

type Client struct {
	Agents      *AgentsAPI
	AgentGroups *AgentGroupsAPI
	Plugins     *PluginsAPI
	Workbenches *WorkbenchesAPI
	// contains filtered or unexported fields
}

func DefaultClient

func DefaultClient(accessKey string, secretKey string) *Client

func (*Client) WithDebug

func (c *Client) WithDebug() *Client

type CommonFilterHelpers

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

func (CommonFilterHelpers) WithDateRange

func (c CommonFilterHelpers) WithDateRange(numDaysIncluded int) CommonFilterHelpers

func (CommonFilterHelpers) WithFilters

func (c CommonFilterHelpers) WithFilters(filters ...Filter) CommonFilterHelpers

func (CommonFilterHelpers) WithSearchType

type Filter

type Filter struct {
	Filter  string `json:"filter"`
	Quality string `json:"quality"`
	Value   string `json:"value"`
}

type FilterConfigShort

type FilterConfigShort RequestModifier

func WithFilterType

func WithFilterType(ft FilterSearchType) FilterConfigShort

func WithFilters

func WithFilters(filters ...FilterShort) FilterConfigShort

func WithLimit

func WithLimit(limit int) FilterConfigShort

func WithOffset

func WithOffset(offset int) FilterConfigShort

func WithSort

func WithSort(sorts ...SortConfig) FilterConfigShort

func WithWildcardFields

func WithWildcardFields(fields ...string) FilterConfigShort

func WithWildcardFilter

func WithWildcardFilter(filterText string) FilterConfigShort

type FilterSearchType

type FilterSearchType string

type FilterShort

type FilterShort struct {
	Field     string
	Operation string
	Value     string
}

type FilterSortType

type FilterSortType string

type Pagination

type Pagination struct {
	Total  int    `json:"total"`
	Offset int    `json:"offset"`
	Limit  int    `json:"limit"`
	Sort   []Sort `json:"sort"`
}

Ref: https://cloud.tenable.com/api#/resources/filters

type Plugin

type Plugin struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Ref: https://cloud.tenable.com/api#/resources/plugins

type PluginAttributes

type PluginAttributes struct {
	Name  string `json:"attribute_name"`
	Value string `json:"attribute_value"`
}

Ref: https://cloud.tenable.com/api#/resources/plugins

type PluginDetails

type PluginDetails struct {
	ID         int                `json:"id"`
	Name       string             `json:"name"`
	FamilyName string             `json:"family_name"`
	Attributes []PluginAttributes `json:"attributes"`
}

Ref: https://cloud.tenable.com/api#/resources/plugins/plugin-details

type PluginFamilies

type PluginFamilies struct {
	Families []PluginFamily `json:"families"`
}

Ref: https://cloud.tenable.com/api#/resources/plugins

type PluginFamily

type PluginFamily struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Count int    `json:"count"`
}

Ref: https://cloud.tenable.com/api#/resources/plugins

type PluginFamilyDetails

type PluginFamilyDetails struct {
	ID      int      `json:"id"`
	Name    string   `json:"name"`
	Plugins []Plugin `json:"plugins"`
}

Ref: https://cloud.tenable.com/api#/resources/plugins/family-details

type PluginsAPI

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

func (*PluginsAPI) Families

func (c *PluginsAPI) Families() (*PluginFamilies, error)

Returns the list of plugin families.

Ref: https://cloud.tenable.com/api#/resources/plugins/families

func (*PluginsAPI) FamilyDetails

func (c *PluginsAPI) FamilyDetails(familyID int) (*PluginFamilyDetails, error)

Returns the list of plugins in a family.

Ref:https://cloud.tenable.com/api#/resources/plugins/family-details

func (*PluginsAPI) PluginDetails

func (c *PluginsAPI) PluginDetails(pluginID int) (*PluginDetails, error)

Returns details for a given plugin.

Ref: https://cloud.tenable.com/api#/resources/plugins/plugin-details

type RequestModifier

type RequestModifier func(*resty.Request) *resty.Request

type Sort

type Sort struct {
	Name  string `json:"name"`
	Order string `json:"order"`
}

Ref: https://cloud.tenable.com/api#/resources/filters

type SortConfig

type SortConfig struct {
	Field string
	Type  FilterSortType
}

type Source

type Source struct {
	Name      string `json:"name"`
	FirstSeen string `json:"first_seen"`
	LastSeen  string `json:"last_seen"`
}

source

Ref: https://cloud.tenable.com/api#/resources/workbenches

type Vulnerability

type Vulnerability struct {
	Count              int    `json:"count"`
	PluginFamily       string `json:"plugin_family"`
	PluginID           int    `json:"plugin_id"`
	PluginName         string `json:"plugin_name"`
	VulnerabilityState string `json:"vulnerability_state"`
	Severity           int    `json:"severity"`
}

vulnerability

Ref: https://cloud.tenable.com/api#/resources/workbenches

type VulnerabilityInfo

type VulnerabilityInfo struct {
	Description              string                         `json:"description"`
	Synopsis                 string                         `json:"synopsis"`
	Discovery                interface{}                    `json:"discovery"`
	PluginDetails            VulnerabilityInfoPluginDetails `json:"plugin_details"`
	ReferenceInformation     interface{}                    `json:"reference_information"`
	RiskInformation          interface{}                    `json:"risk_information"`
	SeeAlso                  []interface{}                  `json:"see_also"`
	Solution                 string                         `json:"solution"`
	VulnerabilityInformation VulnerabilityInformation       `json:"vulnerability_information"`
}

vulnerability_info

Ref: https://cloud.tenable.com/api#/resources/workbenches

TODO: Finish the VulnerabilityInfo struct

type VulnerabilityInfoPluginDetails

type VulnerabilityInfoPluginDetails struct {
	Name             string     `json:"name"`
	FamilyName       string     `json:"family"`
	Severity         int        `json:"severity"`
	Type             string     `json:"local"`
	PublicationDate  *time.Time `json:"publication_date"`
	ModificationDate *time.Time `json:"modification_date"`
	Version          string     `json:"version"`
}

type VulnerabilityInformation

type VulnerabilityInformation struct {
	CPE                  []string   `json:"cpe"`
	VulnPublicationDate  *time.Time `json:"vulnerability_publication_date"`
	PatchPublicationDate *time.Time `json:"patch_publication_date"`
	UnsupportedByVendor  bool       `json:"unsupported_by_vendor"`

	// TODO: Finish implementing this..
	ExploitAvailable   interface{} `json:"exploit_available"`
	ExploitabilityEase interface{} `json:"exploitability_ease"`
	ExploitedByMalware interface{} `json:"exploited_by_malware"`
	ExploitedByNessus  interface{} `json:"exploited_by_nessus"`
	ExploitFrameworks  interface{} `json:"exploit_frameworks"`
	AssetInventory     interface{} `json:"asset_inventory"`
	DefaultAccount     interface{} `json:"default_account"`
	InTheNews          interface{} `json:"in_the_news"`
	Malware            interface{} `json:"malware"`
}

vulnerability_info

Ref: https://cloud.tenable.com/api#/resources/workbenches

type VulnerabilityOutput

type VulnerabilityOutput struct {
	ApplicationProtocol string  `json:"application_protocol"`
	Assets              []Asset `json:"assets"`
	Port                int     `json:"port"`
	TransportProtocol   string  `json:"transport_protocol"`
}

vulnerability_output

Ref: https://cloud.tenable.com/api#/resources/workbenches

type WorkbenchesAPI

type WorkbenchesAPI struct {
	CommonFilterHelpers
	// contains filtered or unexported fields
}

func (*WorkbenchesAPI) ApplyCommonFilters

func (c *WorkbenchesAPI) ApplyCommonFilters(req *resty.Request)

func (*WorkbenchesAPI) AssetVulnInfo

func (c *WorkbenchesAPI) AssetVulnInfo(assetID string, pluginID int) (*AssetVulnInfo, error)

Get the details for a vulnerability recorded on a given asset.

Ref: https://cloud.tenable.com/api#/resources/workbenches/asset-vulnerability-info

func (*WorkbenchesAPI) AssetVulnOutput

func (c *WorkbenchesAPI) AssetVulnOutput(assetID string, pluginID int) (*AssetVulnOutputs, error)

Get the vulnerability outputs for a plugin recorded on a given asset.

Ref: https://cloud.tenable.com/api#/resources/workbenches/asset-vulnerability-output

func (*WorkbenchesAPI) AssetVulns

func (c *WorkbenchesAPI) AssetVulns(assetID string) (*AssetVulnerabilities, error)

A list of up to 5000 of the vulnerabilities recorded for a given asset. By default, this list is sorted by vulnerability count, descending.

Ref: https://cloud.tenable.com/api#/resources/workbenches/asset-vulnerabilities

func (*WorkbenchesAPI) Assets

func (c *WorkbenchesAPI) Assets() (*Assets, error)

A list of up to 5000 assets. The list can be modified using filters.

Ref: https://cloud.tenable.com/api#/resources/workbenches/assets

func (*WorkbenchesAPI) WithDateRange

func (c *WorkbenchesAPI) WithDateRange(numDaysIncluded int) *WorkbenchesAPI

func (*WorkbenchesAPI) WithFilters

func (c *WorkbenchesAPI) WithFilters(filters ...Filter) *WorkbenchesAPI

func (*WorkbenchesAPI) WithSearchType

func (c *WorkbenchesAPI) WithSearchType(st FilterSearchType) *WorkbenchesAPI

Jump to

Keyboard shortcuts

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