https://github.com/palantir/tenablesc-client
A Golang-based API client for Tenable.SC
https://github.com/palantir/tenablesc-client
octo-correct-managed
Last synced: 9 months ago
JSON representation
A Golang-based API client for Tenable.SC
- Host: GitHub
- URL: https://github.com/palantir/tenablesc-client
- Owner: palantir
- License: other
- Created: 2022-07-20T16:47:00.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2024-09-11T22:45:04.000Z (over 1 year ago)
- Last Synced: 2024-09-12T08:54:33.322Z (over 1 year ago)
- Topics: octo-correct-managed
- Language: Go
- Homepage:
- Size: 553 KB
- Stars: 9
- Watchers: 193
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: changelog/0.1.0/pr-10.v2.yml
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Tenable.SC Client
## Overview
This is a golang client for interacting with the Tenable.SC API.
Use cases include automating asset creation, metric gathering, and general configuration management.
Not all endpoints are implemented, pull requests are welcome!
## Usage Example
```go
package main
import (
"fmt"
"os"
"github.palantir.build/arch/tenablesc-client/tenablesc"
)
func main() {
client := tenablesc.NewDefaultAPIKeyClient(
// SC_URL should be the full URL to the API base;
// Typically this is https://FQDN/rest
os.Getenv("SC_URL"),
// Access and Secret keys are generated from the Users
// UI in Tenable.SC.
os.Getenv("SC_ACCESS_KEY"),
os.Getenv("SC_SECRET_KEY"),
)
_, err := client.GetCurrentUser()
if err != nil {
fmt.Errorf("unable to authenticate to SC: %w", err)
os.Exit(1)
}
var analysisResult []tenablesc.VulnSumIPResult
// Composing the query structs is a combination of reading the docs
// and using browser Developer Tools to identify the right fields by
// building the queries in the UI.
err := client.Analyze(&tenablesc.Analysis{
Type: "vuln",
Query: tenablesc.AnalysisQuery{
Type: "vuln",
SourceType: "cumulative",
Tool: "sumip",
Filters: []tenablesc.AnalysisFilter{
{
FilterName: "repository",
Operator: "=",
Value: []map[string]string{
{
// if this weren't an example, I'd recommend looking up your
// repo ID first. your accessible repos may vary.
"id": "1",
},
},
},
},
},
SourceType: "cumulative",
SortField: "score",
SortDirection: "desc",
},
&analysisResult,
)
if err != nil {
fmt.Errorf("couldn't get list of vulnerabilities: %w", err)
os.Exit(1)
}
fmt.Printf("%+$v", analysisResult)
}
```
### References
- [Tenable.SC Vendor Product page](https://www.tenable.com/products/tenable-sc)
- [Tenable.SC API docs](https://docs.tenable.com/tenablesc/api/index.htm)