ManySecured d3-cli
Utility cli for ManySecured-D3 claims
Installation
This api may be installed using pip like so:
pip install d3-cli
When developing these scripts, Python Poetry is used to install and manage dependencies as well as publish to PyPI.
Poetry will create a python isolated virtual environment in the ./.venv folder and install dependencies if you run:
poetry install
You cannot run the cli or scripts directly from the ./src/d3-scripts since we are using Python relative imports.
Instead, you must run the d3-cli script defined in the [tool.poetry.scripts] field of pyproject.toml: You can run the command line interface locally, directly from source code without building/installing by running poetry run d3-cli.
Usage
usage: d3-cli [-h] [--version] [--guid] [--output [OUTPUT]] [--mode [{build,lint,export,website}]] [--skip-mal]
[--build-dir [BUILD_DIR]] [--check_uri_resolves] [--web-address [WEB_ADDRESS]] [--verbose | --quiet]
[input ...]
ManySecured D3 CLI for creating, linting and exporting D3 claims
positional arguments:
input folders containing D3 YAML files.
optional arguments:
-h, --help show this help message and exit
--version show the version and exit.
--guid, --uuid generate and show guid and exit.
--output [OUTPUT], -o [OUTPUT]
directory in which to output built claims.
--mode [{build,lint,export,website}], -m [{build,lint,export,website}]
mode to run d3-cli in.
build creates a directory of D3 claims in json format, with the parent and child types resolved, and CVEvulnerabilities added.
lint lints the claims to check they confirm to the yaml syntax and schemas.
export creates a directory with the CSVs of the tables of types, behaviours andfirmwares.
website creates a directory containing the source for a static website of claims which can be browsed,with unique uris for each type.
--skip-mal skip malicious url lookup.
This takes a bit of time, and requires an internet connection
so you may wish to skip this step for local testing.
--build-dir [BUILD_DIR]
build directory with json claims to export to build website with.
Specifying this will skip build step in export mode and website mode.
--check_uri_resolves check that URIs/refs resolve.
This can be very slow, so you may want to leave this off normally.
--web-address [WEB_ADDRESS]
web address to use for website build
--verbose, -v
--quiet, -q
Example: d3-cli ./manufacturers
Tests
Tests can be run via:
poetry run pytest
Publish
The d3-cli utility is published here.
In order to publish you must run:
poetry build
poetry publish
And then enter the credentials for the NquiringMinds pypi account.
D3 type explorer web page
This static page is generated from (post-processed) D3 statements and hosted here. This site relies upon two Github actions in the D3DB repository
- Run D3 Build of website for github pages - processes all files, exporting html files
- Publish website (main-branch only) deploys the pelecan site to Github pages
In order for the pelican graphviz plugin which generates the digraph's in the webpage to work you need to have graphviz installed on your pc. For linux machines this can be done with sudo apt install graphviz, for windows graphviz installers may be downloaded from here.
Running Locally
To generate the site files inside a defined directory:
cd d3-cli
poetry install
poetry run d3-cli --mode website "path-to-d3-yaml-files" --output "output-file"
serving the static site:
cd "output-file"/output
python -m http.server 8000
Metadata
Release files for d3-cli 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| d3_cli-0.2.5.tar.gz | 31.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| d3_cli-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.3 kB
Release files / d3_cli-0.2.5.tar.gz
| Download URL | d3_cli-0.2.5.tar.gz |
|---|---|
| Size | 31.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e937dbb360fae478faf8dfacf66dea6fddc7ba3d3e96589a9c788eeec487d200
|
|
BLAKE2b-256 checksum How to use checksums |
2604a8ab968e4e34a58a9a166f627f0d02b8c4a09301114dbfa7d434a3b5a833
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.9.7 Linux/5.15.0-67-generic
|
Release files / d3_cli-0.2.5-py3-none-any.whl
| Download URL | d3_cli-0.2.5-py3-none-any.whl |
|---|---|
| Size | 40.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96dd9105b9f642d7cf290e6e951e487b1c590707bc7b3a18bcbf79ede21a3d26
|
|
BLAKE2b-256 checksum How to use checksums |
cf1e94ebc8fde87b0a8eeef115f51b9514cef67a8dda456f6be2e33550a2382a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.9.7 Linux/5.15.0-67-generic
|