covertutils.orchestration package

Submodules

covertutils.orchestration.orchestrator module

class covertutils.orchestration.orchestrator.Orchestrator(passphrase, tag_length, cycling_algorithm=None, streams=[], history=1, reverse=False)[source]

Bases: object

Orchestrator objects utilize the raw data to (stream, message) tuple translation and vice-versa. (stream, message) tuples are recognised by the classes in covertutils.handlers but data transmission is only possible with raw data.

__init__(passphrase, tag_length, cycling_algorithm=None, streams=[], history=1, reverse=False)[source]
addStream(stream)[source]
checkIdentity(identity)[source]
Parameters:identity (str) – The identity hash of the Orchestrator object to be checked for compatibility.
Rtype bool:
Returns:Returns True if the Orchestrator with the passed identity is compatible, False if it has the same specs but needs the reverse argument toggled, and None if it is incompatible (initialized with different password, tag_length, streams, etc).
deleteStream(stream)[source]
depositChunk(chunk, ret_chunk=False)[source]
Parameters:
  • chunk (str) – The raw data chunk received.
  • ret_chunk (bool) – If True the message part that exists in the chunk will be returned. Else None will be returned, unless the provided chunk is the last of a message.
Return type:

tuple

Returns:

The (stream, message) tuple.

generateIdentity(*args)[source]
getChunkerForStream(stream)[source]
getDefaultStream()[source]

This method returns the stream that is used if no stream is specified in readyMessage().

Return type:str
getHistoryChunk(index=0)[source]
getIdentity(length=16)[source]
Parameters:length (int) – The length of hex bytes to be returned. Defaults to ‘16’. If a number greater than the available identity string is passed, the whole identity hash will be returned.
getStreamDict()[source]
getStreams()[source]
readyMessage(message, stream=None)[source]
Parameters:
  • message (str) – The message to be processed for sending.
  • stream (str) – The stream where the message will be sent. If not specified the default stream will be used.
Return type:

list

Returns:

The raw data chunks translation of the (stream, message) tuple.

reset()[source]

This method resets all components of the Orchestrator instance, effectively restarting One-Time-Pad keys, etc.

covertutils.orchestration.simpleorchestrator module

class covertutils.orchestration.simpleorchestrator.SimpleOrchestrator(passphrase, tag_length=2, out_length=10, in_length=10, streams=['main'], cycling_algorithm=None, reverse=False)[source]

Bases: covertutils.orchestration.orchestrator.Orchestrator

The SimpleOrchestrator class combines compression, chunking, encryption and stream tagging, by utilizing the below covertutils classes:

  • covertutils.datamanipulation.Chunker
  • covertutils.datamanipulation.Compressor
  • covertutils.crypto.keys.StandardCyclingKey
  • covertutils.orchestration.StreamIdentifier
__init__(passphrase, tag_length=2, out_length=10, in_length=10, streams=['main'], cycling_algorithm=None, reverse=False)[source]
Parameters:
  • passphrase (str) – The passphrase is the seed used to generate all encryption keys and stream identifiers. Two SimpleOrchestrator objects are compatible (can understand each other products) if they are initialized with the same passphrase. As passphrase is data argument, it is Case-Sensitive, and arbitrary bytes (not just printable strings) can be used.
  • tag_length (int) – Every Stream is identified by a Tag, that is also data, appended to every Message chunk. The byte length of those tags can be set by this argument. Too small tags can mislead the Orchestrator object to recognise arbitrary data and try to process it (start decompressing it, decrypt it). Too large tags spend too much of a chunks bandwidth.
  • out_length (int) – The data length of the chunks that are returned by the covertutils.orchestration.SimpleOrchestrator.readyMessage().
  • in_length (int) – The data length of the chunks that will be passed to covertutils.orchestration.SimpleOrchestrator.depositChunk().
  • streams (list) – The list of all streams needed to be recognised by the SimpleOrchestrator. A “control” stream is always hardcoded in a SimpleOrchestrator object.
  • cycling_algorithm (class) – The hashing/cycling function used in all OTP crypto and stream identification. If not specified the covertutils.crypto.algorithms.StandardCyclingAlgorithm will be used. The hashlib.sha256 is a great choice if hashlib is available.
  • reverse (bool) – If this is set to True the out_length and in_length are internally reversed in the instance. This parameter is typically used to keep the parameter list the same between 2 SimpleOrchestrator initializations, yet make them compatible.
