Help us shape the future of Go! Take the 2026 Go Developer Survey

go_tenable

package module
v0.0.0-...-a4b2bb8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 10 Imported by: 0

README

Go-Tenable

This is a simple library for interacting with Tenable's suite of products.

  • Tenable.sc
  • Tenable.io
  • Nessus

Installation

go get github.com/thathaneydude/go-tenable

Examples

Tenable.sc
package main

import (
	"crypto/tls"
	"fmt"
	"github.com/thathaneydude/go-tenable"
	"net/http"
)

func main() {
	transport :=  &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	scClient := go_tenable.NewTenableSCClient("sc-console.example.com", transport)
	scClient.Login("sc-user", "sc-password")
	for _, asset := range scClient.ListAssets().Response.Usable {
		fmt.Printf("Asset %v (%v): %v\n", asset.Name, asset.ID, asset.Type)
	}

	scClient.Logout()
}
Tenable.io
package main

import (
	"crypto/tls"
	"fmt"
	"github.com/thathaneydude/go-tenable"
	"net/http"
	"time"
)

func main(){
	transport :=  &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}

	tio := go_tenable.NewTenableIOClient("access-key", "secret-key", transport)

	var Payload = go_tenable.AssetRequestBody{ChunkSize: 10000}
	export := tio.NewExport("assets")
	export.RequestExport(Payload.ToBytes())
	for {
		status := export.RequestStatus()
		if status != "FINISHED" {
			time.Sleep(5)
		} else {
			break
		}
	}

	for _, asset := range export.DownloadChunk(1) {
		fmt.Printf("Asset %v IPs: %v\n", asset.ID, asset.Ipv4s)
	}
}
Nessus
package main

import (
	"crypto/tls"
	"fmt"
	"github.com/thathaneydude/go-tenable"
	"net/http"
)

func main(){
	transport :=  &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	nessusClient := go_tenable.NewNessusClient(
		"access-key",
		"secret-key",
		"nessus-address.example.com",
		8834,
		transport)
	status := nessusClient.GetStatus()
	properties := nessusClient.GetProperties()
	health := nessusClient.GetHealthStats(1)
	fmt.Printf("Scanner %v\n", nessusClient.Address)
	fmt.Printf("-Status: %v\n", status.Status)
	fmt.Printf("-Version: %v\n", properties.ServerVersion)
	fmt.Printf("-Licensed IP Count: %v\n", properties.License.Ips)
	fmt.Printf("-Licensed Expiration: %v\n", properties.License.ExpirationDate)
	fmt.Printf("-Free Disk: %v\n", health.PerfStatsCurrent.NessusDataDiskFree)
}

Authors

Ryan Haney @thathaneydude
John Lampe @f00dikator
Julian Davies

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptRiskRule

type AcceptRiskRule struct {
	HostValue    interface{} `json:"hostValue,omitempty"`
	HostType     string      `json:"hostType"`
	Port         string      `json:"Port,omitempty"`
	Protocol     string      `json:"protocol,omitempty"`
	Expires      string      `json:"expires"`
	CreatedTime  string      `json:"createdTime"`
	ModifiedTime string      `json:"modifiedTime"`
	Status       string      `json:"status"`
	ID           string      `json:"id"`
	Comments     string      `json:"comments"`
	Plugin       struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description,omitempty"`
	} `json:"plugin"`
	Repository struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description,omitempty"`
	} `json:"repository"`
	User struct {
		ID        string `json:"id"`
		Username  string `json:"username"`
		Firstname string `json:"firstname,omitempty"`
		Lastname  string `json:"lastname,omitempty"`
	} `json:"User"`
}

type AcceptRiskRuleResponse

type AcceptRiskRuleResponse struct {
	Type            string           `json:"type"`
	AcceptRiskRules []AcceptRiskRule `json:"response"`
	ErrorCode       int              `json:"error_code"`
	ErrorMsg        string           `json:"error_msg"`
	Warnings        []interface{}    `json:"warnings"`
	Timestamp       int              `json:"timestamp"`
}

type AgentResponse

