mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merge branch 'develop' of github.com:sleuthkit/autopsy into 7466-customWebCategoriesPolish
This commit is contained in:
commit
342b00eb15
@ -79,7 +79,7 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
int hash = 7;
|
||||||
hash = 41 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getId());
|
hash = 41 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ class AddImageWizardSelectHostVisual extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
final HostListItem other = (HostListItem) obj;
|
final HostListItem other = (HostListItem) obj;
|
||||||
if (!Objects.equals(
|
if (!Objects.equals(
|
||||||
this.host == null ? 0 : this.host.getId(),
|
this.host == null ? 0 : this.host.getHostId(),
|
||||||
other.host == null ? 0 : other.host.getId())) {
|
other.host == null ? 0 : other.host.getHostId())) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class HostsEvent extends TskDataModelChangeEvent<Host> {
|
|||||||
private static List<Long> getIds(List<Host> hosts) {
|
private static List<Long> getIds(List<Host> hosts) {
|
||||||
return getSafeList(hosts).stream()
|
return getSafeList(hosts).stream()
|
||||||
.filter(h -> h != null)
|
.filter(h -> h != null)
|
||||||
.map(h -> h.getId()).collect(Collectors.toList());
|
.map(h -> h.getHostId()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ class OsAccountEvent extends TskDataModelChangeEvent<OsAccount> {
|
|||||||
@Override
|
@Override
|
||||||
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
protected List<OsAccount> getDataModelObjects(SleuthkitCase caseDb, List<Long> ids) throws TskCoreException {
|
||||||
Long id = ids.get(0);
|
Long id = ids.get(0);
|
||||||
OsAccount account = caseDb.getOsAccountManager().getOsAccount(id);
|
OsAccount account = caseDb.getOsAccountManager().getOsAccountByObjectId(id);
|
||||||
List<OsAccount> accounts = new ArrayList<>();
|
List<OsAccount> accounts = new ArrayList<>();
|
||||||
accounts.add(account);
|
accounts.add(account);
|
||||||
return accounts;
|
return accounts;
|
||||||
|
@ -42,7 +42,7 @@ public class PersonsEvent extends TskDataModelChangeEvent<Person> {
|
|||||||
private static List<Long> getIds(List<Person> persons) {
|
private static List<Long> getIds(List<Person> persons) {
|
||||||
return getSafeList(persons).stream()
|
return getSafeList(persons).stream()
|
||||||
.filter(h -> h != null)
|
.filter(h -> h != null)
|
||||||
.map(h -> h.getId()).collect(Collectors.toList());
|
.map(h -> h.getPersonId()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,6 +82,24 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
* @param account OsAccount to display, if null is passed the panel will
|
* @param account OsAccount to display, if null is passed the panel will
|
||||||
* appear blank.
|
* 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) {
|
void setOsAccount(OsAccount account) {
|
||||||
removeAll();
|
removeAll();
|
||||||
revalidate();
|
revalidate();
|
||||||
@ -319,15 +337,22 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
*/
|
*/
|
||||||
private class PanelDataFetcher extends SwingWorker<WorkerResults, Void> {
|
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.
|
* Construct a new worker for the given account.
|
||||||
*
|
*
|
||||||
* @param account
|
* @param account
|
||||||
*/
|
*/
|
||||||
|
PanelDataFetcher(Long accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
this.account = null;
|
||||||
|
}
|
||||||
|
|
||||||
PanelDataFetcher(OsAccount account) {
|
PanelDataFetcher(OsAccount account) {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
|
this.accountId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -335,6 +360,11 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
Map<Host, List<OsAccountAttribute>> hostMap = new HashMap<>();
|
Map<Host, List<OsAccountAttribute>> hostMap = new HashMap<>();
|
||||||
Map<Host, DataSource> instanceMap = new HashMap<>();
|
Map<Host, DataSource> instanceMap = new HashMap<>();
|
||||||
OsAccountManager osAccountManager = Case.getCurrentCase().getSleuthkitCase().getOsAccountManager();
|
OsAccountManager osAccountManager = Case.getCurrentCase().getSleuthkitCase().getOsAccountManager();
|
||||||
|
|
||||||
|
if(account == null) {
|
||||||
|
account = osAccountManager.getOsAccountByObjectId(accountId);
|
||||||
|
}
|
||||||
|
|
||||||
List<Host> hosts = osAccountManager.getHosts(account);
|
List<Host> hosts = osAccountManager.getHosts(account);
|
||||||
List<OsAccountAttribute> attributeList = account.getOsAccountAttributes();
|
List<OsAccountAttribute> attributeList = account.getOsAccountAttributes();
|
||||||
|
|
||||||
@ -362,7 +392,7 @@ public class OsAccountDataPanel extends JPanel {
|
|||||||
|
|
||||||
// Add attribute lists to the hostMap
|
// Add attribute lists to the hostMap
|
||||||
for (Host host : hosts) {
|
for (Host host : hosts) {
|
||||||
List<OsAccountAttribute> atList = idMap.get(host.getId());
|
List<OsAccountAttribute> atList = idMap.get(host.getHostId());
|
||||||
if (atList != null) {
|
if (atList != null) {
|
||||||
hostMap.put(host, atList);
|
hostMap.put(host, atList);
|
||||||
}
|
}
|
||||||
|
@ -53,26 +53,29 @@ public class OsAccountViewer extends javax.swing.JPanel implements DataContentVi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNode(Node node) {
|
public void setNode(Node node) {
|
||||||
OsAccount osAccount = null;
|
Long osAccountId = null;
|
||||||
try {
|
try {
|
||||||
osAccount = node.getLookup().lookup(OsAccount.class);
|
OsAccount osAccount = node.getLookup().lookup(OsAccount.class);
|
||||||
if (osAccount == null) {
|
if (osAccount != null) {
|
||||||
Optional<OsAccount> optional;
|
dataPanel.setOsAccount(osAccount);
|
||||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
return;
|
||||||
if (file != null) {
|
}
|
||||||
optional = file.getOsAccount();
|
|
||||||
if (optional.isPresent()) {
|
Optional<Long> optional;
|
||||||
osAccount = optional.get();
|
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||||
}
|
if (file != null) {
|
||||||
|
optional = file.getOsAccountObjectId();
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
osAccountId = optional.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osAccount == null) {
|
if (osAccountId == null) {
|
||||||
DataArtifact dataArtifact = node.getLookup().lookup(DataArtifact.class);
|
DataArtifact dataArtifact = node.getLookup().lookup(DataArtifact.class);
|
||||||
if (dataArtifact != null) {
|
if (dataArtifact != null) {
|
||||||
Optional<OsAccount> optional = dataArtifact.getOsAccount();
|
optional = dataArtifact.getOsAccountObjectId();
|
||||||
if (optional.isPresent()) {
|
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);
|
logger.log(Level.SEVERE, String.format("Failed to get OsAccount for node %s", node.getDisplayName()), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osAccount != null) {
|
if (osAccountId != null) {
|
||||||
dataPanel.setOsAccount(osAccount);
|
dataPanel.setOsAccountId(osAccountId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,8 +128,8 @@ public class OsAccountViewer extends javax.swing.JPanel implements DataContentVi
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return osAccount != null
|
return osAccount != null
|
||||||
|| (file != null && file.getOsAccount().isPresent())
|
|| (file != null && file.getOsAccountObjectId().isPresent())
|
||||||
|| (dataArtifact != null && dataArtifact.getOsAccount().isPresent());
|
|| (dataArtifact != null && dataArtifact.getOsAccountObjectId().isPresent());
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, String.format("Failed to determine if node %s is Supported for OsAccountViewer", node.getDisplayName()), ex);
|
logger.log(Level.SEVERE, String.format("Failed to determine if node %s is Supported for OsAccountViewer", node.getDisplayName()), ex);
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,7 +51,7 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable<HostDat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.host == null ? 0 : this.host.getId());
|
return Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,8 +66,8 @@ public class HostDataSources implements AutopsyVisitableItem, Comparable<HostDat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HostDataSources other = (HostDataSources) obj;
|
final HostDataSources other = (HostDataSources) obj;
|
||||||
long thisId = (this.getHost() == null) ? 0 : this.getHost().getId();
|
long thisId = (this.getHost() == null) ? 0 : this.getHost().getHostId();
|
||||||
long otherId = (other.getHost() == null) ? 0 : other.getHost().getId();
|
long otherId = (other.getHost() == null) ? 0 : other.getHost().getHostId();
|
||||||
return thisId == otherId;
|
return thisId == otherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class HostGrouping implements AutopsyVisitableItem, Comparable<HostGroupi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.host == null ? 0 : this.host.getId());
|
return Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,8 +66,8 @@ public class HostGrouping implements AutopsyVisitableItem, Comparable<HostGroupi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final HostGrouping other = (HostGrouping) obj;
|
final HostGrouping other = (HostGrouping) obj;
|
||||||
long thisId = (this.getHost() == null) ? 0 : this.getHost().getId();
|
long thisId = (this.getHost() == null) ? 0 : this.getHost().getHostId();
|
||||||
long otherId = (other.getHost() == null) ? 0 : other.getHost().getId();
|
long otherId = (other.getHost() == null) ? 0 : other.getHost().getHostId();
|
||||||
return thisId == otherId;
|
return thisId == otherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class HostNode extends DisplayableItemNode {
|
|||||||
String eventType = evt.getPropertyName();
|
String eventType = evt.getPropertyName();
|
||||||
if (hostId != null && eventType.equals(Case.Events.HOSTS_CHANGED.toString()) && evt instanceof HostsChangedEvent) {
|
if (hostId != null && eventType.equals(Case.Events.HOSTS_CHANGED.toString()) && evt instanceof HostsChangedEvent) {
|
||||||
((HostsChangedEvent) evt).getNewValue().stream()
|
((HostsChangedEvent) evt).getNewValue().stream()
|
||||||
.filter(h -> h != null && h.getId() == hostId)
|
.filter(h -> h != null && h.getHostId() == hostId)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent((newHost) -> {
|
.ifPresent((newHost) -> {
|
||||||
setName(newHost.getName());
|
setName(newHost.getName());
|
||||||
@ -242,7 +242,7 @@ public class HostNode extends DisplayableItemNode {
|
|||||||
super(children,
|
super(children,
|
||||||
host == null ? Lookups.fixed(displayName) : Lookups.fixed(host, displayName));
|
host == null ? Lookups.fixed(displayName) : Lookups.fixed(host, displayName));
|
||||||
|
|
||||||
hostId = host == null ? null : host.getId();
|
hostId = host == null ? null : host.getHostId();
|
||||||
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.HOSTS_CHANGED),
|
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.HOSTS_CHANGED),
|
||||||
WeakListeners.propertyChange(hostChangePcl, this));
|
WeakListeners.propertyChange(hostChangePcl, this));
|
||||||
super.setName(displayName);
|
super.setName(displayName);
|
||||||
|
@ -52,7 +52,7 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable<PersonGr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(this.person == null ? 0 : this.person.getId());
|
return Objects.hashCode(this.person == null ? 0 : this.person.getPersonId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -67,8 +67,8 @@ public class PersonGrouping implements AutopsyVisitableItem, Comparable<PersonGr
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PersonGrouping other = (PersonGrouping) obj;
|
final PersonGrouping other = (PersonGrouping) obj;
|
||||||
long thisId = (this.getPerson() == null) ? 0 : this.getPerson().getId();
|
long thisId = (this.getPerson() == null) ? 0 : this.getPerson().getPersonId();
|
||||||
long otherId = (other.getPerson() == null) ? 0 : other.getPerson().getId();
|
long otherId = (other.getPerson() == null) ? 0 : other.getPerson().getPersonId();
|
||||||
return thisId == otherId;
|
return thisId == otherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
|
|||||||
String eventType = evt.getPropertyName();
|
String eventType = evt.getPropertyName();
|
||||||
if (personId != null && eventType.equals(Case.Events.PERSONS_CHANGED.toString()) && evt instanceof PersonsChangedEvent) {
|
if (personId != null && eventType.equals(Case.Events.PERSONS_CHANGED.toString()) && evt instanceof PersonsChangedEvent) {
|
||||||
((PersonsChangedEvent) evt).getNewValue().stream()
|
((PersonsChangedEvent) evt).getNewValue().stream()
|
||||||
.filter(p -> p != null && p.getId() == personId)
|
.filter(p -> p != null && p.getPersonId() == personId)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent((newPerson) -> {
|
.ifPresent((newPerson) -> {
|
||||||
setName(newPerson.getName());
|
setName(newPerson.getName());
|
||||||
@ -191,7 +191,7 @@ public class PersonGroupingNode extends DisplayableItemNode {
|
|||||||
super.setDisplayName(displayName);
|
super.setDisplayName(displayName);
|
||||||
this.setIconBaseWithExtension(ICON_PATH);
|
this.setIconBaseWithExtension(ICON_PATH);
|
||||||
this.person = person;
|
this.person = person;
|
||||||
this.personId = person == null ? null : person.getId();
|
this.personId = person == null ? null : person.getPersonId();
|
||||||
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.PERSONS_CHANGED),
|
Case.addEventTypeSubscriber(EnumSet.of(Case.Events.PERSONS_CHANGED),
|
||||||
WeakListeners.propertyChange(personChangePcl, this));
|
WeakListeners.propertyChange(personChangePcl, this));
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 5;
|
int hash = 5;
|
||||||
hash = 89 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getId());
|
hash = 89 * hash + Objects.hashCode(this.host == null ? 0 : this.host.getHostId());
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
return this.host == null && other.getHost() == null;
|
return this.host == null && other.getHost() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.host.getId() == other.getHost().getId();
|
return this.host.getHostId() == other.getHost().getHostId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
Long selectedId = null;
|
Long selectedId = null;
|
||||||
try {
|
try {
|
||||||
Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName);
|
Host newHost = Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().createHost(newHostName);
|
||||||
selectedId = newHost == null ? null : newHost.getId();
|
selectedId = newHost == null ? null : newHost.getHostId();
|
||||||
} catch (NoCurrentCaseException | TskCoreException e) {
|
} catch (NoCurrentCaseException | TskCoreException e) {
|
||||||
logger.log(Level.WARNING, String.format("Unable to add new host '%s' at this time.", newHostName), e);
|
logger.log(Level.WARNING, String.format("Unable to add new host '%s' at this time.", newHostName), e);
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host.getId() == selectedId) {
|
if (host.getHostId() == selectedId) {
|
||||||
hostList.setSelectedIndex(i);
|
hostList.setSelectedIndex(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -238,11 +238,11 @@ public class ManageHostsDialog extends javax.swing.JDialog {
|
|||||||
try {
|
try {
|
||||||
Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().updateHost(selectedHost);
|
Case.getCurrentCaseThrows().getSleuthkitCase().getHostManager().updateHost(selectedHost);
|
||||||
} catch (NoCurrentCaseException | TskCoreException e) {
|
} catch (NoCurrentCaseException | TskCoreException e) {
|
||||||
logger.log(Level.WARNING, String.format("Unable to update host '%s' with id: %d at this time.", selectedHost.getName(), selectedHost.getId()), e);
|
logger.log(Level.WARNING, String.format("Unable to update host '%s' with id: %d at this time.", selectedHost.getName(), selectedHost.getHostId()), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
HostListItem selectedItem = hostList.getSelectedValue();
|
HostListItem selectedItem = hostList.getSelectedValue();
|
||||||
Long selectedId = selectedItem == null || selectedItem.getHost() == null ? null : selectedItem.getHost().getId();
|
Long selectedId = selectedItem == null || selectedItem.getHost() == null ? null : selectedItem.getHost().getHostId();
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
@ -538,8 +538,12 @@ final class ChromeCacheExtractor {
|
|||||||
webAttr.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID,
|
webAttr.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID,
|
||||||
moduleName, cachedItemFile.getId()));
|
moduleName, cachedItemFile.getId()));
|
||||||
|
|
||||||
Optional<OsAccount> optional = cacheEntryFile.getOsAccount();
|
Optional<Long> optional = cacheEntryFile.getOsAccountObjectId();
|
||||||
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr, optional.isPresent() ? optional.get() : null);
|
OsAccount account = null;
|
||||||
|
if(optional.isPresent()) {
|
||||||
|
account = currentCase.getSleuthkitCase().getOsAccountManager().getOsAccountByObjectId(optional.get());
|
||||||
|
}
|
||||||
|
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr, account);
|
||||||
artifactsAdded.add(webCacheArtifact);
|
artifactsAdded.add(webCacheArtifact);
|
||||||
|
|
||||||
// Create a TSK_ASSOCIATED_OBJECT on the f_XXX or derived file file back to the CACHE entry
|
// 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 {
|
Optional<OsAccount> getOsAccount(Content content) throws TskCoreException {
|
||||||
if(content instanceof AbstractFile) {
|
if(content instanceof AbstractFile) {
|
||||||
if(osAccountCache == null) {
|
if(osAccountCache == null) {
|
||||||
return ((AbstractFile)content).getOsAccount();
|
Optional<Long> accountId = ((AbstractFile)content).getOsAccountObjectId();
|
||||||
|
if(accountId.isPresent()) {
|
||||||
|
return Optional.ofNullable(tskCase.getOsAccountManager().getOsAccountByObjectId(accountId.get()));
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
return osAccountCache.getOsAccount(((AbstractFile)content));
|
return osAccountCache.getOsAccount(((AbstractFile)content));
|
||||||
|
@ -340,7 +340,7 @@ final class ExtractRecycleBin extends Extract {
|
|||||||
private Map<String, String> makeUserNameMap(Content dataSource) throws TskCoreException {
|
private Map<String, String> makeUserNameMap(Content dataSource) throws TskCoreException {
|
||||||
Map<String, String> userNameMap = new HashMap<>();
|
Map<String, String> userNameMap = new HashMap<>();
|
||||||
|
|
||||||
for(OsAccount account: tskCase.getOsAccountManager().getAccounts(((DataSource)dataSource).getHost())) {
|
for(OsAccount account: tskCase.getOsAccountManager().getOsAccounts(((DataSource)dataSource).getHost())) {
|
||||||
Optional<String> userName = account.getLoginName();
|
Optional<String> userName = account.getLoginName();
|
||||||
userNameMap.put(account.getName(), userName.isPresent() ? userName.get() : "");
|
userNameMap.put(account.getName(), userName.isPresent() ? userName.get() : "");
|
||||||
}
|
}
|
||||||
|
@ -1716,7 +1716,7 @@ class ExtractRegistry extends Extract {
|
|||||||
private Map<String, String> makeUserNameMap(Content dataSource) throws TskCoreException {
|
private Map<String, String> makeUserNameMap(Content dataSource) throws TskCoreException {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
|
|
||||||
for(OsAccount account: tskCase.getOsAccountManager().getAccounts(((DataSource)dataSource).getHost())) {
|
for(OsAccount account: tskCase.getOsAccountManager().getOsAccounts(((DataSource)dataSource).getHost())) {
|
||||||
Optional<String> userName = account.getLoginName();
|
Optional<String> userName = account.getLoginName();
|
||||||
map.put(account.getName(), userName.isPresent() ? userName.get() : "");
|
map.put(account.getName(), userName.isPresent() ? userName.get() : "");
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import org.sleuthkit.datamodel.Host;
|
import org.sleuthkit.datamodel.Host;
|
||||||
@ -71,18 +72,18 @@ final class RAOsAccountCache {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
Optional<OsAccount> getOsAccount(AbstractFile file) throws TskCoreException {
|
Optional<OsAccount> getOsAccount(AbstractFile file) throws TskCoreException {
|
||||||
Optional<OsAccount> optional = file.getOsAccount();
|
Optional<Long> optional = file.getOsAccountObjectId();
|
||||||
|
|
||||||
if (!optional.isPresent()) {
|
if (!optional.isPresent()) {
|
||||||
return getAccountForPath(file.getParentPath());
|
return getAccountForPath(file.getParentPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
OsAccount osAccount = optional.get();
|
OsAccount osAccount = Case.getCurrentCase().getSleuthkitCase().getOsAccountManager().getOsAccountByObjectId(optional.get());
|
||||||
if (osAccount.getName().equals("S-1-5-32-544")) {
|
if (osAccount.getName().equals("S-1-5-32-544")) {
|
||||||
return getAccountForPath(file.getParentPath());
|
return getAccountForPath(file.getParentPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
return optional;
|
return Optional.ofNullable(osAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,7 +121,7 @@ final class RAOsAccountCache {
|
|||||||
|
|
||||||
for (OsAccountAttribute attribute : attributeList) {
|
for (OsAccountAttribute attribute : attributeList) {
|
||||||
if (attribute.getHostId().isPresent()
|
if (attribute.getHostId().isPresent()
|
||||||
&& attribute.getHostId().get().equals(host.getId())
|
&& attribute.getHostId().get().equals(host.getHostId())
|
||||||
&& attribute.getAttributeType().equals(homeDir)) {
|
&& attribute.getAttributeType().equals(homeDir)) {
|
||||||
accountCache.put(attribute.getValueString(), account);
|
accountCache.put(attribute.getValueString(), account);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user