Documentation ¶
Index ¶
- type Asset
- type AuthProvider
- type BasicAuthProvider
- type Client
- type Finding
- type Host
- type Info
- type KeyAuthProvider
- type NessusClient
- func (c *NessusClient) CreateScan(scan *Scan) (*PersistedScan, error)
- func (c *NessusClient) CreateScanContext(ctx context.Context, scan *Scan) (*PersistedScan, error)
- func (c *NessusClient) DeleteScan(scanID int64) error
- func (c *NessusClient) DeleteScanContext(ctx context.Context, scanID int64) error
- func (c *NessusClient) GetAssetByName(ctx context.Context, name string) (*Asset, error)
- func (c *NessusClient) GetFindingsByAssetName(ctx context.Context, name string) ([]Finding, error)
- func (c *NessusClient) GetPluginByID(ID int64) (*Plugin, error)
- func (c *NessusClient) GetPluginByIDContext(ctx context.Context, ID int64) (*Plugin, error)
- func (c *NessusClient) GetPluginOutput(scanID, hostID, pluginID int64) (*PluginOutputResponse, error)
- func (c *NessusClient) GetPluginOutputContext(ctx context.Context, scanID, hostID, pluginID int64) (*PluginOutputResponse, error)
- func (c *NessusClient) GetPolicyByID(ID int64) (*Policy, error)
- func (c *NessusClient) GetPolicyByIDContext(ctx context.Context, ID int64) (*Policy, error)
- func (c *NessusClient) GetScanByID(ID int64) (*ScanDetail, error)
- func (c *NessusClient) GetScanByIDContext(ctx context.Context, ID int64) (*ScanDetail, error)
- func (c *NessusClient) GetScanTemplates() ([]*ScanTemplate, error)
- func (c *NessusClient) GetScanTemplatesContext(ctx context.Context) ([]*ScanTemplate, error)
- func (c *NessusClient) GetScans(lastModificationDate int64) ([]*PersistedScan, error)
- func (c *NessusClient) GetScansContext(ctx context.Context, lastModificationDate int64) ([]*PersistedScan, error)
- func (c *NessusClient) LaunchScan(scanID int64) error
- func (c *NessusClient) LaunchScanContext(ctx context.Context, scanID int64) error
- func (c *NessusClient) StopScan(scanID int64) error
- func (c *NessusClient) StopScanContext(ctx context.Context, scanID int64) error
- type Pagination
- type PersistedScan
- type Plugin
- type PluginAttribute
- type PluginOutput
- type PluginOutputResponse
- type Policy
- type PolicySettings
- type Scan
- type ScanDetail
- type ScanSettings
- type ScanTemplate
- type Vulnerability
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶ added in v1.1.0
type Asset struct { ID string `json:"id"` Name string `json:"name"` Types []string `json:"types"` Sources []string `json:"sources"` Created time.Time `json:"created"` ObservationSources []struct { FirstObserved time.Time `json:"first_observed"` LastObserved time.Time `json:"last_observed"` Name string `json:"name"` } `json:"observation_sources"` IsLicensed bool `json:"is_licensed"` Fqdns []string `json:"fqdns"` Tags []struct { ID string `json:"id"` Category string `json:"category"` Value string `json:"value"` Type string `json:"type"` } `json:"tags"` Network struct { ID string `json:"id"` Name string `json:"name"` } `json:"network"` FirstObserved time.Time `json:"first_observed"` DisplayFqdn string `json:"display_fqdn"` IsDeleted bool `json:"is_deleted"` LastObserved time.Time `json:"last_observed"` Updated time.Time `json:"updated"` }
Asset represents the asset entity on Tenable.io.
More attributes available at https://developer.tenable.com/docs/common-asset-attributes.
type AuthProvider ¶
type AuthProvider interface { AddAuthHeaders(*http.Request) Prepare(url string, client *http.Client) error }
AuthProvider expose the methods necessary to perform authenticated calls
type BasicAuthProvider ¶
type BasicAuthProvider struct {
// contains filtered or unexported fields
}
BasicAuthProvider represent the basic auth method
func NewBasicAuthProvider ¶
func NewBasicAuthProvider(username string, password string) *BasicAuthProvider
NewBasicAuthProvider returns a new BasicAuthProvider
func (*BasicAuthProvider) AddAuthHeaders ¶
func (b *BasicAuthProvider) AddAuthHeaders(r *http.Request)
AddAuthHeaders add auth headers
type Client ¶
type Client interface { GetScanTemplates() ([]*ScanTemplate, error) LaunchScan(scanID int64) error StopScan(scanID int64) error DeleteScan(scanID int64) error CreateScan(scan *Scan) (*PersistedScan, error) GetScans(lastModificationDate int64) ([]*PersistedScan, error) GetScanByID(id int64) (*ScanDetail, error) GetPluginByID(id int64) (*Plugin, error) GetPluginOutput(scanID, hostID, pluginID int64) (*PluginOutputResponse, error) GetAssetByName(name string) (*Asset, error) GetFindingsByAssetName(name string) ([]Finding, error) }
Client expose the methods callable on Nessus Api
type Finding ¶ added in v1.1.0
type Finding struct { Output string `json:"output"` ID string `json:"id"` Severity int `json:"severity"` Port int `json:"port"` Protocol string `json:"protocol"` Service string `json:"service"` Definition struct { ID int `json:"id"` // plugin_id Name string `json:"name"` Description string `json:"description"` Synopsis string `json:"synopsis"` Solution string `json"solution"` CVSS3 struct { BaseScore *float32 `json:"base_score"` } `json:"cvss3"` CVSS2 struct { BaseScore *float32 `json:"base_score"` } `json:"cvss2"` CWE []string `json:"cwe"` SeeAlso []string `json:"see_also"` } `json:"definition"` }
Finding represents the finding entity on Tenable.io.
More info available at https://developer.tenable.com/docs/tenable-plugin-attributes.
type Info ¶
type Info struct {
Status string `json:"status"`
}
Info represents detailed information from a Scan returned by Nessus API
type KeyAuthProvider ¶
type KeyAuthProvider struct {
// contains filtered or unexported fields
}
KeyAuthProvider represent the key based auth method
func NewKeyAuthProvider ¶
func NewKeyAuthProvider(accessKey string, secretKey string) *KeyAuthProvider
NewKeyAuthProvider returns a new KeyAuthProvider
func (*KeyAuthProvider) AddAuthHeaders ¶
func (k *KeyAuthProvider) AddAuthHeaders(r *http.Request)
AddAuthHeaders add auth headers
type NessusClient ¶
type NessusClient struct {
// contains filtered or unexported fields
}
NessusClient implements nessus.Client
func NewClient ¶
func NewClient(auth AuthProvider, url string, allowInsecureConnection bool) (*NessusClient, error)
NewClient returns a new NessusClient
func (*NessusClient) CreateScan ¶
func (c *NessusClient) CreateScan(scan *Scan) (*PersistedScan, error)
CreateScan creates a scan
func (*NessusClient) CreateScanContext ¶
func (c *NessusClient) CreateScanContext(ctx context.Context, scan *Scan) (*PersistedScan, error)
CreateScanContext creates a scan with the given scan data and context.
func (*NessusClient) DeleteScan ¶
func (c *NessusClient) DeleteScan(scanID int64) error
DeleteScan will remove the scan with the given scanID
func (*NessusClient) DeleteScanContext ¶
func (c *NessusClient) DeleteScanContext(ctx context.Context, scanID int64) error
DeleteScanContext will remove the scan with the given scanID and context.
func (*NessusClient) GetAssetByName ¶ added in v1.1.0
GetAssetByName returns an asset by its name. Returns an error if more than one or none assets are matching.
func (*NessusClient) GetFindingsByAssetName ¶ added in v1.1.0
GetFindingsByAssetName returns all the findings associated to an asset by its name.
func (*NessusClient) GetPluginByID ¶
func (c *NessusClient) GetPluginByID(ID int64) (*Plugin, error)
GetPluginByID retrieves a plugin by ID
func (*NessusClient) GetPluginByIDContext ¶
GetPluginByIDContext retrieves a plugin by ID using the given context.
func (*NessusClient) GetPluginOutput ¶
func (c *NessusClient) GetPluginOutput(scanID, hostID, pluginID int64) (*PluginOutputResponse, error)
GetPluginOutput retrieves output from a plugin ran against a target
func (*NessusClient) GetPluginOutputContext ¶
func (c *NessusClient) GetPluginOutputContext(ctx context.Context, scanID, hostID, pluginID int64) (*PluginOutputResponse, error)
GetPluginOutputContext retrieves output from a plugin ran against a target using the given context.
func (*NessusClient) GetPolicyByID ¶
func (c *NessusClient) GetPolicyByID(ID int64) (*Policy, error)
GetPolicyByID retrieves a policy by ID
func (*NessusClient) GetPolicyByIDContext ¶
GetPolicyByIDContext retrieves a policy by ID using the given context.
func (*NessusClient) GetScanByID ¶
func (c *NessusClient) GetScanByID(ID int64) (*ScanDetail, error)
GetScanByID retrieve a scan by ID
func (*NessusClient) GetScanByIDContext ¶
func (c *NessusClient) GetScanByIDContext(ctx context.Context, ID int64) (*ScanDetail, error)
GetScanByIDContext retrieve a scan by ID
func (*NessusClient) GetScanTemplates ¶
func (c *NessusClient) GetScanTemplates() ([]*ScanTemplate, error)
GetScanTemplates retrieves Scan Templates
func (*NessusClient) GetScanTemplatesContext ¶
func (c *NessusClient) GetScanTemplatesContext(ctx context.Context) ([]*ScanTemplate, error)
GetScanTemplatesContext retrieves the Scan templates ussing the given context.
func (*NessusClient) GetScans ¶
func (c *NessusClient) GetScans(lastModificationDate int64) ([]*PersistedScan, error)
GetScans get a list of scan matching the provided lastModificationDate (check Nessus documentation)
func (*NessusClient) GetScansContext ¶
func (c *NessusClient) GetScansContext(ctx context.Context, lastModificationDate int64) ([]*PersistedScan, error)
GetScansContext get a list of scan matching the provided lastModificationDate (check Nessus documentation) and context.
func (*NessusClient) LaunchScan ¶
func (c *NessusClient) LaunchScan(scanID int64) error
LaunchScan launch spe scan with the specified scanID
func (*NessusClient) LaunchScanContext ¶
func (c *NessusClient) LaunchScanContext(ctx context.Context, scanID int64) error
LaunchScanContext launch the scan with the specified scanID and context.
func (*NessusClient) StopScan ¶
func (c *NessusClient) StopScan(scanID int64) error
StopScan stops the scan with the given scanID
func (*NessusClient) StopScanContext ¶
func (c *NessusClient) StopScanContext(ctx context.Context, scanID int64) error
StopScanContext stops the scan with the given scanID
type Pagination ¶ added in v1.1.0
type Pagination struct { Next string `json:"next"` Limit int `json:"limit"` Total int `json:"total"` }
Pagination is used to iterate results for some endpoints. If the attribute `Next` has content, needs to be passed as a parameter to the next request.
type PersistedScan ¶
type PersistedScan struct { ID int64 `json:"id"` UUID string `json:"uuid"` Name string `json:"name"` Status string `json:"status"` CreationDate int64 `json:"creation_date"` LastModificationDate int64 `json:"last_modification_date"` Owner string `json:"owner"` }
PersistedScan represents a Persisted Scan on Nessus API
type Plugin ¶
type Plugin struct { ID int64 `json:"id"` Name string `json:"name"` FamilyName string `json:"family_name"` Attributes []PluginAttribute `json:"attributes"` }
Plugin represents a plugin returned by Nessus API
type PluginAttribute ¶
type PluginAttribute struct { Name string `json:"attribute_name"` Value string `json:"attribute_value"` }
PluginAttribute represents an attribute for a plugin returned by Nessus API
type PluginOutput ¶
type PluginOutput struct { Hosts string `json:"hosts"` Ports interface{} `json:"ports"` Output string `json:"plugin_output"` Severity int `json:"severity"` }
PluginOutput represents the output of a plugin returned by Nessus API
type PluginOutputResponse ¶
type PluginOutputResponse struct {
Output []PluginOutput `json:"outputs"`
}
PluginOutputResponse represents the output of a plugin returned by Nessus API
type Policy ¶
type Policy struct { ID int64 UUID string `json:"uuid"` Settings PolicySettings `json:"settings"` }
Policy represents a policy returned by Nessus API
type PolicySettings ¶
type PolicySettings struct {
Name string `json:"name"`
}
PolicySettings represents a setting for policy returned by Nessus API
type Scan ¶
type Scan struct { TemplateUUID string `json:"uuid"` Settings ScanSettings `json:"settings"` }
Scan represents a Scan to be posted to Nessus API
type ScanDetail ¶
type ScanDetail struct { ID int64 Info Info `json:"info"` Hosts []Host `json:"hosts"` Vulnerabilities []Vulnerability `json:"vulnerabilities"` }
ScanDetail represents Details from a Scan returned by Nessus API
type ScanSettings ¶
type ScanSettings struct { Name string `json:"name"` Enabled bool `json:"enabled"` Targets string `json:"text_targets"` PolicyID int64 `json:"policy_id"` }
ScanSettings represents settings for a Scan to be posted to Nessus API
type ScanTemplate ¶
type ScanTemplate struct { UUID string `json:"uuid"` Name string `json:"name"` Title string `json:"title"` Description string `json:"description"` CloudOnly bool `json:"cloud_only"` SubscriptionOnly bool `json:"subscription_only"` IsAgent bool `json:"is_agent"` Info string `json:"more_info"` }
ScanTemplate represents a Template for a Scan returned by Nessus API
type Vulnerability ¶
type Vulnerability struct { VulnerabilityIndex int64 `json:"vuln_index"` Severity int64 `json:"severity"` PluginName string `json:"plugin_name"` Count int64 `json:"count"` PluginID int64 `json:"plugin_id"` PluginFamily string `json:"plugin_family"` }
Vulnerability represents a Vulnerability returned by Nessus API