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;
 
   52     private final List<Extract> 
extractors = 
new ArrayList<>();
 
   67         Extract iexplore = 
new ExtractIE(context);
 
   68         Extract edge = 
new ExtractEdge(context);
 
   69         Extract registry = 
new ExtractRegistry(context);
 
   70         Extract recentDocuments = 
new RecentDocumentsByLnk(context);
 
   71         Extract chrome = 
new Chromium(context);
 
   72         Extract firefox = 
new Firefox(context);
 
   73         Extract SEUQA = 
new SearchEngineURLQueryAnalyzer(context);
 
   74         Extract osExtract = 
new ExtractOs(context);
 
   75         Extract dataSourceAnalyzer = 
new DataSourceUsageAnalyzer(context);
 
   76         Extract safari = 
new ExtractSafari(context);
 
   77         Extract zoneInfo = 
new ExtractZoneIdentifier(context);
 
   78         Extract recycleBin = 
new ExtractRecycleBin(context);
 
   79         Extract sru = 
new ExtractSru(context);
 
   80         Extract prefetch = 
new ExtractPrefetch(context);
 
   81         Extract webAccountType = 
new ExtractWebAccountType(context);
 
   82         Extract messageDomainType = 
new DomainCategoryRunner(context);
 
   83         Extract jumpList = 
new ExtractJumpLists(context);
 
   85         extractors.add(recycleBin);
 
   86         extractors.add(jumpList);
 
   87         extractors.add(recentDocuments);
 
   88         extractors.add(registry); 
 
   89         extractors.add(osExtract); 
 
   90         extractors.add(dataSourceAnalyzer); 
 
   91         extractors.add(chrome);
 
   92         extractors.add(firefox);
 
   93         extractors.add(iexplore);
 
   95         extractors.add(safari);
 
   96         extractors.add(SEUQA); 
 
   97         extractors.add(webAccountType); 
 
   98         extractors.add(zoneInfo); 
 
  100         extractors.add(prefetch);
 
  101         extractors.add(messageDomainType);
 
  103         browserExtractors.add(chrome);
 
  104         browserExtractors.add(firefox);
 
  105         browserExtractors.add(iexplore);
 
  106         browserExtractors.add(edge);
 
  107         browserExtractors.add(safari);
 
  109         for (Extract extractor : extractors) {
 
  117                 NbBundle.getMessage(this.getClass(),
 
  118                         "RAImageIngestModule.process.started",
 
  123         ArrayList<String> errors = 
new ArrayList<>();
 
  125         for (
int i = 0; i < extractors.size(); i++) {
 
  126             Extract extracter = extractors.get(i);
 
  128                 logger.log(Level.INFO, 
"Recent Activity has been canceled, quitting before {0}", extracter.getDisplayName()); 
 
  132             progressBar.
progress(extracter.getDisplayName(), i);
 
  135                 extracter.process(dataSource, progressBar);
 
  136             } 
catch (Exception ex) {
 
  137                 logger.log(Level.SEVERE, 
"Exception occurred in " + extracter.getDisplayName(), ex); 
 
  141             errors.addAll(extracter.getErrorMessages());
 
  145         StringBuilder errorMessage = 
new StringBuilder();
 
  146         String errorMsgSubject;
 
  148         if (errors.isEmpty() == 
false) {
 
  151                     NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.errMsg.errsEncountered"));
 
  152             for (String msg : errors) {
 
  153                 errorMessage.append(
"<li>").append(msg).append(
"</li>\n"); 
 
  155             errorMessage.append(
"</ul>\n"); 
 
  157             if (errors.size() == 1) {
 
  158                 errorMsgSubject = NbBundle.getMessage(this.getClass(), 
"RAImageIngestModule.process.errMsgSub.oneErr");
 
  160                 errorMsgSubject = NbBundle.getMessage(this.getClass(),
 
  161                         "RAImageIngestModule.process.errMsgSub.nErrs", errors.size());
 
  164             errorMessage.append(NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.errMsg.noErrs"));
 
  165             errorMsgSubject = NbBundle.getMessage(this.getClass(), 
"RAImageIngestModule.process.errMsgSub.noErrs");
 
  168                 NbBundle.getMessage(this.getClass(),
 
  169                         "RAImageIngestModule.process.ingestMsg.finished",
 
  170                         dataSource.
getName(), errorMsgSubject),
 
  171                 errorMessage.toString());
 
  174         StringBuilder historyMsg = 
new StringBuilder();
 
  176                 NbBundle.getMessage(
this.getClass(), 
"RAImageIngestModule.process.histMsg.title", dataSource.
getName()));
 
  177         for (Extract module : browserExtractors) {
 
  178             historyMsg.append(
"<li>").append(module.getDisplayName()); 
 
  179             historyMsg.append(
": ").append((module.foundData()) ? NbBundle
 
  180                     .getMessage(this.getClass(), 
"RAImageIngestModule.process.histMsg.found") : NbBundle
 
  181                     .getMessage(this.getClass(), 
"RAImageIngestModule.process.histMsg.notFnd"));
 
  182             historyMsg.append(
"</li>"); 
 
  184         historyMsg.append(
"</ul>"); 
 
  186                 NbBundle.getMessage(this.getClass(),
 
  187                         "RAImageIngestModule.process.ingestMsg.results",
 
  189                 historyMsg.toString());
 
  197         for (
int i = 0; i < extractors.size(); i++) {
 
  198             Extract extracter = extractors.get(i);
 
  200                 extracter.shutDown();
 
  201             } 
catch (Exception ex) {
 
  202                 logger.log(Level.SEVERE, 
"Exception occurred when completing " + extracter.getDisplayName(), ex); 
 
  220         String moduleFolder = String.format(
"%s_%d", module, ingestJobId);
 
  221         Path tmpPath = Paths.get(basePath, RECENT_ACTIVITY_FOLDER, moduleFolder);
 
  222         File dir = tmpPath.toFile();
 
  223         if (dir.exists() == 
false) {
 
  226         return tmpPath.toString();
 
  239     static String getRATempPath(
Case a_case, String mod, 
long ingestJobId) {
 
  253     static String getRAOutputPath(Case a_case, String mod, 
long ingestJobId) {
 
  263     static String getRelModuleOutputPath(Case autCase, String mod, 
long ingestJobId) {
 
  264         return Paths.get(
getAndMakeRAPath(autCase.getModuleOutputDirectoryRelativePath(), mod, ingestJobId))
 
final List< Extract > extractors
static final Logger logger
String getTempDirectory()
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()