otupy.transfers.http.http_transfer.HTTPSTransfer
- class HTTPSTransfer(host, port=443, endpoint='/.well-known/openc2')
Bases:
HTTPTransferHTTP Transfer Protocol with SSL
This class provides an implementation of the Specification. It builds on Flask and so it is not suitable for production environments.
Use HTTPSTransfer to build OpenC2 communication stacks in Producer and Consumer. Usage and methods of HTTPSTransfer are semanthically the same as for HTTPTransfer.
Methods
Listen for incoming messages
Sends OpenC2 message
- __init__(host, port=443, endpoint='/.well-known/openc2')
Builds the HTTPSTransfer instance
The host and port parameters are used either for selecting the remote server (Producer) or for local binding (Consumer). This implementation only supports TCP as transport protocol. :param host: Hostname or IP address of the OpenC2 server. :param port: Transport port of the OpenC2 server. :param endpoint: The remote endpoint to contact the OpenC2 server (Producer only).
- receive(callback, encoder)
Listen for incoming messages
This method implements the Transfer interface to listen for and receive OpenC2 messages. The internal implementation uses Flask as HTTP server. The method invokes the callback for each received message, which must be provided by a Producer to properly dispatch Commands to the relevant server(s). It also takes an Encoder that is used to create responses to
Commands encoded with unknown encoders.- Parameters:
callback – The function that is invoked to process OpenC2 messages.
encoder – Default Encoder instance to respond to unknown or wrong messages.
- Returns:
None
- send(msg, encoder)
Sends OpenC2 message
This method implements the required Transfer interface to send message to an OpenC2 server.
- Parameters:
msg – The message to send (otupy Message).
encoder – The encoder to use for encoding the msg.
- Returns:
An OpenC2 response (Response).