23 package org.sleuthkit.autopsy.recentactivity;
 
   26 import java.nio.file.Path;
 
   27 import java.nio.file.Paths;
 
   28 import java.util.ArrayList;
 
   29 import java.util.List;
 
   30 import java.util.logging.Level;
 
   31 import org.openide.util.NbBundle;
 
   54     private final List<Extract> 
extractors = 
new ArrayList<>();
 
   71         Extract iexplore = 
new ExtractIE();
 
   72         Extract edge = 
new ExtractEdge();
 
   73         Extract registry = 
new ExtractRegistry();
 
   74         Extract recentDocuments = 
new RecentDocumentsByLnk();
 
   75         Extract chrome = 
new Chromium();
 
   76         Extract firefox = 
new Firefox();
 
   77         Extract SEUQA = 
new SearchEngineURLQueryAnalyzer();
 
   78         Extract osExtract = 
new ExtractOs();
 
   79         Extract dataSourceAnalyzer = 
new DataSourceUsageAnalyzer();
 
   80         Extract safari = 
new ExtractSafari();
 
   81         Extract zoneInfo = 
new ExtractZoneIdentifier();
 
   82         Extract recycleBin = 
new ExtractRecycleBin();
 
   83         Extract sru = 
new ExtractSru();
 
   84         Extract prefetch = 
new ExtractPrefetch();
 
   85         Extract webAccountType = 
new ExtractWebAccountType();
 
   86         Extract messageDomainType = 
new DomainCategoryRunner();
 
   87         Extract jumpList = 
new ExtractJumpLists();
 
   89         extractors.add(recycleBin); 
 
   90         extractors.add(jumpList);
 
   91         extractors.add(recentDocuments);
 
   92         extractors.add(registry); 
 
   93         extractors.add(osExtract); 
 
   94         extractors.add(dataSourceAnalyzer); 
 
   95         extractors.add(chrome);
 
   96         extractors.add(firefox);
 
   97         extractors.add(iexplore);
 
   99         extractors.add(safari);
 
  100         extractors.add(SEUQA); 
 
  101         extractors.add(webAccountType); 
 
  102         extractors.add(zoneInfo); 
 
  104         extractors.add(prefetch);
 
  105         extractors.add(messageDomainType);
 
  107         browserExtractors.add(chrome);
 
  108         browserExtractors.add(firefox);
 
  109         browserExtractors.add(iexplore);
 
  110         browserExtractors.add(edge);
 
  111         browserExtractors.add(safari);
 
  113         for (Extract extractor : extractors) {
 
  121                 NbBundle.getMessage(this.getClass(),
 
  122                         "RAImageIngestModule.process.started",
 
  123                         dataSource.getName())));
 
  127         ArrayList<String> errors = 
