A command-line interface (CLI) client for interacting with the JupiterOne API. This tool allows you to execute J1QL queries against your JupiterOne account and output the results in JSON or CSV format.
- Python 3.6 or later
- A JupiterOne account with an API token
-
Clone the repository:
git clone https://github.com/jmountifield/jupiterone-cli-client.git cd jupiterone-cli-client
-
Install the required dependencies:
pip install -r requirements.txt
-
Install the CLI tool:
pip install .
Once installed, you can use the CLI client by running the jupiterone-cli
command followed by the necessary arguments.
--account-id
(Required): The ID of your JupiterOne account.--token
(Required): Your API token for authentication.--api-url
(Optional): The URL of the JupiterOne API. Defaults tohttps://api.us.jupiterone.io
.--output
(Optional): Output format, eithercsv
orjson
. Defaults tocsv
.--include-deleted
(Optional): Include deleted entities in the query results.query
(Positional, Required): The J1QL query to execute.
-
Basic Query with JSON Output:
jupiterone-cli --account-id your_account_id --token your_api_token "FIND * LIMIT 1" --output json
-
Query with CSV Output:
jupiterone-cli --account-id your_account_id --token your_api_token "FIND * LIMIT 1" --output csv > output.csv
-
Include Deleted Entities:
jupiterone-cli --account-id your_account_id --token your_api_token --include-deleted "FIND * LIMIT 1" --output json
- JSON: The results will be printed to stdout in JSON format.
- CSV: The results will be printed to stdout in CSV format. You can redirect the output to a file using
> output.csv
.
Unit tests are provided to ensure the CLI client works as expected.
-
Install the test dependencies:
pip install coverage
-
Run the tests with coverage:
coverage run -m unittest discover -s tests
-
Generate a coverage report:
coverage report
-
Optionally, generate an HTML coverage report:
coverage html
Open
htmlcov/index.html
in your web browser to view the coverage details.
Contributions are welcome! Please fork the repository and create a pull request with your changes. Ensure your code is well-documented and covered by tests.
-
Clone the repository:
git clone https://github.com/jmountifield/jupiterone-cli-client.git
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Make your changes and add tests as necessary.
This project is licensed under the MIT License. See the LICENSE file for details.