addStream(stream)[source]
reset()[source]

This method resets all components of the SimpleOrchestrator instance, effectively flushing the Chunkers, restarting One-Time-Pad keys, etc.

covertutils.orchestration.stegoorchestrator module

class covertutils.orchestration.stegoorchestrator.StegoOrchestrator(passphrase, stego_config, main_template, transformation_list=[], tag_length=2, cycling_algorithm=None, streams=['main'], hex_inject=False, reverse=False)[source]

Bases: covertutils.orchestration.orchestrator.Orchestrator

The StegoOrchestrator class combines compression, chunking, encryption, stream tagging and steganography injection, by utilizing the below covertutils classes:

  • covertutils.datamanipulation.AdHocChunker
  • covertutils.datamanipulation.Compressor
  • covertutils.crypto.keys.StandardCyclingKey
  • covertutils.orchestration.StreamIdentifier
  • covertutils.datamanipulation.StegoInjector
  • covertutils.datamanipulation.DataTransformer

The StegoOrchestrator packs (stream, message) pairs in predefined data templates.

__init__(passphrase, stego_config, main_template, transformation_list=[], tag_length=2, cycling_algorithm=None, streams=['main'], hex_inject=False, reverse=False)[source]
Parameters:
  • stego_config (str) – The configuration that is passed to covertutils.datamanipulation.stegoinjector.StegoInjector.
  • main_template (str) – The default template that will be used in readyMessage() template argument.
  • transformation_list (list) – The Transformation List that is passed to the covertutils.datamanipulation.datatransformer.DataTransformer object.
  • cycling_algorithm (class) – The hashing/cycling function used in all OTP crypto and stream identification. If not specified the covertutils.crypto.algorithms.StandardCyclingAlgorithm will be used. The hashlib.sha256 is a great choice if hashlib is available.
  • streams (list) – The list of all streams needed to be recognised by the SimpleOrchestrator. A “control” stream is always hardcoded in a SimpleOrchestrator object.
  • intermediate_function (func) – A codec function with signature codec( data, encode = False ). The function is called before and injection of a chunk with encode = True and after the extraction of a chunk with encode = False.
  • reverse (bool) – If this is set to True a StegoOrchestrator with reverse streams is created. This parameter is typically used to keep the parameter list the same between 2 StegoOrchestrator initializations, yet make them compatible.
addStream(stream)[source]
depositChunk(chunk)[source]
Parameters:
  • chunk (str) – The raw data chunk received.
  • ret_chunk (bool) – If True the message part that exists in the chunk will be returned. Else None will be returned, unless the provided chunk is the last of a message.
Return type:

tuple

Returns:

The (stream, message) tuple.

lastReceivedTemplate()[source]
Return type:str
Returns:Returns the last template received.
readyMessage(message, stream=None)[source]
Parameters:
  • message (str) – The message to be processed for sending.
  • stream (str) – The stream where the message will be sent. If not specified the default stream will be used.
Return type:

list

Returns:

The raw data chunks translation of the (stream, message) tuple.

useTemplate(template)[source]
Parameters:template (str) – The template to use for the next Message. Use None for random templates.

covertutils.orchestration.streamidentifier module

class covertutils.orchestration.streamidentifier.StreamIdentifier(passphrase, stream_list=[], cycling_algorithm=None, reverse=False, hard_stream='control')[source]
__init__(passphrase, stream_list=[], cycling_algorithm=None, reverse=False, hard_stream='control')[source]
addStream(stream_name)[source]
checkIdentifier(bytes_)[source]
deleteStream(stream_name)[source]
getHardStreamName()[source]
getIdentifierForStream(stream_name=None, byte_len=2)[source]
getStreams()[source]
reset()[source]

Module contents