Skip to content

Commands

What is it ?

This folder containes the code that is responsible for the different commands that can be used by the user in a CLI (command line interface).

How does it work ?

How to use it ?

If you choosed to install the application manually, you can use commands in you CLI as follows:

#Example
$ opencve create-user john john.doe@example.com --admin

If you chose to install the application with docker, you can use the following commands:

#Example
$ docker exec -it webserver opencve create-user john john.doe@example.com --admin

The import functions

Those functions are stored int the import folder and are responsible for importing the data from the NIST database.

You may be familiar with the import_data function that is used to import the data from the NIST database when you install the application.

Note

Every function must be declared in the opencve/cli.py file as follows:

cli.add_command(import_data)

Here is how it is declared as an example :

# Example
@click.command()
@click.option("--confirm", is_flag=True, help="Automatically confirm the prompt.")
@ensure_config
@with_appcontext
def import_data(confirm):
    """
    Perform initial imports (cve, cwe, cpe).
    """
    # Code to import the data...

Other CLI functions

Those functions name are pretty self-explanatory, here is the list :

  • add_product_to_category.py
  • celery.py
  • create_category.py
  • create_table.py
  • create_user.py
  • read_excel.py
  • upgrade_db
  • utils.py
  • webserver.py