Skip to content

markteicher/BitSight_SDK_CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ BitSight SDK + CLI

A Software Developer's Kit and Command Line Interpreter interface for Bitsight Security Ratings.

Bitsight, a leading cyber risk intelligence company, provides objective, data-driven security ratings and analytics to help organizations manage digital risks, particularly with third parties. Their platform continuously analyzes external data to score companies' security postures, identify vulnerabilities, and benchmark performance, helping businesses make informed decisions about vendors, cyber insurance, and overall security strategy.

What it does:

Security Ratings: Assigns objective, data-backed scores (from 250-900) to organizations, reflecting their cybersecurity health.

Third-Party Risk Management (TPRM): Assesses the risk introduced by vendors, clients, and partners, helping companies manage supply chain vulnerabilities.

Attack Surface Management: Maps and monitors an organization's entire digital footprint to find exposures.

Benchmarking: Allows companies to compare their security performance against peers and industry standards.

Risk Quantification: Provides data to help understand the financial impact of cyber risk.

This application is built to export data via the extensive BitSight API for writing it into Microsoft SQL Server (MSSQL) using a 1:1 physical table representation of BitSight endpoints.

⚠️ Disclaimer

This tool is not an official BitSight product.

Use of this software is not covered by any license, warranty, or support agreement you may have with BitSight. All functionality is implemented independently using publicly available Bitsight API Documentation: https://help.bitsighttech.com/hc/en-us/articles/231872628-API-Documentation-Overview


βœ… Help and discovery

Running any of the following prints the full command tree (all commands + subcommands):

  • bitsight-cli --help
  • bitsight-cli -h
  • bitsight-cli help

πŸšͺ Exit / quit

The CLI supports explicit exit commands:

  • bitsight-cli exit
  • bitsight-cli quit
  • x
  • q

On exit/quit it prints:

Thank you for using the BitSight CLI


βš™οΈ Global options

These options apply to all commands (when present on the CLI):

Option Description
--verbose Enable debug logging
--no-progress Disable progress bars
--api-key BitSight API token (HTTP Basic Auth username)
--base-url BitSight API base URL (e.g., https://api.bitsighttech.com)
--proxy-url Proxy URL (e.g., http://proxy:8080)
--timeout HTTP timeout (seconds)

🧭 Command taxonomy

The BitSight CLI is organized into two planes:

A) Control plane (changes state)

  • config β€” configuration management
  • db β€” database initialization / maintenance
  • ingest β€” API β†’ database ingestion

B) Inspection plane (observes state)

  • show β€” query data already in the database (planned/next)
  • stats β€” summarize database contents (planned/next)
  • health β€” connection + schema + ingestion status checks (planned/next)

show/stats/health are part of the agreed taxonomy and are wired after the control plane is complete.


πŸ” config commands

Command Purpose
bitsight-cli config init Create initial config state
bitsight-cli config show Display current config
bitsight-cli config validate Validate config + connectivity
bitsight-cli config reset Reset config to defaults
bitsight-cli config clear-keys Clear stored secrets/keys
bitsight-cli config set ... Set config fields

config set flags:

  • --api-key
  • --base-url
  • --proxy-url
  • --proxy-username
  • --proxy-password
  • --timeout

πŸ—„οΈ db commands (MSSQL only)

Initialize schema

bitsight-cli db init --mssql --server <server> --database <db> --username <user> --password <pass> --schema-path db/schema/mssql.sql

Flush data

# Flush one table
bitsight-cli db flush --mssql --server <server> --database <db> --username <user> --password <pass> --table bitsight_users

# Flush all BitSight tables
bitsight-cli db flush --mssql --server <server> --database <db> --username <user> --password <pass> --all

Status

bitsight-cli db status

πŸ“₯ ingest commands

Each ingest command maps to a BitSight API endpoint and writes results into its corresponding MSSQL table(s).

Users

  • bitsight-cli ingest users
  • bitsight-cli ingest user-details --user-guid <guid>
  • bitsight-cli ingest user-quota
  • bitsight-cli ingest user-company-views

