mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Merge branch 'master' into timeline
This commit is contained in:
commit
f66f65f2c1
@ -132,7 +132,7 @@ public class Logger extends java.util.logging.Logger {
|
|||||||
* Log an action to autopsy_actions.log
|
* Log an action to autopsy_actions.log
|
||||||
* @param actionClass class where user triggered action occurs
|
* @param actionClass class where user triggered action occurs
|
||||||
*/
|
*/
|
||||||
public static void noteAction(Class actionClass) {
|
public static void noteAction(Class<?> actionClass) {
|
||||||
actionsLogger.log(Level.INFO, "Action performed: {0}", actionClass.getName());
|
actionsLogger.log(Level.INFO, "Action performed: {0}", actionClass.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,27 +20,23 @@ package org.sleuthkit.autopsy.coreutils;
|
|||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
|
import org.hyperic.sigar.Sigar;
|
||||||
import org.openide.modules.InstalledFileLocator;
|
import org.openide.modules.InstalledFileLocator;
|
||||||
import org.openide.modules.Places;
|
import org.openide.modules.Places;
|
||||||
import org.openide.util.Exceptions;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.LocalDisk;
|
import org.sleuthkit.autopsy.casemodule.LocalDisk;
|
||||||
import org.sleuthkit.datamodel.SleuthkitJNI;
|
import org.sleuthkit.datamodel.SleuthkitJNI;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Platform utilities
|
* Platform utilities
|
||||||
@ -51,10 +47,8 @@ public class PlatformUtil {
|
|||||||
public static final String OS_NAME_UNKNOWN = "unknown";
|
public static final String OS_NAME_UNKNOWN = "unknown";
|
||||||
public static final String OS_VERSION_UNKNOWN = "unknown";
|
public static final String OS_VERSION_UNKNOWN = "unknown";
|
||||||
public static final String OS_ARCH_UNKNOWN = "unknown";
|
public static final String OS_ARCH_UNKNOWN = "unknown";
|
||||||
|
private static volatile long pid = -1;
|
||||||
|
private static volatile Sigar sigar = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get root path where the application is installed
|
* Get root path where the application is installed
|
||||||
@ -271,8 +265,8 @@ public class PlatformUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all physical drives attached to the client's machine.
|
* Get a list of all physical drives attached to the client's machine. Error
|
||||||
* Error threshold of 4 non-existent physical drives before giving up.
|
* threshold of 4 non-existent physical drives before giving up.
|
||||||
*
|
*
|
||||||
* @return list of physical drives
|
* @return list of physical drives
|
||||||
*/
|
*/
|
||||||
@ -322,7 +316,8 @@ public class PlatformUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list all all the local drives and partitions on the client's machine.
|
* Get a list all all the local drives and partitions on the client's
|
||||||
|
* machine.
|
||||||
*
|
*
|
||||||
* @return list of local drives and partitions
|
* @return list of local drives and partitions
|
||||||
*/
|
*/
|
||||||
@ -361,11 +356,11 @@ public class PlatformUtil {
|
|||||||
/**
|
/**
|
||||||
* Are we able to read this drive? Usually related to admin permissions.
|
* 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
|
* For all drives and partitions, we are using Java's ability to read the
|
||||||
* the first byte of a drive to determine if TSK would be able to
|
* first byte of a drive to determine if TSK would be able to read the drive
|
||||||
* read the drive during the add image process. This returns whether
|
* during the add image process. This returns whether the drive is readable
|
||||||
* the drive is readable or not far faster than validating if TSK can open
|
* or not far faster than validating if TSK can open the drive. We are
|
||||||
* the drive. We are assuming the results are almost exactly the same.
|
* assuming the results are almost exactly the same.
|
||||||
*
|
*
|
||||||
* @param diskPath path to the disk we want to read
|
* @param diskPath path to the disk we want to read
|
||||||
* @return true if we successfully read the first byte
|
* @return true if we successfully read the first byte
|
||||||
@ -389,4 +384,57 @@ public class PlatformUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query and get PID fo this process
|
||||||
|
*
|
||||||
|
* @return PID of this process or -1 if it couldn't be determined
|
||||||
|
*/
|
||||||
|
public static synchronized long getPID() {
|
||||||
|
|
||||||
|
if (pid != -1) {
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (sigar == null) {
|
||||||
|
sigar = new Sigar();
|
||||||
|
}
|
||||||
|
pid = sigar.getPid();
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.out.println("Can't load library and get PID, " + e.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Can't get PID, " + e.toString());
|
||||||
|
}
|
||||||
|
return pid;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query and return virtual memory used by the process
|
||||||
|
*
|
||||||
|
* @return virt memory used in bytes or -1 if couldn't be queried
|
||||||
|
*/
|
||||||
|
public static synchronized long getProcessVirtualMemoryUsed() {
|
||||||
|
long pid = getPID();
|
||||||
|
long virtMem = -1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (sigar == null) {
|
||||||
|
sigar = new Sigar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sigar == null || pid == -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtMem = sigar.getProcMem(pid).getSize();
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.out.println("Can't load library and get virt mem used, " + e.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Can't get virt mem used, " + e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return virtMem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user