gotenable

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 12 Imported by: 0

README

GoTenable

GoTenable is a Go library for interfacing with Tenable product APIs.

Getting Started

Tenable.io

package main

import (
	"github.com/andrewspearson/gotenable/gotenableutils"
	"github.com/andrewspearson/gotenable/tenableio"
)

func main() {
	config := tenableio.Config{}
	config.AccessKey = `ACCESS_KEY`
	config.SecretKey = `SECRET_KEY`

	tio := tenableio.New(config)

	resp := tio.Get(`/scans`)

	gotenableutils.PPrintJSON(resp.Body)
}

Tenable.sc

package main

import (
	"github.com/andrewspearson/gotenable/gotenableutils"
	"github.com/andrewspearson/gotenable/tenablesc"
)

func main() {
	config := tenablesc.Config{}
	config.BaseURL = `https://tenablesc.company.local`
	config.AccessKey = `ACCESS_KEY`
	config.SecretKey = `SECRET_KEY`

	tsc := tenablesc.New(config)

	resp := tsc.Get(`/scan`)

	gotenableutils.PPrintJSON(resp.Body)
}

Downloads

package main

import (
	"github.com/andrewspearson/gotenable/downloads"
	"github.com/andrewspearson/gotenable/gotenableutils"
)

func main() {
	config := downloads.Config{}
	config.BearerToken = `BEARER_TOKEN`

	dl := downloads.New(config)

	resp := dl.Get(`/pages`)

	gotenableutils.PPrintJSON(resp.Body)
}

Documentation

See DOCUMENTATION.md for complete details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = LeveledLog{}

Create leveled logging

View Source
var ValidKeyHex20 = regexp.MustCompile(`^[a-f0-9]{20}$`)
View Source
var ValidKeyHex32 = regexp.MustCompile(`^[a-f0-9]{32}$`)
View Source
var ValidKeyHex64 = regexp.MustCompile(`^[a-f0-9]{64}$`)
View Source
var ValidTOTP = regexp.MustCompile(`^[0-9]{6}$`)

RegExes for input validation

Functions

func HTTPTransportConfig

func HTTPTransportConfig(proxy string, cert string, insecureSkipVerify bool) *http.Transport

Types

type Config

type Config struct {
	BaseURL            string
	Proxy              string
	Cert               string
	InsecureSkipVerify bool
}

Client models that will be inherited

type LeveledLog

type LeveledLog struct {
	Logger      *log.Logger
	LevelFilter *logutils.LevelFilter
}

gotenable models for global settings

type Request

type Request struct {
	HTTPClient  *retryablehttp.Client
	HTTPHeaders http.Header
	BaseURL     string
}

func RequestDefaults

func RequestDefaults() Request

RequestDefaults sets default values on new Request objects

type Response

type Response struct {
	Resp *http.Response
	Body []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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