The Sleuth Kit Framework  4.1
Public Types | Public Member Functions | List of all members
TskSystemProperties Class Referenceabstract

A base class for setting and retrieving system-wide name/value pairs. More...

#include <TskSystemProperties.h>

Inheritance diagram for TskSystemProperties:
TskSystemPropertiesImpl

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.
 

Detailed Description

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).

Member Enumeration Documentation

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.

Member Function Documentation

std::string TskSystemProperties::expandMacros ( const std::string &  inputStr) const

Expands any system property macros in a given string.

Parameters
inputStrThe input string.
Returns
A copy of the input string with all system property macros expanded.

Referenced by expandMacrosW(), and get().

std::wstring TskSystemProperties::expandMacrosW ( const std::wstring &  inputStr) const

Expands any system property macros in a given string.

Parameters
inputStrThe input string.
Returns
A copy of the input string with all system property macros expanded.

References expandMacros(), TskUtilities::toUTF16(), and TskUtilities::toUTF8().

std::string TskSystemProperties::get ( PredefinedProperty  prop) const

Retrieves the string value associated with a name.

Parameters
propAn element of the PredefinedProperty enum.
Returns
String value corresponding to prop. Throws TskException if the requested value is for a required predefined property that is not set.

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.

Parameters
nameName of value to retrieve.
Returns
String value or empty string if name was not found.

References expandMacros().

std::wstring TskSystemProperties::getW ( PredefinedProperty  prop) const

Retrieves the string value associated with a name.

Parameters
propAn element of the PredefinedProperty enum.
Returns
String value corresponding to prop. Throws TskException if the requested value is for a required predefined property that is not set.

References TskUtilities::toUTF16().

std::wstring TskSystemProperties::getW ( const std::wstring &  name) const

Retrieves the string value associated with a name.

Parameters
nameName of value to retrieve.
Returns
String value or empty string if name was not found.

References TskUtilities::toUTF16(), and TskUtilities::toUTF8().

bool TskSystemProperties::isConfigured ( ) const

Determines whether or not all required predefined system properties are currently set.

Returns
True if all required properties are set, false otherwise.
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.

Parameters
propAn element of the PredefinedProperty enum.
valueThe value to associate with the name corresponding to the PredefinedProperty enum element.
Returns
Throws TskException if prop is out of range.

References PROG_DIR.

Referenced by get(), and setW().

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.

Parameters
nameThe name with which to associate the value.
valueThe value to associate with the name.
Returns
Throws TskException if name is empty.

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.

Parameters
propAn element of the PredefinedProperty enum.
valueThe value to associate with the name corresponding to the PredefinedProperty enum element.
Returns
Throws TskException if prop is out of range.

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.

Parameters
nameThe name with which to associate the value.
valueThe value to associate with the name.
Returns
Throws TskException if name is empty.

References set(), and TskUtilities::toUTF8().


The documentation for this class was generated from the following files:

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.