Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
org.sleuthkit.autopsy.coreutils.PlatformUtil Class Reference

Static Public Member Functions

static< T > boolean extractResourceToUserConfigDir (final Class< T > resourceClass, final String resourceFileName, boolean overWrite) throws IOException
 
static String getAllMemUsageInfo ()
 
static String getDefaultPlatformCharset ()
 
static String getDefaultPlatformFileEncoding ()
 
static String getInstallModulesPath ()
 
static String getInstallPath ()
 
static synchronized String getJavaPath ()
 
static synchronized long getJavaPID (String sigarSubQuery)
 
static synchronized long[] getJavaPIDs (String sigarSubQuery)
 
static String getJvmMemInfo ()
 
static String getLogDirectory ()
 
static String getLogFileEncoding ()
 
static String getOSArch ()
 
static String getOSFilePath (String origFilePath)
 
static String getOSName ()
 
static String getOSVersion ()
 
static List< LocalDiskgetPartitions ()
 
static List< LocalDiskgetPhysicalDrives ()
 
static String getPhysicalMemInfo ()
 
static synchronized long getPID ()
 
static synchronized long getProcessVirtualMemoryUsed ()
 
static List< String > getProjectsDirs ()
 
static String getUserConfigDirectory ()
 
static File getUserDirectory ()
 
static String getUserModulesPath ()
 
static String getUserPythonModulesPath ()
 
static boolean is64BitJVM ()
 
static boolean is64BitOS ()
 
static boolean isWindowsOS ()
 
static synchronized void killProcess (long pid)
 

Static Public Attributes

static final String OS_ARCH_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.archUnknown")
 
static final String OS_NAME_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.nameUnknown")
 
static final String OS_VERSION_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.verUnknown")
 

Static Private Member Functions

static boolean canReadDrive (String diskPath)
 

Static Private Attributes

static String javaPath = null
 
static volatile MemoryMXBean memoryManager = null
 
static volatile long pid = -1
 
static final String PYTHON_MODULES_SUBDIRECTORY = "python_modules"
 
static volatile Sigar sigar = null
 

Detailed Description

Platform utilities

Definition at line 51 of file PlatformUtil.java.

Member Function Documentation

static boolean org.sleuthkit.autopsy.coreutils.PlatformUtil.canReadDrive ( String  diskPath)
staticprivate

Are we able to read this drive? Usually related to admin permissions.

For all drives and partitions, we are using Java's ability to read the first byte of a drive to determine if TSK would be able to read the drive during the add image process. This returns whether the drive is readable or not far faster than validating if TSK can open the drive. We are assuming the results are almost exactly the same.

Parameters
diskPathpath to the disk we want to read
Returns
true if we successfully read the first byte
Exceptions
IOExceptionif we fail to read

Definition at line 430 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getPartitions(), and org.sleuthkit.autopsy.coreutils.PlatformUtil.getPhysicalDrives().

static <T> boolean org.sleuthkit.autopsy.coreutils.PlatformUtil.extractResourceToUserConfigDir ( final Class< T >  resourceClass,
final String  resourceFileName,
boolean  overWrite 
) throws IOException
static

Utility to extract a resource file to a user configuration directory, if it does not exist - useful for setting up default configurations.

Parameters
resourceClassclass in the same package as the resourceFile to extract
resourceFileNameName of the resource file to extract
overWritetrue to overwrite an existing resource
Returns
true if extracted, false otherwise (if file already exists)
Exceptions
IOExceptionexception thrown if extract the file failed for IO reasons

Definition at line 224 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserConfigDirectory().

Referenced by org.sleuthkit.autopsy.report.ReportBranding.extractDefaultGeneratorLogo(), org.sleuthkit.autopsy.coreutils.XMLUtil.validateDocument(), and org.sleuthkit.autopsy.coreutils.XMLUtil.xmlIsValid().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getAllMemUsageInfo ( )
static
static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getDefaultPlatformCharset ( )
static
static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getDefaultPlatformFileEncoding ( )
static
static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getInstallModulesPath ( )
static

Get root path where the application modules are installed

Returns
absolute path string to the install modules root dir, or null if not found

