diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java index a32bf32581833e131dd4d14c0793e862e4aff657..44f36e57567a99b8ee2c18b09c14e88e76145006 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java @@ -1105,7 +1105,7 @@ private boolean parseSamPluginOutput(String regFilePath, AbstractFile regAbstrac //add remaining userinfos as accounts; for (Map<String, String> userInfo : userInfoMap.values()) { - OsAccount osAccount = accountMgr.newWindowsOsAccount(userInfo.get(SID_KEY), null, domainName, host, domainName != null || !domainName.isEmpty() ? OsAccountRealm.RealmScope.DOMAIN : OsAccountRealm.RealmScope.UNKNOWN); + OsAccount osAccount = accountMgr.newWindowsOsAccount(userInfo.get(SID_KEY), null, domainName, host, domainName != null && !domainName.isEmpty() ? OsAccountRealm.RealmScope.DOMAIN : OsAccountRealm.RealmScope.UNKNOWN); accountMgr.newOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED); updateOsAccount(osAccount, userInfo, groupMap.get(userInfo.get(SID_KEY)), regAbstractFile); } @@ -2025,7 +2025,7 @@ private void createOrUpdateOsAccount(AbstractFile file, String sid, String userN Optional<OsAccount> optional = accountMgr.getWindowsOsAccount(sid, null, null, host); OsAccount osAccount; if (!optional.isPresent()) { - osAccount = accountMgr.newWindowsOsAccount(sid, userName != null && userName.isEmpty() ? null : userName, domainName, host, domainName != null || !domainName.isEmpty()? OsAccountRealm.RealmScope.DOMAIN : OsAccountRealm.RealmScope.UNKNOWN); + osAccount = accountMgr.newWindowsOsAccount(sid, userName != null && userName.isEmpty() ? null : userName, domainName, host, domainName != null && !domainName.isEmpty()? OsAccountRealm.RealmScope.DOMAIN : OsAccountRealm.RealmScope.UNKNOWN); accountMgr.newOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED); } else { osAccount = optional.get(); diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ParseRegistryHive.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ParseRegistryHive.java index 2048313c43f1b514d8b87cb49dc495c122321c4b..b02489112c003b2a478850506a7f0b9a9e431341 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ParseRegistryHive.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ParseRegistryHive.java @@ -27,6 +27,7 @@ import java.io.UnsupportedEncodingException; import java.util.Calendar; import java.util.List; +import java.util.NoSuchElementException; import java.util.logging.Level; import org.sleuthkit.autopsy.coreutils.Logger; @@ -116,6 +117,9 @@ private RegistryKey findRegistryKey(RegistryHiveFile registryHiveFile, String re } } catch (RegistryParseException ex) { return null; + } catch (NoSuchElementException ex) { + logger.log(Level.WARNING, String.format("Cannot find the registry key %s in the registry hive file %s", registryKey, registryHiveFile.toString())); + return null; } return currentKey;