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

Public Member Functions

 UNCPathUtilities ()
 
synchronized String convertPathToUNC (String indexDir)
 
synchronized Path ipToHostName (Path inputPath)
 
synchronized String ipToHostName (String inputPath)
 
synchronized boolean isDriveMapped (Path inputPath)
 
synchronized boolean isDriveMapped (String inputPath)
 
synchronized String mappedDriveToUNC (String inputPath)
 
synchronized Path mappedDriveToUNC (Path inputPath)
 
synchronized void rescanDrives ()
 

Static Public Member Functions

synchronized static boolean isUNC (Path inputPath)
 
synchronized static boolean isUNC (String inputPath)
 

Private Member Functions

synchronized Map< String, String > getMappedDrives ()
 

Private Attributes

final String nameString
 

Static Private Attributes

static final String C_DRIVE = "C:"
 
static final String COLON = ":"
 
static final String DATA_TRIGGER = "----------"
 
static final int DRIVE_LEN = 2
 
static Map< String, String > drives
 
static final int FIRST_ITEM = 0
 
static final String MAPPED_DRIVES = "_mapped_drives.txt"
 
static final String OK_TXT = "OK"
 
static final int REPLACEMENT_SIZE = 2
 
static final int STARTING_OFFSET = 0
 
static final String TEMP_FOLDER = "TEMP"
 
static final String UNC_PATH_START = "\\\\"
 

Detailed Description

Definition at line 35 of file UNCPathUtilities.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.coreutils.UNCPathUtilities.UNCPathUtilities ( )

Member Function Documentation

synchronized String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.convertPathToUNC ( String  indexDir)

Converts a path to UNC, if possible. This is accomplished by checking the mapped drives list the operating system maintains and substituting where required. If the drive of the path passed in does not exist in the cached mapped drives list, a rescan of the mapped drives list is forced, and mapping is attempted one more time.

Parameters
indexDirthe String of the absolute path to be converted to UNC, if possible
Returns
UNC path if able to convert to UNC, original input path otherwise

Definition at line 331 of file UNCPathUtilities.java.

References org.sleuthkit.autopsy.coreutils.UNCPathUtilities.mappedDriveToUNC(), and org.sleuthkit.autopsy.coreutils.UNCPathUtilities.rescanDrives().

synchronized Map<String, String> org.sleuthkit.autopsy.coreutils.UNCPathUtilities.getMappedDrives ( )
private

Populates the list of mapped drives this class contains. The list is used to resolve mappedDriveToUNC and isDriveMapped calls. Note this uses system I/O, so call it with some care.

Returns
the hashmap

Definition at line 268 of file UNCPathUtilities.java.

References org.sleuthkit.autopsy.coreutils.Logger.getLogger(), org.sleuthkit.autopsy.coreutils.PlatformUtil.isWindowsOS(), and org.sleuthkit.autopsy.coreutils.UNCPathUtilities.MAPPED_DRIVES.

Referenced by org.sleuthkit.autopsy.coreutils.UNCPathUtilities.rescanDrives(), and org.sleuthkit.autopsy.coreutils.UNCPathUtilities.UNCPathUtilities().

synchronized Path org.sleuthkit.autopsy.coreutils.UNCPathUtilities.ipToHostName ( Path  inputPath)

Takes a UNC path that may have an IP address in it and converts it to hostname, if it can resolve the hostname. Given "\\10.11.12.13\some\folder", the result will be "\\TEDS_COMPUTER\some\folder" if the IP address 10.11.12.13 belongs to a machine with the hostname TEDS_COMPUTER and the local machine is able to resolve the hostname.

Parameters
inputPaththe path to convert to a hostname UNC path
Returns
the successfully converted path or null if unable to resolve

Definition at line 181 of file UNCPathUtilities.java.

synchronized String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.ipToHostName ( String  inputPath)

Takes a UNC path that may have an IP address in it and converts it to hostname, if it can resolve the hostname. Given "\\10.11.12.13\some\folder", the result will be "\\TEDS_COMPUTER\some\folder" if the IP address 10.11.12.13 belongs to a machine with the hostname TEDS_COMPUTER and the local machine is able to resolve the hostname.

Parameters
inputPatha String of the path to convert to a hostname UNC path
Returns
the successfully converted path or null if unable to resolve

Definition at line 201 of file UNCPathUtilities.java.

References org.sleuthkit.autopsy.coreutils.UNCPathUtilities.isUNC().

synchronized boolean org.sleuthkit.autopsy.coreutils.UNCPathUtilities.isDriveMapped ( Path  inputPath)

Tests if the drive in the passed in path is a mapped drive.

Parameters
inputPaththe Path to test.
Returns
true if the passed in drive is mapped, false otherwise

Definition at line 142 of file UNCPathUtilities.java.

synchronized boolean org.sleuthkit.autopsy.coreutils.UNCPathUtilities.isDriveMapped ( String  inputPath)

Tests if the drive in the passed in path is a mapped drive.

Parameters
inputPaththe Path to test.
Returns
true if the passed in drive is mapped, false otherwise

Definition at line 157 of file UNCPathUtilities.java.

synchronized static boolean org.sleuthkit.autopsy.coreutils.UNCPathUtilities.isUNC ( Path  inputPath)
static

