mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Update OsAccountDataViewer
This commit is contained in:
parent
a096c6e926
commit
996cd1f0bc
@ -1,3 +1,4 @@
|
||||
OsAccountDataPanel_administrator_title=Administrator
|
||||
OsAccountDataPanel_basic_address=Address
|
||||
OsAccountDataPanel_basic_admin=Administrator
|
||||
OsAccountDataPanel_basic_creationDate=Creation Date
|
||||
@ -5,6 +6,10 @@ OsAccountDataPanel_basic_fullname=Full Name
|
||||
OsAccountDataPanel_basic_login=Login
|
||||
OsAccountDataPanel_basic_title=Basic Properties
|
||||
OsAccountDataPanel_basic_type=Type
|
||||
OsAccountDataPanel_data_accessed_title=Last Login
|
||||
OsAccountDataPanel_host_count_title=Login Count
|
||||
# {0} - hostName
|
||||
OsAccountDataPanel_host_section_title={0} Details
|
||||
OsAccountDataPanel_realm_address=Address
|
||||
OsAccountDataPanel_realm_confidence=Confidence
|
||||
OsAccountDataPanel_realm_name=Name
|
||||
|
@ -41,6 +41,7 @@ import javax.swing.SwingWorker;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.contentviewers.osaccount.SectionData.RowData;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.datamodel.Host;
|
||||
import org.sleuthkit.datamodel.OsAccount;
|
||||
@ -48,6 +49,7 @@ import org.sleuthkit.datamodel.OsAccountAttribute;
|
||||
import org.sleuthkit.datamodel.OsAccountInstance;
|
||||
import org.sleuthkit.datamodel.OsAccountManager;
|
||||
import org.sleuthkit.datamodel.OsAccountRealm;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
|
||||
/**
|
||||
* Panel for displaying the properties of an OsAccount.
|
||||
@ -82,7 +84,6 @@ 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();
|
||||
@ -225,10 +226,33 @@ public class OsAccountDataPanel extends JPanel {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Messages({
|
||||
"# {0} - hostName",
|
||||
"OsAccountDataPanel_host_section_title={0} Details",
|
||||
"OsAccountDataPanel_host_count_title=Login Count",
|
||||
"OsAccountDataPanel_data_accessed_title=Last Login",
|
||||
"OsAccountDataPanel_administrator_title=Administrator"
|
||||
})
|
||||
private SectionData buildHostData(Host host, List<OsAccountAttribute> attributeList) {
|
||||
SectionData data = new SectionData(host.getName());
|
||||
SectionData data = new SectionData(Bundle.OsAccountDataPanel_host_section_title(host.getName()));
|
||||
for (OsAccountAttribute attribute : attributeList) {
|
||||
data.addData(attribute.getAttributeType().getDisplayName(), attribute.getDisplayString());
|
||||
String displayName = attribute.getAttributeType().getDisplayName();
|
||||
String value = attribute.getDisplayString();
|
||||
|
||||
if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COUNT.getTypeID()) {
|
||||
displayName = Bundle.OsAccountDataPanel_host_count_title();
|
||||
} else if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IS_ADMIN.getTypeID()) {
|
||||
displayName = Bundle.OsAccountDataPanel_administrator_title();
|
||||
if(attribute.getValueInt() == 0) {
|
||||
value = "False";
|
||||
} else {
|
||||
value = "True";
|
||||
}
|
||||
} else if(attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()) {
|
||||
displayName = Bundle.OsAccountDataPanel_data_accessed_title();
|
||||
}
|
||||
|
||||
data.addData(displayName, value);
|
||||
}
|
||||
|
||||
return data;
|
||||
@ -254,7 +278,7 @@ public class OsAccountDataPanel extends JPanel {
|
||||
* @param row The row in the layout.
|
||||
*/
|
||||
private void addPropertyName(String key, int row) {
|
||||
JLabel label = new JLabel(key);
|
||||
JLabel label = new JLabel(key + ":");
|
||||
add(label, getPropertyNameContraints(row));
|
||||
}
|
||||
|
||||
@ -359,7 +383,9 @@ public class OsAccountDataPanel extends JPanel {
|
||||
protected WorkerResults doInBackground() throws Exception {
|
||||
Map<Host, List<OsAccountAttribute>> hostMap = new HashMap<>();
|
||||
Map<Host, DataSource> instanceMap = new HashMap<>();
|
||||
OsAccountManager osAccountManager = Case.getCurrentCase().getSleuthkitCase().getOsAccountManager();
|
||||
SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
OsAccountManager osAccountManager = skCase.getOsAccountManager();
|
||||
OsAccountRealm realm = skCase.getOsAccountRealmManager().getRealmById(account.getRealmId());
|
||||
|
||||
if(account == null) {
|
||||
account = osAccountManager.getOsAccountByObjectId(accountId);
|
||||
@ -414,7 +440,7 @@ public class OsAccountDataPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
return new WorkerResults(hostMap, instanceMap);
|
||||
return new WorkerResults(hostMap, instanceMap, realm);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -442,20 +468,21 @@ public class OsAccountDataPanel extends JPanel {
|
||||
hostDataMap.forEach((K, V) -> data.add(buildHostData(K, V)));
|
||||
}
|
||||
|
||||
// TODO - load realm on background thread
|
||||
//OsAccountRealm realm = account.getRealm();
|
||||
//if (realm != null) {
|
||||
// data.add(buildRealmProperties(realm));
|
||||
//}
|
||||
|
||||
Map<Host, DataSource> instanceMap = results.getDataSourceMap();
|
||||
if (!instanceMap.isEmpty()) {
|
||||
SectionData instanceSection = new SectionData("Instances");
|
||||
instanceMap.forEach((K, V) -> instanceSection.addData(K.getName(), V.getName()));
|
||||
|
||||
data.add(instanceSection);
|
||||
OsAccountRealm realm = results.getRealm();
|
||||
if (realm != null) {
|
||||
data.add(buildRealmProperties(realm));
|
||||
}
|
||||
|
||||
// Removing the instance section for now. Leaving code here for
|
||||
// future use.
|
||||
// Map<Host, DataSource> instanceMap = results.getDataSourceMap();
|
||||
// if (!instanceMap.isEmpty()) {
|
||||
// SectionData instanceSection = new SectionData("Instances");
|
||||
// instanceMap.forEach((K, V) -> instanceSection.addData(K.getName(), V.getName()));
|
||||
//
|
||||
// data.add(instanceSection);
|
||||
// }
|
||||
|
||||
addDataComponents(data);
|
||||
|
||||
revalidate();
|
||||
@ -472,6 +499,7 @@ public class OsAccountDataPanel extends JPanel {
|
||||
|
||||
private final Map<Host, List<OsAccountAttribute>> attributeMap;
|
||||
private final Map<Host, DataSource> instanceMap;
|
||||
private final OsAccountRealm realm;
|
||||
|
||||
/**
|
||||
* Construct a new WorkerResult object.
|
||||
@ -481,9 +509,10 @@ public class OsAccountDataPanel extends JPanel {
|
||||
* @param instanceMap A map of data to display OsAccount instance
|
||||
* information.
|
||||
*/
|
||||
WorkerResults(Map<Host, List<OsAccountAttribute>> attributeMap, Map<Host, DataSource> instanceMap) {
|
||||
WorkerResults(Map<Host, List<OsAccountAttribute>> attributeMap, Map<Host, DataSource> instanceMap, OsAccountRealm realm) {
|
||||
this.attributeMap = attributeMap;
|
||||
this.instanceMap = instanceMap;
|
||||
this.realm = realm;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -505,5 +534,9 @@ public class OsAccountDataPanel extends JPanel {
|
||||
Map<Host, DataSource> getDataSourceMap() {
|
||||
return instanceMap;
|
||||
}
|
||||
|
||||
OsAccountRealm getRealm() {
|
||||
return realm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user