mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-16 09:47:42 +00:00
Fixed content panel and osAccount
This commit is contained in:
parent
333d7247f5
commit
bef9e117e2
@ -82,6 +82,24 @@ public class OsAccountDataPanel extends JPanel {
|
||||
* @param account OsAccount to display, if null is passed the panel will
|
||||
* appear blank.
|
||||
*/
|
||||
// void setOsAccount(OsAccount account) {
|
||||
void setOsAccountId(Long osAccountId) {
|
||||
removeAll();
|
||||
revalidate();
|
||||
|
||||
if (osAccountId != null) {
|
||||
setLayout(new BorderLayout());
|
||||
add(new JLabel("Loading OsAccount Data..."), BorderLayout.NORTH);
|
||||
|
||||
if (dataFetcher != null && !dataFetcher.isDone()) {
|
||||
dataFetcher.cancel(true);
|
||||
}
|
||||
|
||||
dataFetcher = new PanelDataFetcher(osAccountId);
|
||||
dataFetcher.execute();
|
||||
}
|
||||
}
|
||||
|
||||
void setOsAccount(OsAccount account) {
|
||||
removeAll();
|
||||
revalidate();
|
||||
@ -319,15 +337,22 @@ public class OsAccountDataPanel extends JPanel {
|
||||
*/
|
||||
private class PanelDataFetcher extends SwingWorker<WorkerResults, Void> {
|
||||
|
||||
private final OsAccount account;
|
||||
private final Long accountId;
|
||||
private OsAccount account;
|
||||
|
||||
/**
|
||||
* Construct a new worker for the given account.
|
||||
*
|
||||
* @param account
|
||||
*/
|
||||
PanelDataFetcher(Long accountId) {
|
||||
this.accountId = accountId;
|
||||
this.account = null;
|
||||
}
|
||||
|
||||
PanelDataFetcher(OsAccount account) {
|
||||
this.account = account;
|
||||
this.accountId = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -335,6 +360,11 @@ public class OsAccountDataPanel extends JPanel {
|
||||
Map<Host, List<OsAccountAttribute>> hostMap = new HashMap<>();
|
||||
Map<Host, DataSource> instanceMap = new HashMap<>();
|
||||
OsAccountManager osAccountManager = Case.getCurrentCase().getSleuthkitCase().getOsAccountManager();
|
||||
|
||||
if(account == null) {
|
||||
account = osAccountManager.getOsAccount(accountId);
|
||||
}
|
||||
|
||||
List<Host> hosts = osAccountManager.getHosts(account);
|
||||
List<OsAccountAttribute> attributeList = account.getOsAccountAttributes();
|
||||
|
||||
|
@ -53,26 +53,29 @@ public class OsAccountViewer extends javax.swing.JPanel implements DataContentVi
|
||||
|
||||
@Override
|
||||
public void setNode(Node node) {
|
||||
OsAccount osAccount = null;
|
||||
Long osAccountId = null;
|
||||
try {
|
||||
osAccount = node.getLookup().lookup(OsAccount.class);
|
||||
if (osAccount == null) {
|
||||
Optional<OsAccount> optional;
|
||||
OsAccount osAccount = node.getLookup().lookup(OsAccount.class);
|
||||
if (osAccount != null) {
|
||||
dataPanel.setOsAccount(osAccount);
|
||||
return;
|
||||
}
|
||||
|
||||
Optional<Long> optional;
|
||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||
if (file != null) {
|
||||
optional = file.getOsAccount();
|
||||
optional = file.getOsAccountObjectId();
|
||||
if (optional.isPresent()) {
|
||||
osAccount = optional.get();
|
||||
}
|
||||
osAccountId = optional.get();
|
||||
}
|
||||
}
|
||||
|
||||
if (osAccount == null) {
|
||||
if (osAccountId == null) {
|
||||
DataArtifact dataArtifact = node.getLookup().lookup(DataArtifact.class);
|
||||
if (dataArtifact != null) {
|
||||
Optional<OsAccount> optional = dataArtifact.getOsAccount();
|
||||
optional = dataArtifact.getOsAccountObjectId();
|
||||
if (optional.isPresent()) {
|
||||
osAccount = optional.get();
|
||||
osAccountId = optional.get();
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,8 +84,8 @@ public class OsAccountViewer extends javax.swing.JPanel implements DataContentVi
|
||||
logger.log(Level.SEVERE, String.format("Failed to get OsAccount for node %s", node.getDisplayName()), ex);
|
||||
}
|
||||
|
||||
if (osAccount != null) {
|
||||
dataPanel.setOsAccount(osAccount);
|
||||
if (osAccountId != null) {
|
||||
dataPanel.setOsAccountId(osAccountId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,8 +128,8 @@ public class OsAccountViewer extends javax.swing.JPanel implements DataContentVi
|
||||
|
||||
try {
|
||||
return osAccount != null
|
||||
|| (file != null && file.getOsAccount().isPresent())
|
||||
|| (dataArtifact != null && dataArtifact.getOsAccount().isPresent());
|
||||
|| (file != null && file.getOsAccountObjectId().isPresent())
|
||||
|| (dataArtifact != null && dataArtifact.getOsAccountObjectId().isPresent());
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, String.format("Failed to determine if node %s is Supported for OsAccountViewer", node.getDisplayName()), ex);
|
||||
return false;
|
||||
|
@ -538,8 +538,12 @@ final class ChromeCacheExtractor {
|
||||
webAttr.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID,
|
||||
moduleName, cachedItemFile.getId()));
|
||||
|
||||
Optional<OsAccount> optional = cacheEntryFile.getOsAccount();
|
||||
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr, optional.isPresent() ? optional.get() : null);
|
||||
Optional<Long> optional = cacheEntryFile.getOsAccountObjectId();
|
||||
OsAccount account = null;
|
||||
if(optional.isPresent()) {
|
||||
account = currentCase.getSleuthkitCase().getOsAccountManager().getOsAccount(optional.get());
|
||||
}
|
||||
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr, account);
|
||||
artifactsAdded.add(webCacheArtifact);
|
||||
|
||||
// Create a TSK_ASSOCIATED_OBJECT on the f_XXX or derived file file back to the CACHE entry
|
||||
|
@ -533,7 +533,11 @@ abstract class Extract {
|
||||
Optional<OsAccount> getOsAccount(Content content) throws TskCoreException {
|
||||
if(content instanceof AbstractFile) {
|
||||
if(osAccountCache == null) {
|
||||
return ((AbstractFile)content).getOsAccount();
|
||||
Optional<Long> accountId = ((AbstractFile)content).getOsAccountObjectId();
|
||||
if(accountId.isPresent()) {
|
||||
return Optional.ofNullable(tskCase.getOsAccountManager().getOsAccount(accountId.get()));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return osAccountCache.getOsAccount(((AbstractFile)content));
|
||||
|
@ -24,6 +24,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.Host;
|
||||
@ -71,18 +72,18 @@ final class RAOsAccountCache {
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
Optional<OsAccount> getOsAccount(AbstractFile file) throws TskCoreException {
|
||||
Optional<OsAccount> optional = file.getOsAccount();
|
||||
Optional<Long> optional = file.getOsAccountObjectId();
|
||||
|
||||
if (!optional.isPresent()) {
|
||||
return getAccountForPath(file.getParentPath());
|
||||
}
|
||||
|
||||
OsAccount osAccount = optional.get();
|
||||
OsAccount osAccount = Case.getCurrentCase().getSleuthkitCase().getOsAccountManager().getOsAccount(optional.get());
|
||||
if (osAccount.getName().equals("S-1-5-32-544")) {
|
||||
return getAccountForPath(file.getParentPath());
|
||||
}
|
||||
|
||||
return optional;
|
||||
return Optional.ofNullable(osAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user