Definition at line 79 of file PlatformUtil.java.

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getInstallPath ( )
static

Get root path where the application is installed

Returns
absolute path string to the install root dir

Definition at line 67 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getJavaPath().

static synchronized String org.sleuthkit.autopsy.coreutils.PlatformUtil.getJavaPath ( )
static

get file path to the java executable binary use embedded java if available, otherwise use system java in PATH no validation is done if java exists in PATH

Returns
file path to java binary

Definition at line 126 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.getInstallPath(), and org.sleuthkit.autopsy.coreutils.PlatformUtil.javaPath.

static synchronized long org.sleuthkit.autopsy.coreutils.PlatformUtil.getJavaPID ( String  sigarSubQuery)
static

Query and get PID of another java process

Parameters
sigarSubQuerya sigar subquery to identify a unique java process among other java processes, for example, by class name, use: Args.*.eq=org.jboss.Main more examples here: http://support.hyperic.com/display/SIGAR/PTQL
Returns
PID of a java process or -1 if it couldn't be determined

Definition at line 486 of file PlatformUtil.java.

References org.sleuthkit.autopsy.corelibs.SigarLoader.getSigar().

static synchronized long [] org.sleuthkit.autopsy.coreutils.PlatformUtil.getJavaPIDs ( String  sigarSubQuery)
static

Query and get PIDs of another java processes matching a query

Parameters
sigarSubQuerya sigar subquery to identify a java processes among other java processes, for example, by class name, use: Args.*.eq=org.jboss.Main more examples here: http://support.hyperic.com/display/SIGAR/PTQL
Returns
array of PIDs of a java processes matching the query or null if it couldn't be determined

Definition at line 518 of file PlatformUtil.java.

References org.sleuthkit.autopsy.corelibs.SigarLoader.getSigar().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getJvmMemInfo ( )
static

Return formatted string with Jvm heap and non-heap memory usage

Returns
formatted string with jvm memory usage

Definition at line 591 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getAllMemUsageInfo().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getLogDirectory ( )
static

Get log directory path

Returns
Get log directory path string

Definition at line 193 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.casemodule.Case.changeCurrentCase().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getLogFileEncoding ( )
static

Definition at line 206 of file PlatformUtil.java.

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getOSArch ( )
static

Get OS arch details, or OS_ARCH_UNKNOWN

Returns
OS arch string

Definition at line 271 of file PlatformUtil.java.

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getOSFilePath ( String  origFilePath)
static

Convert file path (quote) for OS specific

Parameters
origFilePath
Returns
converted file path

Definition at line 291 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.isWindowsOS().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getOSName ( )
static

Get operating system name, or OS_NAME_UNKNOWN

Returns
OS name string

Definition at line 253 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.isWindowsOS().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getOSVersion ( )
static

Get operating system version, or OS_VERSION_UNKNOWN

Returns
OS version string

Definition at line 262 of file PlatformUtil.java.

static List<LocalDisk> org.sleuthkit.autopsy.coreutils.PlatformUtil.getPartitions ( )
static

Get a list all all the local drives and partitions on the client's machine.

Returns
list of local drives and partitions

Definition at line 383 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.canReadDrive(), and org.sleuthkit.autopsy.coreutils.PlatformUtil.isWindowsOS().

static List<LocalDisk> org.sleuthkit.autopsy.coreutils.PlatformUtil.getPhysicalDrives ( )
static

Get a list of all physical drives attached to the client's machine. Error threshold of 4 non-existent physical drives before giving up.

Returns
list of physical drives

Definition at line 332 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.canReadDrive(), and org.sleuthkit.autopsy.coreutils.PlatformUtil.isWindowsOS().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getPhysicalMemInfo ( )
static

Return formatted string with physical memory usage

Returns
formatted string with physical memory usage

Definition at line 610 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getAllMemUsageInfo().

static synchronized long org.sleuthkit.autopsy.coreutils.PlatformUtil.getPID ( )
static

Query and get PID of this process

Returns
PID of this process or -1 if it couldn't be determined

Definition at line 454 of file PlatformUtil.java.

