The Sleuth Kit Framework
4.1
|
A base class for setting and retrieving system-wide name/value pairs. More...
#include <TskSystemProperties.h>
Public Types | |
enum | PredefinedProperty { PROG_DIR, CONFIG_DIR, MODULE_DIR, MODULE_CONFIG_DIR, OUT_DIR, SYSTEM_OUT_DIR, MODULE_OUT_DIR, LOG_DIR, DB_HOST, DB_PORT, CARVE_DIR, UNALLOC_SECTORS_IMG_FILE_NAME, MAX_UNALLOC_SECTORS_IMG_FILE_SIZE, CARVE_EXTRACT_KEEP_INPUT_FILES, CARVE_EXTRACT_KEEP_OUTPUT_FILES, SCALPEL_DIR, SCALPEL_CONFIG_FILE, PIPELINE_CONFIG_FILE, SESSION_ID, CURRENT_TASK, CURRENT_SEQUENCE_NUMBER, NODE, PID, START_TIME, CURRENT_TIME, UNIQUE_ID, IMAGE_FILE, END_PROPS } |
The TSK Framework predefines a set of system properties. More... | |
Public Member Functions | |
std::string | expandMacros (const std::string &inputStr) const |
Expands any system property macros in a given string. More... | |
std::wstring | expandMacrosW (const std::wstring &inputStr) const |
Expands any system property macros in a given string. More... | |
std::string | get (PredefinedProperty prop) const |
Retrieves the string value associated with a name. More... | |
std::string | get (const std::string &name) const |
Retrieves the string value associated with a name. More... | |
std::wstring | getW (PredefinedProperty prop) const |
Retrieves the string value associated with a name. More... | |
std::wstring | getW (const std::wstring &name) const |
Retrieves the string value associated with a name. More... | |
bool | isConfigured () const |
Determines whether or not all required predefined system properties are currently set. More... | |
void | set (PredefinedProperty prop, const std::string &value) |
Associates a string value with a name. More... | |
void | set (const std::string &name, const std::string &value) |
Associates a string value with an unofficial name. More... | |
void | setW (PredefinedProperty prop, const std::wstring &value) |
Associates a string value with a name. More... | |
void | setW (const std::wstring &name, const std::wstring &value) |
Associates a string value with an unofficial name. More... | |
TskSystemProperties () | |
Default constructor. | |
virtual | ~TskSystemProperties () |
Destructor, virtual since this is an abstract base class. | |
A base class for setting and retrieving system-wide name/value pairs.
Typically used to store system settings so that all modules and classes can access the settings. Can be registered with and retrieved from TskServices.
The class defines several standard 'names' in the PredefinedProperties enum. Any 'name' can be used though.
Values can refer to other 'names' in the SystemProperties. When the values are retrieved via one of the get() methods, the value is searched for words between two '#' characters. If the word is a defined system property, then its value will be replaced. For example, #PROG_DIR# would be replaced by the PROG_DIR system property value in "#PROG_DIR#\\foo".
The class is abstract; derived classes supply property storage options and implement the private virtual functions setProperty and getProperty (the class design makes use of Herb Sutter's Non-Virtual Interface [NVI] idiom).
The TSK Framework predefines a set of system properties.
Many of these properties have default values, while others are required to have values supplied by either the executing program or the framework configuration file. TskSystemProperties::isConfigured() may be called to do a runtime query of whether or not all required system properties are set.
Enumerator | |
---|---|
PROG_DIR |
Program root directory. Defaults to the directory where the executing program is installed. |
CONFIG_DIR |
Directory where configuration files and data can be found. Defaults to #PROG_DIR#/Config. |
MODULE_DIR |
Directory where plug-in and executable modules can be found. Defaults to #PROG_DIR#/Modules. |
MODULE_CONFIG_DIR |
Directory where plug-in modules can find their configuration files, if any. Defaults to MODULE_DIR. |
OUT_DIR |
Root output directory. It should be a shared location if the TSK Framework is being used in a distributed environment. It is a required system property. |
SYSTEM_OUT_DIR |
The output directory for the executing program. Defaults to #OUT_DIR#/SystemOutput. |
MODULE_OUT_DIR |
The output directory for plug-in and executable modules. Defaults to #OUT_DIR#/ModuleOutput. |
LOG_DIR |
Directory where system logs are written. Defaults to #SYSTEM_OUT_DIR#/Logs. |
DB_HOST |
Hostname of database server (if one is being used). |
DB_PORT |
Port of database server (if one is being used) |
CARVE_DIR |
Directory where unallocated sectors image files are stored prior to carving. Defaults to #SYSTEM_OUT_DIR#\Carving. |
UNALLOC_SECTORS_IMG_FILE_NAME |
File name to be given to all unallocated sectors image files. Default to unalloc.bin. |
MAX_UNALLOC_SECTORS_IMG_FILE_SIZE |
Maximum allowable size (in bytes) for unallocated sectors image files. Can be set to zero to have no maximum size and instead break files on volume boundaries only. Defaults to zero. |
CARVE_EXTRACT_KEEP_INPUT_FILES |
Whether or not unallocated sectors image files should be retained after carving is completed. Defaults to false. |
CARVE_EXTRACT_KEEP_OUTPUT_FILES |
Whether or not carved files should be retained in the carving directory after they are copied to file storage. Defaults to false. |
SCALPEL_DIR |
Directory where scalpel.exe is installed. Used by the TSK Framework's implementation of the CarveExtract interface. |
SCALPEL_CONFIG_FILE |
Path to a Scalpel configuration file. Used by the TSK Framework's implementation of the CarveExtract interface. Defaults to #SCALPEL_DIR#/scalpel.conf. |
PIPELINE_CONFIG_FILE |
Path to a pipeline configuration file. Defaults to #CONFIG_DIR#/pipeline_config.xml. |
SESSION_ID |
ID of this session. The intended use of this is in a distributed environment that is processing multiple images at the same time. Each image would have a unique session ID. |
CURRENT_TASK |
Currently executing task, e.g., file analysis, carving, etc. |
CURRENT_SEQUENCE_NUMBER |
Can be used to assign a number in a sequence to a sub task of the current task. |
NODE |
The hostname of the computer on which the program is executing. |
PID |
The process identifier of the process running the program. |
START_TIME |
The time the process running the program began executing. |
CURRENT_TIME |
Current system time. Read only. |
UNIQUE_ID |
A combination of elements that define a unique identifier for the current task. For example, this property might be defined to be a string of the form CurrentTask_HostName_PID_StartTime. |
IMAGE_FILE |
Image file path. Defaults to the image file path stored in the image database. |
std::string TskSystemProperties::expandMacros | ( | const std::string & | inputStr) | const |
Expands any system property macros in a given string.
inputStr | The input string. |
Referenced by expandMacrosW(), and get().
std::wstring TskSystemProperties::expandMacrosW | ( | const std::wstring & | inputStr) | const |
Expands any system property macros in a given string.
inputStr | The input string. |
References expandMacros(), TskUtilities::toUTF16(), and TskUtilities::toUTF8().
std::string TskSystemProperties::get | ( | PredefinedProperty | prop) | const |
Retrieves the string value associated with a name.
prop | An element of the PredefinedProperty enum. |
References CURRENT_TIME, expandMacros(), TskServices::getImgDB(), TskUtilities::getProgDir(), IMAGE_FILE, TskServices::Instance(), PROG_DIR, and set().
std::string TskSystemProperties::get | ( | const std::string & | name) | const |
Retrieves the string value associated with a name.
name | Name of value to retrieve. |
References expandMacros().
std::wstring TskSystemProperties::getW | ( | PredefinedProperty | prop) | const |
Retrieves the string value associated with a name.
prop | An element of the PredefinedProperty enum. |
References TskUtilities::toUTF16().
std::wstring TskSystemProperties::getW | ( | const std::wstring & | name) | const |
Retrieves the string value associated with a name.
name | Name of value to retrieve. |
References TskUtilities::toUTF16(), and TskUtilities::toUTF8().
bool TskSystemProperties::isConfigured | ( | ) | const |
Determines whether or not all required predefined system properties are currently set.
void TskSystemProperties::set | ( | PredefinedProperty | prop, |
const std::string & | value | ||
) |
Associates a string value with a name.
See the class description for more details on setting properties based on other properties.
prop | An element of the PredefinedProperty enum. |
value | The value to associate with the name corresponding to the PredefinedProperty enum element. |
References PROG_DIR.
void TskSystemProperties::set | ( | const std::string & | name, |
const std::string & | value | ||
) |
Associates a string value with an unofficial name.
See the class description for more details on setting properties based on other properties.
name | The name with which to associate the value. |
value | The value to associate with the name. |
References LOGWARN.
void TskSystemProperties::setW | ( | PredefinedProperty | prop, |
const std::wstring & | value | ||
) |
Associates a string value with a name.
See the class description for more details on setting properties based on other properties.
prop | An element of the PredefinedProperty enum. |
value | The value to associate with the name corresponding to the PredefinedProperty enum element. |
References set(), and TskUtilities::toUTF8().
void TskSystemProperties::setW | ( | const std::wstring & | name, |
const std::wstring & | value | ||
) |
Associates a string value with an unofficial name.
See the class description for more details on setting properties based on other properties.
name | The name with which to associate the value. |
value | The value to associate with the name. |
References set(), and TskUtilities::toUTF8().
Copyright © 2011-2013 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.