type AgentResponse struct {
	Agents []struct {
		ID           int    `json:"id"`
		UUID         string `json:"uuid"`
		Name         string `json:"name"`
		Platform     string `json:"platform"`
		Distro       string `json:"distro"`
		IP           string `json:"ip"`
		LastScanned  int    `json:"last_scanned"`
		PluginFeedID string `json:"plugin_feed_id"`
		CoreBuild    string `json:"core_build"`
		CoreVersion  string `json:"core_version"`
		LinkedOn     int    `json:"linked_on"`
		LastConnect  int    `json:"last_connect"`
		Status       string `json:"status"`
		Groups       []struct {
			Name string `json:"name"`
			ID   int    `json:"id"`
		} `json:"groups"`
	} `json:"agents"`
	Pagination struct {
		Total  int `json:"total"`
		Limit  int `json:"limit"`
		Offset int `json:"offset"`
		Sort   []struct {
			Name  string `json:"name"`
			Order string `json:"order"`
		} `json:"sort"`
	} `json:"pagination"`
}

type AssetChunkDownloadResponse

type AssetChunkDownloadResponse []struct {
	ID                        string    `json:"id,omitempty"`
	HasAgent                  bool      `json:"has_agent,omitempty"`
	HasPluginResults          bool      `json:"has_plugin_results,omitempty"`
	CreatedAt                 time.Time `json:"created_at,omitempty"`
	TerminatedAt              time.Time `json:"terminated_at,omitempty"`
	TerminatedBy              time.Time `json:"terminated_by,omitempty"`
	UpdatedAt                 time.Time `json:"updated_at,omitempty"`
	DeletedAt                 time.Time `json:"deleted_at,omitempty"`
	DeletedBy                 time.Time `json:"deleted_by,omitempty"`
	FirstSeen                 time.Time `json:"first_seen,omitempty"`
	LastSeen                  time.Time `json:"last_seen,omitempty"`
	FirstScanTime             time.Time `json:"first_scan_time,omitempty"`
	LastScanTime              time.Time `json:"last_scan_time,omitempty"`
	LastAuthenticatedScanDate time.Time `json:"last_authenticated_scan_date,omitempty"`
	LastLicensedScanDate      time.Time `json:"last_licensed_scan_date,omitempty"`
	AzureVMID                 string    `json:"azure_vm_id,omitempty"`
	AzureResourceID           string    `json:"azure_resource_id,omitempty"`
	AwsEc2InstanceAmiID       string    `json:"aws_ec2_instance_ami_id,omitempty"`
	AwsEc2InstanceID          string    `json:"aws_ec2_instance_id,omitempty"`
	AgentUUID                 string    `json:"agent_uuid,omitempty"`
	BiosUUID                  string    `json:"bios_uuid,omitempty"`
	EnvironmentID             string    `json:"environment_id,omitempty"`
	AwsOwnerID                string    `json:"aws_owner_id,omitempty"`
	AwsAvailabilityZone       string    `json:"aws_availability_zone,omitempty"`
	AwsRegion                 string    `json:"aws_region,omitempty"`
	AwsVpcID                  string    `json:"aws_vpc_id,omitempty"`
	AwsEc2InstanceGroupName   string    `json:"aws_ec2_instance_group_name,omitempty"`
	AwsEc2InstanceStateName   string    `json:"aws_ec2_instance_state_name,omitempty"`
	AwsEc2InstanceType        string    `json:"aws_ec2_instance_type,omitempty"`
	AwsSubnetID               string    `json:"aws_subnet_id,omitempty"`
	AwsEc2ProductCode         string    `json:"aws_ec2_product_code,omitempty"`
	AwsEc2Name                string    `json:"aws_ec2_name,omitempty"`
	McafeeEpoGUID             string    `json:"mcafee_epo_guid,omitempty"`
	McafeeEpoAgentGUID        string    `json:"mcafee_epo_agent_guid,omitempty"`
	ServicenowSysid           string    `json:"servicenow_sysid,omitempty"`
	AgentNames                []string  `json:"agent_names,omitempty"`
	Ipv4s                     []string  `json:"ipv4s,omitempty"`
	Ipv6s                     []string  `json:"ipv6s,omitempty"`
	Fqdns                     []string  `json:"fqdns,omitempty"`
	MacAddresses              []string  `json:"mac_addresses,omitempty"`
	NetbiosNames              []string  `json:"netbios_names,omitempty"`
	OperatingSystems          []string  `json:"operating_systems,omitempty"`
	SystemTypes               []string  `json:"system_types,omitempty"`
	Hostnames                 []string  `json:"hostnames,omitempty"`
	SSHFingerprints           []string  `json:"ssh_fingerprints,omitempty"`
	QualysAssetIds            []string  `json:"qualys_asset_ids,omitempty"`
	QualysHostIds             []string  `json:"qualys_host_ids,omitempty"`
	ManufacturerTpmIds        []string  `json:"manufacturer_tpm_ids,omitempty"`
	SymantecEpHardwareKeys    []string  `json:"symantec_ep_hardware_keys,omitempty"`
	Sources                   []struct {
		Name      string    `json:"name,omitempty"`
		FirstSeen time.Time `json:"first_seen,omitempty"`
		LastSeen  time.Time `json:"last_seen,omitempty"`
	} `json:"sources,omitempty"`
	Tags              []string `json:"tags,omitempty"`
	NetworkInterfaces []struct {
		Name         string   `json:"name,omitempty"`
		Virtual      bool     `json:"virtual,omitempty"`
		Aliased      bool     `json:"aliased,omitempty"`
		Fqdns        []string `json:"fqdns,omitempty"`
		MacAddresses []string `json:"mac_addresses,omitempty"`
		Ipv4S        []string `json:"ipv4s,omitempty"`
		Ipv6S        []string `json:"ipv6s,omitempty"`
	} `json:"network_interfaces"`
}

