Merge branch 'master' of https://github.com/sleuthkit/autopsy into viewInContext

This commit is contained in:
Jeff Wallace 2013-11-26 12:15:07 -05:00
commit f022875a04
16 changed files with 570 additions and 367 deletions

View File

@ -26,8 +26,8 @@ import javafx.embed.swing.JFXPanel;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.openide.modules.ModuleInstall;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/**
* Wrapper over Installers in packages in Core module This is the main
@ -39,6 +39,41 @@ public class Installer extends ModuleInstall {
private static final Logger logger = Logger.getLogger(Installer.class.getName());
private static volatile boolean javaFxInit = false;
static {
loadDynLibraries();
}
private static void loadDynLibraries() {
if (PlatformUtil.isWindowsOS()) {
try {
//on windows force loading ms crt dependencies first
//in case linker can't find them on some systems
//Note: if shipping with a different CRT version, this will only print a warning
//and try to use linker mechanism to find the correct versions of libs.
//We should update this if we officially switch to a new version of CRT/compiler
System.loadLibrary("msvcr100");
System.loadLibrary("msvcp100");
logger.log(Level.INFO, "MS CRT libraries loaded");
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ms crt libraries, ", e);
}
try {
System.loadLibrary("zlib");
logger.log(Level.INFO, "ZLIB library loaded loaded");
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ZLIB library, ", e);
}
try {
System.loadLibrary("libewf");
logger.log(Level.INFO, "EWF library loaded");
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading EWF library, ", e);
}
}
}
public Installer() {
logger.log(Level.INFO, "core installer created");
javaFxInit = false;

View File

@ -299,7 +299,6 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
currentPage = page;
long offset = (currentPage - 1) * pageLength;
// change the cursor to "waiting cursor" for this operation
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
@ -344,13 +343,13 @@ public class DataContentViewerHex extends javax.swing.JPanel implements DataCont
// set the output view
if (errorText == null) {
int showLength = bytesRead < pageLength ? bytesRead : (int) pageLength;
outputViewPane.setText(DataConversion.byteArrayToHex(data, showLength, offset, outputViewPane.getFont()));
outputViewPane.setText(DataConversion.byteArrayToHex(data, showLength, offset));
}
else {
outputViewPane.setText(errorText);
}
outputViewPane.moveCaretPosition(0);
outputViewPane.setCaretPosition(0);
this.setCursor(null);
}

View File

@ -20,79 +20,106 @@ package org.sleuthkit.autopsy.datamodel;
import java.awt.Font;
import java.util.Arrays;
import java.util.Formatter;
/**
* Helper methods for converting data.
*/
public class DataConversion {
public static String byteArrayToHex(byte[] array, int length, long offset, Font font) {
final private static char[] hexArray = "0123456789ABCDEF".toCharArray();
/**
* Return the hex-dump layout of the passed in byte array.
* Deprecated because we don't need font
* @param array Data to display
* @param length Amount of data in array to display
* @param arrayOffset Offset of where data in array begins as part of a bigger file (used for arrayOffset column)
* @param font Font that will be used to display the text
* @return
*/
@Deprecated
public static String byteArrayToHex(byte[] array, int length, long arrayOffset, Font font) {
return byteArrayToHex(array, length, arrayOffset);
}
/**
* Return the hex-dump layout of the passed in byte array.
* @param array Data to display
* @param length Amount of data in array to display
* @param arrayOffset Offset of where data in array begins as part of a bigger file (used for arrayOffset column)
* @return
*/
public static String byteArrayToHex(byte[] array, int length, long arrayOffset) {
if (array == null) {
return "";
} else {
String base = new String(array, 0, length);
}
else {
StringBuilder outputStringBuilder = new StringBuilder();
StringBuilder buff = new StringBuilder();
int count = 0;
int extra = base.length() % 16;
String sub = "";
char subchar;
// loop through the file in 16-byte increments
for (int curOffset = 0; curOffset < length; curOffset += 16) {
// how many bytes are we displaying on this line
int lineLen = 16;
if (length - curOffset < 16) {
lineLen = length - curOffset;
}
//commented out code can be used as a base for generating hex length based on
//offset/length/file size
//String hex = Long.toHexString(length + offset);
//double hexMax = Math.pow(16, hex.length());
double hexMax = Math.pow(16, 6);
while (count < base.length() - extra) {
buff.append("0x");
buff.append(Long.toHexString((long) (offset + count + hexMax)).substring(1));
buff.append(": ");
// print the offset column
//outputStringBuilder.append("0x");
outputStringBuilder.append(String.format("0x%08x: ", arrayOffset + curOffset));
//outputStringBuilder.append(": ");
// print the hex columns
for (int i = 0; i < 16; i++) {
buff.append(Integer.toHexString((((int) base.charAt(count + i)) & 0xff) + 256).substring(1).toUpperCase());
buff.append(" ");
if (i < lineLen) {
int v = array[curOffset + i] & 0xFF;
outputStringBuilder.append(hexArray[v >>> 4]);
outputStringBuilder.append(hexArray[v & 0x0F]);
}
else {
outputStringBuilder.append(" ");
}
// someday we'll offer the option of these two styles...
if (true) {
outputStringBuilder.append(" ");
if (i % 4 == 3) {
outputStringBuilder.append(" ");
}
if (i == 7) {
buff.append(" ");
outputStringBuilder.append(" ");
}
}
// xxd style
else {
if (i % 2 == 1) {
outputStringBuilder.append(" ");
}
}
sub = base.substring(count, count + 16);
for (int i = 0; i < 16; i++) {
subchar = sub.charAt(i);
if (!font.canDisplay(subchar)) {
sub.replace(subchar, '.');
}
// replace all unprintable characters with "."
int dec = (int) subchar;
outputStringBuilder.append(" ");
// print the ascii columns
String ascii = new String(array, curOffset, lineLen);
for (int i = 0; i < 16; i++) {
char c = ' ';
if (i < lineLen) {
c = ascii.charAt(i);
int dec = (int) c;
if (dec < 32 || dec > 126) {
sub = sub.replace(subchar, '.');
c = '.';
}
}
buff.append(" " + sub + "\n");
count += 16;
outputStringBuilder.append(c);
}
outputStringBuilder.append("\n");
}
if (base.length() % 16 != 0) {
buff.append("0x" + Long.toHexString((long) (offset + count + hexMax)).substring(1) + ": ");
}
for (int i = 0; i < 16; i++) {
if (i < extra) {
buff.append(Integer.toHexString((((int) base.charAt(count + i)) & 0xff) + 256).substring(1) + " ");
} else {
buff.append(" ");
}
if (i == 7) {
buff.append(" ");
}
}
sub = base.substring(count, count + extra);
for (int i = 0; i < extra; i++) {
subchar = sub.charAt(i);
if (!font.canDisplay(subchar)) {
sub.replace(subchar, '.');
}
}
buff.append(" " + sub);
return buff.toString();
return outputStringBuilder.toString();
}
}

View File

@ -65,9 +65,15 @@ public class GeneralIngestConfigurator implements IngestConfigurator {
String[] enabledModuleNames = ModuleSettings.getConfigSetting(moduleContext, ENABLED_INGEST_MODULES_KEY).split(", ");
List<IngestModuleAbstract> enabledModules = new ArrayList<>();
for (String moduleName : enabledModuleNames) {
// if no modules were enabled, we get an empty string in here
if (moduleName.trim().equals("")) {
continue;
}
// we renamed this module in 3.0.9 -> update it to prevent an error message
if (moduleName.equals("Thunderbird Parser")) {
moduleName = "MBox Parser";
}
IngestModuleAbstract moduleFound = null;
for (IngestModuleAbstract module : allModules) {
if (moduleName.equals(module.getName())) {
@ -79,7 +85,7 @@ public class GeneralIngestConfigurator implements IngestConfigurator {
enabledModules.add(moduleFound);
}
else {
messages.add("Unable to enable ingest module: " + moduleName);
messages.add(moduleName + " was previously enabled, but could not be found");
}
}
ingestDialogPanel.setEnabledIngestModules(enabledModules);

View File

@ -3,7 +3,128 @@
<!-- Need a way to specify TSK Debug versus Release -->
<property name="TSK_BUILD_TYPE">Release</property>
<!-- Directory paths -->
<property name="amd64" location="${basedir}/Core/release/modules/lib/amd64" />
<property name="x86" location="${basedir}/Core/release/modules/lib/x86" />
<property name="x86_64" location="${basedir}/Core/release/modules/lib/x86_64" />
<property name="i386" location="${basedir}/Core/release/modules/lib/i386" />
<property name="i586" location="${basedir}/Core/release/modules/lib/i586" />
<property name="i686" location="${basedir}/Core/release/modules/lib/i686"/>
<property name="crt" location="${basedir}/thirdparty/crt" />
<!-- NATIVE LIB TARGETS -->
<target name="copyLibs" depends="copyWinLibs64,copyWinLibs32" description="Copy windows dlls to the correct location." />
<target name="init-lib-path" description="Set up folder hierarchy under release/modules/lib">
<mkdir dir="${amd64}"/>
<mkdir dir="${x86_64}"/>
<mkdir dir="${x86}"/>
<mkdir dir="${i386}"/>
<mkdir dir="${i586}"/>
<mkdir dir="${i686}"/>
</target>
<target name="checkLibDirs" depends="init-lib-path">
<property environment="env"/>
<condition property="ewfFound">
<isset property="env.LIBEWF_HOME"/>
</condition>
<fail unless="ewfFound" message="LIBEWF_HOME must be set as an environment variable."/>
<property name="win64.lib.path" value="${env.TSK_HOME}/win32/x64/Release"/>
<property name="win32.lib.path" value="${env.TSK_HOME}/win32/Release" />
<available property="win64.exists" type="dir" file="${win64.lib.path}" />
<available property="win32.exists" type="dir" file="${win32.lib.path}" />
</target>
<target name="copyWinLibs64" depends="checkLibDirs" if="win64.exists">
<property name="win64dir" location="${win64.lib.path}" />
<fileset dir="${win64dir}" id="win64dlls">
<include name="libewf.dll" />
<include name="zlib.dll"/>
</fileset>
<copy todir="${amd64}" overwrite="true">
<fileset refid="win64dlls" />
</copy>
<copy todir="${x86_64}" overwrite="true">
<fileset refid="win64dlls" />
</copy>
</target>
<target name="copyWinLibs32" depends="checkLibDirs" if="win32.exists">
<property name="win32dir" location="${win32.lib.path}" />
<fileset dir="${win32dir}" id="win32dlls">
<include name="zlib.dll" />
<include name="libewf.dll"/>
</fileset>
<copy todir="${i386}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
<copy todir="${x86}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
<copy todir="${i586}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
<copy todir="${i686}" overwrite="true">
<fileset refid="win32dlls" />
</copy>
</target>
<!-- CRT LIBS TO ZIP -->
<target name="copyExternalLibsToZip" depends="copyCRT32,copyCRT64"/>
<target name="copyCRT32">
<property name="CRT.path" value="${thirdparty.dir}/crt/win32/crt.zip"/>
<available file="${CRT.path}" property="crtFound"/>
<fail unless="crtFound" message="CRT not found in the thirdparty repo in path: ${CRT.path}"/>
<property name="zip-lib-path" value="${zip-tmp}/${app.name}/${app.name}/modules/lib/"/>
<unzip src="${CRT.path}" dest="${zip-lib-path}/x86" overwrite="true"/>
<fileset dir="${zip-lib-path}/x86" id="crt32dlls">
<include name="*.dll"/>
</fileset>
<copy todir="${zip-lib-path}/i386" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
<copy todir="${zip-lib-path}/i586" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
<copy todir="${zip-lib-path}/i686" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
</target>
<target name="copyCRT64">
<property name="CRT.path" value="${thirdparty.dir}/crt/win64/crt.zip"/>
<available file="${CRT.path}" property="crtFound"/>
<fail unless="crtFound" message="CRT not found in the thirdparty repo in path: ${CRT.path}"/>
<property name="zip-lib-path" value="${zip-tmp}/${app.name}/${app.name}/modules/lib/"/>
<unzip src="${CRT.path}" dest="${zip-lib-path}/x86_64" overwrite="true"/>
<fileset dir="${zip-lib-path}/x86_64" id="crt32dlls">
<include name="*.dll"/>
</fileset>
<copy todir="${zip-lib-path}/amd64" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
</target>
<!-- ADVANCED INSTALLER TARGETS -->
<target name="build-installer-windows" depends="init-advanced-installer"
description="Makes an installer from the opened ZIP file">
<antcall target="run-advanced-installer" />

View File

@ -72,6 +72,12 @@
<unzip src="${thirdparty.dir}/gstreamer/${os.family}/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/>
<copy file="${basedir}/branding_${app.name}/icon.ico" tofile="${zip-tmp}/${app.name}/icon.ico" overwrite="true"/>
<if>
<equals arg1="${os.family}" arg2="windows"/>
<then>
<antcall target="copyExternalLibsToZip"/>
</then>
</if>
<property name="app.property.file" value="${zip-tmp}/${app.name}/etc/${app.name}.conf" />
<property name="jvm.options" value="&quot;--branding ${app.name} -J-Xms24m -J-XX:MaxPermSize=128M -J-Xverify:none -J-Xdock:name=${app.title}&quot;" />
@ -126,7 +132,16 @@
<property name="app.version" value="${DSTAMP}"/>
</target>
<target name="-init" depends="-taskdefs,-convert-old-project,getProps,getJunit">
<target name="getExternals">
<if>
<equals arg1="${os.family}" arg2="windows"/>
<then>
<antcall target="copyLibs"/>
</then>
</if>
</target>
<target name="-init" depends="-taskdefs,-convert-old-project,getProps,getJunit,getExternals">
<convertclusterpath from="${cluster.path.evaluated}" to="cluster.path.final" id="cluster.path.id"/>
<sortsuitemodules unsortedmodules="${modules}" sortedmodulesproperty="modules.sorted"/>
<property name="cluster" location="build/cluster"/>

BIN
thirdparty/crt/win32/crt.zip vendored Executable file

Binary file not shown.

BIN
thirdparty/crt/win64/crt.zip vendored Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.