Common
General tools and converters
CPE Converters
- CveXplore.common.cpe_converters.from2to3CPE(cpe, autofill=False)[source]
Method to transform cpe2.2 to cpe2.3 format
- Parameters
cpe (str) – cpe2.2 string
autofill (bool) – Whether to cpe string should be autofilled with double quotes and hyphens
- Returns
cpe2.3 formatted string
- Return type
str
- CveXplore.common.cpe_converters.from3to2CPE(cpe)[source]
Method to transform cpe2.3 to cpe2.2 format
- Parameters
cpe (str) – cpe2.3 string
- Returns
cpe2.2 string
- Return type
str
Data source connection
- class CveXplore.common.data_source_connection.DatasourceConnection(collection)[source]
Bases:
object
The DatasourceConnection class handles the connection to the data source and is the base class for the database objects and generic database functions
Generic API
- class CveXplore.common.generic_api.GenericApi(address, api_path=None, proxies=None, protocol='https', user_agent='GenericApi')[source]
Bases:
object
The GenericApi class serves as a base class for all API’s used within CveXplore
- __init__(address, api_path=None, proxies=None, protocol='https', user_agent='GenericApi')[source]
The Generic api caller handles all communication towards a api resource.
- Parameters
address (tuple) – Tuple with host ip/name and port
api_path (str) – Generic to connect to api resources, defaults to ‘None’
proxies (dict) – If you need to use a proxy, you can configure individual requests with the proxies argument to any request method
protocol (str) – Protocol to use when connecting to api; defaults to ‘https’
- call(method=None, resource=None, data=None)[source]
Method for requesting free format api resources
- Parameters
method (str) – http method to use (e.g. POST, GET, DELETE, PUT)
resource (str) – API end point to connect to
data (dict) – Request body data
- Returns
query result
- Return type
dict
- del_header_field(field)[source]
Method to delete a header field
- Parameters
field (str) – Name of the header field to delete
- Returns
self.myheaders
- Return type
dict
- property headers
Property to return the current headers
- Returns
self.myheaders
- Return type
dict