a bit more cleanup

This commit is contained in:
millmanorama 2018-08-23 11:57:35 +02:00
parent de51946bac
commit aacd6d99ba
2 changed files with 12 additions and 16 deletions

View File

@ -589,7 +589,8 @@ final class Chrome extends Extract {
List<HashMap<String, Object>> tempList = this.dbConnect(temps, LOGIN_QUERY); List<HashMap<String, Object>> tempList = this.dbConnect(temps, LOGIN_QUERY);
logger.log(Level.INFO, "{0}- Now getting login information from {1} with {2}artifacts identified.", new Object[]{getModuleName(), temps, tempList.size()}); //NON-NLS logger.log(Level.INFO, "{0}- Now getting login information from {1} with {2}artifacts identified.", new Object[]{getModuleName(), temps, tempList.size()}); //NON-NLS
for (HashMap<String, Object> result : tempList) { for (HashMap<String, Object> result : tempList) {
Collection<BlackboardAttribute> bbattributes = Arrays.asList(new BlackboardAttribute( Collection<BlackboardAttribute> bbattributes = Arrays.asList(
new BlackboardAttribute(
TSK_URL, PARENT_MODULE_NAME, TSK_URL, PARENT_MODULE_NAME,
Objects.toString(result.get("origin_url"), "")), //NON-NLS Objects.toString(result.get("origin_url"), "")), //NON-NLS
new BlackboardAttribute( new BlackboardAttribute(
@ -624,23 +625,18 @@ final class Chrome extends Extract {
this.getModuleName(), signonFile.getName())); this.getModuleName(), signonFile.getName()));
} }
// Don't add TSK_OS_ACCOUNT artifacts to the ModuleDataEvent Set<BlackboardAttribute> osAccountAttriubtes = Collections.singleton(
//TODO: Why not? Because it has a different artifact type? We can just post it seperately? new BlackboardAttribute(
TSK_USER_NAME, PARENT_MODULE_NAME,
Objects.toString(result.get("username_value"), "").replaceAll("'", "''")));//NON-NLS
try { try {
BlackboardAttribute osAcctAttribute = new BlackboardAttribute(TSK_USER_NAME, PARENT_MODULE_NAME,
Objects.toString(result.get("username_value"), "").replaceAll("'", "''")); //NON-NLS
BlackboardArtifact osAccountArtifact = signonFile.newArtifact(TSK_OS_ACCOUNT); BlackboardArtifact osAccountArtifact = signonFile.newArtifact(TSK_OS_ACCOUNT);
osAccountArtifact.addAttributes(Collections.singleton(osAcctAttribute)); osAccountArtifact.addAttributes(osAccountAttriubtes);
bbartifacts.add(osAccountArtifact);
blackboard.postArtifact(osAccountArtifact, PARENT_MODULE_NAME);
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
logger.log(Level.SEVERE, "Error while trying to insert Chrome os account artifact.", ex); //NON-NLS logger.log(Level.SEVERE, "Error while trying to insert Chrome os account artifact.", ex); //NON-NLS
this.addErrorMessage(NbBundle.getMessage(Chrome.class, "Chrome.getLogin.errMsg.errAnalyzingFiles", this.addErrorMessage(NbBundle.getMessage(Chrome.class, "Chrome.getLogin.errMsg.errAnalyzingFiles",
this.getModuleName(), signonFile.getName())); this.getModuleName(), signonFile.getName()));
} catch (Blackboard.BlackboardException ex) {
logger.log(Level.SEVERE, "Error while trying to post Chrome os account artifact.", ex); //NON-NLS
this.addErrorMessage(Bundle.Extractor_errPostingArtifacts(getModuleName()));
} }
} }

View File

@ -83,7 +83,7 @@ class Util {
} }
public static String getBaseDomain(String url) { public static String getBaseDomain(String url) {
//TODO: There is no utility in apache or guave to do this for us? //JIRA-2384: There is no utility in apache or guave to do this for us?
//strip protocol //strip protocol
String cleanUrl = url.replaceFirst(".*:\\/\\/", ""); String cleanUrl = url.replaceFirst(".*:\\/\\/", "");
@ -112,7 +112,7 @@ class Util {
public static String extractDomain(String value) { public static String extractDomain(String value) {
//TODO: There is no utility in apache or guave to do this for us? //JIRA-2384: There is no utility in apache or guave to do this for us?
if (value == null) { if (value == null) {
return ""; return "";