Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
AndroidIngestModule.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.modules.android;
20 
21 import java.util.ArrayList;
22 import java.util.HashMap;
23 
24 import org.openide.util.NbBundle;
36 
37 class AndroidIngestModule implements DataSourceIngestModule {
38 
39  private static final HashMap<Long, Long> fileCountsForIngestJobs = new HashMap<>();
40  private IngestJobContext context = null;
41  private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter();
42  private static final Logger logger = Logger.getLogger(AndroidIngestModule.class.getName());
43  private IngestServices services = IngestServices.getInstance();
44 
45  @Override
46  public void startUp(IngestJobContext context) throws IngestModuleException {
47  this.context = context;
48  }
49 
50  @Override
51  public ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar) {
53  NbBundle.getMessage(this.getClass(),
54  "AndroidIngestModule.processing.startedAnalysis")));
55 
56  ArrayList<String> errors = new ArrayList<>();
57  progressBar.switchToDeterminate(9);
59 
60  try {
61  ContactAnalyzer.findContacts(dataSource, fileManager);
62  progressBar.progress(1);
63  if (context.dataSourceIngestIsCancelled()) {
65  }
66  } catch (Exception e) {
67  errors.add("Error getting Contacts"); //NON-NLS
68  }
69 
70  try {
71  CallLogAnalyzer.findCallLogs(dataSource, fileManager);
72  progressBar.progress(2);
73  if (context.dataSourceIngestIsCancelled()) {
75  }
76  } catch (Exception e) {
77  errors.add("Error getting Call Logs"); //NON-NLS
78  }
79 
80  try {
81  TextMessageAnalyzer.findTexts(dataSource, fileManager);
82  progressBar.progress(3);
83  if (context.dataSourceIngestIsCancelled()) {
85  }
86  } catch (Exception e) {
87  errors.add("Error getting Text Messages"); //NON-NLS
88  }
89 
90  try {
91  TangoMessageAnalyzer.findTangoMessages(dataSource, fileManager);
92  progressBar.progress(4);
93  if (context.dataSourceIngestIsCancelled()) {
95  }
96  } catch (Exception e) {
97  errors.add("Error getting Tango Messages"); //NON-NLS
98  }
99 
100  try {
101  WWFMessageAnalyzer.findWWFMessages(dataSource, fileManager);
102  progressBar.progress(5);
103  if (context.dataSourceIngestIsCancelled()) {
105  }
106  } catch (Exception e) {
107  errors.add("Error getting Words with Friends Messages"); //NON-NLS
108  }
109 
110  try {
111  GoogleMapLocationAnalyzer.findGeoLocations(dataSource, fileManager);
112  progressBar.progress(6);
113  if (context.dataSourceIngestIsCancelled()) {
115  }
116  } catch (Exception e) {
117  errors.add("Error getting Google Map Locations"); //NON-NLS
118  }
119 
120  try {
121  BrowserLocationAnalyzer.findGeoLocations(dataSource, fileManager);
122  progressBar.progress(7);
123  if (context.dataSourceIngestIsCancelled()) {
125  }
126  } catch (Exception e) {
127  errors.add("Error getting Browser Locations"); //NON-NLS
128  }
129 
130  try {
131  CacheLocationAnalyzer.findGeoLocations(dataSource, fileManager);
132  progressBar.progress(8);
133  } catch (Exception e) {
134  errors.add("Error getting Cache Locations"); //NON-NLS
135  }
136 
137  // create the final message for inbox
138  StringBuilder errorMessage = new StringBuilder();
139  String errorMsgSubject;
141  if (errors.isEmpty() == false) {
142  msgLevel = IngestMessage.MessageType.ERROR;
143  errorMessage.append("Errors were encountered"); //NON-NLS
144  for (String msg : errors) {
145  errorMessage.append("<li>").append(msg).append("</li>\n"); //NON-NLS
146  }
147  errorMessage.append("</ul>\n"); //NON-NLS
148 
149  if (errors.size() == 1) {
150  errorMsgSubject = "One error was found"; //NON-NLS
151  } else {
152  errorMsgSubject = "errors found: " + errors.size(); //NON-NLS
153  }
154  } else {
155  errorMessage.append("No errors"); //NON-NLS
156  errorMsgSubject = "No errors"; //NON-NLS
157  }
158 
159  services.postMessage(IngestMessage.createMessage(msgLevel, AndroidModuleFactory.getModuleName(),
160  NbBundle.getMessage(this.getClass(),
161  "AndroidIngestModule.processing.finishedAnalysis",
162  errorMsgSubject), errorMessage.toString()));
163 
165  }
166 }
static IngestMessage createMessage(MessageType messageType, String source, String subject, String detailsHtml)
void postMessage(final IngestMessage message)
static Logger getLogger(String name)
Definition: Logger.java:131
static synchronized IngestServices getInstance()

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.