JNI comms up and going

This commit is contained in:
Karl Mortensen 2015-04-13 14:55:46 -04:00
parent dd91ea187d
commit 242c7b1b82
9 changed files with 137 additions and 12 deletions

View File

@ -355,7 +355,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
db = SleuthkitCase.newCase(dbName); db = SleuthkitCase.newCase(dbName);
} }
else if (caseType == CaseType.MULTI_USER_CASE) { else if (caseType == CaseType.MULTI_USER_CASE) {
db = SleuthkitCase.newCase(dbName, UserPreferences.getDatabaseConnectionInfo()); db = SleuthkitCase.newCase(dbName, UserPreferences.getDatabaseConnectionInfo(), caseDir);
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error creating a case: " + caseName + " in dir " + caseDir, ex); //NON-NLS logger.log(Level.SEVERE, "Error creating a case: " + caseName + " in dir " + caseDir, ex); //NON-NLS
@ -407,7 +407,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
} }
} else { } else {
db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), UserPreferences.getDatabaseConnectionInfo()); db = SleuthkitCase.openCase(xmlcm.getDatabaseName(), UserPreferences.getDatabaseConnectionInfo(), caseDir);
if (null != db.getBackupDatabasePath()) { if (null != db.getBackupDatabasePath()) {
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg", NbBundle.getMessage(Case.class, "Case.open.msgDlg.updated.msg",
@ -433,7 +433,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
throw new CaseActionException( throw new CaseActionException(
NbBundle.getMessage(Case.class, "Case.open.exception.checkFile.msg", CASE_DOT_EXTENSION), ex); NbBundle.getMessage(Case.class, "Case.open.exception.checkFile.msg", CASE_DOT_EXTENSION), ex);
} else { } else {
throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.open.exception.gen.msg"), ex); throw new CaseActionException(NbBundle.getMessage(Case.class, "Case.open.exception.gen.msg")+". "+ex.getMessage(), ex);
} }
} }
} }

View File

@ -218,6 +218,13 @@ class OpenRecentCasePanel extends javax.swing.JPanel {
Case.open(casePath); // open the case Case.open(casePath); // open the case
} }
} catch (CaseActionException ex) { } catch (CaseActionException ex) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(),
"CaseOpenAction.msgDlg.cantOpenCase.msg", caseName,
ex.getMessage()),
NbBundle.getMessage(this.getClass(),
"CaseOpenAction.msgDlg.cantOpenCase.title"),
JOptionPane.ERROR_MESSAGE);
logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS logger.log(Level.WARNING, "Error: couldn't open case: " + caseName, ex); //NON-NLS
} }
} }

View File

@ -79,6 +79,10 @@ class RecentItems implements ActionListener {
try { try {
Case.open(casePath); // open the case Case.open(casePath); // open the case
} catch (CaseActionException ex) { } catch (CaseActionException ex) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.msg", casePath,
ex.getMessage()), NbBundle.getMessage(this.getClass(), "CaseOpenAction.msgDlg.cantOpenCase.title"),
JOptionPane.ERROR_MESSAGE);
Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex); //NON-NLS Logger.getLogger(RecentItems.class.getName()).log(Level.WARNING, "Error: Couldn't open recent case at " + casePath, ex); //NON-NLS
} }
} }

View File

@ -65,9 +65,9 @@ public class Installer extends ModuleInstall {
//We should update this if we officially switch to a new version of CRT/compiler //We should update this if we officially switch to a new version of CRT/compiler
System.loadLibrary("msvcr100"); //NON-NLS System.loadLibrary("msvcr100"); //NON-NLS
System.loadLibrary("msvcp100"); //NON-NLS System.loadLibrary("msvcp100"); //NON-NLS
logger.log(Level.INFO, "MS CRT libraries loaded"); //NON-NLS logger.log(Level.INFO, "MSVCR100 and MSVCP100 libraries loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) { } catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ms crt libraries, ", e); //NON-NLS logger.log(Level.SEVERE, "Error loading MSVCR100 and MSVCP100 libraries, ", e); //NON-NLS
} }
try { try {
@ -83,6 +83,34 @@ public class Installer extends ModuleInstall {
} catch (UnsatisfiedLinkError e) { } catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading EWF library, ", e); //NON-NLS logger.log(Level.SEVERE, "Error loading EWF library, ", e); //NON-NLS
} }
try {
System.loadLibrary("libeay32"); //NON-NLS
logger.log(Level.INFO, "LIBEAY32 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading LIBEAY32 library, ", e); //NON-NLS
}
try {
System.loadLibrary("ssleay32"); //NON-NLS
logger.log(Level.INFO, "SSLEAY32 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading SSLEAY32 library, ", e); //NON-NLS
}
try {
System.loadLibrary("libintl-8"); //NON-NLS
logger.log(Level.INFO, "libintl-8 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading libintl-8 library, ", e); //NON-NLS
}
try {
System.loadLibrary("libpq"); //NON-NLS
logger.log(Level.INFO, "LIBPQ library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading LIBPQ library, ", e); //NON-NLS
}
} }
} }

View File