new ArrayList<>();
 
  129         for (
int i = 0; i < extractors.size(); i++) {
 
  130             Extract extracter = extractors.get(i);
 
  132                 logger.log(Level.INFO, 
"Recent Activity has been canceled, quitting before {0}", extracter.getName()); 
 
  136             progressBar.
progress(extracter.getName(), i);
 
  139                 extracter.process(dataSource, context, progressBar, accountCache);
 
  140                 if (extracter instanceof ExtractRegistry) {
 
  141                     accountCache.initialize(tskCase, ((DataSource) dataSource).getHost());
 
  143             } 
catch (Exception ex) {
 
  144                 logger.log(Level.SEVERE, 
"Exception occurred in " + extracter.getName(), ex); 
 
  145                 subCompleted.append(NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.errModFailed",
 
  146                         extracter.getName()));
 
  151             errors.addAll(extracter.getErrorMessages());
 
  155         StringBuilder errorMessage = 
new StringBuilder();
 
  156         String errorMsgSubject;
 
  158         if (errors.isEmpty() == 
false) {
 
  161                     NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.errMsg.errsEncountered"));
 
  162             for (String msg : errors) {
 
  163                 errorMessage.append(
"<li>").append(msg).append(
"</li>\n"); 
 
  165             errorMessage.append(
"</ul>\n"); 
 
  167             if (errors.size() == 1) {
 
  168                 errorMsgSubject = NbBundle.getMessage(this.getClass(), 
"RAImageIngestModule.process.errMsgSub.oneErr");
 
  170                 errorMsgSubject = NbBundle.getMessage(this.getClass(),
 
  171                         "RAImageIngestModule.process.errMsgSub.nErrs", errors.size());
 
  174             errorMessage.append(NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.errMsg.noErrs"));
 
  175             errorMsgSubject = NbBundle.getMessage(this.getClass(), 
"RAImageIngestModule.process.errMsgSub.noErrs");
 
  178                 NbBundle.getMessage(this.getClass(),
 
  179                         "RAImageIngestModule.process.ingestMsg.finished",
 
  180                         dataSource.getName(), errorMsgSubject),
 
  181                 errorMessage.toString());
 
  184         StringBuilder historyMsg = 
new StringBuilder();
 
  186                 NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.histMsg.title", dataSource.getName()));
 
  187         for (Extract module : browserExtractors) {
 
  188             historyMsg.append(
"<li>").append(module.getName()); 
 
  189             historyMsg.append(
": ").append((module.foundData()) ? NbBundle
 
  190                     .getMessage(this.getClass(), 
"RAImageIngestModule.process.histMsg.found") : NbBundle
 
  191                     .getMessage(this.getClass(), 
"RAImageIngestModule.process.histMsg.notFnd"));
 
  192             historyMsg.append(
"</li>"); 
 
  194         historyMsg.append(
"</ul>"); 
 
  196                 NbBundle.getMessage(this.getClass(),
 
  197                         "RAImageIngestModule.process.ingestMsg.results",
 
  198                         dataSource.getName()),
 
  199                 historyMsg.toString());
 
  206         for (
int i = 0; i < extractors.size(); i++) {
 
  207             Extract extracter = extractors.get(i);
 
  209                 extracter.complete();
 
  210             } 
catch (Exception ex) {
 
  211                 logger.log(Level.SEVERE, 
"Exception occurred when completing " + extracter.getName(), ex); 
 
  212                 subCompleted.append(NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.complete.errMsg.failed",
 
  213                         extracter.getName()));
 
  232         String moduleFolder = String.format(
"%s_%d", module, ingestJobId);
 
  233         Path tmpPath = Paths.get(basePath, RECENT_ACTIVITY_FOLDER, moduleFolder);
 
  234         File dir = tmpPath.toFile();
 
  235         if (dir.exists() == 
false) {
 
  238         return tmpPath.toString();
 
  251     static String getRATempPath(
Case a_case, String mod, 
long ingestJobId) {
 
  265     static String getRAOutputPath(Case a_case, String mod, 
long ingestJobId) {
 
  275     static String getRelModuleOutputPath(Case autCase, String mod, 
long ingestJobId) {
 
  276         return Paths.get(
getAndMakeRAPath(autCase.getModuleOutputDirectoryRelativePath(), mod, ingestJobId))
 
final List< Extract > extractors
 
static final Logger logger
 
String getTempDirectory()
 
RAOsAccountCache accountCache
 
final StringBuilder subCompleted
 
static IngestMessage createMessage(MessageType messageType, String source, String subject, String detailsHtml)
 
ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar)
 
static final String RECENT_ACTIVITY_FOLDER
 
void postMessage(final IngestMessage message)
 
SleuthkitCase getSleuthkitCase()
 
void startUp(IngestJobContext context)
 
boolean dataSourceIngestIsCancelled()
 
final List< Extract > browserExtractors
 
void switchToDeterminate(int workUnits)
 
static Case getCurrentCase()
 
synchronized static Logger getLogger(String name)
 
static String getAndMakeRAPath(String basePath, String module, long ingestJobId)
 
void progress(int workUnits)
 
final IngestServices services
 
static synchronized IngestServices getInstance()