References org.sleuthkit.autopsy.corelibs.SigarLoader.getSigar(), and org.sleuthkit.autopsy.coreutils.PlatformUtil.pid.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getProcessVirtualMemoryUsed(), and org.sleuthkit.autopsy.coreutils.Installer.restored().

static synchronized long org.sleuthkit.autopsy.coreutils.PlatformUtil.getProcessVirtualMemoryUsed ( )
static

Query and return virtual memory used by the process

Returns
virt memory used in bytes or -1 if couldn't be queried

Definition at line 566 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.getPID(), and org.sleuthkit.autopsy.corelibs.SigarLoader.getSigar().

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getAllMemUsageInfo(), and org.sleuthkit.autopsy.coreutils.Installer.restored().

static List<String> org.sleuthkit.autopsy.coreutils.PlatformUtil.getProjectsDirs ( )
static

Get RCP project dirs

Returns

Definition at line 164 of file PlatformUtil.java.

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserConfigDirectory ( )
static
static File org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserDirectory ( )
static

Get user directory where application wide user settings, cache, temp files are stored

Returns
File object representing user directory

Definition at line 155 of file PlatformUtil.java.

Referenced by org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserModulesPath(), org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserPythonModulesPath(), and org.sleuthkit.autopsy.corecomponents.AboutWindowPanel.startVerboseLogging().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserModulesPath ( )
static

Get root path where the user modules are installed

Returns
absolute path string to the install modules root dir, or null if not found

Definition at line 106 of file PlatformUtil.java.

References org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserDirectory().

static String org.sleuthkit.autopsy.coreutils.PlatformUtil.getUserPythonModulesPath ( )
static
static boolean org.sleuthkit.autopsy.coreutils.PlatformUtil.is64BitJVM ( )
static

Attempts to determine whether the JVM is 64-bit or 32-bit. May not be completely reliable for non-Windows operating systems.

Returns
True if the JVM is 64-bit. False otherwise.

Definition at line 321 of file PlatformUtil.java.

static boolean org.sleuthkit.autopsy.coreutils.PlatformUtil.is64BitOS ( )
static

Attempts to determine whether the operating system is a 64-bit operating system. May not be completely reliable for non-Windows operating systems.

Returns
True if the operating system is definitely a 64-bit operating system, false otherwise.

Definition at line 306 of file PlatformUtil.java.

static boolean org.sleuthkit.autopsy.coreutils.PlatformUtil.isWindowsOS ( )
static
static synchronized void org.sleuthkit.autopsy.coreutils.PlatformUtil.killProcess ( long  pid)
static

Kill a process by PID by sending signal to it using Sigar

Parameters
pidpid of the process to kill

Definition at line 544 of file PlatformUtil.java.

References org.sleuthkit.autopsy.corelibs.SigarLoader.getSigar().

Member Data Documentation

String org.sleuthkit.autopsy.coreutils.PlatformUtil.javaPath = null
staticprivate
volatile MemoryMXBean org.sleuthkit.autopsy.coreutils.PlatformUtil.memoryManager = null
staticprivate

Definition at line 60 of file PlatformUtil.java.

final String org.sleuthkit.autopsy.coreutils.PlatformUtil.OS_ARCH_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.archUnknown")
static

Definition at line 57 of file PlatformUtil.java.

final String org.sleuthkit.autopsy.coreutils.PlatformUtil.OS_NAME_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.nameUnknown")
static

Definition at line 55 of file PlatformUtil.java.

final String org.sleuthkit.autopsy.coreutils.PlatformUtil.OS_VERSION_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.verUnknown")
static

Definition at line 56 of file PlatformUtil.java.

volatile long org.sleuthkit.autopsy.coreutils.PlatformUtil.pid = -1
staticprivate
final String org.sleuthkit.autopsy.coreutils.PlatformUtil.PYTHON_MODULES_SUBDIRECTORY = "python_modules"
staticprivate
volatile Sigar org.sleuthkit.autopsy.coreutils.PlatformUtil.sigar = null
staticprivate

Definition at line 59 of file PlatformUtil.java.


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

Copyright © 2012-2016 Basis Technology. Generated on: Tue Oct 25 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.