type AssetListResponse

type AssetListResponse struct {
	Type     string `json:"type"`
	Response struct {
		Usable []AssetResponse `json:"usable"`
	} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

type AssetRequestBody

type AssetRequestBody struct {
	ChunkSize                 int      `json:"chunk_size"`
	CreatedAt                 float32  `json:"filters.created_at,omitempty"`
	UpdatedAt                 float32  `json:"filters.updated_at,omitempty"`
	TerminatedAt              float32  `json:"filters.terminated_at,omitempty"`
	DeletedAt                 float32  `json:"filters.deleted_at,omitempty"`
	FirstScanTime             float32  `json:"filters.first_scan_time,omitempty"`
	LastAuthenticatedScanTime float32  `json:"filters.last_authenticated_scan_time,omitempty"`
	LastAssessed              float32  `json:"filters.last_assessed,omitempty"`
	ServiceNowSysID           bool     `json:"filters.servicenow_sysid,omitempty"`
	Sources                   []string `json:"filters.sources,omitempty"`
	HasPluginResults          bool     `json:"filters.has_plugin_results,omitempty"`
}

func (AssetRequestBody) ToBytes

func (req AssetRequestBody) ToBytes() []byte

type AssetResponse

type AssetResponse struct {
	Status       string `json:"status"`
	Name         string `json:"name"`
	Type         string `json:"type"`
	Description  string `json:"description"`
	CreatedTime  string `json:"createdTime"`
	ModifiedTime string `json:"modifiedTime"`
	Tags         string `json:"tags"`
	ID           string `json:"id"`
	Repositories []struct {
		IPCount    string `json:"ipCount"`
		Repository struct {
			ID          string `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
		} `json:"repository"`
	} `json:"repositories"`
	IPCount   int           `json:"ipCount"`
	Groups    []interface{} `json:"groups"`
	CanUse    string        `json:"canUse"`
	CanManage string        `json:"canManage"`
	Owner     struct {
		ID        string `json:"id"`
		Username  string `json:"username"`
		Firstname string `json:"firstname"`
		Lastname  string `json:"lastname"`
	} `json:"owner"`
	OwnerGroup struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
	} `json:"ownerGroup"`
	Template struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
	} `json:"template"`
	TargetGroup struct {
		ID          int    `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
	} `json:"targetGroup"`
	Creator struct {
		ID        string `json:"id"`
		Username  string `json:"username"`
		Firstname string `json:"firstname"`
		Lastname  string `json:"lastname"`
	} `json:"creator"`
}

type AssetStatusResponse

type AssetStatusResponse struct {
	Type     string `json:"type"`
	Response struct {
		ID      string      `json:"id"`
		Name    string      `json:"name"`
		IPCount interface{} `json:"ipCount"`
	} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

type AuditLogResponse

type AuditLogResponse struct {
	Events     []Event `json:"events"`
	Pagination struct {
		Total int `json:"total"`
		Limit int `json:"limit"`
	} `json:"pagination"`
}

type Event

type Event struct {
	ID          string      `json:"id"`
	Action      string      `json:"action"`
	Crud        string      `json:"crud"`
	IsFailure   bool        `json:"is_failure"`
	Received    time.Time   `json:"received"`
	Description interface{} `json:"description"`
	Actor       struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"actor"`
	IsAnonymous interface{} `json:"is_anonymous"`
	Target      struct {
		ID   string `json:"id"`
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"target"`
	Fields []interface{} `json:"fields"`
}

type EventFilter

type EventFilter struct {
	Filter   string
	Operator string
	Value    string
}

type Export

type Export struct {
	ExportUUID      string
	ExportType      string
	ExportStatus    string
	AvailableChunks []int
	ProcessedChunks []int
	// contains filtered or unexported fields
}

func (*Export) DownloadChunk

func (export *Export) DownloadChunk(ChunkID int) AssetChunkDownloadResponse

func (*Export) GetUnprocessedChunks

func (export *Export) GetUnprocessedChunks() []int

func (*Export) RequestExport

func (export *Export) RequestExport(Payload []byte) string

func (*Export) RequestStatus

func (export *Export) RequestStatus() string

type ExportRequestResponse

type ExportRequestResponse struct {
	ExportUUID string `json:"export_uuid"`
}

type ExportStatusResponse

type ExportStatusResponse struct {
	Status          string `json:"status"`
	ChunksAvailable []int  `json:"chunks_available"`
}

type Nessus

type Nessus struct {
	BaseClient baseClient

	Address string
	Port    int
	BaseURL string
	// contains filtered or unexported fields
}

func NewNessusClient

func NewNessusClient(accessKey string, secretKey string, nessusAddress string, port int, transport *http.Transport) Nessus

func (Nessus) Delete

func (n Nessus) Delete(endpoint string, params string) (*http.Response, error)

func (Nessus) Get

func (n Nessus) Get(endpoint string, params string) (*http.Response, error)

func (*Nessus) GetHealthStats

func (n *Nessus) GetHealthStats(count int) ScannerSettingsResponse

func (*Nessus) GetProperties

func (n *Nessus) GetProperties() PropertiesResponse

func (*Nessus) GetStatus

func (n *Nessus) GetStatus() StatusResponse

Public Functions

func (Nessus) Patch

func (n Nessus) Patch(endpoint string, body []byte) (*http.Response, error)

func (Nessus) Post

func (n Nessus) Post(endpoint string, body []byte) (*http.Response, error)

func (Nessus) Put

func (n Nessus) Put(endpoint string, body []byte) (*http.Response, error)

type PropertiesResponse

type PropertiesResponse struct {
	Installers struct {
	} `json:"installers"`
	LoadedPluginSet string `json:"loaded_plugin_set"`
	Features        struct {
		Report       bool `json:"report"`
		RemoteLink   bool `json:"remote_link"`
		Users        bool `json:"users"`
		PluginRules  bool `json:"plugin_rules"`
		API          bool `json:"api"`
		ScanAPI      bool `json:"scan_api"`
		LocalScanner bool `json:"local_scanner"`
		Logs         bool `json:"logs"`
		SMTP         bool `json:"smtp"`
	} `json:"features"`
	ServerUUID string `json:"server_uuid"`
	Update     struct {
		Href       interface{} `json:"href"`
		NewVersion int         `json:"new_version"`
		Restart    int         `json:"restart"`
	} `json:"update"`
	RestartPending struct {
		Reason interface{} `json:"reason"`
		Type   interface{} `json:"type"`
	} `json:"restart_pending"`
	NessusUIVersion string        `json:"nessus_ui_version"`
	NessusType      string        `json:"nessus_type"`
	Notifications   []interface{} `json:"notifications"`
	License         struct {
		Features struct {
			Report       bool `json:"report"`
			RemoteLink   bool `json:"remote_link"`
			Users        bool `json:"users"`
			PluginRules  bool `json:"plugin_rules"`
			API          bool `json:"api"`
			ScanAPI      bool `json:"scan_api"`
			LocalScanner bool `json:"local_scanner"`
			Logs         bool `json:"logs"`
			SMTP         bool `json:"smtp"`
		} `json:"features"`
		Type           string `json:"type"`
		ExpirationDate int    `json:"expiration_date"`
		Ips            int64  `json:"ips"`
		Restricted     bool   `json:"restricted"`
		Agents         int    `json:"agents"`
		Mode           int    `json:"mode"`
		Scanners       int    `json:"scanners"`
		ScannersUsed   int    `json:"scanners_used"`
		AgentsUsed     int    `json:"agents_used"`
		Name           string `json:"name"`
	} `json:"license"`
	FeedError              int         `json:"feed_error"`
	RestartNeeded          interface{} `json:"restart_needed"`
	ServerBuild            string      `json:"server_build"`
	ShowNpv7WhatsNew       int         `json:"show_npv7_whats_new"`
	Npv7DowngradeAvailable int         `json:"npv7_downgrade_available"`
	Capabilities           struct {
		ScanVulnerabilityGroups      bool `json:"scan_vulnerability_groups"`
		ReportEmailConfig            bool `json:"report_email_config"`
		ScanVulnerabilityGroupsMixed bool `json:"scan_vulnerability_groups_mixed"`
	} `json:"capabilities"`
	PluginSet               string      `json:"plugin_set"`
	IdleTimeout             string      `json:"idle_timeout"`
	NessusUIBuild           string      `json:"nessus_ui_build"`
	Npv7UpgradeRequired     bool        `json:"npv7_upgrade_required"`
	ScannerBoottime         int         `json:"scanner_boottime"`
	Npv7                    int         `json:"npv7"`
	LoginBanner             interface{} `json:"login_banner"`
	Npv7UpgradeNotification int         `json:"npv7_upgrade_notification"`
	Platform                string      `json:"platform"`
	ServerVersion           string      `json:"server_version"`
}

type RecastRiskRule

type RecastRiskRule struct {
	HostValue   interface{} `json:"hostValue,omitempty"`
	HostType    string      `json:"hostType"`
	Port        string      `json:"Port,omitempty"`
	Protocol    string      `json:"protocol,omitempty"`
	NewSeverity string      `json:"newSeverity"`
	CreatedTime string      `json:"createdTime"`
	Order       string      `json:"order"`
	Status      string      `json:"status"`
	ID          string      `json:"id"`
	Comments    string      `json:"comments"`
	Plugin      struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description,omitempty"`
	} `json:"plugin"`
	Repository struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description,omitempty"`
	} `json:"repository"`
	User struct {
		ID        string `json:"id"`
		Username  string `json:"username"`
		Firstname string `json:"firstname,omitempty"`
		Lastname  string `json:"lastname,omitempty"`
	} `json:"User"`
}

type RecastRiskRuleResponse

type RecastRiskRuleResponse struct {
	Type        string           `json:"type"`
	RecastRules []RecastRiskRule `json:"response"`
	ErrorCode   int              `json:"error_code"`
	ErrorMsg    string           `json:"error_msg"`
	Warnings    []interface{}    `json:"warnings"`
	Timestamp   int              `json:"timestamp"`
}

type RepoDetailResponse

type RepoDetailResponse struct {
	Type     string `json:"type"`
	Response struct {
		Name           string `json:"name"`
		Description    string `json:"description"`
		Type           string `json:"type"`
		DataFormat     string `json:"dataFormat"`
		DownloadFormat string `json:"downloadFormat"`
		CreatedTime    string `json:"createdTime"`
		ModifiedTime   string `json:"modifiedTime"`
		VulnCount      string `json:"vulnCount"`
		Running        string `json:"running"`
		LastSyncTime   string `json:"lastSyncTime"`
		LastVulnUpdate string `json:"lastVulnUpdate"`
		ID             string `json:"id"`
		Organizations  []struct {
			ID          string `json:"id"`
			GroupAssign string `json:"groupAssign"`
			Name        string `json:"name"`
			Description string `json:"description"`
		} `json:"organizations"`
		TypeFields struct {
			NessusSchedule struct {
				Type       string `json:"type"`
				Start      string `json:"start"`
				RepeatRule string `json:"repeatRule"`
			} `json:"nessusSchedule"`
			Correlation            []interface{} `json:"correlation"`
			IPRange                string        `json:"ipRange"`
			IPCount                string        `json:"ipCount"`
			RunningNessus          string        `json:"runningNessus"`
			LastGenerateNessusTime string        `json:"lastGenerateNessusTime"`
			TrendingDays           string        `json:"trendingDays"`
			TrendWithRaw           string        `json:"trendWithRaw"`
			LastTrendUpdate        string        `json:"lastTrendUpdate"`
		} `json:"typeFields"`
	} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

type RepoList

type RepoList struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

type RepoListResponse

type RepoListResponse struct {
	Type       string        `json:"type"`
	Repos      []RepoList    `json:"response"`
	Error_code int           `json:"error_code"`
	Error_msg  string        `json:"error_msg"`
	Warnings   []interface{} `json:"warnings"`
	Timestamp  int           `json:"timestamp"`
}

type ScannerSettingsResponse

type ScannerSettingsResponse struct {
	PerfStatsHistory []struct {
		KbytesReceived      int         `json:"kbytes_received"`
		KbytesSent          int         `json:"kbytes_sent"`
		AvgDNSLookupTime    int         `json:"avg_dns_lookup_time"`
		NumDNSLookups       int         `json:"num_dns_lookups"`
		AvgRdnsLookupTime   int         `json:"avg_rdns_lookup_time"`
		NumRdnsLookups      int         `json:"num_rdns_lookups"`
		CPULoadAvg          int         `json:"cpu_load_avg"`
		NessusLogDiskFree   int         `json:"nessus_log_disk_free"`
		NessusLogDiskTotal  int         `json:"nessus_log_disk_total"`
		NessusDataDiskFree  int         `json:"nessus_data_disk_free"`
		NessusDataDiskTotal int         `json:"nessus_data_disk_total"`
		TempDiskFree        int         `json:"temp_disk_free"`
		TempDiskTotal       int         `json:"temp_disk_total"`
		NumTCPSessions      int         `json:"num_tcp_sessions"`
		NessusVmem          int         `json:"nessus_vmem"`
		NessusMem           int         `json:"nessus_mem"`
		SysRAMUsed          interface{} `json:"sys_ram_used"`
		SysRAM              int         `json:"sys_ram"`
		SysCores            int         `json:"sys_cores"`
		NumHosts            int         `json:"num_hosts"`
		NumScans            int         `json:"num_scans"`
		Timestamp           int         `json:"timestamp"`
	} `json:"perf_stats_history"`
	PerfStatsCurrent struct {
		KbytesReceived      int         `json:"kbytes_received"`
		KbytesSent          int         `json:"kbytes_sent"`
		AvgDNSLookupTime    int         `json:"avg_dns_lookup_time"`
		NumDNSLookups       int         `json:"num_dns_lookups"`
		AvgRdnsLookupTime   int         `json:"avg_rdns_lookup_time"`
		NumRdnsLookups      int         `json:"num_rdns_lookups"`
		CPULoadAvg          int         `json:"cpu_load_avg"`
		NessusLogDiskFree   int         `json:"nessus_log_disk_free"`
		NessusLogDiskTotal  int         `json:"nessus_log_disk_total"`
		NessusDataDiskFree  int         `json:"nessus_data_disk_free"`
		NessusDataDiskTotal int         `json:"nessus_data_disk_total"`
		TempDiskFree        int         `json:"temp_disk_free"`
		TempDiskTotal       int         `json:"temp_disk_total"`
		NumTCPSessions      int         `json:"num_tcp_sessions"`
		NessusVmem          int         `json:"nessus_vmem"`
		NessusMem           int         `json:"nessus_mem"`
		SysRAMUsed          interface{} `json:"sys_ram_used"`
		SysRAM              int         `json:"sys_ram"`
		SysCores            int         `json:"sys_cores"`
		NumHosts            int         `json:"num_hosts"`
		NumScans            int         `json:"num_scans"`
		Timestamp           int         `json:"timestamp"`
	} `json:"perf_stats_current"`
}

type StaticIPAsset

type StaticIPAsset struct {
	ID          int
	Name        string
	Type        string
	DefinedIPs  string
	Description string
	Tag         string
}

func (StaticIPAsset) Calculating

func (asset StaticIPAsset) Calculating(sc TenableSC) bool

func (*StaticIPAsset) Create

func (StaticIPAsset) Delete

func (asset StaticIPAsset) Delete(sc TenableSC) *http.Response

func (StaticIPAsset) Edit

func (asset StaticIPAsset) Edit(sc TenableSC) *http.Response

func (*StaticIPAsset) View

func (asset *StaticIPAsset) View(sc TenableSC)

type StaticIPCreateResponse

type StaticIPCreateResponse struct {
	Type     string `json:"type"`
	Response struct {
		ID           string `json:"id"`
		Name         string `json:"name"`
		Type         string `json:"type"`
		Description  string `json:"description"`
		Tags         string `json:"tags"`
		Context      string `json:"context"`
		Status       string `json:"status"`
		CreatedTime  string `json:"createdTime"`
		ModifiedTime string `json:"modifiedTime"`
		TypeFields   struct {
			DefinedIPs string `json:"definedIPs"`
		} `json:"typeFields"`
		Repositories []struct {
			IPCount    string `json:"ipCount"`
			Repository struct {
				ID          string `json:"id"`
				Name        string `json:"name"`
				Description string `json:"description"`
			} `json:"repository"`
		} `json:"repositories"`
		IPCount         int           `json:"ipCount"`
		Groups          []interface{} `json:"groups"`
		AssetDataFields []interface{} `json:"assetDataFields"`
		CanUse          string        `json:"canUse"`
		CanManage       string        `json:"canManage"`
		Creator         struct {
			ID        string `json:"id"`
			Username  string `json:"username"`
			Firstname string `json:"firstname"`
			Lastname  string `json:"lastname"`
		} `json:"creator"`
		Owner struct {
			ID        string `json:"id"`
			Username  string `json:"username"`
			Firstname string `json:"firstname"`
			Lastname  string `json:"lastname"`
		} `json:"owner"`
		OwnerGroup struct {
			ID          string `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
		} `json:"ownerGroup"`
		TargetGroup struct {
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
		} `json:"targetGroup"`
		Template struct {
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
		} `json:"template"`
	} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

type StaticIPViewResponse

type StaticIPViewResponse struct {
	Type     string `json:"type"`
	Response struct {
		ID          string `json:"id"`
		Name        string `json:"name"`
		Description string `json:"description"`
		Tags        string `json:"tags"`
		TypeFields  struct {
			DefinedIPs string `json:"definedIPs"`
		} `json:"typeFields"`
	} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

type StatusResponse

type StatusResponse struct {
	Code     int         `json:"code"`
	Progress interface{} `json:"progress"`
	Status   string      `json:"status"`
}

type TenableIO

type TenableIO struct {
	BaseClient baseClient

	BaseURL string
	// contains filtered or unexported fields
}

func NewTenableIOClient

func NewTenableIOClient(accessKey string, secretKey string, transport *http.Transport) TenableIO

Creating a New Clients

func (TenableIO) Delete

func (io TenableIO) Delete(endpoint string, params string) (*http.Response, error)

func (TenableIO) Get

func (io TenableIO) Get(endpoint string, params string) (*http.Response, error)

func (*TenableIO) ListAgents

func (io *TenableIO) ListAgents() []AgentResponse

func (*TenableIO) ListEvents

func (io *TenableIO) ListEvents(filter EventFilter) ([]Event, error)

func (TenableIO) NewExport

func (io TenableIO) NewExport(exportType string) Export

func (TenableIO) Patch

func (io TenableIO) Patch(endpoint string, body []byte) (*http.Response, error)

func (TenableIO) Post

func (io TenableIO) Post(endpoint string, body []byte) (*http.Response, error)

func (TenableIO) Put

func (io TenableIO) Put(endpoint string, body []byte) (*http.Response, error)

type TenableSC

type TenableSC struct {
	BaseClient baseClient
	User       string

	BaseURL string
	// contains filtered or unexported fields
}

func NewTenableSCClient

func NewTenableSCClient(scHost string, transport *http.Transport) TenableSC

func (TenableSC) Delete

func (sc TenableSC) Delete(endpoint string, params string) (*http.Response, error)

func (TenableSC) Get

func (sc TenableSC) Get(endpoint string, params string) (*http.Response, error)

func (*TenableSC) ListAssets

func (sc *TenableSC) ListAssets() AssetListResponse

func (*TenableSC) ListRepositories

func (sc *TenableSC) ListRepositories() RepoListResponse

func (*TenableSC) ListRiskAcceptanceRules

func (sc *TenableSC) ListRiskAcceptanceRules() AcceptRiskRuleResponse

func (*TenableSC) ListRiskRecastRules

func (sc *TenableSC) ListRiskRecastRules() RecastRiskRuleResponse

func (*TenableSC) Login

func (sc *TenableSC) Login(scUser string, scPassword string) (*TokenResponse, error)

With the provided user name and password, attempts to create an authenticated session with Tenable.sc using the token endpoint. The function needs to be executed prior to any other SC client request as it sets the token and session cookie for requests.

func (*TenableSC) Logout

func (sc *TenableSC) Logout() error

func (TenableSC) NewStaticIPAsset

func (sc TenableSC) NewStaticIPAsset(Name string, IPAddresses string, Description string, Tag string) StaticIPAsset

func (TenableSC) Patch

func (sc TenableSC) Patch(endpoint string, body []byte) (*http.Response, error)

func (TenableSC) Post

func (sc TenableSC) Post(endpoint string, body []byte) (*http.Response, error)

func (TenableSC) Put

func (sc TenableSC) Put(endpoint string, body []byte) (*http.Response, error)

func (*TenableSC) RepositoryDetail

func (sc *TenableSC) RepositoryDetail(RepoId int) RepoDetailResponse

type TokenCookie

type TokenCookie struct {
	HTTPOnly bool   `json:"httpOnly"`
	Path     string `json:"path"`
	Secure   bool   `json:"secure"`
	Value    string `json:"value"`
}

type TokenError

type TokenError struct {
	Type      string        `json:"type"`
	Response  []interface{} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

type TokenRequest

type TokenRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (TokenRequest) ToBytes

func (req TokenRequest) ToBytes() []byte

type TokenResponse

type TokenResponse struct {
	Type     string `json:"type"`
	Response struct {
		LastLogin        string `json:"lastLogin"`
		LastLoginIP      string `json:"lastLoginIP"`
		FailedLogins     string `json:"failedLogins"`
		FailedLoginIP    string `json:"failedLoginIP"`
		LastFailedLogin  string `json:"lastFailedLogin"`
		Token            int    `json:"token"`
		UnassociatedCert string `json:"unassociatedCert"`
	} `json:"response"`
	ErrorCode int           `json:"error_code"`
	ErrorMsg  string        `json:"error_msg"`
	Warnings  []interface{} `json:"warnings"`
	Timestamp int           `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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