Skip to content
Tenable.io SDK offers a scalable and safe way to integrate with the Tenable.io platform.
Java
Branch: master
Clone or download
tenableAndrew Merge pull request #54 from tenable/api-and-jackson-fixes
Fix for Jackson.core 2.10 compile issues and API inconsistencies
Latest commit c336a99 Aug 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper changed permissions Aug 21, 2017
src field is named outputs not output Aug 14, 2019
.gitignore * Added support for bulk operations. Nov 29, 2017
Jenkinsfile Build/api bump (#40) May 16, 2018
LICENSE Initial commit Feb 3, 2017
build.gradle Set release version Aug 13, 2019
changelog.md Set release version Aug 13, 2019
gradlew changed permissions Aug 21, 2017
gradlew.bat changed permissions Aug 21, 2017
readme.md Update readme.md May 15, 2017
settings.gradle Initial commit Feb 3, 2017

readme.md

Tenable.io Java SDK

Tenable.io Java SDK

For you Pythonistas, check out Tenable.io SDK for Python: https://github.com/tenable/Tenable.io-SDK-for-Python

Configuration

Access key and secret key are needed to authenticate with the [Tenable Cloud API]. There are three ways to configure the TenableIoClient with the keys.

TenableIoClient Constructor Arguments

TenableIoClient client = new TenableIoClient( 'YOUR_ACCESS_KEY', 'YOUR_SECRET_KEY' );

Environment Variables

TenableIoClient looks for the environment variables TENABLEIO_ACCESS_KEY and TENABLEIO_SECRET_KEY. When defined, the TenableIoClient can be created without parameters:

TenableIoClient client = new TenableIoClient();

Other environment variables:

  • TENABLEIO_EXPORT_DIRECTORY: path to a folder that will be used to export temporary files. If not specified, the default OS "temp" folder will be used. See also JVM property tenableIoExportDirectory.
  • TENABLE_IO_SCHEME: Optional. Tenable IO base API URL scheme, either http or https. Defaults to https.
  • TENABLE_IO_HOST: Optional. Tenable IO base API URL hostname. Defaults to cloud.tenable.com.

JVM system properties

TenableIoClient looks for the JVM system properties tenableIoAccessKey and tenableIoSecretKey. They are set like any other JVM system properties, with the -D command line option, for isntance:

java -DtenableIoAccessKey=<YOUR ACCESS KEY> -DtenableIoSecretKey=<YOUR SECRET KEY>

When defined, the TenableIoClient can be created without parameters:

TenableIoClient client = new TenableIoClient();

Other JVM system properties:

  • tenableIoExportDirectory: path to a folder that will be used to export temporary files. If not specified, the default OS "temp" folder will be used. See also environment variable TENABLEIO_EXPORT_DIRECTORY.
  • tenableIoScheme: Optional. Tenable IO base API URL scheme, either http or https. Defaults to https.
  • tenableIoHost: Optional. Tenable IO base API URL hostname. Defaults to cloud.tenable.com.

NOTE: The JVM system properties have priority over the environment variables.

Java Version

1.7+

Development

The Tenable IO SDK uses the Gradle build tool and has to following dependencies:

org.apache.httpcomponents.httpasyncclient => version:4.1.2
org.apache.httpcomponents.httpmime => version: 4.5.2
com.fasterxml.jackson.core.jackson-core => version: 2.0.0 or above
com.fasterxml.jackson.core.jackson-annotations => version: 2.0.0 or above
com.fasterxml.jackson.core.jackson-databind => version: 2.0.0 or above
org.slf4j.slf4j-api => version: '1.7.23'

Logging

The Tenable IO SDK uses SLF4J for logging so you can use your preferred logging framework by simply dropping the corresponding SLF4J binding. More info: https://www.slf4j.org/manual.html.

Run Tests

To run the tests, edit the build.gradle and update the test block with your information:

test {
    // Access key and secret
    jvmArgs "-DtenableIoAccessKey=<ACCESS KEY>"
    jvmArgs "-DtenableIoSecretKey=<ACCESS SECRET>"
    // A valid domain name for username, for instance "tenable.com"
    jvmArgs "-DuserDomainName=<YOUR DOMAIN>"
    // Comma-separated list of host targets to create a scan with. (Warning: do not scan targets that you're not authorized to.)
    jvmArgs "-DscanTextTargets=<SCAN_TEXT_TARGETS>"
    // Comma-separated list of host alternative targets to launch a scan with. (Warning: do not scan targets that you're not authorized to.)
    jvmArgs "-DscanAltTargets=<SCAN_ALT_TARGETS>"
    // Name of template to create a scan with.
    jvmArgs "-DscanTemplateName=discovery"
    // Name of template to create a policy with.
    jvmArgs "-DpolicyTemplateName=discovery"
    // Optional, Tenable IO base API URL scheme and hostname
    jvmArgs "-DtenableIoScheme=https"
    jvmArgs "-DtenableIoHost=cloud.tenable.com"
}

Note: alternatively, you can also define your Access and Secret key by setting the environment variables TENABLEIO_ACCESS_KEY and TENABLEIO_SECRET_KEY, either at the bash level (in which case they can be taken out of the test block) or directly in the test block:

test {
    environment "TENABLEIO_ACCESS_KEY", "YOUR ACCESS KEY"
    environment "TENABLEIO_SECRET_KEY", "YOUR SECRET KEY"
    // A valid domain name for username, for instance "tenable.com"
    jvmArgs "-DuserDomainName=<YOUR DOMAIN>"
            ...
            ...
}

To run the tests, execute the following command from the project root

$ gradle test

Documentation

Generate HTML documentation. Run the following command from the project root. HTML docs will get generated in build/docs/javadoc

$ gradle javadoc
You can’t perform that action at this time.