Companies

  • bitsight-cli ingest companies
  • bitsight-cli ingest company-details --company-guid <guid>

Portfolio

  • bitsight-cli ingest portfolio
  • bitsight-cli ingest portfolio-details --company-guid <guid>
  • bitsight-cli ingest portfolio-contacts
  • bitsight-cli ingest portfolio-public-disclosures

Ratings

  • bitsight-cli ingest current-ratings
  • bitsight-cli ingest current-ratings-v2
  • bitsight-cli ingest ratings-history --company-guid <guid> --since <date> [--backfill]

Findings & observations

  • bitsight-cli ingest findings --company-guid <guid> --since <date> [--expand <value>]
  • bitsight-cli ingest observations --company-guid <guid> --since <date>

Threat intelligence / threats

  • bitsight-cli ingest threats
  • bitsight-cli ingest threat-exposures`

Alerts

  • bitsight-cli ingest alerts --since <date>

Credentials

  • bitsight-cli ingest credential-leaks
  • bitsight-cli ingest exposed-credentials

🧩 ingest-group commands

Grouped ingestion runs multiple ingestion commands in sequence:

  • bitsight-cli ingest-group core
  • bitsight-cli ingest-group security
  • bitsight-cli ingest-group all

(These groupings are explicitly wired.)


πŸ—‚οΈ Directory structure

BitSight_SDK_CLI/
β”œβ”€β”€ cli.py
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ ingestion.py
β”‚   β”œβ”€β”€ status_codes.py
β”‚   β”œβ”€β”€ exit_codes.py
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ db_router.py
β”‚   └── database_interface.py
β”œβ”€β”€ db/
β”‚   β”œβ”€β”€ init.py
β”‚   β”œβ”€β”€ mssql.py
β”‚   └── schema/
β”‚       └── mssql.sql 
β”œβ”€β”€ ingest/
β”‚   β”œβ”€β”€ alerts.py
β”‚   β”œβ”€β”€ asset_risk_matrix.py
β”‚   β”œβ”€β”€ asset_summaries.py
β”‚   β”œβ”€β”€ assets.py
β”‚   β”œβ”€β”€ base.py
β”‚   β”œβ”€β”€ client_access_links.py
β”‚   β”œβ”€β”€ companies.py
β”‚   β”œβ”€β”€ company_details.py
β”‚   β”œβ”€β”€ company_findings_summary.py
β”‚   β”œβ”€β”€ company_infrastructure.py
β”‚   β”œβ”€β”€ company_overview_report.py
β”‚   β”œβ”€β”€ company_products.py
β”‚   β”œβ”€β”€ company_products_post.py
β”‚   β”œβ”€β”€ company_relationships.py
β”‚   β”œβ”€β”€ company_requests.py
β”‚   β”œβ”€β”€ current_ratings.py
β”‚   β”œβ”€β”€ current_ratings_v2.py
β”‚   β”œβ”€β”€ findings.py
β”‚   β”œβ”€β”€ findings_statistics.py
β”‚   β”œβ”€β”€ observations.py
β”‚   β”œβ”€β”€ portfolio.py
β”‚   β”œβ”€β”€ ratings_history.py
β”‚   β”œβ”€β”€ threats.py
β”‚   β”œβ”€β”€ threat_statistics.py
β”‚   β”œβ”€β”€ threats_impact.py
β”‚   β”œβ”€β”€ threats_evidence.py
β”‚   β”œβ”€β”€ user_company_views.py
β”‚   β”œβ”€β”€ user_details.py
β”‚   β”œβ”€β”€ users.py
β”‚   └── users_quota.py


🧱 Database schema

MSSQL schema file:

  • db/schema/mssql.sql

Tables store raw_payload as NVARCHAR(MAX) to preserve the full API response alongside typed columns.


Support

License

#MIT License

#Copyright (c) 2025 Mark Teicher

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.