plasoscaffolder.bll.services package

Submodules

plasoscaffolder.bll.services.base_sqlite_generator module

Base class for a Generator for SQLite.

class plasoscaffolder.bll.services.base_sqlite_generator.BaseSQLiteGenerator[source]

Bases: object

Class representing the base class for the base SQLite generator.

GenerateSQLitePlugin(template_path: str, fileHandler: plasoscaffolder.common.base_file_handler.BaseFileHandler, formatter_init_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, parser_init_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, parser_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, formatter_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, parser_test_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, formatter_test_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, mappingHelper: plasoscaffolder.bll.mappings.base_mapping_helper.BaseMappingHelper, database_information: plasoscaffolder.dal.base_database_information.BaseDatabaseInformation)[source]

Generate the whole SQLite plugin.

Parameters:

plasoscaffolder.bll.services.base_sqlite_plugin_helper module

Base class for SQLite plugin helper

class plasoscaffolder.bll.services.base_sqlite_plugin_helper.BaseSQLitePluginHelper[source]

Bases: object

Class representing the base class for the SQLite plugin helper.

FileExists(path: str) → bool[source]

Checks if the file exists.

Parameters:path (str) – the file path
FolderExists(path: str) → bool[source]

Checks if folder exists.

Parameters:path (str) – the folder path
GetAssumedTimestamps(columns: [<module 'plasoscaffolder.model.sql_query_column_model' from '/home/docs/checkouts/readthedocs.org/user_builds/plasoscaffolder/checkouts/latest/src/plasoscaffolder/model/sql_query_column_model.py'>]) → [<class 'str'>][source]

Gets all columns assumed that they are timestamps

Parameters:columns ([sql_query_column_model]) – the columns from the query
Returns:the names from the columns assumed they could be a timestamp
Return type:[str]
GetColumnsAndTimestampColumn(columns: [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>], timestamps: [<class 'str'>], data: [<class 'str'>]) -> ([<class 'plasoscaffolder.model.sql_query_column_model_data.SQLColumnModelData'>], [<class 'plasoscaffolder.model.sql_query_column_model_timestamp.SQLColumnModelTimestamp'>])[source]

Splits the column list into a list of simple columns and a list for timestamp event columns and adds the data to the simple columns

Parameters:
Returns:

