Merge pull request #6835 from gdicristofaro/7461-osAccountManagerChanges

7461 os account manager changes
This commit is contained in:
Richard Cordovano 2021-03-29 14:30:00 -04:00 committed by GitHub
commit 7428b06bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -144,10 +144,10 @@ public final class OsAccounts implements AutopsyVisitableItem {
if(skCase != null) { if(skCase != null) {
try { try {
if (filteringDSObjId == 0) { if (filteringDSObjId == 0) {
list.addAll(skCase.getOsAccountManager().getAccounts()); list.addAll(skCase.getOsAccountManager().getOsAccounts());
} else { } else {
Host host = skCase.getHostManager().getHost(skCase.getDataSource(filteringDSObjId)); Host host = skCase.getHostManager().getHost(skCase.getDataSource(filteringDSObjId));
list.addAll(skCase.getOsAccountManager().getAccounts(host)); list.addAll(skCase.getOsAccountManager().getOsAccounts(host));
} }
} catch (TskCoreException | TskDataException ex) { } catch (TskCoreException | TskDataException ex) {
logger.log(Level.SEVERE, "Unable to retrieve list of OsAccounts for case", ex); logger.log(Level.SEVERE, "Unable to retrieve list of OsAccounts for case", ex);

View File

@ -1081,7 +1081,7 @@ class ExtractRegistry extends Extract {
HostManager hostMrg = tskCase.getHostManager(); HostManager hostMrg = tskCase.getHostManager();
Host host = hostMrg.getHost((DataSource)dataSource); Host host = hostMrg.getHost((DataSource)dataSource);
List<OsAccount> existingAccounts = accountMgr.getAccounts(host); List<OsAccount> existingAccounts = accountMgr.getOsAccounts(host);
for(OsAccount osAccount: existingAccounts) { for(OsAccount osAccount: existingAccounts) {
Optional<String> optional = osAccount.getAddr(); Optional<String> optional = osAccount.getAddr();
if(!optional.isPresent()) { if(!optional.isPresent()) {
@ -1097,7 +1097,7 @@ class ExtractRegistry extends Extract {
//add remaining userinfos as accounts; //add remaining userinfos as accounts;
for (Map<String, String> userInfo : userInfoMap.values()) { for (Map<String, String> userInfo : userInfoMap.values()) {
OsAccount osAccount = accountMgr.createWindowsAccount(userInfo.get(SID_KEY), null, null, host, OsAccountRealm.RealmScope.UNKNOWN); OsAccount osAccount = accountMgr.createWindowsOsAccount(userInfo.get(SID_KEY), null, null, host, OsAccountRealm.RealmScope.UNKNOWN);
accountMgr.createOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED); accountMgr.createOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED);
updateOsAccount(osAccount, userInfo, groupMap.get(userInfo.get(SID_KEY)), regAbstractFile); updateOsAccount(osAccount, userInfo, groupMap.get(userInfo.get(SID_KEY)), regAbstractFile);
} }
@ -1969,10 +1969,10 @@ class ExtractRegistry extends Extract {
HostManager hostMrg = tskCase.getHostManager(); HostManager hostMrg = tskCase.getHostManager();
Host host = hostMrg.getHost((DataSource)dataSource); Host host = hostMrg.getHost((DataSource)dataSource);
Optional<OsAccount> optional = accountMgr.getWindowsAccount(sid, null, null, host); Optional<OsAccount> optional = accountMgr.getWindowsOsAccount(sid, null, null, host);
OsAccount osAccount; OsAccount osAccount;
if (!optional.isPresent()) { if (!optional.isPresent()) {
osAccount = accountMgr.createWindowsAccount(sid, userName != null && userName.isEmpty() ? null : userName, null, host, OsAccountRealm.RealmScope.UNKNOWN); osAccount = accountMgr.createWindowsOsAccount(sid, userName != null && userName.isEmpty() ? null : userName, null, host, OsAccountRealm.RealmScope.UNKNOWN);
accountMgr.createOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED); accountMgr.createOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED);
} else { } else {
osAccount = optional.get(); osAccount = optional.get();
@ -1989,7 +1989,7 @@ class ExtractRegistry extends Extract {
osAccount.addAttributes(attributes); osAccount.addAttributes(attributes);
} }
accountMgr.updateAccount(osAccount); accountMgr.updateOsAccount(osAccount);
} }
/** /**
@ -2164,7 +2164,7 @@ class ExtractRegistry extends Extract {
} }
osAccount.addAttributes(attributes); osAccount.addAttributes(attributes);
tskCase.getOsAccountManager().updateAccount(osAccount); tskCase.getOsAccountManager().updateOsAccount(osAccount);
} }
/** /**

View File

@ -113,7 +113,7 @@ final class RAOsAccountCache {
*/ */
private void buildAccountMap(SleuthkitCase tskCase, Host host) throws TskCoreException { private void buildAccountMap(SleuthkitCase tskCase, Host host) throws TskCoreException {
BlackboardAttribute.Type homeDir = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HOME_DIR); BlackboardAttribute.Type homeDir = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HOME_DIR);
List<OsAccount> accounts = tskCase.getOsAccountManager().getAccounts(host); List<OsAccount> accounts = tskCase.getOsAccountManager().getOsAccounts(host);
for (OsAccount account : accounts) { for (OsAccount account : accounts) {
List<OsAccountAttribute> attributeList = account.getOsAccountAttributes(); List<OsAccountAttribute> attributeList = account.getOsAccountAttributes();