Helper classes¶
libcloudforensics.scripts.utils module¶
Utils method for cloud providers
-
libcloudforensics.scripts.utils.
ReadStartupScript
(filename='')¶ Read and return the startup script that is to be run on the forensics VM.
Users can either write their own script to install custom packages, or use one of the provided ones. To use your own script, export a STARTUP_SCRIPT environment variable with the absolute path to it: “user@terminal:~$ export STARTUP_SCRIPT=’absolute/path/script.sh’”
- Parameters
filename (str) – the name of the script in the scripts directory to read Defaults to ‘forensics_packages_startup.sh’ if none specified.
- Returns
The script to run.
- Return type
str
- Raises
OSError – If the script cannot be opened, read or closed.
libcloudforensics.errors module¶
Generic error wrapper
-
exception
libcloudforensics.errors.
CredentialsConfigurationError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with the credentials configuration is encountered.
-
exception
libcloudforensics.errors.
InstanceStateChangeError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with changing an instance state is encountered.
-
exception
libcloudforensics.errors.
InvalidFileFormatError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with file format is encountered.
-
exception
libcloudforensics.errors.
InvalidNameError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with resource name is encountered.
-
exception
libcloudforensics.errors.
LCFError
(message, name)¶ Bases:
Exception
Class to represent a cloud-forensics-utils (CFU) error.
-
message
¶ The error message.
- Type
str
-
name
¶ Name of the module that generated the error.
- Type
str
-
-
exception
libcloudforensics.errors.
ResourceCreationError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with creating a new resource is encountered.
-
exception
libcloudforensics.errors.
ResourceDeletionError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with deleting a resource is encountered.
-
exception
libcloudforensics.errors.
ResourceNotFoundError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with non-existent resource is encountered.
-
exception
libcloudforensics.errors.
ServiceAccountRemovalError
(message, name)¶ Bases:
libcloudforensics.errors.LCFError
Error when an issue with removing a service account is encountered.
libcloudforensics.logging_utils module¶
Module providing custom logging formatters and colorization for ANSI compatible terminals.
-
class
libcloudforensics.logging_utils.
Formatter
(colorize=True, random_color=False, **kwargs)¶ Bases:
logging.Formatter
Helper class used to add color to log messages depending on their level.
-
format
(record)¶ Hooks the native format method and colorizes messages if needed.
- Parameters
record (logging.LogRecord) – Native log record.
- Returns
The formatted message string.
- Return type
str
-
-
libcloudforensics.logging_utils.
GetLogger
(name)¶ Return a logger.
This is a wrapper around logging.getLogger that is intended to be used by the other modules so that they don’t have to import the logging module + this module.
- Parameters
name (str) –
- Returns
The logger.
- Return type
logging.Logger
-
libcloudforensics.logging_utils.
SetUpLogger
(name)¶ Setup a logger.
- Parameters
name (str) – The name for the logger.
- Return type
None