Skip to content

tenable/asm-python-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bit Discovery Python scripts

These scripts demonstrate how you can integrate your work with the Bit Discovery API.

To run these scripts, you have to have Python 3.6+ installed on your computer and your Bit Discovery API keys for an inventory. (You can get this on your Bit Discovery profile page.) The best way is to save your API key to a variable and reuse it for every script.

APIKEY=eyJh...hUFs
python pdf-report.py $APIKEY

If you need more information about the options of any script, just see the help message:

python pdf-report.py --help

PDF Report

The pdf-report.py script exports the assets from one or all of your inventories (--multiple flag), and creates a PDF file analysis based on the inventory data.

Usage

Install the dependencies:

pip install argparse datetime fpdf2 matplotlib pypdf2 requests

Create a pdf report by passing the inventory api key:

python3 pdf-report.py $APIKEY

If you want to create a pdf report for every inventory you own, you can pass the --multiple flag:

python3 pdf-report.py $APIKEY --multiple

Auto add assets

The auto-add-assets.py script can search your cloud provider, AWS, Google Cloud or Azure (using their respective command-line tools), and add your running instances to the provided inventory.

Usage

For this script you need to have and be signed in to the command-line interfaces of your cloud provider of choice. For AWS, install the AWS CLI, for GCP Cloud the gcloud CLI and for Azure az.

After that, install the Python dependencies:

pip install argparse datetime requests sh

Read your running EC2 instances and buckets from your AWS account:

python3 auto-add-assets.py amazon-ec2 $APIKEY

Similarly for Google Cloud and Azure:

# GCP
python3 auto-add-assets.py google-cloud $APIKEY
# Azure
python3 auto-add-assets.py azure $APIKEY

Delete ip or source

The delete-ip.py script deletes one specific IP or source from your inventory.

Usage

First, install the Python dependencies:

pip install argparse requests sh

Delete an IP or a source (with its id) from the given inventory:

python3 delete-ip.py ip 1.1.1.1 $APIKEY
python3 delete-ip.py source 13 $APIKEY

About

Bit Discovery REST API scripts

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages