1
0
mirror of https://github.com/elisspace/autopsy.git synced 2026-08-29 15:43:50 +00:00

Merge pull request #1778 from mhmdfy/smaller-installer

Smaller installer
This commit is contained in:
Richard Cordovano
2015-12-17 13:39:58 -05:00
24 changed files with 174 additions and 83 deletions

View File

@@ -64,23 +64,23 @@ public class Installer extends ModuleInstall {
//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"); //NON-NLS
System.loadLibrary("msvcp100"); //NON-NLS
PlatformUtil.loadLibrary("msvcr100"); //NON-NLS
PlatformUtil.loadLibrary("msvcp100"); //NON-NLS
logger.log(Level.INFO, "MSVCR100 and MSVCP100 libraries loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading MSVCR100 and MSVCP100 libraries, ", e); //NON-NLS
logger.log(Level.WARNING, "Error loading MSVCR100 and MSVCP100 libraries"); //NON-NLS
}
try {
System.loadLibrary("zlib"); //NON-NLS
PlatformUtil.loadLibrary("zlib"); //NON-NLS
logger.log(Level.INFO, "ZLIB library loaded loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading ZLIB library, ", e); //NON-NLS
}
try {
System.loadLibrary("libewf"); //NON-NLS
PlatformUtil.loadLibrary("libewf"); //NON-NLS
logger.log(Level.INFO, "EWF library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading EWF library, ", e); //NON-NLS
@@ -88,21 +88,21 @@ public class Installer extends ModuleInstall {
/* PostgreSQL */
try {
System.loadLibrary("msvcr120"); //NON-NLS
PlatformUtil.loadLibrary("msvcr120"); //NON-NLS
logger.log(Level.INFO, "MSVCR 120 library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading MSVCR120 library, ", e); //NON-NLS
}
try {
System.loadLibrary("libeay32"); //NON-NLS
PlatformUtil.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
PlatformUtil.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
@@ -114,14 +114,14 @@ public class Installer extends ModuleInstall {
libintlName = "intl";
}
try {
System.loadLibrary(libintlName); //NON-NLS
PlatformUtil.loadLibrary(libintlName); //NON-NLS
logger.log(Level.INFO, libintlName + " library loaded"); //NON-NLS
} catch (UnsatisfiedLinkError e) {
logger.log(Level.SEVERE, "Error loading " + libintlName + " library, ", e); //NON-NLS
}
try {
System.loadLibrary("libpq"); //NON-NLS
PlatformUtil.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

@@ -42,12 +42,6 @@ public abstract class MediaViewVideoPanel extends JPanel implements FrameCapture
private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName());
// 64 bit architectures
private static final String[] ARCH64 = new String[]{"amd64", "x86_64"}; //NON-NLS NON-NLS
// 32 bit architectures
private static final String[] ARCH32 = new String[]{"x86"}; //NON-NLS
/**
* Factory Method to create a MediaViewVideoPanel.
*
@@ -71,8 +65,11 @@ public abstract class MediaViewVideoPanel extends JPanel implements FrameCapture
* @return
*/
private static boolean is64BitJVM() {
// String arch = System.getenv("PROCESSOR_ARCHITECTURE");
// String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");
// String realArch = arch.endsWith("64") || wow64Arch != null && wow64Arch.endsWith("64") ? "64" : "32";
String arch = System.getProperty("os.arch");
return Arrays.asList(ARCH64).contains(arch);
return arch.endsWith("64");
}
/**

View File

@@ -101,11 +101,11 @@ public class ImageUtils {
//load opencv libraries
boolean openCVLoadedTemp;
try {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
if (System.getProperty("os.arch").equals("amd64") || System.getProperty("os.arch").equals("x86_64")) {
System.loadLibrary("opencv_ffmpeg248_64");
PlatformUtil.loadLibrary(Core.NATIVE_LIBRARY_NAME);
if (System.getProperty("os.arch").endsWith("64")) {
PlatformUtil.loadLibrary("opencv_ffmpeg248_64");
} else {
System.loadLibrary("opencv_ffmpeg248");
PlatformUtil.loadLibrary("opencv_ffmpeg248");
}
openCVLoadedTemp = true;

View File

@@ -194,6 +194,17 @@ public class PlatformUtil {
return Places.getUserDirectory().getAbsolutePath() + File.separator
+ "var" + File.separator + "log" + File.separator; //NON-NLS
}
/**
* Gets the absolute path to the lib folder
*
* @return Lib path string
*/
public static String getLibsPath() {
// locate uses "/" regardless of format
File libFolder = InstalledFileLocator.getDefault().locate("modules/lib/" + getOSArch(), PlatformUtil.class.getPackage().getName(), false); //NON-NLS
return libFolder.getAbsolutePath();
}
public static String getDefaultPlatformFileEncoding() {
return System.getProperty("file.encoding");
@@ -269,7 +280,22 @@ public class PlatformUtil {
* @return OS arch string
*/
public static String getOSArch() {
return System.getProperty("os.arch", OS_ARCH_UNKNOWN); //NON-NLS
String arch = System.getProperty("os.arch"); //NON-NLS
if(arch == null)
return OS_ARCH_UNKNOWN;
else
return arch.endsWith("64") ? "x86_64" : "x86"; //NON-NLS
}
/**
* load library from library path (hardcoded .dll for now).
*
* @param libName name of library to be loaded
*/
public static void loadLibrary(String libName) {
String path = getLibsPath() + File.separator;
String ext = ".dll";
System.load(path + libName + ext);
}
/**

View File

@@ -6,6 +6,14 @@
<code-name-base>org.sleuthkit.autopsy.corelibs</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>org.openide.modules</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.43.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>

View File

@@ -5,3 +5,4 @@ OpenIDE-Module-Long-Description=\
OpenIDE-Module-Name=Autopsy-CoreLibs
OpenIDE-Module-Short-Description=Autopsy Core module external libraries
SigarLoader.linkErr.msg=Could not load sigar library for your environment (non-critical), OS-level metrics will be unavailable.
ScalpelCarver.archUnknown=unknown

View File

@@ -0,0 +1,70 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2012-15 Basis Technology Corp.
*
* Copyright 2012 42six Solutions.
* Contact: aebadirad <at> 42six <dot> com
* Project Contact/Architect: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.corelibs;
import java.io.File;
import org.openide.modules.InstalledFileLocator;
import org.openide.util.NbBundle;
class LibsPathUtil {
public static final String OS_ARCH_UNKNOWN = NbBundle.getMessage(LibsPathUtil.class, "LibsPathUtil.archUnknown");
private LibsPathUtil() {}
/**
* load library from library path (hardcoded .dll for now).
*
* @param libName name of library to be loaded
*/
public static void loadLibrary(String libName) {
String path = getLibsPath() + File.separator;
String ext = ".dll";
System.load(path + libName + ext);
}
/**
* Gets the absolute path to the lib folder
*
* @return Lib path string
*/
public static String getLibsPath() {
// locate uses "/" regardless of format
File libFolder = InstalledFileLocator.getDefault().locate("modules/lib/" + getOSArch(), LibsPathUtil.class.getPackage().getName(), false); //NON-NLS
return libFolder.getAbsolutePath();
}
/**
* Get OS arch details, or OS_ARCH_UNKNOWN
*
* @return OS arch string
*/
public static String getOSArch() {
String arch = System.getProperty("os.arch"); //NON-NLS
if(arch == null)
return OS_ARCH_UNKNOWN;
else
return arch.endsWith("64") ? "x86_64" : "x86"; //NON-NLS
}
}

View File

@@ -44,9 +44,9 @@ public class SigarLoader {
try {
//rely on netbeans / jna to locate the lib variation for architecture/OS
if (PlatformUtil.isWindows()) {
System.loadLibrary("libsigar"); //NON-NLS
LibsPathUtil.loadLibrary("libsigar"); //NON-NLS
} else {
System.loadLibrary("sigar"); //NON-NLS
LibsPathUtil.loadLibrary("sigar"); //NON-NLS
}
sigar = new Sigar();
sigar.enableLogging(false); //forces a test

View File

@@ -617,18 +617,6 @@ class ExtractRegistry extends Extract {
break;
case "ProcessorArchitecture": //NON-NLS
// Architecture is now included under Profiler
//try {
// String processorArchitecture = value;
// if (processorArchitecture.equals("AMD64"))
// processorArchitecture = "x86-64";
// BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_OS_INFO);
// bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROCESSOR_ARCHITECTURE.getTypeID(), parentModuleName, processorArchitecture));
// bbart.addAttributes(bbattributes);
//} catch (TskCoreException ex) {
// logger.log(Level.SEVERE, "Error adding os info artifact to blackboard."); //NON-NLS
//}
break;
case "ProfileList": //NON-NLS

View File

@@ -6,6 +6,14 @@
<code-name-base>org.sleuthkit.autopsy.scalpel</code-name-base>
<standalone/>
<module-dependencies>
<dependency>
<code-name-base>org.openide.modules</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.43.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>

View File

@@ -5,4 +5,5 @@ ScalpelCarver.carve.exception.invalidArgs=Invalid arguments for scalpel carving.
ScalpelCarver.carve.exception.cannotReadConfig=Cannot read libscalpel config file\: {0}
ScalpelCarver.carve.exception.cannotWriteConfig=Cannot write to libscalpel output dir\: {0}
ScalpelOutputParser.outputStart.text=The following files were carved\:
ScalpelOutputParser.toString.text=CarvedFileMeta'{'fileName\={0}, start\: {1}, size\: {2}'}'
ScalpelOutputParser.toString.text=CarvedFileMeta'{'fileName\={0}, start\: {1}, size\: {2}'}'
LibsPathUtil.archUnknown=unknown

View File

@@ -27,6 +27,7 @@ import java.util.List;
import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.openide.modules.InstalledFileLocator;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.scalpel.jni.ScalpelOutputParser.CarvedFileMeta;
import org.sleuthkit.datamodel.AbstractFile;
@@ -75,7 +76,7 @@ public class ScalpelCarver {
boolean success = false;
try {
//rely on netbeans / jna to locate the lib variation for architecture/OS
System.loadLibrary(id);
loadLibrary(id);
success = true;
} catch (UnsatisfiedLinkError ex) {
String msg = NbBundle.getMessage(ScalpelCarver.class, "ScalpelCarver.loadLib.errMsg.cannotLoadLib", id);
@@ -89,6 +90,41 @@ public class ScalpelCarver {
return success;
}
/**
* load library from library path (hardcoded .dll for now).
*
* @param libName name of library to be loaded
*/
private static void loadLibrary(String libName) {
String path = getLibsPath() + File.separator;
String ext = ".dll";
System.load(path + libName + ext);
}
/**
* Gets the absolute path to the lib folder
*
* @return Lib path string
*/
public static String getLibsPath() {
// locate uses "/" regardless of format
File libFolder = InstalledFileLocator.getDefault().locate("modules/lib/" + getOSArch(), ScalpelCarver.class.getPackage().getName(), false); //NON-NLS
return libFolder.getAbsolutePath();
}
/**
* Get OS arch details, or OS_ARCH_UNKNOWN
*
* @return OS arch string
*/
private static String getOSArch() {
String arch = System.getProperty("os.arch"); //NON-NLS
if(arch == null)
return NbBundle.getMessage(ScalpelCarver.class, "ScalpelCarver.archUnknown");
else
return arch.endsWith("64") ? "x86_64" : "x86"; //NON-NLS
}
/**

View File

@@ -43,7 +43,7 @@
</target>
<target name="autoAIPath" description="Attempt to find the AI path based on standard installation location">
<property name="AI.path" value="C:\Program Files (x86)\Caphyon\Advanced Installer 10.3\bin\x86\AdvancedInstaller.com" />
<property name="AI.path" value="C:\Program Files (x86)\Caphyon\Advanced Installer 12.4.2\bin\x86\advinst.exe" />
<available file="${AI.path}"
property="ai-exe-path"
value="${AI.path}"/>

View File

@@ -1,23 +1,15 @@
<project name="AutopsyTSKTargets">
<!-- 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" />
<import file="build-windows-installer.xml" />
<target name="makeBaseLibDirs" 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="checkTskLibDirs">
@@ -55,11 +47,6 @@
<include name="msvcr120.dll"/>
</fileset>
<copy todir="${amd64}" overwrite="true">
<fileset refid="win64dlls" />
<fileset refid="postgres64dlls" />
</copy>
<copy todir="${x86_64}" overwrite="true">
<fileset refid="win64dlls" />
<fileset refid="postgres64dlls" />
@@ -81,25 +68,10 @@
<include name="msvcr120.dll"/>
</fileset>
<copy todir="${i386}" overwrite="true">
<fileset refid="win32dlls" />
<fileset refid="postgres32dlls" />
</copy>
<copy todir="${x86}" overwrite="true">
<fileset refid="win32dlls" />
<fileset refid="postgres32dlls" />
</copy>
<copy todir="${i586}" overwrite="true">
<fileset refid="win32dlls" />
<fileset refid="postgres32dlls" />
</copy>
<copy todir="${i686}" overwrite="true">
<fileset refid="win32dlls" />
<fileset refid="postgres32dlls" />
</copy>
</target>
<!-- This gets called from the main build.xml -->
@@ -128,18 +100,6 @@
<copy todir="${zip-lib-path}/x86" overwrite="true">
<fileset refid="crt32dlls"/>
</copy>
<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="copyCRT64ToZIP">
@@ -157,9 +117,5 @@
<copy todir="${zip-lib-path}/x86_64" overwrite="true">
<fileset refid="crt64dlls"/>
</copy>
<copy todir="${zip-lib-path}/amd64" overwrite="true">
<fileset refid="crt64dlls"/>
</copy>
</target>
</project>

BIN
thirdparty/libscalpel_jni/current/libscalpel_jni.zip vendored Normal file → Executable file

Binary file not shown.

BIN
thirdparty/sigar/1.6.4/sigar-native.zip vendored Normal file → Executable file

Binary file not shown.