Test if a Path is UNC. It is considered UNC if it begins with \

Parameters
inputPaththe path to check
Returns
true if the passed in Path is UNC, false otherwise

Definition at line 226 of file UNCPathUtilities.java.

Referenced by org.sleuthkit.autopsy.coreutils.UNCPathUtilities.ipToHostName(), and org.sleuthkit.autopsy.coreutils.UNCPathUtilities.mappedDriveToUNC().

synchronized static boolean org.sleuthkit.autopsy.coreutils.UNCPathUtilities.isUNC ( String  inputPath)
static

Test if a String path is UNC. It is considered UNC if it begins with \

Parameters
inputPaththe String of the path to check
Returns
true if the passed in Path is UNC, false otherwise

Definition at line 241 of file UNCPathUtilities.java.

synchronized String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.mappedDriveToUNC ( String  inputPath)

This method converts a passed in path to UNC if it is not already UNC. The UNC path will end up in one of the following two forms: "\\hostname\somefolder\otherfolder" or "\\IP_ADDRESS\somefolder\otherfolder"

This is accomplished by checking the mapped drives list the operating system maintains and substituting where required. If the drive of the path passed in does not exist in the cached mapped drives list, you can force a rescan of the mapped drives list with rescanDrives(), then call this method again. This would be of use if the end user added a mapped drive while your dialog was up, for example.

Parameters
inputPatha String of the path to convert
Returns
returns a successfully converted inputPath or null if unable to find a matching drive and convert it to UNC

Definition at line 78 of file UNCPathUtilities.java.

References org.sleuthkit.autopsy.coreutils.UNCPathUtilities.isUNC().

Referenced by org.sleuthkit.autopsy.coreutils.UNCPathUtilities.convertPathToUNC(), and org.sleuthkit.autopsy.coreutils.UNCPathUtilities.mappedDriveToUNC().

synchronized Path org.sleuthkit.autopsy.coreutils.UNCPathUtilities.mappedDriveToUNC ( Path  inputPath)

This method converts a passed in path to UNC if it is not already UNC. The UNC path will end up in one of the following two forms: \\hostname\somefolder\otherfolder or \\IP_ADDRESS\somefolder\otherfolder

This is accomplished by checking the mapped drives list the operating system maintains and substituting where required. If the drive of the path passed in does not exist in the cached mapped drives list, you can force a rescan of the mapped drives list with rescanDrives(), then call this method again. This would be of use if the end user added a mapped drive while your dialog was up, for example.

Parameters
inputPaththe path to convert
Returns
returns a successfully converted inputPath or null if unable to find a matching drive and convert it to UNC

Definition at line 122 of file UNCPathUtilities.java.

References org.sleuthkit.autopsy.coreutils.UNCPathUtilities.mappedDriveToUNC().

synchronized void org.sleuthkit.autopsy.coreutils.UNCPathUtilities.rescanDrives ( )

Updates the list of mapped drives this class contains. This list is used to resolve mappedDriveToUNC and isDriveMapped calls. This is useful to call if the user has potentially added mapped drives to their system after the module calling mappedDriveToUNC has already begun running. Note this uses system I/O, so call it with some care.

Definition at line 257 of file UNCPathUtilities.java.

References org.sleuthkit.autopsy.coreutils.UNCPathUtilities.getMappedDrives().

Referenced by org.sleuthkit.autopsy.coreutils.UNCPathUtilities.convertPathToUNC().

Member Data Documentation

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.C_DRIVE = "C:"
staticprivate

Definition at line 44 of file UNCPathUtilities.java.

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.COLON = ":"
staticprivate

Definition at line 42 of file UNCPathUtilities.java.

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.DATA_TRIGGER = "----------"
staticprivate

Definition at line 40 of file UNCPathUtilities.java.

final int org.sleuthkit.autopsy.coreutils.UNCPathUtilities.DRIVE_LEN = 2
staticprivate

Definition at line 45 of file UNCPathUtilities.java.

Map<String, String> org.sleuthkit.autopsy.coreutils.UNCPathUtilities.drives
staticprivate

Definition at line 37 of file UNCPathUtilities.java.

final int org.sleuthkit.autopsy.coreutils.UNCPathUtilities.FIRST_ITEM = 0
staticprivate

Definition at line 48 of file UNCPathUtilities.java.

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.MAPPED_DRIVES = "_mapped_drives.txt"
staticprivate
final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.nameString
private

Definition at line 49 of file UNCPathUtilities.java.

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.OK_TXT = "OK"
staticprivate

Definition at line 41 of file UNCPathUtilities.java.

final int org.sleuthkit.autopsy.coreutils.UNCPathUtilities.REPLACEMENT_SIZE = 2
staticprivate

Definition at line 47 of file UNCPathUtilities.java.

final int org.sleuthkit.autopsy.coreutils.UNCPathUtilities.STARTING_OFFSET = 0
staticprivate

Definition at line 46 of file UNCPathUtilities.java.

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.TEMP_FOLDER = "TEMP"
staticprivate

Definition at line 39 of file UNCPathUtilities.java.

final String org.sleuthkit.autopsy.coreutils.UNCPathUtilities.UNC_PATH_START = "\\\\"
staticprivate

Definition at line 43 of file UNCPathUtilities.java.


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

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jun 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.