Core

Main

class CveXplore.main.CveXplore(mongodb_connection_details=None, api_connection_details=None)[source]

Bases: object

Main class for CveXplore package

__init__(mongodb_connection_details=None, api_connection_details=None)[source]

Create a new instance of CveXplore

Parameters
  • mongodb_connection_details (dict) – Provide the connection details needed to establish a connection to a mongodb instance. The connection details should be in line with pymongo’s documentation.

  • api_connection_details (dict) – Provide the connection details needed to establish a connection to a cve-search API provider. The cve-search API provider should allow access to the ‘query’ POST endpoint; all other API endpoints are not needed for CveXplore to function. For the connection details supported please check the API connection documentation.

__repr__()[source]

String representation of object

capec_by_cwe_id(cwe_id)[source]

Method to retrieve capecs related to a specific CWE ID

Parameters

cwe_id – String representing the CWE id; e.g. ‘15’

Returns

List with Capecs

Return type

list

cve_by_id(cve_id)[source]

Method to retrieve a single CVE from the database by it’s CVE ID number

Parameters

cve_id (str) – String representing the CVE id; e.g. CVE-2020-0001

Returns

CVE object

Return type

Cves

cves_for_cpe(cpe_string)[source]

Method for retrieving Cves that match a single CPE string. By default the search will be made matching the configuration fields of the cves documents.

Parameters

cpe_string (str) – CPE string: e.g. cpe:2.3:o:microsoft:windows_7:*:sp1:*:*:*:*:*:*

Returns

List with Cves

Return type

list

get_db_content_stats()[source]

Property returning the stats from the database. Stats consist of the time last modified and the document count per cvedb store in the database.

Returns

Statistics

Return type

dict

get_multi_store_entries(*queries, limit=10)[source]

Method to perform multiple queries on a single or multiple collections in the data source and return the results.

Parameters

queries (list) – A list of tuples which contains the entry_type and the dict_filter. Choices for entry_type: - capec; - cpe; - cwe; - via4; - cves; dict_filter is a dictionary representing a filter according to pymongo documentation. example: get_multi_store_entries([(“CWE”, {“id”: “78”}), (“cves”, {“id”: “CVE-2009-0018”})])

Returns

Queried results in a single list

Return type

list

get_single_store_entries(query, limit=10)[source]

Method to perform a query on a single collection in the data source and return all of the results.

Parameters
  • query (tuple) – Tuple which contains the entry_type and the dict_filter in a tuple. Choices for entry_type: - capec; - cpe; - cwe; - via4; - cves; dict_filter is a dictionary representing a filter according to pymongo documentation. example: get_single_store_entries((“CWE”, {“id”: “78”}))

  • limit (int) – Limit the amount of returned results, defaults to 10

Returns

list with queried results

Return type

list

get_single_store_entry(entry_type, dict_filter={})[source]

Method to perform a query on a single collection in the data source and return a single result.

Parameters
  • entry_type (str) – Which specific store are you querying? Choices are: - capec; - cpe; - cwe; - via4; - cves;

  • dict_filter (dict) – Dictionary representing a filter according to pymongo documentation

Returns

Objectified result from the query

Return type

object

last_cves(limit=10)[source]

Method to retrieve the last entered / changed cves. By default limited to 10.

Returns

List with Cves

Return type

list

property version

Property returning current version