@ -151,7 +151,7 @@ public class FileTypeNode extends DisplayableItemNode {
if (UserPreferences.hideKnownFilesInViewsTree()) { if (UserPreferences.hideKnownFilesInViewsTree()) {
query.append(" AND (known IS NULL OR known != ").append(TskData.FileKnown.KNOWN.getFileKnownValue()).append(")"); //NON-NLS query.append(" AND (known IS NULL OR known != ").append(TskData.FileKnown.KNOWN.getFileKnownValue()).append(")"); //NON-NLS
} }
query.append(" AND (0"); //NON-NLS query.append(" AND (NULL"); //NON-NLS
for (String s : filter.getFilter()) { for (String s : filter.getFilter()) {
query.append(" OR name LIKE '%").append(s).append("'"); //NON-NLS query.append(" OR name LIKE '%").append(s).append("'"); //NON-NLS
} }

View File

@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.datamodel;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
@ -87,6 +86,7 @@ import org.sleuthkit.datamodel.TskCoreException;
try (CaseDbQuery dbQuery = skCase.executeQuery(query)) { try (CaseDbQuery dbQuery = skCase.executeQuery(query)) {
ResultSet resultSet = dbQuery.getResultSet(); ResultSet resultSet = dbQuery.getResultSet();
resultSet.next();
result = resultSet.getLong(1); result = resultSet.getLong(1);
} catch (TskCoreException | SQLException ex) { } catch (TskCoreException | SQLException ex) {
logger.log(Level.WARNING, "Couldn't get recent files results: ", ex); //NON-NLS logger.log(Level.WARNING, "Couldn't get recent files results: ", ex); //NON-NLS

View File

@ -498,7 +498,7 @@ public class IngestManager {
// Cancel all the jobs already created. Force a stack trace for the log // Cancel all the jobs already created. Force a stack trace for the log
// message. // message.
logger.log(Level.INFO, String.format("Cancelling all ingest jobs called with %d jobs in jobsById map", this.jobsById.size()), new Exception("Cancelling all ingest jobs")); // KDM logger.log(Level.INFO, String.format("Cancelling all ingest jobs called with %d jobs in jobsById map", this.jobsById.size()), new Exception("Cancelling all ingest jobs"));
for (IngestJob job : this.jobsById.values()) { for (IngestJob job : this.jobsById.values()) {
logger.log(Level.INFO, "Cancelling ingest job {0}, already cancelled is {1}", new Object[]{job.getId(), job.isCancelled()}); logger.log(Level.INFO, "Cancelling ingest job {0}, already cancelled is {1}", new Object[]{job.getId(), job.isCancelled()});
job.cancel(); job.cancel();

View File

@ -29,8 +29,10 @@
<property name="win64.TskLib.path" value="${env.TSK_HOME}/win32/x64/Release"/> <property name="win64.TskLib.path" value="${env.TSK_HOME}/win32/x64/Release"/>
<property name="win32.TskLib.path" value="${env.TSK_HOME}/win32/Release" /> <property name="win32.TskLib.path" value="${env.TSK_HOME}/win32/Release" />
<property name="win64.TskLib.path_postgres" value="${env.TSK_HOME}/win32/x64/Release_PostgreSql"/>
<available property="win64.TskLib.exists" type="dir" file="${win64.TskLib.path}" /> <available property="win64.TskLib.exists" type="dir" file="${win64.TskLib.path}" />
<available property="win32.TskLib.exists" type="dir" file="${win32.TskLib.path}" /> <available property="win32.TskLib.exists" type="dir" file="${win32.TskLib.path}" />
<available property="win64.TskLib_postgres.exists" type="dir" file="${win64.TskLib.path_postgres}" />
</target> </target>
<!-- The following copy the libtsk_jni dependencies to the Autopsy <!-- The following copy the libtsk_jni dependencies to the Autopsy
@ -41,6 +43,8 @@
<fileset dir="${win64.TskLib.path}" id="win64dlls"> <fileset dir="${win64.TskLib.path}" id="win64dlls">
<include name="libewf.dll" /> <include name="libewf.dll" />
<include name="zlib.dll"/> <include name="zlib.dll"/>
<include name="libpq.dll"/>
<include name="libintl-8.dll"/>
</fileset> </fileset>
<copy todir="${amd64}" overwrite="true"> <copy todir="${amd64}" overwrite="true">
@ -53,6 +57,29 @@
</target> </target>
<!-- The following copy the libtsk_jni dependencies to the Autopsy
folder structure. libtsk_jni is inside of the JAR file and contains
libtsk and the JNI code. -->
<!-- copy 64-bit dlls into the installer folder for Postgres build-->
<target name="copyWinTskLibs64_postgres_ToBaseDir" if="win64.TskLib_postgres.exists">
<fileset dir="${win64.TskLib.path_postgres}" id="win64_postgres_dlls">
<include name="libewf.dll" />
<include name="zlib.dll"/>
<include name="libpq.dll"/>
<include name="libintl-8.dll"/>
</fileset>
<copy todir="${amd64}" overwrite="true">
<fileset refid="win64_postgres_dlls" />
</copy>
<copy todir="${x86_64}" overwrite="true">
<fileset refid="win64_postgres_dlls" />
</copy>
</target>
<!-- copy 32-bit dlls into the installer folder --> <!-- copy 32-bit dlls into the installer folder -->
<target name="copyWinTskLibs32ToBaseDir" if="win32.TskLib.exists"> <target name="copyWinTskLibs32ToBaseDir" if="win32.TskLib.exists">
<fileset dir="${win32.TskLib.path}" id="win32dlls"> <fileset dir="${win32.TskLib.path}" id="win32dlls">
@ -84,6 +111,12 @@
<antcall target="copyWinTskLibs64ToBaseDir" inheritRefs="true" /> <antcall target="copyWinTskLibs64ToBaseDir" inheritRefs="true" />
</target> </target>
<!-- This gets called from the main build.xml -->
<target name="copyLibsToBaseDir_postgres" depends="checkTskLibDirs" description="Copy windows dlls to the correct location." >
<antcall target="makeBaseLibDirs" inheritRefs="true" />
<antcall target="copyWinTskLibs64_postgres_ToBaseDir" inheritRefs="true" />
</target>
<!-- CRT LIBS TO ZIP - gets called from build.xml --> <!-- CRT LIBS TO ZIP - gets called from build.xml -->
<target name="copyLibsToZip" depends="copyCRT32ToZIP,copyCRT64ToZIP"/> <target name="copyLibsToZip" depends="copyCRT32ToZIP,copyCRT64ToZIP"/>

View File

@ -54,7 +54,7 @@
<!-- This target will create a custom ZIP file for us. It first uses the general <!-- This target will create a custom ZIP file for us. It first uses the general
ZIP target and then opens it up and adds in any files that we want. This is where we customize the ZIP target and then opens it up and adds in any files that we want. This is where we customize the
version number. --> version number. -->
<target name="build-zip" depends="suite.build-zip"> <!--,findJRE" --> <target name="build-zip" depends="doxygen, suite.build-zip"> <!--,findJRE" -->
<property name="release.dir" value="${nbdist.dir}/${app.name}"/> <property name="release.dir" value="${nbdist.dir}/${app.name}"/>
@ -102,6 +102,10 @@
<include name="libtsk_jni.dll" /> <include name="libtsk_jni.dll" />
<include name="libewf.dll" /> <include name="libewf.dll" />
<include name="zlib.dll" /> <include name="zlib.dll" />
<include name="libintl-8.dll"/>
<include name="ssleay32.dll"/>
<include name="libeay32.dll"/>
<include name="libpq.dll"/>
</fileset> </fileset>
</delete> </delete>
@ -161,8 +165,30 @@
</condition> </condition>
</target> </target>
<target name="-init_postgres" depends="-taskdefs,-convert-old-project,getProps,getJunit,copyLibsToBaseDir_postgres">
<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"/>
<echo level="verbose">Suite in ${basedir} with clusters ${cluster.path.final}, build cluster ${cluster}, and sorted modules ${modules.sorted}</echo>
<!-- synchronize with SuiteProject -->
<property name="disabled.modules" value=""/>
<property name="enabled.clusters" value=""/>
<property name="disabled.clusters" value=""/>
<property name="branding.dir" location="branding"/>
<property name="dist.dir" location="dist"/>
<condition property="run.branding"> <!-- #84689 -->
<and>
<available file="${branding.dir}" type="dir"/>
<isset property="branding.token"/>
</and>
</condition>
</target>
<!-- override build to add branding --> <!-- override build to add branding -->
<target name="build" depends="build-brand,suite.build" description="Compiles autopsy and produces a basic branded build that can run on a dev. system" /> <target name="build" depends="build-brand,suite.build" description="Compiles autopsy and produces a basic branded build that can run on a dev. system" />
<target name="build_postgres" depends="build-brand_postgres,suite.build" description="Compiles autopsy and produces a basic branded build that can run on a dev. system" />
<target name="build-brand" depends="-init"> <target name="build-brand" depends="-init">
@ -189,6 +215,33 @@
<entry key="build.type" value="${build.type}" /> <entry key="build.type" value="${build.type}" />
</propertyfile> </propertyfile>
</target>
<target name="build-brand_postgres" depends="-init_postgres">
<echo>${app.name} branding</echo>
<propertyfile
file="${branding.dir}/core/core.jar/org/netbeans/core/startup/Bundle.properties"
comment="Updated by build script">
<entry key="currentVersion" value="${app.title} ${app.version}" />
</propertyfile>
<propertyfile
file="${branding.dir}/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties"
comment="Updated by build script">
<entry key="CTL_MainWindow_Title" value="${app.title} ${app.version}" />
<entry key="CTL_MainWindow_Title_No_Project" value="${app.title} ${app.version}" />
</propertyfile>
<propertyfile
file="${basedir}/Core/src/org/sleuthkit/autopsy/coreutils/Version.properties"
comment="Updated by build script">
<entry key="app.name" value="${app.title}" />
<entry key="app.version" value="${app.version}" />
<entry key="build.type" value="${build.type}" />
</propertyfile>
</target> </target>
<!-- This seems really bad to be hard coded, but I couldn't find a better solution --> <!-- This seems really bad to be hard coded, but I couldn't find a better solution -->