([sql_query_column_model_data.SQLColumnModelData],

[sql_query_column_model_timestamp.SQLColumnModelTimestamp): a tuple of columns, the first are the normal columns, the second are the timestamp events

GetDistinctColumnsFromSQLQueryData(queries: [<class 'plasoscaffolder.model.sql_query_model.SQLQueryModel'>]) → [<class 'str'>][source]

Get a distinct list of all attributes from multiple queries

Parameters:queries ([sql_query_model.SQLQueryModel]) – an array of multiple sql query data objects
Returns:all distinct attributes used in the query
Return type:list[str]
IsValidCommaSeparatedString(text: str) → bool[source]

Validates a comma separated string

Parameters:text (str) – the string to validate
Returns:true if the text is valide
Return type:bool
IsValidPluginName(plugin_name: str) → bool[source]

Validates the plugin Name.

Parameters:plugin_name (str) – the plugin Name
Returns:true if the plugin Name is valid
Return type:bool
IsValidRowName(row_name: str) → bool[source]

Validates the row name.

Parameters:row_name (str) – the row name
Returns:true if the row name is valid
Return type:bool
PluginExists(path: str, plugin_name: str, database_suffix: str, path_helper: plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper) → bool[source]

Checks if the plugin already exists.

Parameters:
Returns:

True if the plugin already exists. False if it does not.

Return type:

bool

RunSQLQuery(query: str, executor: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Validates the sql query

Parameters:
  • executor (base_sql_query_execution.SQLiteQueryExecution) – to validate the SQL queries provided by the user
  • query (str) – the SQL query
Returns:

data returned by executing the

query

Return type:

sql_query_data.SQLQueryData

plasoscaffolder.bll.services.base_sqlite_plugin_path_helper module

Base class for SQLite plugin path helper.

class plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper[source]

Bases: object

Class representing the base class for the SQLite plugin path helper.

formatter_file_path

str – the path to the formatter file

parser_file_path

str – the path to the parser file

formatter_test_file_path

str – the path to the formatter test file

parser_test_file_path

str – the path to the parser test file

database_path

str – the path to the database file

parser_init_file_path

str – the path to the parser init file

formatter_init_file_path

str – the path to the formatter init file

plasoscaffolder.bll.services.sqlite_generator module

A SQLite Generator

class plasoscaffolder.bll.services.sqlite_generator.SQLiteGenerator(path: str, name: str, database: str, queries: [<class 'plasoscaffolder.model.sql_query_model.SQLQueryModel'>], output_handler: plasoscaffolder.common.base_output_handler.BaseOutputHandler, pluginHelper: plasoscaffolder.bll.services.base_sqlite_plugin_helper.BaseSQLitePluginHelper, pathHelper: plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper)[source]

Bases: plasoscaffolder.bll.services.base_sqlite_generator.BaseSQLiteGenerator

Generator for SQLite Files.

GenerateSQLitePlugin(template_path: str, fileHandler: plasoscaffolder.common.base_file_handler.BaseFileHandler, formatter_init_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, parser_init_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, parser_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, formatter_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, parser_test_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, formatter_test_mapper: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper, mappingHelper: plasoscaffolder.bll.mappings.base_mapping_helper.BaseMappingHelper, database_information: plasoscaffolder.dal.base_database_information.BaseDatabaseInformation)[source]

Generate the whole SQLite plugin.

Parameters:

plasoscaffolder.bll.services.sqlite_plugin_helper module

SQLite plugin helper.

class plasoscaffolder.bll.services.sqlite_plugin_helper.SQLitePluginHelper[source]

Bases: plasoscaffolder.bll.services.base_sqlite_plugin_helper.BaseSQLitePluginHelper

Class containing helper functions for the SQLite plugin.

FileExists(path: str) → bool[source]

Checks if the file exists.

Parameters:path – the plaso folder path

Returns: true if the file exists

FolderExists(path: str) → bool[source]

Checks if folder exists.

Parameters:path – the plaso folder path

Returns: true if the folder exists

GetAssumedTimestamps(columns: [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>]) → [<class 'str'>][source]

Gets all columns assumed that they are timestamps

Parameters:columns ([sql_query_column_model.SQLColumnModel]) – the columns from the SQL query
Returns:the names from the columns assumed they could be a timestamp
Return type:[str]
GetColumnsAndTimestampColumn(columns: [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>], timestamps: [<class 'str'>], data: [<class 'str'>]) -> ([<class 'plasoscaffolder.model.sql_query_column_model_data.SQLColumnModelData'>], [<class 'plasoscaffolder.model.sql_query_column_model_timestamp.SQLColumnModelTimestamp'>])[source]

Splits the column list into a list of simple columns and a list for timestamp event columns and adds the data to the simple columns

Parameters:
Returns:

([sql_query_column_model_data.SQLColumnModelData],

[sql_query_column_model_timestamp.SQLColumnModelTimestamp]): a tuple of columns, the first are the normal columns, the second are the timestamp events

GetDistinctColumnsFromSQLQueryData(queries: [<class 'plasoscaffolder.model.sql_query_model.SQLQueryModel'>]) → [<class 'str'>][source]

Get a distinct list of all attributes from multiple queries.

Parameters:queries ([sql_query_model.SQLQueryModel]) – an array of multiple SQL query data objects
Returns:all distinct attributes used in the query
Return type:list[str]
IsValidCommaSeparatedString(text: str) → bool[source]

Validates a comma separated string

Parameters:text (str) – the string to validate
Returns:true if the text is valid
Return type:bool
IsValidPluginName(plugin_name: str) → bool[source]

Validates the plugin name.

Parameters:plugin_name (str) – the plugin name
Returns:true if the plugin name is valid
Return type:bool
IsValidRowName(row_name: str) → bool[source]

Validates the row name.

Parameters:row_name (str) – the row name
Returns:true if the row name is valid
Return type:bool
PluginExists(path: str, plugin_name: str, database_suffix: str, path_helper: <plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper object at 0x7fccff1d2588>) → bool[source]

Checks if the plugin already exists.

Parameters:
  • database_suffix – the suffix of the database file
  • path (str) – the path of the plaso source
  • plugin_name (str) – the Name of the plugin
  • path_helper (BaseSQLitePluginHelper) – the SQLite plugin helper
Returns:

True if the plugin already exists. False if it does not.

Return type:

bool

RunSQLQuery(query: str, executor: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Validates the SQL query.

Parameters:
  • executor (base_sql_query_execution.SQLQueryExection()) –
  • query (str) – the SQL query
Returns:

data returned by executing the

query

Return type:

sql_query_data.SQLQueryData

plasoscaffolder.bll.services.sqlite_plugin_path_helper module

SQLite Plugin Path Helper-

class plasoscaffolder.bll.services.sqlite_plugin_path_helper.SQLitePluginPathHelper(path: str, plugin_name: str, database_suffix: str)[source]

Bases: plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper

Class containing helper functions for the SQLite plugin for the path-

formatter_file_path

str – the path to the formatter file

parser_file_path

str – the path to the parser file

formatter_test_file_path

str – the path to the formatter test file

parser_test_file_path

str – the path to the parser test file

database_path

str – the path to the database file

parser_init_file_path

str – the path to the parser init file

formatter_init_file_path

str – the path to the formatter init file

Module contents