mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
This commit is contained in:
commit
b865ea6ca6
@ -34,6 +34,7 @@ import org.openide.WizardDescriptor;
|
|||||||
import org.openide.util.HelpCtx;
|
import org.openide.util.HelpCtx;
|
||||||
import org.openide.util.Lookup;
|
import org.openide.util.Lookup;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
import org.sleuthkit.datamodel.Image;
|
import org.sleuthkit.datamodel.Image;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
import org.sleuthkit.datamodel.SleuthkitJNI.CaseDbHandle.AddImageProcess;
|
import org.sleuthkit.datamodel.SleuthkitJNI.CaseDbHandle.AddImageProcess;
|
||||||
@ -381,6 +382,9 @@ class AddImageWizardPanel3 implements WizardDescriptor.Panel<WizardDescriptor> {
|
|||||||
// task
|
// task
|
||||||
cleanupImage.disable();
|
cleanupImage.disable();
|
||||||
settings.putProperty(AddImageAction.IMAGECLEANUPTASK_PROP, null);
|
settings.putProperty(AddImageAction.IMAGECLEANUPTASK_PROP, null);
|
||||||
|
|
||||||
|
logger.log(Level.INFO, "Image committed, imageId: " + imageId);
|
||||||
|
logger.log(Level.INFO, PlatformUtil.getAllMemUsageInfo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,15 @@ 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.lang.management.ManagementFactory;
|
||||||
|
import java.lang.management.MemoryMXBean;
|
||||||
|
import java.lang.management.MemoryUsage;
|
||||||
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 java.util.logging.Level;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
import org.hyperic.sigar.Sigar;
|
import org.hyperic.sigar.Sigar;
|
||||||
import org.hyperic.sigar.SigarLoader;
|
|
||||||
import org.openide.modules.InstalledFileLocator;
|
import org.openide.modules.InstalledFileLocator;
|
||||||
import org.openide.modules.Places;
|
import org.openide.modules.Places;
|
||||||
import org.sleuthkit.autopsy.casemodule.LocalDisk;
|
import org.sleuthkit.autopsy.casemodule.LocalDisk;
|
||||||
@ -50,6 +53,7 @@ public class PlatformUtil {
|
|||||||
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 long pid = -1;
|
||||||
private static volatile Sigar sigar = null;
|
private static volatile Sigar sigar = null;
|
||||||
|
private static volatile MemoryMXBean memoryManager = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get root path where the application is installed
|
* Get root path where the application is installed
|
||||||
@ -403,8 +407,7 @@ public class PlatformUtil {
|
|||||||
}
|
}
|
||||||
if (sigar != null) {
|
if (sigar != null) {
|
||||||
pid = sigar.getPid();
|
pid = sigar.getPid();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
System.out.println("Can't get PID");
|
System.out.println("Can't get PID");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -439,4 +442,51 @@ public class PlatformUtil {
|
|||||||
|
|
||||||
return virtMem;
|
return virtMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return formatted string with Jvm heap and non-heap memory usage
|
||||||
|
*
|
||||||
|
* @return formatted string with jvm memory usage
|
||||||
|
*/
|
||||||
|
public static String getJvmMemInfo() {
|
||||||
|
synchronized (PlatformUtil.class) {
|
||||||
|
if (memoryManager == null) {
|
||||||
|
memoryManager = ManagementFactory.getMemoryMXBean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final MemoryUsage heap = memoryManager.getHeapMemoryUsage();
|
||||||
|
final MemoryUsage nonHeap = memoryManager.getNonHeapMemoryUsage();
|
||||||
|
|
||||||
|
return "JVM heap usage: " + heap.toString() + ", JVM non-heap usage: " + nonHeap.toString();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return formatted string with physical memory usage
|
||||||
|
*
|
||||||
|
* @return formatted string with physical memory usage
|
||||||
|
*/
|
||||||
|
public static String getPhysicalMemInfo() {
|
||||||
|
final Runtime runTime = Runtime.getRuntime();
|
||||||
|
final long maxMemory = runTime.maxMemory();
|
||||||
|
final long totalMemory = runTime.totalMemory();
|
||||||
|
final long freeMemory = runTime.freeMemory();
|
||||||
|
return "Physical memory usage (max, total, free): "
|
||||||
|
+ Long.toString(maxMemory) + ", " + Long.toString(totalMemory)
|
||||||
|
+ ", " + Long.toString(freeMemory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return formatted string with all memory usage (jvm, physical, native)
|
||||||
|
*
|
||||||
|
* @return formatted string with all memory usage info
|
||||||
|
*/
|
||||||
|
public static String getAllMemUsageInfo() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(PlatformUtil.getPhysicalMemInfo()).append("\n");
|
||||||
|
sb.append(PlatformUtil.getJvmMemInfo()).append("\n");
|
||||||
|
sb.append("Process Virtual Memory: ").append(PlatformUtil.getProcessVirtualMemoryUsed());
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,6 @@ import java.beans.PropertyChangeEvent;
|
|||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.management.ManagementFactory;
|
|
||||||
import java.lang.management.MemoryMXBean;
|
|
||||||
import java.lang.management.MemoryUsage;
|
|
||||||
import java.util.logging.FileHandler;
|
import java.util.logging.FileHandler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.SimpleFormatter;
|
import java.util.logging.SimpleFormatter;
|
||||||
@ -45,7 +42,6 @@ public class IngestMonitor {
|
|||||||
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());
|
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());
|
||||||
private Timer timer;
|
private Timer timer;
|
||||||
private static final java.util.logging.Logger MONITOR_LOGGER = java.util.logging.Logger.getLogger("monitor");
|
private static final java.util.logging.Logger MONITOR_LOGGER = java.util.logging.Logger.getLogger("monitor");
|
||||||
private final MemoryMXBean memoryManager = ManagementFactory.getMemoryMXBean();
|
|
||||||
private MonitorAction monitor;
|
private MonitorAction monitor;
|
||||||
|
|
||||||
IngestMonitor() {
|
IngestMonitor() {
|
||||||
@ -103,8 +99,7 @@ public class IngestMonitor {
|
|||||||
long getFreeSpace() {
|
long getFreeSpace() {
|
||||||
try {
|
try {
|
||||||
return monitor.getFreeSpace();
|
return monitor.getFreeSpace();
|
||||||
}
|
} catch (SecurityException e) {
|
||||||
catch (SecurityException e) {
|
|
||||||
logger.log(Level.WARNING, "Error checking for free disk space on ingest data drive", e);
|
logger.log(Level.WARNING, "Error checking for free disk space on ingest data drive", e);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -204,21 +199,7 @@ public class IngestMonitor {
|
|||||||
* Monitor memory usage and print to memory log
|
* Monitor memory usage and print to memory log
|
||||||
*/
|
*/
|
||||||
private void monitorMemory() {
|
private void monitorMemory() {
|
||||||
|
MONITOR_LOGGER.log(Level.INFO, PlatformUtil.getAllMemUsageInfo());
|
||||||
final Runtime runTime = Runtime.getRuntime();
|
|
||||||
final long maxMemory = runTime.maxMemory();
|
|
||||||
final long totalMemory = runTime.totalMemory();
|
|
||||||
final long freeMemory = runTime.freeMemory();
|
|
||||||
MONITOR_LOGGER.log(Level.INFO, "Physical memory (max, total, free): "
|
|
||||||
+ Long.toString(maxMemory) + ", " + Long.toString(totalMemory)
|
|
||||||
+ ", " + Long.toString(freeMemory));
|
|
||||||
|
|
||||||
final MemoryUsage heap = memoryManager.getHeapMemoryUsage();
|
|
||||||
final MemoryUsage nonHeap = memoryManager.getNonHeapMemoryUsage();
|
|
||||||
|
|
||||||
MONITOR_LOGGER.log(Level.INFO, "Java heap memory: " + heap.toString() + ", Java non-heap memory: " + nonHeap.toString());
|
|
||||||
MONITOR_LOGGER.log(Level.INFO, "Process Virtual Memory: " + PlatformUtil.getProcessVirtualMemoryUsed());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,15 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.sleuthkit.autopsy.corelibs;
|
package org.sleuthkit.autopsy.corelibs;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.hyperic.sigar.Sigar;
|
import org.hyperic.sigar.Sigar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper over Sigar instrumentation class to facilitate dll loading.
|
* Wrapper over Sigar instrumentation class to facilitate dll loading. Our setup
|
||||||
* Our setup bypasses Sigar library loader which does not work well for netbeans environment
|
* bypasses Sigar library loader which does not work well for netbeans
|
||||||
* We are responsible for loading the library ourselves.
|
* environment We are responsible for loading the library ourselves.
|
||||||
*/
|
*/
|
||||||
public class SigarLoader {
|
public class SigarLoader {
|
||||||
|
|
||||||
@ -38,9 +37,8 @@ public class SigarLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Sigar getSigar() {
|
public static Sigar getSigar() {
|
||||||
if (sigar == null) {
|
|
||||||
synchronized (SigarLoader.class) {
|
synchronized (SigarLoader.class) {
|
||||||
|
if (sigar == null) {
|
||||||
try {
|
try {
|
||||||
//rely on netbeans / jna to locate the lib variation for architecture/OS
|
//rely on netbeans / jna to locate the lib variation for architecture/OS
|
||||||
System.loadLibrary("libsigar");
|
System.loadLibrary("libsigar");
|
||||||
@ -49,8 +47,7 @@ public class SigarLoader {
|
|||||||
|
|
||||||
} catch (UnsatisfiedLinkError ex) {
|
} catch (UnsatisfiedLinkError ex) {
|
||||||
System.out.println("Error loading sigar library" + ex.toString());
|
System.out.println("Error loading sigar library" + ex.toString());
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
System.out.println("Error loading sigar library" + ex.toString());
|
System.out.println("Error loading sigar library" + ex.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ public class Server {
|
|||||||
|
|
||||||
InputStream stream;
|
InputStream stream;
|
||||||
OutputStream out;
|
OutputStream out;
|
||||||
boolean doRun = true;
|
volatile boolean doRun = true;
|
||||||
|
|
||||||
InputStreamPrinterThread(InputStream stream, String type) {
|
InputStreamPrinterThread(InputStream stream, String type) {
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
@ -266,9 +266,11 @@ public class Server {
|
|||||||
public void run() {
|
public void run() {
|
||||||
InputStreamReader isr = new InputStreamReader(stream);
|
InputStreamReader isr = new InputStreamReader(stream);
|
||||||
BufferedReader br = new BufferedReader(isr);
|
BufferedReader br = new BufferedReader(isr);
|
||||||
|
OutputStreamWriter osw = null;
|
||||||
|
BufferedWriter bw = null;
|
||||||
try {
|
try {
|
||||||
OutputStreamWriter osw = new OutputStreamWriter(out, PlatformUtil.getDefaultPlatformCharset());
|
osw = new OutputStreamWriter(out, PlatformUtil.getDefaultPlatformCharset());
|
||||||
BufferedWriter bw = new BufferedWriter(osw);
|
bw = new BufferedWriter(osw);
|
||||||
String line = null;
|
String line = null;
|
||||||
while (doRun && (line = br.readLine()) != null) {
|
while (doRun && (line = br.readLine()) != null) {
|
||||||
bw.write(line);
|
bw.write(line);
|
||||||
@ -280,7 +282,16 @@ public class Server {
|
|||||||
}
|
}
|
||||||
bw.flush();
|
bw.flush();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
logger.log(Level.WARNING, "Error redirecting Solr output stream");
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if (bw != null) {
|
||||||
|
try {
|
||||||
|
bw.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
logger.log(Level.WARNING, "Error closing Solr output stream");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ import org.sleuthkit.datamodel.BlackboardAttribute;
|
|||||||
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
||||||
import org.sleuthkit.datamodel.Image;
|
import org.sleuthkit.datamodel.Image;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
import org.sleuthkit.datamodel.TskData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chrome recent activity extraction
|
* Chrome recent activity extraction
|
||||||
@ -108,8 +109,24 @@ public class Chrome extends Extract implements IngestModuleImage {
|
|||||||
logger.log(Level.SEVERE, "Error when trying to get Chrome history files.", ex);
|
logger.log(Level.SEVERE, "Error when trying to get Chrome history files.", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get only the allocated ones, for now
|
||||||
|
List<FsContent> allocatedHistoryFiles = new ArrayList<>();
|
||||||
|
for (FsContent historyFile : historyFiles) {
|
||||||
|
if (historyFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC)) {
|
||||||
|
allocatedHistoryFiles.add(historyFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we should have only one allocated history file. Log a warning if we
|
||||||
|
// have more, but process them all
|
||||||
|
if (allocatedHistoryFiles.size() > 1) {
|
||||||
|
logger.log(Level.INFO, "Found more than one allocated Chrome history file. Processing them all.");
|
||||||
|
} else if (allocatedHistoryFiles.size() == 0) {
|
||||||
|
logger.log(Level.INFO, "Could not find an allocated Chrome history file.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
if (historyFiles != null && !historyFiles.isEmpty()) {
|
|
||||||
while (j < historyFiles.size()) {
|
while (j < historyFiles.size()) {
|
||||||
String temps = currentCase.getTempDirectory() + File.separator + historyFiles.get(j).getName().toString() + j + ".db";
|
String temps = currentCase.getTempDirectory() + File.separator + historyFiles.get(j).getName().toString() + j + ".db";
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
@ -155,7 +172,6 @@ public class Chrome extends Extract implements IngestModuleImage {
|
|||||||
|
|
||||||
services.fireModuleDataEvent(new ModuleDataEvent("Recent Activity", BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY));
|
services.fireModuleDataEvent(new ModuleDataEvent("Recent Activity", BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void getBookmark(Image image, IngestImageWorkerController controller) {
|
private void getBookmark(Image image, IngestImageWorkerController controller) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user