diff --git a/Core/src/org/sleuthkit/autopsy/examples/SampleDataSourceIngestModule.java b/Core/src/org/sleuthkit/autopsy/examples/SampleDataSourceIngestModule.java index da4a7b99b7..8b47e77101 100755 --- a/Core/src/org/sleuthkit/autopsy/examples/SampleDataSourceIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/examples/SampleDataSourceIngestModule.java @@ -89,7 +89,7 @@ import org.sleuthkit.datamodel.TskCoreException; } @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { // do nothing } diff --git a/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java index 464c79888c..23c2bf6c31 100755 --- a/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java @@ -72,7 +72,7 @@ import org.sleuthkit.datamodel.TskData; @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { /* For this demo, we are going to make a private attribute to post our * results to the blackbaord with. There are many standard blackboard artifact * and attribute types and you should first consider using one of those before diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestDataSourceThread.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestDataSourceThread.java index f599edf44a..8c427eeff1 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestDataSourceThread.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestDataSourceThread.java @@ -31,6 +31,7 @@ import org.openide.util.Cancellable; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.StopWatch; import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent; +import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException; import org.sleuthkit.datamodel.Content; /** @@ -75,13 +76,13 @@ import org.sleuthkit.datamodel.Content; return module; } - public void init() { + public void init() throws IngestModuleException{ logger.log(Level.INFO, "Initializing module: " + module.getName()); try { module.init(init); inited = true; - } catch (Exception e) { + } catch (IngestModuleException e) { logger.log(Level.INFO, "Failed initializing module: " + module.getName() + ", will not run."); //will not run inited = false; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java index 6e079a2d53..6ccd1b89dd 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -42,6 +42,7 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.StopWatch; import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType; import org.sleuthkit.autopsy.ingest.IngestScheduler.FileScheduler.FileTask; +import org.sleuthkit.autopsy.ingest.IngestModuleAbstract.IngestModuleException; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; @@ -459,7 +460,7 @@ public class IngestManager { IngestModuleInit moduleInit = new IngestModuleInit(); try { s.init(moduleInit); - } catch (Exception e) { + } catch (IngestModuleException e) { logger.log(Level.SEVERE, "File ingest module failed init(): " + s.getName(), e); allInited = false; failedModule = s; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleAbstract.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleAbstract.java index 6bf6b36f57..8ee8baea01 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleAbstract.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleAbstract.java @@ -23,7 +23,7 @@ package org.sleuthkit.autopsy.ingest; /** * Base interface for ingest modules */ - abstract class IngestModuleAbstract { + public abstract class IngestModuleAbstract { private String args; @@ -41,6 +41,13 @@ package org.sleuthkit.autopsy.ingest; */ AbstractFile }; + + public class IngestModuleException extends Exception { + public IngestModuleException(String msg) { + super(msg); + } + } + /** * Invoked every time an ingest session is started by the framework. @@ -55,8 +62,10 @@ package org.sleuthkit.autopsy.ingest; * NEVER initialize IngestServices handle in the member declaration, because it might result * in multiple instances of the singleton -- different class loaders are used in different modules. * @param initContext context used to initialize some modules + * + * @throws IngestModuleException if a critical error occurs in initializing the module. */ - abstract public void init(IngestModuleInit initContext); + abstract public void init(IngestModuleInit initContext) throws IngestModuleException; /** * Invoked when an ingest session completes. diff --git a/ExifParser/src/org/sleuthkit/autopsy/exifparser/ExifParserFileIngestModule.java b/ExifParser/src/org/sleuthkit/autopsy/exifparser/ExifParserFileIngestModule.java index f2283e814a..5d21b71e3b 100644 --- a/ExifParser/src/org/sleuthkit/autopsy/exifparser/ExifParserFileIngestModule.java +++ b/ExifParser/src/org/sleuthkit/autopsy/exifparser/ExifParserFileIngestModule.java @@ -226,7 +226,7 @@ public final class ExifParserFileIngestModule extends IngestModuleAbstractFile { } @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); logger.log(Level.INFO, "init() " + this.toString()); diff --git a/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchIngestModule.java b/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchIngestModule.java index 0e95916063..ce8e530d29 100644 --- a/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchIngestModule.java +++ b/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchIngestModule.java @@ -83,7 +83,7 @@ public class FileExtMismatchIngestModule extends org.sleuthkit.autopsy.ingest.In @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); // Load mapping diff --git a/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchXML.java b/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchXML.java index 5283d5c04f..a5cdb368e7 100644 --- a/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchXML.java +++ b/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/FileExtMismatchXML.java @@ -23,8 +23,8 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.logging.Level; import javax.xml.parsers.DocumentBuilder; @@ -33,7 +33,6 @@ import javax.xml.parsers.ParserConfigurationException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil; -import org.sleuthkit.datamodel.BlackboardAttribute; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -143,7 +142,7 @@ class FileExtMismatchXML { * @return Loaded hash map or null on error or null if data does not exist */ public boolean save(HashMap sigTypeToExtMap) { - boolean success = false; + boolean success; DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); @@ -154,16 +153,17 @@ class FileExtMismatchXML { Element rootEl = doc.createElement(ROOT_EL); doc.appendChild(rootEl); - Iterator keyIt = sigTypeToExtMap.keySet().iterator(); + ArrayList appTypeList = new ArrayList<>(sigTypeToExtMap.keySet()); + Collections.sort(appTypeList); - while (keyIt.hasNext()) { - String key = keyIt.next(); + for (String appType : appTypeList) { Element sigEl = doc.createElement(SIG_EL); - sigEl.setAttribute(SIG_MIMETYPE_ATTR, key); + sigEl.setAttribute(SIG_MIMETYPE_ATTR, appType); - String[] extArray = sigTypeToExtMap.get(key); + String[] extArray = sigTypeToExtMap.get(appType); if (extArray != null) { ArrayList extList = new ArrayList<>(Arrays.asList(extArray)); + Collections.sort(extList); for (String ext : extList) { Element extEl = doc.createElement(EXT_EL); extEl.setTextContent(ext); diff --git a/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/mismatch_config.xml b/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/mismatch_config.xml index 8c88fcb430..e41fb5f2df 100644 --- a/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/mismatch_config.xml +++ b/FileExtMismatch/src/org/sleuthkit/autopsy/fileextmismatch/mismatch_config.xml @@ -1,444 +1,439 @@ - + - - - txt - ini - inf - url - reg - cfg - log - lo_ - dat - lst - xml - dtd - xsd - xdr - xsl - xsml - kml - wsdl - box - rdf - manifest - htm - html - shtml - shtm - xhtml - hta - css - js - jsm - vbs - vb - php - php3 - phtml - h - hpp - hxx - cpp - cxx - cc - c - java - cs - asp - aspx - axd - ashx - properties - mak - cmake - la - pl - pm - plx - py - pyw - bat - lua - tex - lsp - lisp - rb - rbw - ps - json - mof - mfl - inc - milk - acro - adm - dun - obe - pro - sam - cmd - rat - htt - iem - policy - pc - catalog - hlp - cnt - sql - rbf - rsp - wpl - dic - aff - iqy - ecf - elm - ent - gdl - gpd - isp - theme - nt - cty - icw - man - ppd - cpx - scp - ver - library-ms - winprf - winprf_backup - svg - psp - jsp - oem - map - det - ins - ph - prx - sif - idl - isl - nld - sve - ita - fra - esn - enu - deu - sep - sve - cht - chs - psm - rq0 - old - eng - dlg - org - ic - ths - sig - std - cmp - stp - rst - lng - xdc - tha - sys - - doc - docx - docm - dotm - dot - dotx - xls - xlt - xla - xlsx - xlsm - xltm - xlam - xlsb - ppt - pot - pps - ppa - pptx - potx - ppam - pptm - potm - ppsm - msi - mst - db - db.keep - wiz - gra - automaticDestinations-ms - customDestinations-ms - feed-ms - - - docx - dotx - xlsx - xlsm - xltm - xlam - xlsb - pptx - potx - ppam - pptm - potm - ppsm - - - doc - dot - - - xls - xlt - xla - - - ppt - pot - pps - ppa - - - zip - docx - dotx - xlsx - xlsm - xltm - xlam - xlsb - pptx - potx - ppam - pptm - potm - ppsm - wmz - jar - amo - xpi - - - odt - - - ods - - - odp - - - pdf - - - rtf - - - htm - html - htx - htmls - hhk - hta - wpl - htt - shtml - - - - jpg - jpeg - jpe - jif - jfif - jfi - - - psd - - - nef - - - tif - tiff - - - png - - - gif - - - bmp - - - bmp - bm - - - ico - - - - mp4 - m4r - - - mov - qt - mp4 - - - rm - - - 3gp - - - avi - - - wmv - - - wmv - asf - - - wmv - asf - wma - - - wma - asf - - - mpg - mpeg - m1v - m2v - mpe - mpv - - - flv - - - m4v - - - rm - - - rv - - - swf - - - - aif - aiff - - - aif - aiff - - - flac - - - wav - - - m4a - mp4 - - - mp2 - mp3 - mpa - m2a - - - aac - - - mp2 - mp3 - mpa - m2a - - - mp2 - mp3 - mpa - m2a - - - m3u - - - mid - midi - - - ogg - - - - rar - - - arj - - - tar - - - gz - gzip - tgz - - - bzip - bz - - - cab - - - jar - - - bzip2 - - - cpio - - - - exe - - \ No newline at end of file + + tar + + + nef + + + xla + xls + xlt + + + docx + dotx + potm + potx + ppam + ppsm + pptm + pptx + xlam + xlsb + xlsm + xlsx + xltm + + + bzip2 + + + tif + tiff + + + aif + aiff + + + arj + + + pot + ppa + pps + ppt + + + amo + docx + dotx + jar + kmz + potm + potx + ppam + ppsm + pptm + pptx + wmz + xlam + xlsb + xlsm + xlsx + xltm + xpi + zip + + + aac + + + png + + + gif + + + hhk + hta + htm + html + htmls + htt + htx + shtml + wpl + + + m2a + mp2 + mp3 + mpa + + + exe + + + mid + midi + + + ico + + + psd + + + m2a + mp2 + mp3 + mpa + + + rv + + + jfi + jfif + jif + jpe + jpeg + jpg + + + m4r + mp4 + + + doc + rtf + + + cab + + + aif + aiff + + + wav + + + jar + + + wmv + + + asf + wmv + + + asf + wma + + + odp + + + asf + wma + wmv + + + ods + + + doc + dot + + + gz + gzip + tgz + + + avi + + + flv + + + odt + + + bz + bzip + + + swf + + + m2a + mp2 + mp3 + mpa + + + ogg + + + cpio + + + 3gp + + + bmp + + + rar + + + acro + adm + aff + ashx + asp + aspx + axd + bat + box + c + catalog + cc + cfg + chs + cht + cmake + cmd + cmp + cnt + cpp + cpx + cs + css + csv + cty + cxx + dat + det + deu + dic + dlg + dtd + dun + ecf + elm + eng + ent + enu + esn + fra + gdl + gpd + h + hlp + hpp + hta + htm + html + htt + hxx + ic + icw + idl + iem + inc + inf + ini + ins + iqy + isl + isp + ita + java + js + jsm + json + jsp + kml + la + library-ms + lisp + lng + lo_ + log + lsp + lst + lua + mak + man + manifest + map + mfl + milk + mof + nld + nt + obe + oem + old + org + pc + ph + php + php3 + phtml + pl + plx + pm + policy + ppd + pro + properties + prx + ps + psm + psp + py + pyw + rat + rb + rbf + rbw + rdf + reg + rq0 + rsp + rst + sam + scp + sep + shtm + shtml + sif + sig + sql + std + stp + sve + sve + svg + tex + text + tha + theme + ths + txt + url + vb + vbs + ver + winprf + winprf_backup + wpl + wsdl + xdc + xdr + xhtml + xml + xsd + xsl + xsml + + + m3u + + + m4a + mp4 + + + mov + mp4 + qt + + + flac + + + bm + bmp + + + m1v + m2v + mpe + mpeg + mpg + mpv + + + automaticDestinations-ms + customDestinations-ms + db + db.keep + doc + docm + docx + dot + dotm + dotx + feed-ms + gra + msi + mst + pot + potm + potx + ppa + ppam + pps + ppsm + ppt + pptm + pptx + wiz + xla + xlam + xls + xlsb + xlsm + xlsx + xlt + xltm + + + rm + + + m4v + + + pdf + + diff --git a/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/FileTypeIdIngestModule.java b/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/FileTypeIdIngestModule.java index 8ab0b53bbe..a32a7ba109 100644 --- a/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/FileTypeIdIngestModule.java +++ b/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/FileTypeIdIngestModule.java @@ -76,7 +76,7 @@ import org.sleuthkit.datamodel.TskException; @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); } diff --git a/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/TikaFileTypeDetector.java b/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/TikaFileTypeDetector.java index 4d902037cb..8ab655e27b 100644 --- a/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/TikaFileTypeDetector.java +++ b/FileTypeId/src/org/sleuthkit/autopsy/filetypeid/TikaFileTypeDetector.java @@ -38,11 +38,26 @@ class TikaFileTypeDetector implements FileTypeDetectionInterface { byte buffer[] = new byte[maxBytesInitial]; int len = abstractFile.read(buffer, 0, maxBytesInitial); + boolean found = false; try { - String mimetype = tikaInst.detect(buffer); + // the xml detection in Tika tries to parse the entire file and throws exceptions + // for files that are not complete + try { + String tagHeader = new String(buffer, 0, 5); + if (tagHeader.equals("(); browserModules = new ArrayList(); logger.log(Level.INFO, "init() {0}", this.toString()); @@ -180,7 +180,7 @@ public final class RAImageIngestModule extends IngestModuleDataSource { for (Extract module : modules) { try { module.init(initContext); - } catch (Exception ex) { + } catch (IngestModuleException ex) { logger.log(Level.SEVERE, "Exception during init() of " + module.getName(), ex); } } diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RecentDocumentsByLnk.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RecentDocumentsByLnk.java index 880427e832..e304df8c7b 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RecentDocumentsByLnk.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/RecentDocumentsByLnk.java @@ -121,7 +121,7 @@ class RecentDocumentsByLnk extends Extract { } @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); } diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/SearchEngineURLQueryAnalyzer.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/SearchEngineURLQueryAnalyzer.java index 4477271dd9..24da74feef 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/SearchEngineURLQueryAnalyzer.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/SearchEngineURLQueryAnalyzer.java @@ -333,7 +333,7 @@ class SearchEngineURLQueryAnalyzer extends Extract { } @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { try{ services = IngestServices.getDefault(); PlatformUtil.extractResourceToUserConfigDir(SearchEngineURLQueryAnalyzer.class, XMLFILE); diff --git a/SevenZip/src/org/sleuthkit/autopsy/sevenzip/SevenZipIngestModule.java b/SevenZip/src/org/sleuthkit/autopsy/sevenzip/SevenZipIngestModule.java index 4f79973dcd..861e7e4828 100644 --- a/SevenZip/src/org/sleuthkit/autopsy/sevenzip/SevenZipIngestModule.java +++ b/SevenZip/src/org/sleuthkit/autopsy/sevenzip/SevenZipIngestModule.java @@ -113,7 +113,7 @@ public final class SevenZipIngestModule extends IngestModuleAbstractFile { } @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); initialized = false; diff --git a/ewfVerify/src/org/sleuthkit/autopsy/ewfverify/EwfVerifyIngestModule.java b/ewfVerify/src/org/sleuthkit/autopsy/ewfverify/EwfVerifyIngestModule.java index c6afccff95..2719bf2033 100755 --- a/ewfVerify/src/org/sleuthkit/autopsy/ewfverify/EwfVerifyIngestModule.java +++ b/ewfVerify/src/org/sleuthkit/autopsy/ewfverify/EwfVerifyIngestModule.java @@ -153,7 +153,7 @@ public class EwfVerifyIngestModule extends IngestModuleDataSource { } @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); skCase = Case.getCurrentCase().getSleuthkitCase(); running = false; diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java index 4527cf737b..82a4ffcb6e 100644 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java @@ -285,7 +285,7 @@ public class ThunderbirdMboxFileIngestModule extends IngestModuleAbstractFile { @Override - public void init(IngestModuleInit initContext) { + public void init(IngestModuleInit initContext) throws IngestModuleException { services = IngestServices.getDefault(); fileManager = Case.getCurrentCase().getServices().getFileManager(); }