23 package org.sleuthkit.autopsy.recentactivity;
25 import com.google.common.collect.ImmutableMap;
26 import com.google.gson.JsonArray;
27 import com.google.gson.JsonElement;
28 import com.google.gson.JsonIOException;
29 import com.google.gson.JsonObject;
30 import com.google.gson.JsonParser;
31 import com.google.gson.JsonSyntaxException;
32 import java.io.BufferedReader;
33 import org.openide.util.NbBundle;
35 import java.util.logging.Level;
37 import java.io.FileNotFoundException;
38 import java.io.FileReader;
39 import java.io.IOException;
40 import java.util.Collection;
41 import java.util.List;
43 import java.util.HashMap;
44 import java.util.ArrayList;
45 import java.util.Arrays;
47 import org.apache.commons.io.FilenameUtils;
48 import org.apache.commons.lang3.StringUtils;
49 import org.openide.util.NbBundle.Messages;
62 import org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
64 import org.
sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException;
68 import org.
sleuthkit.datamodel.blackboardutils.WebBrowserArtifactsHelper;
73 class Chromium
extends Extract {
75 private static final String HISTORY_QUERY =
"SELECT urls.url, urls.title, urls.visit_count, urls.typed_count, "
76 +
"last_visit_time, urls.hidden, visits.visit_time, (SELECT urls.url FROM urls WHERE urls.id=visits.url) AS from_visit, visits.transition FROM urls, visits WHERE urls.id = visits.url";
77 private static final String COOKIE_QUERY =
"SELECT name, value, host_key, expires_utc,last_access_utc, creation_utc FROM cookies";
78 private static final String DOWNLOAD_QUERY =
"SELECT full_path, url, start_time, received_bytes FROM downloads";
79 private static final String DOWNLOAD_QUERY_V30 =
"SELECT current_path AS full_path, url, start_time, received_bytes FROM downloads, downloads_url_chains WHERE downloads.id=downloads_url_chains.id";
80 private static final String LOGIN_QUERY =
"SELECT origin_url, username_value, date_created, signon_realm from logins";
81 private static final String AUTOFILL_QUERY =
"SELECT name, value, count, date_created "
82 +
" FROM autofill, autofill_dates "
83 +
" WHERE autofill.pair_id = autofill_dates.pair_id";
84 private static final String AUTOFILL_QUERY_V8X =
"SELECT name, value, count, date_created, date_last_used from autofill";
85 private static final String WEBFORM_ADDRESS_QUERY =
"SELECT first_name, middle_name, last_name, address_line_1, address_line_2, city, state, zipcode, country_code, number, email, date_modified "
86 +
" FROM autofill_profiles, autofill_profile_names, autofill_profile_emails, autofill_profile_phones"
87 +
" WHERE autofill_profiles.guid = autofill_profile_names.guid AND autofill_profiles.guid = autofill_profile_emails.guid AND autofill_profiles.guid = autofill_profile_phones.guid";
89 private static final String WEBFORM_ADDRESS_QUERY_V8X =
"SELECT first_name, middle_name, last_name, full_name, street_address, city, state, zipcode, country_code, number, email, date_modified, use_date, use_count"
90 +
" FROM autofill_profiles, autofill_profile_names, autofill_profile_emails, autofill_profile_phones"
91 +
" WHERE autofill_profiles.guid = autofill_profile_names.guid AND autofill_profiles.guid = autofill_profile_emails.guid AND autofill_profiles.guid = autofill_profile_phones.guid";
92 private static final String FAVICON_QUERY =
"SELECT page_url, last_updated, last_requested FROM icon_mapping, favicon_bitmaps "
93 +
" WHERE icon_mapping.icon_id = favicon_bitmaps.icon_id";
94 private static final String LOCALSTATE_FILE_NAME =
"Local State";
95 private static final String EXTENSIONS_FILE_NAME =
"Secure Preferences";
96 private static final String HISTORY_FILE_NAME =
"History";
97 private static final String BOOKMARK_FILE_NAME =
"Bookmarks";
98 private static final String COOKIE_FILE_NAME =
"Cookies";
99 private static final String LOGIN_DATA_FILE_NAME =
"Login Data";
100 private static final String WEB_DATA_FILE_NAME =
"Web Data";
101 private static final String FAVICON_DATA_FILE_NAME =
"Favicons";
102 private static final String UC_BROWSER_NAME =
"UC Browser";
103 private static final String OPERA_BROWSER_NAME =
"Opera";
104 private static final String ENCRYPTED_FIELD_MESSAGE =
"The data was encrypted.";
105 private static final String GOOGLE_PROFILE_NAME =
"Profile";
106 private static final String GOOGLE_PROFILE =
"Google Chrome ";
107 private static final String FAVICON_ARTIFACT_NAME =
"TSK_FAVICON";
108 private static final String LOCAL_STATE_ARTIFACT_NAME =
"TSK_LOCAL_STATE";
109 private static final String EXTENSIONS_ARTIFACT_NAME =
"TSK_CHROME_EXTENSIONS";
110 private static final String MALICIOUS_EXTENSION_FOUND =
"Malicious Extension Found - ";
112 private Boolean databaseEncrypted =
false;
113 private Boolean fieldEncrypted =
false;
115 private static final String MALICIOUS_CHROME_EXTENSION_LIST =
"malicious_chrome_extensions.csv";
116 private Map<String, String> maliciousChromeExtensions;
118 private final Logger logger = Logger.getLogger(this.getClass().getName());
119 private Content dataSource;
120 private final IngestJobContext context;
122 private Map<String, String> userProfiles;
123 private Map<String, String> browserLocations;
125 private static final Map<String, String> BROWSERS_MAP = ImmutableMap.<String, String>builder()
126 .put(
"Microsoft Edge",
"Microsoft/Edge/User Data")
127 .put(
"Yandex",
"YandexBrowser/User Data")
128 .put(
"Opera",
"Opera Software/Opera Stable")
129 .put(
"SalamWeb",
"SalamWeb/User Data")
130 .put(
"UC Browser",
"UCBrowser/User Data%")
131 .put(
"Brave",
"BraveSoftware/Brave-Browser/User Data")
132 .put(
"Google Chrome",
"Chrome/User Data")
135 @Messages({
"# {0} - browserName",
136 "Progress_Message_Chrome_History=Chrome History Browser {0}",
137 "# {0} - browserName",
138 "Progress_Message_Chrome_Bookmarks=Chrome Bookmarks Browser {0}",
139 "# {0} - browserName",
140 "Progress_Message_Chrome_Cookies=Chrome Cookies Browser {0}",
141 "# {0} - browserName",
142 "Progress_Message_Chrome_Downloads=Chrome Downloads Browser {0}",
143 "Progress_Message_Chrome_Profiles=Chrome Profiles {0}",
144 "Progress_Message_Chrome_Extensions=Chrome Extensions {0}",
145 "Progress_Message_Chrome_Favicons=Chrome Downloads Favicons {0}",
146 "Progress_Message_Chrome_FormHistory=Chrome Form History",
147 "# {0} - browserName",
148 "Progress_Message_Chrome_AutoFill=Chrome Auto Fill Browser {0}",
149 "# {0} - browserName",
150 "Progress_Message_Chrome_Logins=Chrome Logins Browser {0}",
151 "Progress_Message_Chrome_Cache=Chrome Cache",})
153 Chromium(IngestJobContext context) {
154 super(NbBundle.getMessage(Chromium.class,
"Chrome.moduleName"), context);
155 this.context = context;
159 public void process(Content dataSource, DataSourceIngestModuleProgress progressBar) {
160 this.dataSource = dataSource;
162 long ingestJobId = context.getJobId();
164 loadMaliciousChromeExetnsions();
165 userProfiles =
new HashMap<>();
166 browserLocations =
new HashMap<>();
167 for (Map.Entry<String, String> browser : BROWSERS_MAP.entrySet()) {
168 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Profiles", browser.getKey()));
169 getProfiles(browser.getKey(), browser.getValue(), ingestJobId);
170 if (context.dataSourceIngestIsCancelled()) {
174 for (Map.Entry<String, String> profile : userProfiles.entrySet()) {
175 String browserLocation = profile.getKey();
176 String browserName = browserLocations.get(browserLocation);
177 String userName = profile.getValue();
178 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Extensions", browserName));
179 this.getExtensions(browserName, browserLocation, userName, ingestJobId);
180 if (context.dataSourceIngestIsCancelled()) {
183 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_History", browserName));
184 this.getHistory(browserName, browserLocation, userName, ingestJobId);
185 if (context.dataSourceIngestIsCancelled()) {
189 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Bookmarks", browserName));
190 this.getBookmark(browserName, browserLocation, userName, ingestJobId);
191 if (context.dataSourceIngestIsCancelled()) {
195 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Cookies", browserName));
196 this.getCookie(browserName, browserLocation, userName, ingestJobId);
197 if (context.dataSourceIngestIsCancelled()) {
201 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Logins", browserName));
202 this.getLogins(browserName, browserLocation, userName, ingestJobId);
203 if (context.dataSourceIngestIsCancelled()) {
207 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_AutoFill", browserName));
208 this.getAutofill(browserName, browserLocation, userName, ingestJobId);
209 if (context.dataSourceIngestIsCancelled()) {
213 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Downloads", browserName));
214 this.getDownload(browserName, browserLocation, userName, ingestJobId);
215 if (context.dataSourceIngestIsCancelled()) {
219 progressBar.progress(NbBundle.getMessage(
this.getClass(),
"Progress_Message_Chrome_Favicons", browserName));
220 this.getFavicons(browserName, browserLocation, userName, ingestJobId);
221 if (context.dataSourceIngestIsCancelled()) {
226 progressBar.progress(Bundle.Progress_Message_Chrome_Cache());
227 ChromeCacheExtractor chromeCacheExtractor =
new ChromeCacheExtractor(dataSource, context, progressBar);
228 chromeCacheExtractor.processCaches();
238 private void getProfiles(String browser, String browserLocation,
long ingestJobId) {
239 FileManager fileManager = currentCase.getServices().getFileManager();
240 String browserName = browser;
241 List<AbstractFile> localStateFiles;
242 String localStateName = LOCALSTATE_FILE_NAME;
243 if (browserName.equals(UC_BROWSER_NAME)) {
244 localStateName = LOCALSTATE_FILE_NAME +
"%";
247 localStateFiles = fileManager.findFiles(dataSource, localStateName, browserLocation);
248 }
catch (TskCoreException ex) {
249 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getLocalState.errMsg.errGettingFiles");
250 logger.log(Level.SEVERE, msg, ex);
251 this.addErrorMessage(this.getDisplayName() +
": " + msg);
256 List<AbstractFile> allocatedLocalStateFiles =
new ArrayList<>();
257 for (AbstractFile localStateFile : localStateFiles) {
258 if (localStateFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC)) {
259 allocatedLocalStateFiles.add(localStateFile);
264 if (allocatedLocalStateFiles.isEmpty()) {
265 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getLocalState.errMsg.couldntFindAnyFiles");
266 logger.log(Level.INFO, msg);
271 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
273 while (j < allocatedLocalStateFiles.size()) {
274 if (browser.contains(GOOGLE_PROFILE_NAME)) {
275 String parentPath = FilenameUtils.normalizeNoEndSeparator(allocatedLocalStateFiles.get(j).getParentPath());
276 browserName = GOOGLE_PROFILE +
" " + FilenameUtils.getBaseName(parentPath);
278 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + allocatedLocalStateFiles.get(j).getName() + j;
279 final AbstractFile localStateFile = allocatedLocalStateFiles.get(j++);
280 if ((localStateFile.getSize() == 0) || (localStateFile.getName().toLowerCase().contains(
"-slack"))
281 || (localStateFile.getName().toLowerCase().contains(
"cache")) || (localStateFile.getName().toLowerCase().contains(
"media"))
282 || (localStateFile.getName().toLowerCase().contains(
"index"))) {
286 ContentUtils.writeToFile(localStateFile,
new File(temps), context::dataSourceIngestIsCancelled);
287 }
catch (ReadContentInputStreamException ex) {
288 logger.log(Level.WARNING, String.format(
"Error reading Chrome web Local State artifacts file '%s' (id=%d).",
289 localStateFile.getName(), localStateFile.getId()), ex);
290 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getLocalState.errMsg.errAnalyzingFile",
291 this.getDisplayName(), localStateFile.getName()));
293 }
catch (IOException ex) {
294 logger.log(Level.SEVERE, String.format(
"Error writing temp file '%s' for Chrome Local State artifacts file '%s' (id=%d).",
295 temps, localStateFile.getName(), localStateFile.getId()), ex);
296 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getLocalState.errMsg.errAnalyzingFile",
297 this.getDisplayName(), localStateFile.getName()));
301 if (context.dataSourceIngestIsCancelled()) {
305 FileReader tempReader;
307 tempReader =
new FileReader(temps);
308 }
catch (FileNotFoundException ex) {
309 logger.log(Level.WARNING,
"Error while trying to read into the LocalState file.", ex);
313 JsonElement jsonElement;
314 JsonObject jElement, jProfile, jInfoCache;
317 jsonElement = JsonParser.parseReader(tempReader);
318 jElement = jsonElement.getAsJsonObject();
319 if (jElement.has(
"profile")) {
320 jProfile = jElement.get(
"profile").getAsJsonObject();
321 jInfoCache = jProfile.get(
"info_cache").getAsJsonObject();
325 }
catch (JsonIOException | JsonSyntaxException | IllegalStateException ex) {
326 logger.log(Level.WARNING,
"Error parsing Json from LocalState.", ex);
327 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getlocalState.errMsg.errAnalyzingFile",
328 this.getDisplayName(), localStateFile.getName()));
332 BlackboardArtifact.Type localStateArtifactType;
335 localStateArtifactType = createArtifactType(LOCAL_STATE_ARTIFACT_NAME, NbBundle.getMessage(
this.getClass(),
"Chrome.getLocalState.displayName"));
336 }
catch (TskCoreException ex) {
337 logger.log(Level.SEVERE, String.format(
"Error creating artifact type for LocalState."), ex);
338 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getfavicon.errMsg.errCreateArtifact"));
342 Set<String> profileNames = jInfoCache.keySet();
343 for (String profileName : profileNames) {
344 JsonElement result = jInfoCache.get(profileName);
345 JsonObject profile = result.getAsJsonObject();
346 if (profile == null) {
349 JsonElement gaiaIdEl = profile.get(
"gaia_id");
351 if (gaiaIdEl != null) {
352 gaiaId = gaiaIdEl.getAsString();
357 JsonElement hostedDomainEl = profile.get(
"hosted_domain");
358 if (hostedDomainEl != null) {
359 hostedDomain = hostedDomainEl.getAsString();
364 JsonElement shortcutNameEl = profile.get(
"shortcut_name");
365 if (shortcutNameEl != null) {
366 shortcutName = shortcutNameEl.getAsString();
371 JsonElement nameEl = profile.get(
"name");
372 if (nameEl != null) {
373 name = nameEl.getAsString();
378 JsonElement userNameEl = profile.get(
"user_name");
379 if (userNameEl != null) {
380 userName = userNameEl.getAsString();
385 if (userName.contains(
"")) {
386 userProfiles.put(browserLocation +
"/" + profileName, name);
387 browserLocations.put(browserLocation +
"/" + profileName, browser);
389 userProfiles.put(browserLocation +
"/" + profileName, userName);
390 browserLocations.put(browserLocation +
"/" + profileName, browser);
393 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
394 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
395 RecentActivityExtracterModuleFactory.getModuleName(), profileName));
396 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_ID,
397 RecentActivityExtracterModuleFactory.getModuleName(), gaiaId));
398 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
399 RecentActivityExtracterModuleFactory.getModuleName(), hostedDomain));
400 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_SHORTCUT,
401 RecentActivityExtracterModuleFactory.getModuleName(), shortcutName));
402 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME,
403 RecentActivityExtracterModuleFactory.getModuleName(), name));
404 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
405 RecentActivityExtracterModuleFactory.getModuleName(), userName));
406 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
407 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
410 bbartifacts.add(createArtifactWithAttributes(localStateArtifactType, localStateFile, bbattributes));
411 }
catch (TskCoreException ex) {
412 logger.log(Level.SEVERE, String.format(
"Failed to create bookmark artifact for file (%d)", localStateFile.getId()), ex);
417 if (!context.dataSourceIngestIsCancelled()) {
418 postArtifacts(bbartifacts);
424 if (!userProfiles.containsKey(
"Default")) {
425 userProfiles.put(browserLocation +
"/" +
"Default",
"Default");
426 browserLocations.put(browserLocation +
"/" +
"Default", browser);
428 if (!userProfiles.containsKey(
"Guest Profile")) {
429 userProfiles.put(browserLocation +
"/" +
"Guest Profile",
"Guest");
430 browserLocations.put(browserLocation +
"/" +
"Guest Profile", browser);
432 if (!userProfiles.containsKey(
"System Profile")) {
433 userProfiles.put(browserLocation +
"/" +
"System Profile",
"System");
434 browserLocations.put(browserLocation +
"/" +
"System Profile", browser);
445 private void getExtensions(String browser, String browserLocation, String userName,
long ingestJobId) {
446 FileManager fileManager = currentCase.getServices().getFileManager();
447 String browserName = browser;
448 List<AbstractFile> extensionFiles;
449 String extensionsName = EXTENSIONS_FILE_NAME;
450 if (browserName.equals(UC_BROWSER_NAME)) {
451 extensionsName = EXTENSIONS_FILE_NAME +
"%";
455 extensionFiles = fileManager.findFiles(dataSource, extensionsName, browserLocation);
456 }
catch (TskCoreException ex) {
457 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getExtensions.errMsg.errGettingFiles");
458 logger.log(Level.SEVERE, msg, ex);
459 this.addErrorMessage(this.getDisplayName() +
": " + msg);
464 List<AbstractFile> allocatedExtensionsFiles =
new ArrayList<>();
465 for (AbstractFile extensionFile : extensionFiles) {
466 if (extensionFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC)) {
467 allocatedExtensionsFiles.add(extensionFile);
472 if (allocatedExtensionsFiles.isEmpty()) {
473 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getExtensions.errMsg.couldntFindAnyFiles");
474 logger.log(Level.INFO, msg);
479 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
481 while (j < allocatedExtensionsFiles.size()) {
482 if (browser.contains(GOOGLE_PROFILE_NAME)) {
483 String parentPath = FilenameUtils.normalizeNoEndSeparator(allocatedExtensionsFiles.get(j).getParentPath());
484 browserName = GOOGLE_PROFILE +
" " + FilenameUtils.getBaseName(parentPath);
486 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + allocatedExtensionsFiles.get(j).getName() + j;
487 final AbstractFile extensionFile = allocatedExtensionsFiles.get(j++);
488 if ((extensionFile.getSize() == 0) || (extensionFile.getName().toLowerCase().contains(
"-slack"))
489 || (extensionFile.getName().toLowerCase().contains(
"cache")) || (extensionFile.getName().toLowerCase().contains(
"media"))
490 || (extensionFile.getName().toLowerCase().contains(
"index"))) {
494 ContentUtils.writeToFile(extensionFile,
new File(temps), context::dataSourceIngestIsCancelled);
495 }
catch (ReadContentInputStreamException ex) {
496 logger.log(Level.WARNING, String.format(
"Error reading Chrome web extension artifacts file '%s' (id=%d).",
497 extensionFile.getName(), extensionFile.getId()), ex);
498 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getExtensions.errMsg.errAnalyzingFile",
499 this.getDisplayName(), extensionFile.getName()));
501 }
catch (IOException ex) {
502 logger.log(Level.SEVERE, String.format(
"Error writing temp file '%s' for Chrome Extensions artifacts file '%s' (id=%d).",
503 temps, extensionFile.getName(), extensionFile.getId()), ex);
504 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getExtensions.errMsg.errAnalyzingFile",
505 this.getDisplayName(), extensionFile.getName()));
509 if (context.dataSourceIngestIsCancelled()) {
513 FileReader tempReader;
515 tempReader =
new FileReader(temps);
516 }
catch (FileNotFoundException ex) {
517 logger.log(Level.WARNING,
"Error while trying to read into the Secure Preferences file.", ex);
521 BlackboardArtifact.Type localStateArtifactType;
524 localStateArtifactType = createArtifactType(EXTENSIONS_ARTIFACT_NAME, NbBundle.getMessage(
this.getClass(),
"Chrome.getExtensions.displayName"));
525 }
catch (TskCoreException ex) {
526 logger.log(Level.SEVERE, String.format(
"Error creating artifact type for Secure Preferences."), ex);
527 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getExtensions.errMsg.errCreateArtifact"));
531 String profileName = FilenameUtils.getBaseName(StringUtils.chop(extensionFile.getParentPath()));
533 JsonElement jsonElement;
534 JsonObject jElement, jExtensions, jSettings;
537 jsonElement = JsonParser.parseReader(tempReader);
538 jElement = jsonElement.getAsJsonObject();
539 if (jElement.has(
"extensions")) {
540 logger.log(Level.WARNING, String.format(
"Processing Secure Preferences from %s", extensionFile.getParentPath()));
541 jExtensions = jElement.get(
"extensions").getAsJsonObject();
542 if (!browserName.equals(OPERA_BROWSER_NAME)) {
543 jSettings = jExtensions.get(
"settings").getAsJsonObject();
545 jSettings = jExtensions.get(
"opsettings").getAsJsonObject();
550 }
catch (JsonIOException | JsonSyntaxException | IllegalStateException ex) {
551 logger.log(Level.WARNING,
"Error parsing Json from Secure Preferences.", ex);
552 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getExtensoins.errMsg.errAnalyzingFile",
553 this.getDisplayName(), extensionFile.getName()));
557 Set<String> extensions = jSettings.keySet();
558 for (String extension : extensions) {
559 JsonElement result = jSettings.get(extension);
560 JsonObject ext = result.getAsJsonObject();
564 JsonElement flagEl = ext.get(
"state");
566 if (flagEl != null) {
567 if (flagEl.getAsInt() == 1) {
575 String apiGrantedPermissions =
"";
576 if (ext.has(
"active_permissions")) {
577 JsonObject permissions = ext.get(
"active_permissions").getAsJsonObject();
578 JsonArray apiPermissions = permissions.get(
"api").getAsJsonArray();
579 for (JsonElement apiPermission : apiPermissions) {
580 if (apiPermission.isJsonPrimitive()) {
581 String apigrantEl = apiPermission.getAsString();
582 if (apigrantEl != null) {
583 apiGrantedPermissions = apiGrantedPermissions +
", " + apigrantEl;
585 apiGrantedPermissions = apiGrantedPermissions +
"";
593 if (ext.has(
"manifest")) {
594 JsonObject manifest = ext.get(
"manifest").getAsJsonObject();
595 JsonElement descriptionEl = manifest.get(
"description");
596 if (descriptionEl != null) {
597 description = descriptionEl.getAsString();
601 JsonElement versionEl = manifest.get(
"version");
602 if (versionEl != null) {
603 version = versionEl.getAsString();
607 JsonElement extNameEl = manifest.get(
"name");
608 if (extNameEl != null) {
609 extName = extNameEl.getAsString();
618 BlackboardArtifact art = null;
619 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
620 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_ID,
621 RecentActivityExtracterModuleFactory.getModuleName(), extension));
622 if (maliciousChromeExtensions.get(extension) != null) {
623 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT,
624 RecentActivityExtracterModuleFactory.getModuleName(),
625 MALICIOUS_EXTENSION_FOUND + maliciousChromeExtensions.getOrDefault(extension,
"No Source Identified")));
627 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME,
628 RecentActivityExtracterModuleFactory.getModuleName(), extName));
629 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DESCRIPTION,
630 RecentActivityExtracterModuleFactory.getModuleName(), description));
631 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_VERSION,
632 RecentActivityExtracterModuleFactory.getModuleName(), version));
633 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_FLAG,
634 RecentActivityExtracterModuleFactory.getModuleName(), flag));
635 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PERMISSIONS,
636 RecentActivityExtracterModuleFactory.getModuleName(), apiGrantedPermissions.replaceFirst(
", ",
"")));
637 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
638 RecentActivityExtracterModuleFactory.getModuleName(), userName));
639 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
640 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
643 art = createArtifactWithAttributes(localStateArtifactType, extensionFile, bbattributes);
644 bbartifacts.add(art);
645 }
catch (TskCoreException ex) {
646 logger.log(Level.SEVERE, String.format(
"Failed to create Extension artifact for file (%d)", extensionFile.getId()), ex);
650 if (!context.dataSourceIngestIsCancelled()) {
651 postArtifacts(bbartifacts);
665 private void getHistory(String browser, String browserLocation, String userName,
long ingestJobId) {
666 FileManager fileManager = currentCase.getServices().getFileManager();
667 String browserName = browser;
668 List<AbstractFile> historyFiles;
669 String historyFileName = HISTORY_FILE_NAME;
670 if (browserName.equals(UC_BROWSER_NAME)) {
671 historyFileName = HISTORY_FILE_NAME +
"%";
674 historyFiles = fileManager.findFiles(dataSource, historyFileName, browserLocation);
675 }
catch (TskCoreException ex) {
676 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getHistory.errMsg.errGettingFiles");
677 logger.log(Level.SEVERE, msg, ex);
678 this.addErrorMessage(this.getDisplayName() +
": " + msg);
683 List<AbstractFile> allocatedHistoryFiles =
new ArrayList<>();
684 for (AbstractFile historyFile : historyFiles) {
685 if (historyFile.isMetaFlagSet(TskData.TSK_FS_META_FLAG_ENUM.ALLOC)) {
686 allocatedHistoryFiles.add(historyFile);
691 if (allocatedHistoryFiles.isEmpty()) {
692 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getHistory.errMsg.couldntFindAnyFiles");
693 logger.log(Level.INFO, msg);
698 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
700 while (j < allocatedHistoryFiles.size()) {
701 if (browser.contains(GOOGLE_PROFILE_NAME)) {
702 String parentPath = FilenameUtils.normalizeNoEndSeparator(allocatedHistoryFiles.get(j).getParentPath());
703 browserName = GOOGLE_PROFILE +
" " + FilenameUtils.getBaseName(parentPath);
705 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + allocatedHistoryFiles.get(j).getName() + j +
".db";
706 final AbstractFile historyFile = allocatedHistoryFiles.get(j++);
707 if ((historyFile.getSize() == 0) || (historyFile.getName().toLowerCase().contains(
"-slack"))
708 || (historyFile.getName().toLowerCase().contains(
"cache")) || (historyFile.getName().toLowerCase().contains(
"media"))
709 || (historyFile.getName().toLowerCase().contains(
"index"))) {
713 ContentUtils.writeToFile(historyFile,
new File(temps), context::dataSourceIngestIsCancelled);
714 }
catch (ReadContentInputStreamException ex) {
715 logger.log(Level.WARNING, String.format(
"Error reading Chrome web history artifacts file '%s' (id=%d).",
716 historyFile.getName(), historyFile.getId()), ex);
717 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getHistory.errMsg.errAnalyzingFile",
718 this.getDisplayName(), historyFile.getName()));
720 }
catch (IOException ex) {
721 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome web history artifacts file '%s' (id=%d).",
722 temps, historyFile.getName(), historyFile.getId()), ex);
723 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getHistory.errMsg.errAnalyzingFile",
724 this.getDisplayName(), historyFile.getName()));
727 File dbFile =
new File(temps);
728 if (context.dataSourceIngestIsCancelled()) {
732 List<HashMap<String, Object>> tempList;
733 tempList = this.querySQLiteDb(temps, HISTORY_QUERY);
734 logger.log(Level.INFO,
"{0}- Now getting history from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), temps, tempList.size()});
735 for (HashMap<String, Object> result : tempList) {
736 String url = result.get(
"url") == null ?
"" : result.get(
"url").toString();
737 String extractedDomain = NetworkUtils.extractDomain(url);
740 Collection<BlackboardAttribute> bbattributes = createHistoryAttributes(
741 StringUtils.defaultString(url),
742 (Long.valueOf(result.get(
"last_visit_time").toString()) / 1000000) - Long.valueOf(
"11644473600"),
743 result.get(
"from_visit") == null ?
"" : result.get(
"from_visit").toString(),
744 result.get(
"title") == null ?
"" : result.get(
"title").toString(),
749 bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_HISTORY, historyFile, bbattributes));
750 }
catch (TskCoreException ex) {
751 logger.log(Level.SEVERE, String.format(
"Failed to create history artifact for file (%d)", historyFile.getId()), ex);
757 if (!bbartifacts.isEmpty() && !context.dataSourceIngestIsCancelled()) {
758 postArtifacts(bbartifacts);
769 private void getBookmark(String browser, String browserLocation, String userName,
long ingestJobId) {
770 FileManager fileManager = currentCase.getServices().getFileManager();
771 List<AbstractFile> bookmarkFiles;
772 String browserName = browser;
773 String bookmarkFileName = BOOKMARK_FILE_NAME;
774 if (browserName.equals(UC_BROWSER_NAME)) {
775 bookmarkFileName = BOOKMARK_FILE_NAME +
"%";
778 bookmarkFiles = fileManager.findFiles(dataSource, bookmarkFileName, browserLocation);
779 }
catch (TskCoreException ex) {
780 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getBookmark.errMsg.errGettingFiles");
781 logger.log(Level.SEVERE, msg, ex);
782 this.addErrorMessage(this.getDisplayName() +
": " + msg);
786 if (bookmarkFiles.isEmpty()) {
787 logger.log(Level.INFO,
"Didn't find any Chrome bookmark files.");
792 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
794 while (j < bookmarkFiles.size()) {
795 if (browser.contains(GOOGLE_PROFILE_NAME)) {
796 String parentPath = FilenameUtils.normalizeNoEndSeparator(bookmarkFiles.get(j).getParentPath());
797 browserName = GOOGLE_PROFILE +
" " + FilenameUtils.getBaseName(parentPath);
800 AbstractFile bookmarkFile = bookmarkFiles.get(j++);
801 if ((bookmarkFile.getSize() == 0) || (bookmarkFile.getName().toLowerCase().contains(
"-slack"))
802 || (bookmarkFile.getName().toLowerCase().contains(
"extras")) || (bookmarkFile.getName().toLowerCase().contains(
"log"))
803 || (bookmarkFile.getName().toLowerCase().contains(
"backup")) || (bookmarkFile.getName().toLowerCase().contains(
"visualized"))
804 || (bookmarkFile.getName().toLowerCase().contains(
"bak")) || (bookmarkFile.getParentPath().toLowerCase().contains(
"backup"))) {
807 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + bookmarkFile.getName() + j +
".db";
809 ContentUtils.writeToFile(bookmarkFile,
new File(temps), context::dataSourceIngestIsCancelled);
810 }
catch (ReadContentInputStreamException ex) {
811 logger.log(Level.WARNING, String.format(
"Error reading Chrome bookmark artifacts file '%s' (id=%d).",
812 bookmarkFile.getName(), bookmarkFile.getId()), ex);
813 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getBookmark.errMsg.errAnalyzingFile",
814 this.getDisplayName(), bookmarkFile.getName()));
816 }
catch (IOException ex) {
817 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome bookmark artifacts file '%s' (id=%d).",
818 temps, bookmarkFile.getName(), bookmarkFile.getId()), ex);
819 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getBookmark.errMsg.errAnalyzingFile",
820 this.getDisplayName(), bookmarkFile.getName()));
824 logger.log(Level.INFO,
"{0}- Now getting Bookmarks from {1}",
new Object[]{getDisplayName(), temps});
825 File dbFile =
new File(temps);
826 if (context.dataSourceIngestIsCancelled()) {
831 FileReader tempReader;
833 tempReader =
new FileReader(temps);
834 }
catch (FileNotFoundException ex) {
835 logger.log(Level.WARNING,
"Error while trying to read into the Bookmarks for Chrome.", ex);
839 JsonElement jsonElement;
840 JsonObject jElement, jRoot;
843 jsonElement = JsonParser.parseReader(tempReader);
844 jElement = jsonElement.getAsJsonObject();
845 jRoot = jElement.get(
"roots").getAsJsonObject();
846 Set<String> bookmarkKeys = jRoot.keySet();
847 }
catch (JsonIOException | JsonSyntaxException | IllegalStateException ex) {
848 logger.log(Level.WARNING,
"Error parsing Json from Chrome Bookmark.", ex);
849 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getBookmark.errMsg.errAnalyzingFile3",
850 this.getDisplayName(), bookmarkFile.getName()));
854 Set<String> bookmarkKeys = jRoot.keySet();
855 for (String bookmarkKey : bookmarkKeys) {
856 JsonObject jBookmark = jRoot.get(bookmarkKey).getAsJsonObject();
857 JsonArray jBookmarkArray = jBookmark.getAsJsonArray(
"children");
858 for (JsonElement result : jBookmarkArray) {
859 JsonObject address = result.getAsJsonObject();
860 if (address == null) {
863 JsonElement urlEl = address.get(
"url");
866 url = urlEl.getAsString();
871 JsonElement nameEl = address.get(
"name");
872 if (nameEl != null) {
873 name = nameEl.getAsString();
878 JsonElement dateEl = address.get(
"date_added");
879 if (dateEl != null) {
880 date = dateEl.getAsLong();
882 date = Long.valueOf(0);
884 String domain = NetworkUtils.extractDomain(url);
885 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
887 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
888 RecentActivityExtracterModuleFactory.getModuleName(), url));
889 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_TITLE,
890 RecentActivityExtracterModuleFactory.getModuleName(), name));
891 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
892 RecentActivityExtracterModuleFactory.getModuleName(), (date / 1000000) - Long.valueOf(
"11644473600")));
893 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
894 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
895 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
896 RecentActivityExtracterModuleFactory.getModuleName(), domain));
897 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
898 RecentActivityExtracterModuleFactory.getModuleName(), userName));
899 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT,
900 RecentActivityExtracterModuleFactory.getModuleName(), bookmarkKey));
904 bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_BOOKMARK, bookmarkFile, bbattributes));
905 }
catch (TskCoreException ex) {
906 logger.log(Level.SEVERE, String.format(
"Failed to create bookmark artifact for file (%d)", bookmarkFile.getId()), ex);
912 if (!context.dataSourceIngestIsCancelled()) {
913 postArtifacts(bbartifacts);
927 private void getCookie(String browser, String browserLocation, String userName,
long ingestJobId) {
929 FileManager fileManager = currentCase.getServices().getFileManager();
930 List<AbstractFile> cookiesFiles;
931 String browserName = browser;
932 String cookieFileName = COOKIE_FILE_NAME;
933 if (browserName.equals(UC_BROWSER_NAME)) {
936 cookieFileName =
"%" + COOKIE_FILE_NAME +
"%";
939 cookiesFiles = fileManager.findFiles(dataSource, cookieFileName, browserLocation);
940 }
catch (TskCoreException ex) {
941 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getCookie.errMsg.errGettingFiles");
942 logger.log(Level.SEVERE, msg, ex);
943 this.addErrorMessage(this.getDisplayName() +
": " + msg);
947 if (cookiesFiles.isEmpty()) {
948 logger.log(Level.INFO,
"Didn't find any Chrome cookies files.");
953 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
955 while (j < cookiesFiles.size()) {
956 if (browser.contains(GOOGLE_PROFILE_NAME)) {
957 String parentPath = FilenameUtils.normalizeNoEndSeparator(cookiesFiles.get(j).getParentPath());
958 browserName = GOOGLE_PROFILE + FilenameUtils.getBaseName(parentPath);
961 AbstractFile cookiesFile = cookiesFiles.get(j++);
962 if ((cookiesFile.getSize() == 0) || (cookiesFile.getName().toLowerCase().contains(
"-slack"))) {
965 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + cookiesFile.getName() + j +
".db";
967 ContentUtils.writeToFile(cookiesFile,
new File(temps), context::dataSourceIngestIsCancelled);
968 }
catch (ReadContentInputStreamException ex) {
969 logger.log(Level.WARNING, String.format(
"Error reading Chrome cookie artifacts file '%s' (id=%d).",
970 cookiesFile.getName(), cookiesFile.getId()), ex);
971 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getCookie.errMsg.errAnalyzeFile",
972 this.getDisplayName(), cookiesFile.getName()));
974 }
catch (IOException ex) {
975 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome cookie artifacts file '%s' (id=%d).",
976 temps, cookiesFile.getName(), cookiesFile.getId()), ex);
977 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getCookie.errMsg.errAnalyzeFile",
978 this.getDisplayName(), cookiesFile.getName()));
981 File dbFile =
new File(temps);
982 if (context.dataSourceIngestIsCancelled()) {
987 List<HashMap<String, Object>> tempList = this.querySQLiteDb(temps, COOKIE_QUERY);
988 logger.log(Level.INFO,
"{0}- Now getting cookies from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), temps, tempList.size()});
989 for (HashMap<String, Object> result : tempList) {
990 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
991 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
992 RecentActivityExtracterModuleFactory.getModuleName(),
993 ((result.get(
"host_key").toString() != null) ? result.get(
"host_key").toString() :
"")));
994 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED,
995 RecentActivityExtracterModuleFactory.getModuleName(),
996 (Long.valueOf(result.get(
"last_access_utc").toString()) / 1000000) - Long.valueOf(
"11644473600")));
998 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME,
999 RecentActivityExtracterModuleFactory.getModuleName(),
1000 ((result.get(
"name").toString() != null) ? result.get(
"name").toString() :
"")));
1001 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_VALUE,
1002 RecentActivityExtracterModuleFactory.getModuleName(),
1003 ((result.get(
"value").toString() != null) ? result.get(
"value").toString() :
"")));
1004 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
1005 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
1006 String domain = result.get(
"host_key").toString();
1007 domain = domain.replaceFirst(
"^\\.+(?!$)",
"");
1008 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
1009 RecentActivityExtracterModuleFactory.getModuleName(), domain));
1010 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1011 RecentActivityExtracterModuleFactory.getModuleName(), userName));
1014 bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_COOKIE, cookiesFile, bbattributes));
1015 }
catch (TskCoreException ex) {
1016 logger.log(Level.SEVERE, String.format(
"Failed to create cookie artifact for file (%d)", cookiesFile.getId()), ex);
1023 if (!bbartifacts.isEmpty() && !context.dataSourceIngestIsCancelled()) {
1024 postArtifacts(bbartifacts);
1035 private void getDownload(String browser, String browserLocation, String userName,
long ingestJobId) {
1036 FileManager fileManager = currentCase.getServices().getFileManager();
1037 List<AbstractFile> downloadFiles;
1038 String browserName = browser;
1039 String historyFileName = HISTORY_FILE_NAME;
1040 if (browserName.equals(UC_BROWSER_NAME)) {
1041 historyFileName = HISTORY_FILE_NAME +
"%";
1044 downloadFiles = fileManager.findFiles(dataSource, historyFileName, browserLocation);
1045 }
catch (TskCoreException ex) {
1046 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getDownload.errMsg.errGettingFiles");
1047 logger.log(Level.SEVERE, msg, ex);
1048 this.addErrorMessage(this.getDisplayName() +
": " + msg);
1052 if (downloadFiles.isEmpty()) {
1053 logger.log(Level.INFO,
"Didn't find any Chrome download files.");
1058 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1060 while (j < downloadFiles.size()) {
1061 if (browser.contains(GOOGLE_PROFILE_NAME)) {
1062 String parentPath = FilenameUtils.normalizeNoEndSeparator(downloadFiles.get(j).getParentPath());
1063 browserName = GOOGLE_PROFILE + FilenameUtils.getBaseName(parentPath);
1066 AbstractFile downloadFile = downloadFiles.get(j++);
1067 if ((downloadFile.getSize() == 0) || (downloadFile.getName().toLowerCase().contains(
"-slack"))
1068 || (downloadFile.getName().toLowerCase().contains(
"cache")) || (downloadFile.getName().toLowerCase().contains(
"index"))) {
1072 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + downloadFile.getName() + j +
".db";
1074 ContentUtils.writeToFile(downloadFile,
new File(temps), context::dataSourceIngestIsCancelled);
1075 }
catch (ReadContentInputStreamException ex) {
1076 logger.log(Level.WARNING, String.format(
"Error reading Chrome download artifacts file '%s' (id=%d).",
1077 downloadFile.getName(), downloadFile.getId()), ex);
1078 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getDownload.errMsg.errAnalyzeFiles1",
1079 this.getDisplayName(), downloadFile.getName()));
1081 }
catch (IOException ex) {
1082 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome download artifacts file '%s' (id=%d).",
1083 temps, downloadFile.getName(), downloadFile.getId()), ex);
1084 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getDownload.errMsg.errAnalyzeFiles1",
1085 this.getDisplayName(), downloadFile.getName()));
1088 File dbFile =
new File(temps);
1089 if (context.dataSourceIngestIsCancelled()) {
1094 List<HashMap<String, Object>> tempList;
1096 if (isChromePreVersion30(temps)) {
1097 tempList = this.querySQLiteDb(temps, DOWNLOAD_QUERY);
1099 tempList = this.querySQLiteDb(temps, DOWNLOAD_QUERY_V30);
1102 logger.log(Level.INFO,
"{0}- Now getting downloads from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), temps, tempList.size()});
1103 for (HashMap<String, Object> result : tempList) {
1104 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
1105 String fullPath = result.get(
"full_path").toString();
1106 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
1107 RecentActivityExtracterModuleFactory.getModuleName(), fullPath));
1108 long pathID = Util.findID(dataSource, fullPath);
1110 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH_ID,
1111 NbBundle.getMessage(
this.getClass(),
1112 "Chrome.parentModuleName"), pathID));
1114 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
1115 RecentActivityExtracterModuleFactory.getModuleName(),
1116 ((result.get(
"url").toString() != null) ? result.get(
"url").toString() :
"")));
1118 Long time = (Long.valueOf(result.get(
"start_time").toString()) / 1000000) - Long.valueOf(
"11644473600");
1122 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED,
1123 RecentActivityExtracterModuleFactory.getModuleName(), time));
1124 String domain = NetworkUtils.extractDomain((result.get(
"url").toString() != null) ? result.get(
"url").toString() :
"");
1125 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
1126 RecentActivityExtracterModuleFactory.getModuleName(), domain));
1127 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1128 RecentActivityExtracterModuleFactory.getModuleName(), userName));
1129 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
1130 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
1134 BlackboardArtifact webDownloadArtifact = createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_DOWNLOAD, downloadFile, bbattributes);
1135 bbartifacts.add(webDownloadArtifact);
1136 String normalizedFullPath = FilenameUtils.normalize(fullPath,
true);
1137 for (AbstractFile downloadedFile : currentCase.getSleuthkitCase().getFileManager().findFilesExactNameExactPath(dataSource, FilenameUtils.getName(normalizedFullPath), FilenameUtils.getPath(normalizedFullPath))) {
1138 bbartifacts.add(createAssociatedArtifact(downloadedFile, webDownloadArtifact));
1141 }
catch (TskCoreException ex) {
1142 logger.log(Level.SEVERE, String.format(
"Error creating associated object artifact for file '%s'", fullPath), ex);
1149 if (!bbartifacts.isEmpty() && !context.dataSourceIngestIsCancelled()) {
1150 postArtifacts(bbartifacts);
1161 private void getFavicons(String browser, String browserLocation, String userName,
long ingestJobId) {
1162 FileManager fileManager = currentCase.getServices().getFileManager();
1163 List<AbstractFile> faviconFiles;
1164 String browserName = browser;
1166 faviconFiles = fileManager.findFiles(dataSource, FAVICON_DATA_FILE_NAME, browserLocation);
1167 }
catch (TskCoreException ex) {
1168 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getFavicon.errMsg.errGettingFiles");
1169 logger.log(Level.SEVERE, msg, ex);
1170 this.addErrorMessage(this.getDisplayName() +
": " + msg);
1174 if (faviconFiles.isEmpty()) {
1175 logger.log(Level.INFO,
"Didn't find any Chrome favicon files.");
1180 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1182 while (j < faviconFiles.size()) {
1183 if (browser.contains(GOOGLE_PROFILE_NAME)) {
1184 String parentPath = FilenameUtils.normalizeNoEndSeparator(faviconFiles.get(j).getParentPath());
1185 browserName = GOOGLE_PROFILE + FilenameUtils.getBaseName(parentPath);
1187 AbstractFile faviconFile = faviconFiles.get(j++);
1188 if ((faviconFile.getSize() == 0) || (faviconFile.getName().toLowerCase().contains(
"-slack"))
1189 || (faviconFile.getName().toLowerCase().contains(
"cache")) || (faviconFile.getName().toLowerCase().contains(
"index"))) {
1193 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + faviconFile.getName() + j +
".db";
1195 ContentUtils.writeToFile(faviconFile,
new File(temps), context::dataSourceIngestIsCancelled);
1196 }
catch (ReadContentInputStreamException ex) {
1197 logger.log(Level.WARNING, String.format(
"Error reading Chrome favicons artifacts file '%s' (id=%d).",
1198 faviconFile.getName(), faviconFile.getId()), ex);
1199 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getFavicon.errMsg.errAnalyzeFiles1",
1200 this.getDisplayName(), faviconFile.getName()));
1202 }
catch (IOException ex) {
1203 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome favicon artifacts file '%s' (id=%d).",
1204 temps, faviconFile.getName(), faviconFile.getId()), ex);
1205 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getfavicon.errMsg.errAnalyzeFiles1",
1206 this.getDisplayName(), faviconFile.getName()));
1209 File dbFile =
new File(temps);
1210 if (context.dataSourceIngestIsCancelled()) {
1215 BlackboardArtifact.Type faviconArtifactType;
1218 faviconArtifactType = createArtifactType(FAVICON_ARTIFACT_NAME, NbBundle.getMessage(
this.getClass(),
"Chrome.getFavicon.displayName"));
1219 }
catch (TskCoreException ex) {
1220 logger.log(Level.SEVERE, String.format(
"Error creating artifact type for Chrome favicon."), ex);
1221 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getfavicon.errMsg.errCreateArtifact"));
1226 List<HashMap<String, Object>> tempList;
1228 tempList = this.querySQLiteDb(temps, FAVICON_QUERY);
1230 logger.log(Level.INFO,
"{0}- Now getting favicons from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), temps, tempList.size()});
1231 for (HashMap<String, Object> result : tempList) {
1232 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
1233 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
1234 RecentActivityExtracterModuleFactory.getModuleName(),
1235 ((result.get(
"page_url").toString() != null) ? result.get(
"page_url").toString() :
"")));
1236 Long updatedTime = (Long.valueOf(result.get(
"last_updated").toString()) / 1000000) - Long.valueOf(
"11644473600");
1237 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_MODIFIED,
1238 RecentActivityExtracterModuleFactory.getModuleName(), updatedTime));
1239 Long requestedTime = (Long.valueOf(result.get(
"last_requested").toString()) / 1000000) - Long.valueOf(
"11644473600");
1240 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED,
1241 RecentActivityExtracterModuleFactory.getModuleName(), requestedTime));
1242 String domain = NetworkUtils.extractDomain((result.get(
"page_url").toString() != null) ? result.get(
"page_url").toString() :
"");
1243 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
1244 RecentActivityExtracterModuleFactory.getModuleName(), domain));
1245 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1246 RecentActivityExtracterModuleFactory.getModuleName(), userName));
1247 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
1248 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
1251 bbartifacts.add(createArtifactWithAttributes(faviconArtifactType, faviconFile, bbattributes));
1252 }
catch (TskCoreException ex) {
1253 logger.log(Level.SEVERE, String.format(
"Failed to create cookie artifact for file (%d)", faviconFile.getId()), ex);
1261 if (!bbartifacts.isEmpty() && !context.dataSourceIngestIsCancelled()) {
1262 postArtifacts(bbartifacts);
1273 private void getLogins(String browser, String browserLocation, String userName,
long ingestJobId) {
1275 FileManager fileManager = currentCase.getServices().getFileManager();
1276 List<AbstractFile> loginDataFiles;
1277 String browserName = browser;
1278 String loginDataFileName = LOGIN_DATA_FILE_NAME;
1279 if (browserName.equals(UC_BROWSER_NAME)) {
1280 loginDataFileName = LOGIN_DATA_FILE_NAME +
"%";
1284 loginDataFiles = fileManager.findFiles(dataSource, loginDataFileName, browserLocation);
1285 }
catch (TskCoreException ex) {
1286 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getLogin.errMsg.errGettingFiles");
1287 logger.log(Level.SEVERE, msg, ex);
1288 this.addErrorMessage(this.getDisplayName() +
": " + msg);
1292 if (loginDataFiles.isEmpty()) {
1293 logger.log(Level.INFO,
"Didn't find any Chrome Login Data files.");
1298 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1300 while (j < loginDataFiles.size()) {
1301 if (browser.contains(GOOGLE_PROFILE_NAME)) {
1302 String parentPath = FilenameUtils.normalizeNoEndSeparator(loginDataFiles.get(j).getParentPath());
1303 browserName = GOOGLE_PROFILE + FilenameUtils.getBaseName(parentPath);
1305 AbstractFile loginDataFile = loginDataFiles.get(j++);
1306 if ((loginDataFile.getSize() == 0) || (loginDataFile.getName().toLowerCase().contains(
"-slack"))) {
1309 String temps = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + loginDataFile.getName() + j +
".db";
1311 ContentUtils.writeToFile(loginDataFile,
new File(temps), context::dataSourceIngestIsCancelled);
1312 }
catch (ReadContentInputStreamException ex) {
1313 logger.log(Level.WARNING, String.format(
"Error reading Chrome login artifacts file '%s' (id=%d).",
1314 loginDataFile.getName(), loginDataFile.getId()), ex);
1315 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getLogin.errMsg.errAnalyzingFiles",
1316 this.getDisplayName(), loginDataFile.getName()));
1318 }
catch (IOException ex) {
1319 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome login artifacts file '%s' (id=%d).",
1320 temps, loginDataFile.getName(), loginDataFile.getId()), ex);
1321 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getLogin.errMsg.errAnalyzingFiles",
1322 this.getDisplayName(), loginDataFile.getName()));
1325 File dbFile =
new File(temps);
1326 if (context.dataSourceIngestIsCancelled()) {
1330 List<HashMap<String, Object>> tempList = this.querySQLiteDb(temps, LOGIN_QUERY);
1331 logger.log(Level.INFO,
"{0}- Now getting login information from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), temps, tempList.size()});
1332 for (HashMap<String, Object> result : tempList) {
1333 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
1335 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL,
1336 RecentActivityExtracterModuleFactory.getModuleName(),
1337 ((result.get(
"origin_url").toString() != null) ? result.get(
"origin_url").toString() :
"")));
1339 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
1340 RecentActivityExtracterModuleFactory.getModuleName(),
1341 (Long.valueOf(result.get(
"date_created").toString()) / 1000000) - Long.valueOf(
"11644473600")));
1343 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_URL_DECODED,
1344 RecentActivityExtracterModuleFactory.getModuleName(),
1345 (NetworkUtils.extractDomain((result.get(
"origin_url").toString() != null) ? result.get(
"origin_url").toString() :
""))));
1347 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1348 RecentActivityExtracterModuleFactory.getModuleName(),
1349 ((result.get(
"username_value").toString() != null) ? result.get(
"username_value").toString().replaceAll(
"'",
"''") :
"")));
1351 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REALM,
1352 RecentActivityExtracterModuleFactory.getModuleName(),
1353 ((result.get(
"signon_realm") != null && result.get(
"signon_realm").toString() != null) ? result.get(
"signon_realm").toString() :
"")));
1355 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DOMAIN,
1356 RecentActivityExtracterModuleFactory.getModuleName(),
1357 result.containsKey(
"signon_realm") ? NetworkUtils.extractDomain(result.get(
"signon_realm").toString()) :
""));
1359 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
1360 RecentActivityExtracterModuleFactory.getModuleName(), browserName));
1362 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1363 RecentActivityExtracterModuleFactory.getModuleName(), userName));
1366 bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_SERVICE_ACCOUNT, loginDataFile, bbattributes));
1367 }
catch (TskCoreException ex) {
1368 logger.log(Level.SEVERE, String.format(
"Failed to create service account artifact for file (%d)", loginDataFile.getId()), ex);
1375 if (!bbartifacts.isEmpty() && !context.dataSourceIngestIsCancelled()) {
1376 postArtifacts(bbartifacts);
1388 private void getAutofill(String browser, String browserLocation, String userName,
long ingestJobId) {
1390 FileManager fileManager = currentCase.getServices().getFileManager();
1391 List<AbstractFile> webDataFiles;
1392 String browserName = browser;
1393 String webDataFileName = WEB_DATA_FILE_NAME;
1394 if (browserName.equals(UC_BROWSER_NAME)) {
1395 webDataFileName = WEB_DATA_FILE_NAME +
"%";
1399 webDataFiles = fileManager.findFiles(dataSource, webDataFileName, browserLocation);
1400 }
catch (TskCoreException ex) {
1401 String msg = NbBundle.getMessage(this.getClass(),
"Chrome.getAutofills.errMsg.errGettingFiles");
1402 logger.log(Level.SEVERE, msg, ex);
1403 this.addErrorMessage(this.getDisplayName() +
": " + msg);
1407 if (webDataFiles.isEmpty()) {
1408 logger.log(Level.INFO,
"Didn't find any Chrome Web Data files.");
1413 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1415 while (j < webDataFiles.size()) {
1416 if (browser.contains(GOOGLE_PROFILE_NAME)) {
1417 String parentPath = FilenameUtils.normalizeNoEndSeparator(webDataFiles.get(j).getParentPath());
1418 browserName = GOOGLE_PROFILE + FilenameUtils.getBaseName(parentPath);
1420 databaseEncrypted =
false;
1421 AbstractFile webDataFile = webDataFiles.get(j++);
1422 if ((webDataFile.getSize() == 0) || (webDataFile.getName().toLowerCase().contains(
"-slack"))) {
1425 String tempFilePath = RAImageIngestModule.getRATempPath(currentCase, browserName, ingestJobId) + File.separator + webDataFile.getName() + j +
".db";
1427 ContentUtils.writeToFile(webDataFile,
new File(tempFilePath), context::dataSourceIngestIsCancelled);
1428 }
catch (ReadContentInputStreamException ex) {
1429 logger.log(Level.WARNING, String.format(
"Error reading Chrome Autofill artifacts file '%s' (id=%d).",
1430 webDataFile.getName(), webDataFile.getId()), ex);
1431 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getAutofill.errMsg.errAnalyzingFiles",
1432 this.getDisplayName(), webDataFile.getName()));
1434 }
catch (IOException ex) {
1435 logger.log(Level.SEVERE, String.format(
"Error writing temp sqlite db file '%s' for Chrome Web data file '%s' (id=%d).",
1436 tempFilePath, webDataFile.getName(), webDataFile.getId()), ex);
1437 this.addErrorMessage(NbBundle.getMessage(
this.getClass(),
"Chrome.getLogin.errMsg.errAnalyzingFiles",
1438 this.getDisplayName(), webDataFile.getName()));
1441 File dbFile =
new File(tempFilePath);
1442 if (context.dataSourceIngestIsCancelled()) {
1448 boolean isSchemaV8X = Util.checkColumn(
"date_created",
"autofill", tempFilePath);
1451 bbartifacts.addAll(getFormAutofillArtifacts(webDataFile, tempFilePath, isSchemaV8X, userName, browserName));
1454 getFormAddressArtifacts(webDataFile, tempFilePath, isSchemaV8X);
1455 if (databaseEncrypted) {
1456 String comment = String.format(
"%s Autofill Database Encryption Detected", browserName);
1457 Collection<BlackboardAttribute> bbattributes = Arrays.asList(
1458 new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT,
1459 RecentActivityExtracterModuleFactory.getModuleName(), comment));
1462 webDataFile.newAnalysisResult(
1463 BlackboardArtifact.Type.TSK_ENCRYPTION_DETECTED, Score.SCORE_NOTABLE,
1464 null, null, comment, bbattributes).getAnalysisResult());
1466 }
catch (NoCurrentCaseException | TskCoreException | Blackboard.BlackboardException ex) {
1467 logger.log(Level.SEVERE, String.format(
"Error adding artifacts to the case database "
1468 +
"for chrome file %s [objId=%d]", webDataFile.getName(), webDataFile.getId()), ex);
1474 if (!bbartifacts.isEmpty() && !context.dataSourceIngestIsCancelled()) {
1475 postArtifacts(bbartifacts);
1489 private Collection<BlackboardArtifact> getFormAutofillArtifacts(AbstractFile webDataFile, String dbFilePath,
boolean isSchemaV8X, String userName, String browser) {
1491 Collection<BlackboardArtifact> bbartifacts =
new ArrayList<>();
1494 String autoFillquery = (isSchemaV8X) ? AUTOFILL_QUERY_V8X
1497 List<HashMap<String, Object>> autofills = this.querySQLiteDb(dbFilePath, autoFillquery);
1498 logger.log(Level.INFO,
"{0}- Now getting Autofill information from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), dbFilePath, autofills.size()});
1499 for (HashMap<String, Object> result : autofills) {
1500 Collection<BlackboardAttribute> bbattributes =
new ArrayList<>();
1503 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME,
1504 NbBundle.getMessage(
this.getClass(),
"Chrome.parentModuleName"),
1505 ((result.get(
"name").toString() != null) ? result.get(
"name").toString() :
"")));
1507 fieldEncrypted =
false;
1508 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_VALUE,
1509 RecentActivityExtracterModuleFactory.getModuleName(),
1510 processFields(result.get(
"value"))));
1512 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COUNT,
1513 RecentActivityExtracterModuleFactory.getModuleName(),
1514 (Integer.valueOf(result.get(
"count").toString()))));
1516 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
1517 RecentActivityExtracterModuleFactory.getModuleName(),
1518 Long.valueOf(result.get(
"date_created").toString())));
1522 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED,
1523 RecentActivityExtracterModuleFactory.getModuleName(),
1524 Long.valueOf(result.get(
"date_last_used").toString())));
1527 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
1528 RecentActivityExtracterModuleFactory.getModuleName(), userName));
1529 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PROG_NAME,
1530 RecentActivityExtracterModuleFactory.getModuleName(), browser));
1531 if (fieldEncrypted) {
1532 bbattributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT,
1533 RecentActivityExtracterModuleFactory.getModuleName(), ENCRYPTED_FIELD_MESSAGE));
1538 bbartifacts.add(createArtifactWithAttributes(BlackboardArtifact.Type.TSK_WEB_FORM_AUTOFILL, webDataFile, bbattributes));
1539 }
catch (TskCoreException ex) {
1540 logger.log(Level.SEVERE, String.format(
"Failed to create web form autopfill artifact for file (%d)", webDataFile.getId()), ex);
1559 private void getFormAddressArtifacts(AbstractFile webDataFile, String dbFilePath,
boolean isSchemaV8X)
throws NoCurrentCaseException,
1560 TskCoreException, Blackboard.BlackboardException {
1562 String webformAddressQuery = (isSchemaV8X) ? WEBFORM_ADDRESS_QUERY_V8X
1563 : WEBFORM_ADDRESS_QUERY;
1566 WebBrowserArtifactsHelper helper =
new WebBrowserArtifactsHelper(
1567 Case.getCurrentCaseThrows().getSleuthkitCase(),
1568 NbBundle.getMessage(this.getClass(),
"Chrome.parentModuleName"),
1569 webDataFile, context.getJobId()
1573 List<HashMap<String, Object>> addresses = this.querySQLiteDb(dbFilePath, webformAddressQuery);
1574 logger.log(Level.INFO,
"{0}- Now getting Web form addresses from {1} with {2} artifacts identified.",
new Object[]{getDisplayName(), dbFilePath, addresses.size()});
1575 for (HashMap<String, Object> result : addresses) {
1577 fieldEncrypted =
false;
1579 String first_name = processFields(result.get(
"first_name"));
1580 String middle_name = processFields(result.get(
"middle_name"));
1581 String last_name = processFields(result.get(
"last_name"));
1584 String email_Addr = processFields(result.get(
"email"));
1585 String phone_number = processFields(result.get(
"number"));
1588 String city = processFields(result.get(
"city"));
1589 String state = processFields(result.get(
"state"));
1590 String zipcode = processFields(result.get(
"zipcode"));
1591 String country_code = processFields(result.get(
"country_code"));
1594 String full_name =
"";
1595 String street_address =
"";
1596 long date_modified = 0;
1602 full_name = processFields(result.get(
"full_name"));
1603 street_address = processFields(result.get(
"street_address"));
1604 date_modified = result.get(
"date_modified").toString() != null ? Long.valueOf(result.get(
"date_modified").toString()) : 0;
1605 use_count = result.get(
"use_count").toString() != null ? Integer.valueOf(result.get(
"use_count").toString()) : 0;
1606 use_date = result.get(
"use_date").toString() != null ? Long.valueOf(result.get(
"use_date").toString()) : 0;
1608 String address_line_1 = processFields(result.get(
"address_line_1"));
1609 String address_line_2 = processFields(result.get(
"address_line_2"));
1610 street_address = String.join(
" ", address_line_1, address_line_2);
1614 if (full_name == null || full_name.isEmpty()) {
1615 full_name = String.join(
" ", first_name, middle_name, last_name);
1618 String locationAddress = String.join(
", ", street_address, city, state, zipcode, country_code);
1620 List<BlackboardAttribute> otherAttributes =
new ArrayList<>();
1621 if (date_modified > 0) {
1622 otherAttributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_MODIFIED,
1623 RecentActivityExtracterModuleFactory.getModuleName(),
1625 if (fieldEncrypted) {
1626 otherAttributes.add(
new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT,
1627 RecentActivityExtracterModuleFactory.getModuleName(), ENCRYPTED_FIELD_MESSAGE));
1632 helper.addWebFormAddress(
1633 full_name, email_Addr, phone_number,
1634 locationAddress, 0, use_date,
1635 use_count, otherAttributes);
1648 private String processFields(Object dataValue) {
1650 if (dataValue instanceof byte[]) {
1651 fieldEncrypted =
true;
1652 databaseEncrypted =
true;
1655 return dataValue.toString() != null ? dataValue.toString() :
"";
1659 private boolean isChromePreVersion30(String temps) {
1660 String query =
"PRAGMA table_info(downloads)";
1661 List<HashMap<String, Object>> columns = this.querySQLiteDb(temps, query);
1662 for (HashMap<String, Object> col : columns) {
1663 if (col.get(
"name").equals(
"url")) {
1672 "ExtractFavicon_Display_Name=Favicon"
1680 private BlackboardArtifact.Type createArtifactType(String artifactName, String displayName)
throws TskCoreException {
1681 BlackboardArtifact.Type faviconArtifactType;
1683 faviconArtifactType = tskCase.getBlackboard().getOrAddArtifactType(artifactName, displayName);
1684 }
catch (Blackboard.BlackboardException ex) {
1685 throw new TskCoreException(String.format(
"An exception was thrown while defining artifact type %s", artifactName), ex);
1687 return faviconArtifactType;
1693 private void loadMaliciousChromeExetnsions() {
1694 maliciousChromeExtensions =
new HashMap<>();
1697 String malChromeExtenList = PlatformUtil.getUserConfigDirectory() + File.separator + MALICIOUS_CHROME_EXTENSION_LIST;
1698 BufferedReader csvReader =
new BufferedReader(
new FileReader(malChromeExtenList));
1700 while ((row = csvReader.readLine()) != null) {
1701 if (!row.startsWith(
"#", 0)) {
1702 String[] data = row.split(
",");
1703 maliciousChromeExtensions.put(data[0], data[1]);
1706 }
catch (IOException ex) {
1707 logger.log(Level.SEVERE, String.format(
"Failed to load Malicious Chrome Extension List file (%s)", MALICIOUS_CHROME_EXTENSION_LIST), ex);
1716 private void configExtractor() throws IOException {
1717 PlatformUtil.extractResourceToUserConfigDir(Chromium.class,
1718 MALICIOUS_CHROME_EXTENSION_LIST,
true);