Database
Database connection
Database helpers
Generic database functions
- class CveXplore.database.helpers.generic_db.GenericDatabaseFactory(collection)[source]
Bases:
DatasourceConnection
The GenericDatabaseFactory handles the creation of general, collection based, functions which provide an instance of CveXplore functions that apply to the given collection.
- __init__(collection)[source]
Create a new GenericDatabaseFactory and create field specific functions based on the __default_fields and the __fields_mapping.
- field_list(*doc_ids)[source]
Method to fetch all field names from a specific collection
- Return type:
list
- mget_by_id(*doc_ids)[source]
Method to fetch a specific collection entry via it’s id number
- Return type:
Union
[Iterable
[CveXploreObject
],Iterable
]
- class CveXplore.database.helpers.generic_db.GenericDatabaseFieldsFunctions(field, collection)[source]
Bases:
DatasourceConnection
The GenericDatabaseFieldsFunctions handles the creation of general, field based, functions
Specific database functions
- class CveXplore.database.helpers.specific_db.CWEDatabaseFunctions(collection)[source]
Bases:
GenericDatabaseFactory
The CWEDatabaseFunctions is a specific class that provides the cwe attribute of a CveXplore instance additional functions that only apply to the ‘cwe’ collection
- class CveXplore.database.helpers.specific_db.CapecDatabaseFunctions(collection)[source]
Bases:
GenericDatabaseFactory
The CapecDatabaseFunctions is a specific class that provides the capec attribute of a CveXplore instance additional functions that only apply to the ‘capec’ collection
- class CveXplore.database.helpers.specific_db.CpeDatabaseFunctions(collection)[source]
Bases:
GenericDatabaseFactory
The CpeDatabaseFunctions is a specific class that provides the cpe attribute of a CveXplore instance additional functions that only apply to the ‘cpe’ collection
- __init__(collection)[source]
Create a new GenericDatabaseFactory and create field specific functions based on the __default_fields and the __fields_mapping.
- find_active_cpes(field, value, limit=0, sorting=1)[source]
Function to find cpe based on value in string. Only active (deprecated == false) cpe records are returned.
- Return type:
Optional
[List
[CveXploreObject
]]
- search_active_cpes(field, value, limit=0, sorting=1)[source]
Function to regex search for cpe based on value in string. Only active (deprecated == false) cpe records are returned.
- Return type:
Optional
[List
[CveXploreObject
]]
- class CveXplore.database.helpers.specific_db.CvesDatabaseFunctions(collection)[source]
Bases:
GenericDatabaseFactory
The CvesDatabaseFunctions is a specific class that provides the cves attribute of a CveXplore instance additional functions that only apply to the ‘cves’ collection
- __init__(collection)[source]
Create a new GenericDatabaseFactory and create field specific functions based on the __default_fields and the __fields_mapping.
- get_by_id(doc_id)[source]
Method to retrieve a single CVE from the database by its CVE ID number. The number format should be either CVE-2000-0001, cve-2000-0001 or 2000-0001.
- get_cves_for_vendor(vendor, limit=0)[source]
Function to return cves based on a given vendor. By default, to result is sorted descending on th cvss field.
- Return type:
Optional
[List
[CveXploreObject
]]
Mongodb specific
- class CveXplore.database.helpers.cvesearch_mongo_database.CveSearchCollection(database, name, **kwargs)[source]
Bases:
Collection
The CveSearchCollection is a custom Collection based on the pymongo Collection class which has been altered to return a CveSearchCursor reference on the find method.
- class CveXplore.database.helpers.cvesearch_mongo_database.CveSearchCursor(collection, *args, **kwargs)[source]
Bases:
Cursor
The CveSearchCursor is a custom cursor based on the pymongo cursor which will return database objects instead of the raw data from the mongodb database.
- __next__()
Advance the cursor and return CveXplore objects