### Installing pyTenable via pip (Bash) Source: https://github.com/tenable/pytenable/blob/main/README.rst Installs the latest published version of the pyTenable library from PyPI using the pip package manager. ```bash pip install pytenable ``` -------------------------------- ### Installing pyTenable from GitHub (Bash) Source: https://github.com/tenable/pytenable/blob/main/README.rst Installs the bleeding-edge version of the pyTenable library directly from the GitHub repository using pip. Useful for testing the latest changes. ```bash pip install git+git://github.com/tenable/pytenable.git#egg=pytenable ``` -------------------------------- ### Install Dependencies (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/download_scans/readme.md Installs the necessary Python packages required by the script using the pip package manager and the provided requirements file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Test Prerequisites - bash Source: https://github.com/tenable/pytenable/blob/main/docs/testing.rst Installs the necessary development dependencies required to run the pyTenable test suite using pip and the provided dev-requirements.txt file. ```bash pip install -r dev-requirements.txt ``` -------------------------------- ### Install Dependencies (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vuln_export_csv_writer/readme.md Installs the required Python packages listed in the `requirements.txt` file using pip. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vulns_export_raw/readme.md Installs the required Python packages listed in the `requirements.txt` file using the pip package manager. ```bash pip install -r requirements.txt ``` -------------------------------- ### Installing Dependencies for Agent Export Tool (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/agent_export_csv_writer/readme.md Installs the required Python packages listed in `requirements.txt` using pip. This is the first step to set up the environment for running the agent export script. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies with pip (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/asset_export_csv_writer/readme.md Installs the necessary Python packages required by the script using pip, based on the dependencies listed in the requirements.txt file. ```bash pip install -r requirements.txt ``` -------------------------------- ### csvdownload.py Help Output (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/workbench_csv_download/readme.md Displays the command-line help documentation for the `csvdownload.py` script, detailing available arguments, filters, report types, and authentication options. ```bash ➜ ./csvdownload.py -h usage: csvdownload.py [-h] [--tio-access-key TIO_ACCESS_KEY] [--tio-secret-key TIO_SECRET_KEY] [-f FILTERS] [--filter-type {and,or}] [--report-type {diff,exec_summary,vuln_by_host,vuln_by_plugin,vuln_hosts_summary}] [--csv-file FILENAME] optional arguments: -h, --help show this help message and exit --tio-access-key TIO_ACCESS_KEY Tenable.io Access Key --tio-secret-key TIO_SECRET_KEY Tenable.io Secret Key -f FILTERS, --filter FILTERS Filter for the advanced filters in the IO vuln workbench. can be specified multiple times. --filter-type {and,or} Are filters inclusive or exclusive? --report-type {diff,exec_summary,vuln_by_host,vuln_by_plugin,vuln_hosts_summary} The type of CSV Report to run --csv-file FILENAME The CSV filename to use ``` -------------------------------- ### Configure & Run Tenable.io Live Tests - bash Source: https://github.com/tenable/pytenable/blob/main/docs/testing.rst Sets environment variables with Tenable.io API keys for admin and standard accounts, then runs the Tenable.io specific test suite using pytest, disabling VCR to interact with a live instance and generate a coverage report. ```bash export TIO_TEST_ADMIN_ACCESS="ADMIN_API_ACCESS_KEY_HERE" export TIO_TEST_ADMIN_SECRET="ADMIN_API_SECRET_KEY_HERE" export TIO_TEST_STD_ACCESS="STANDARD_ACCOUNT_ACCESS_KEY_HERE" export TIO_TEST_STD_SECRET="STANDARD_ACCOUNT_SECRET_KEY_HERE" pytest --disable-vcr --cov=tenable.io tests/io ``` -------------------------------- ### Display Command-Line Help (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vulns_export_raw/readme.md Shows the usage instructions and available command-line options for the `rawexport.py` script, detailing each parameter's purpose. ```bash Usage: rawexport.py [OPTIONS] OUTPUT Export -> RAW Writer Exports raw export chunks to a -vulns directory. Options: -a, --access-key TEXT Tenable.io API Access Key -s, --secret-key TEXT Tenable.io API Secret Key -d, --days-since INTEGER Vulnerability last indexed_at in days -p, --plugins TEXT Comma separated list of plugin(s) -l, --include-unlicensed Export findings from unlicensed assets -u, --uuid TEXT Vuln Export Uuid -w, --working-dir PATH Output directory to write vulns and debug -t, --threads INTEGER Number of CPU threads -z, --zip Zip results --help Show this message and exit. ``` -------------------------------- ### Agent Export Tool Command Line Help (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/agent_export_csv_writer/readme.md Displays the command-line usage instructions and available options for the `agentexport.py` script. This output provides details on required arguments (OUTPUT file) and optional flags like `--access-key`, `--secret-key`, `--health`, and `--debug`. ```bash Usage: agentexport.py [OPTIONS] OUTPUT Agent -> CSV Writer Exports agents to a CSV in the current directory. Options: -s, --access-key TEXT Tenable VM API Access Key -a, --secret-key TEXT Tenable VM API Secret Key -e, --health TEXT Comma separated list of agent health -d, --debug Enable debugging --help Show this message and exit. ``` -------------------------------- ### Configure & Run Tenable.sc Live Tests - bash Source: https://github.com/tenable/pytenable/blob/main/docs/testing.rst Sets environment variables with Tenable.sc connection details (host, user, password for security manager and admin accounts), then runs the Tenable.sc specific test suite using pytest, disabling VCR to interact with a live instance and generate a coverage report. ```bash export SC_TEST_HOST="TENABLE_SC_IP_OR_FQDN" export SC_TEST_USER="TENABLE_SC_SECMANAGER_USER" export SC_TEST_PASS="TENABLE_SC_SECMANAGER_PASSWORD" export SC_TEST_ADMIN_USER="TENABLE_SC_ADMIN_USER" export SC_TEST_ADMIN_PASS="TENABLE_SC_ADMIN_PASSWORD" pytest --disable-vcr --cov=tenable.sc tests/sc ``` -------------------------------- ### Listing Tenable.sc Vulnerabilities (Python) Source: https://github.com/tenable/pytenable/blob/main/README.rst Shows how to connect to the Tenable.sc API using pyTenable and list vulnerabilities, printing the IP, plugin ID, and plugin name for each. Requires the SC URL, access key, and secret key. ```python from tenable.sc import TenableSC sc = TenableSC(url='https://SC_URL', access_key='AKEY', secret_key='SKEY') for vuln in sc.analysis.vulns(): print('{ip}:{pluginID}:{pluginName}'.format(**vuln)) ``` -------------------------------- ### Listing Tenable.io Scans (Python) Source: https://github.com/tenable/pytenable/blob/main/README.rst Demonstrates how to connect to the Tenable.io API using pyTenable and list all available scans, printing their status, ID, UUID, and name. Requires access and secret keys. ```python from tenable.io import TenableIO tio = TenableIO(access_key='TIO_ACCESS_KEY', secret_key='TIO_SECRET_KEY') for scan in tio.scans.list(): print('{status}: {id}/{uuid} - {name}'.format(**scan)) ``` -------------------------------- ### Display Script Usage Help (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/asset_export_csv_writer/readme.md Shows the command-line help for the csvexport.py script, detailing available options, arguments, and their descriptions for customizing the export process. ```bash Usage: csvexport.py [OPTIONS] OUTPUT Export -> CSV Writer Generates a CSV File from the vulnerability export using the fields specified. Options: --tio-access-key TEXT Tenable.io API Access Key --tio-secret-key TEXT Tenable.io API Secret Key -f, --field TEXT Field to export to CSV -v, --verbose Logging Verbosity --created-at INTEGER Returns assets created after the specified unix timestamp --updated-at INTEGER Returns assets updated after the specified unix timestamp --terminated-at INTEGER Returns assets termninated after the specified unix timestamp --deleted-at INTEGER Returns assets deleted after the specified unix timestamp --last-authenticated-scan-time INTEGER Returns assets that have authenticated results after the specified unix timestamp --last-assessed INTEGER Returns assets assessed after the specified unix timestamp --has-plugin-results BOOLEAN Returns only assets with plugin results --tag ... Tag Key/Value pair to restrict the export to. --source TEXT Asset Source Data --chunk-size INTEGER The chunk size to use for exporting the data. --help Show this message and exit. ``` -------------------------------- ### Download Unsupported OS Vulnerabilities (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/workbench_csv_download/readme.md Downloads a CSV report for vulnerabilities where the plugin name matches 'Unsupported', saving the output to `unsupported.csv`. ```bash csvdownload -f plugin.name:match:Unsupported --csv-file unsupported.csv ``` -------------------------------- ### Download Nessus Scan Report (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/workbench_csv_download/readme.md Downloads a CSV report specifically for plugin ID 19506 (Nessus Scan Information) with Info severity, saving the output to `scan_reports.csv`. ```bash csvdownload -f plugin.id:eq:19506 -f severity:eq:Info --csv-file scan_reports.csv ``` -------------------------------- ### In-Tool Help Output (Text) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vuln_export_csv_writer/readme.md Displays the command-line usage and available options for the `csvexport.py` script, detailing parameters for filtering and configuration. ```text Usage: csvexport.py [OPTIONS] OUTPUT Export -> CSV Writer Generates a CSV File from the vulnerability export using the fields specified. Options: --tio-access-key TEXT Tenable.io API Access Key --tio-secret-key TEXT Tenable.io API Secret Key --severity TEXT Vulnerability Severity --last-found INTEGER Vulnerability Last Found Timestamp --cidr TEXT Restrict export to this CIDR range --tag ... Tag Key/Value pair to restrict the export to. --field TEXT Field to export to CSV -v, --verbose Logging Verbosity --help Show this message and exit. ``` -------------------------------- ### Basic Usage (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vuln_export_csv_writer/readme.md Runs the script with default settings, exporting all vulnerabilities to the specified output file. ```bash ./csvexport.py example.csv ``` -------------------------------- ### Run Offline Test Suite - bash Source: https://github.com/tenable/pytenable/blob/main/docs/testing.rst Executes the pyTenable test suite using pytest, configured to use pre-recorded API calls (VCRpy) and generate a coverage report for the 'tenable' package. ```bash pytest --vcr-record=none --cov=tenable tests ``` -------------------------------- ### Download High/Critical Vulns and Email (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/workbench_csv_download/readme.md Downloads a CSV report for vulnerabilities with High or Critical severity using an 'or' filter type, saves it to `high_and_crit.csv`, and then emails the file using the `mail` command. ```bash csvdownload -f severity:eq:High -f severity:eq:Critical --filter-type or \ --csv-file high_and_crit.csv mail -s 'High & Critical Vulns Report' user@company.tld -A high_and_crit.csv ``` -------------------------------- ### Export All Vulnerabilities (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vulns_export_raw/readme.md Runs the `rawexport.py` script using the provided access and secret keys to export all vulnerabilities with default settings. ```bash ./rawexport.py --access-key --secret-key ``` -------------------------------- ### Download Critical and Exploitable Vulnerabilities (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/workbench_csv_download/readme.md Downloads a CSV report containing vulnerabilities classified as Critical severity and having an available exploit, saving the output to `crit_and_exploit.csv`. ```bash csvdownload -f severity:eq:Critical \ -f plugin.attributes.exploit_available:eq:true \ --csv-file crit_and_exploit.csv ``` -------------------------------- ### Enabling pyTenable Debug Logging (Python) Source: https://github.com/tenable/pytenable/blob/main/README.rst Configures Python's built-in logging module to enable debug-level logging for pyTenable, which can be helpful for troubleshooting API interactions. ```python import logging logging.basicConfig(level=logging.DEBUG) ``` -------------------------------- ### Exporting All Tenable Agents to CSV (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/agent_export_csv_writer/readme.md Executes the `agentexport.py` script to retrieve all agents from Tenable VM and saves the output to a CSV file named `agents.csv`. Requires providing the Tenable API access and secret keys. ```bash ./agentexport.py --access-key --secret-key agents.csv ``` -------------------------------- ### Export Filtered Vulnerabilities (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vulns_export_raw/readme.md Runs the script with specific options: writes output to `/tmp`, filters by plugin IDs 187240 and 172360, includes vulnerabilities indexed within the last 180 days, and zips the final results. ```bash ./rawexport.py --access-key --secret-key -w /tmp -p 187240,172360 -d 180 -z ``` -------------------------------- ### Exporting Unknown Tenable Agents to CSV (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/agent_export_csv_writer/readme.md Runs the `agentexport.py` script to export agents with an 'UNKNOWN' health status to `agents.csv`. Requires API keys and filters specifically for the 'UNKNOWN' status. ```bash ./agentexport.py --access-key --secret-key --health 'UNKNOWN' agents.csv ``` -------------------------------- ### Run CSV Export Script (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/asset_export_csv_writer/readme.md Executes the csvexport.py script with default settings, specifying the desired output file name for the generated CSV. ```bash ./csvexport.py example.csv ``` -------------------------------- ### Exporting Healthy Tenable Agents to CSV (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/agent_export_csv_writer/readme.md Executes the `agentexport.py` script to retrieve and save only agents marked as 'HEALTHY' to `agents.csv`. Requires API keys and filters by the 'HEALTHY' status. ```bash ./agentexport.py --access-key --secret-key --health 'HEALTHY' agents.csv ``` -------------------------------- ### Advanced Usage with Filters and Fields (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/vuln_export_csv_writer/readme.md Runs the script, filtering for high and critical severity vulnerabilities and specifying only the `plugin.id`, `asset.uuid`, and `plugin.name` fields for the output CSV. ```bash ./csvexport.py -f plugin.id -f asset.uuid -f plugin.name \\ --severity high --severity critical example2.csv ``` -------------------------------- ### Exporting Unhealthy Tenable Agents to CSV (Bash) Source: https://github.com/tenable/pytenable/blob/main/examples/io/agent_export_csv_writer/readme.md Runs the `agentexport.py` script to filter and export only agents with 'WARNING' or 'CRITICAL' health statuses to `agents.csv`. Requires API keys and specifies the desired health statuses. ```bash ./agentexport.py --access-key --secret-key --health 'WARNING,CRITICAL' agents.csv ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.