mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merdge in wills fixes
This commit is contained in:
commit
a0a2f18f7f
@ -29,6 +29,7 @@ import java.awt.event.ActionListener;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -1214,9 +1215,7 @@ public class Case {
|
||||
/**
|
||||
* Update the GUI to to reflect the current case.
|
||||
*/
|
||||
private static void updateGUIForCaseOpened(Case newCurrentCase) {
|
||||
if (RuntimeProperties.runningWithGUI()) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
private static void updateGUIForCaseOpened(Case newCurrentCase) {
|
||||
/*
|
||||
* If the case database was upgraded for a new schema and a
|
||||
* backup database was created, notify the user.
|
||||
@ -1242,17 +1241,31 @@ public class Case {
|
||||
String path = entry.getValue();
|
||||
boolean fileExists = (new File(path).isFile() || DriveUtils.driveExists(path));
|
||||
if (!fileExists) {
|
||||
int response = JOptionPane.showConfirmDialog(
|
||||
mainFrame,
|
||||
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.msg", path),
|
||||
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.title"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
if (response == JOptionPane.YES_OPTION) {
|
||||
MissingImageDialog.makeDialog(obj_id, caseDb);
|
||||
} else {
|
||||
logger.log(Level.SEVERE, "User proceeding with missing image files"); //NON-NLS
|
||||
try {
|
||||
// Using invokeAndWait means that the dialog will
|
||||
// open on the EDT but this thread will wait for an
|
||||
// answer. Using invokeLater would cause this loop to
|
||||
// end before all of the dialogs appeared.
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int response = JOptionPane.showConfirmDialog(
|
||||
mainFrame,
|
||||
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.msg", path),
|
||||
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.title"),
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
if (response == JOptionPane.YES_OPTION) {
|
||||
MissingImageDialog.makeDialog(obj_id, caseDb);
|
||||
} else {
|
||||
logger.log(Level.SEVERE, "User proceeding with missing image files"); //NON-NLS
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} catch (InterruptedException | InvocationTargetException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to show missing image confirmation dialog", ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1270,14 +1283,16 @@ public class Case {
|
||||
CallableSystemAction.get(CommonAttributeSearchAction.class).setEnabled(true);
|
||||
CallableSystemAction.get(OpenOutputFolderAction.class).setEnabled(false);
|
||||
CallableSystemAction.get(OpenDiscoveryAction.class).setEnabled(true);
|
||||
|
||||
/*
|
||||
* Add the case to the recent cases tracker that supplies a list
|
||||
* of recent cases to the recent cases menu item and the
|
||||
* open/create case dialog.
|
||||
*/
|
||||
RecentCases.getInstance().addRecentCase(newCurrentCase.getDisplayName(), newCurrentCase.getMetadata().getFilePath().toString());
|
||||
|
||||
|
||||
/*
|
||||
* Add the case to the recent cases tracker that supplies a list
|
||||
* of recent cases to the recent cases menu item and the
|
||||
* open/create case dialog.
|
||||
*/
|
||||
RecentCases.getInstance().addRecentCase(newCurrentCase.getDisplayName(), newCurrentCase.getMetadata().getFilePath().toString());
|
||||
final boolean hasData = newCurrentCase.hasData();
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
/*
|
||||
* Open the top components (windows within the main application
|
||||
* window).
|
||||
@ -1286,7 +1301,7 @@ public class Case {
|
||||
* opened via the DirectoryTreeTopComponent 'propertyChange()'
|
||||
* method on a DATA_SOURCE_ADDED event.
|
||||
*/
|
||||
if (newCurrentCase.hasData()) {
|
||||
if (hasData) {
|
||||
CoreComponentControl.openCoreWindows();
|
||||
} else {
|
||||
//ensure that the DirectoryTreeTopComponent is open so that it's listener can open the core windows including making it visible.
|
||||
@ -1300,7 +1315,6 @@ public class Case {
|
||||
*/
|
||||
mainFrame.setTitle(newCurrentCase.getDisplayName() + " - " + getNameForTitle());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -97,12 +97,13 @@ class OtherOccurrenceOneTypeWorker extends SwingWorker<OneTypeData, Void> {
|
||||
// - the data source device ID is different
|
||||
// - the file path is different
|
||||
if (artifactInstance.getCorrelationCase().getCaseUUID().equals(caseUUID)
|
||||
|| (!StringUtils.isBlank(dataSourceName) && artifactInstance.getCorrelationDataSource().getName().equals(dataSourceName))
|
||||
|| (!StringUtils.isBlank(deviceId) && artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId))
|
||||
|| (file != null && artifactInstance.getFilePath().equalsIgnoreCase(file.getParentPath() + file.getName()))) {
|
||||
correlationAttributesToAdd.add(artifactInstance);
|
||||
&& (!StringUtils.isBlank(dataSourceName) && artifactInstance.getCorrelationDataSource().getName().equals(dataSourceName))
|
||||
&& (!StringUtils.isBlank(deviceId) && artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId))
|
||||
&& (file != null && artifactInstance.getFilePath().equalsIgnoreCase(file.getParentPath() + file.getName()))) {
|
||||
|
||||
continue;
|
||||
}
|
||||
correlationAttributesToAdd.add(artifactInstance);
|
||||
OtherOccurrenceNodeInstanceData newNode = new OtherOccurrenceNodeInstanceData(artifactInstance, aType, value);
|
||||
UniquePathKey uniquePathKey = new UniquePathKey(newNode);
|
||||
nodeDataMap.put(uniquePathKey, newNode);
|
||||
|
@ -122,7 +122,7 @@ public final class OtherOccurrencesPanel extends javax.swing.JPanel {
|
||||
exportToCSVMenuItem.addActionListener(actList);
|
||||
showCaseDetailsMenuItem.addActionListener(actList);
|
||||
showCommonalityMenuItem.addActionListener(actList);
|
||||
|
||||
filesTable.setComponentPopupMenu(rightClickPopupMenu);
|
||||
// Configure column sorting.
|
||||
TableRowSorter<TableModel> sorter = new TableRowSorter<>(filesTable.getModel());
|
||||
filesTable.setRowSorter(sorter);
|
||||
|
@ -389,8 +389,8 @@ public final class FileTypes implements AutopsyVisitableItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) throws TskCoreException {
|
||||
return content.newDataArtifact(artifactType, attributesList, osAccount);
|
||||
public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException {
|
||||
return content.newDataArtifact(artifactType, attributesList, osAccountId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -540,12 +540,7 @@ final class ChromeCacheExtractor {
|
||||
webAttr.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID,
|
||||
moduleName, cachedItemFile.getId()));
|
||||
|
||||
Optional<Long> optional = cacheEntryFile.getOsAccountObjectId();
|
||||
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);
|
||||
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr);
|
||||
artifactsAdded.add(webCacheArtifact);
|
||||
|
||||
// Create a TSK_ASSOCIATED_OBJECT on the f_XXX or derived file file back to the CACHE entry
|
||||
|
@ -159,9 +159,10 @@ abstract class Extract {
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
BlackboardArtifact createArtifactWithAttributes(BlackboardArtifact.Type type, Content content, Collection<BlackboardAttribute> attributes) throws TskCoreException {
|
||||
Optional<OsAccount> optional = getOsAccount(content);
|
||||
if (optional.isPresent() && type.getCategory() == BlackboardArtifact.Category.DATA_ARTIFACT) {
|
||||
return content.newDataArtifact(type, attributes, optional.get());
|
||||
if (type.getCategory() == BlackboardArtifact.Category.DATA_ARTIFACT) {
|
||||
return (content instanceof AbstractFile)
|
||||
? ((AbstractFile) content).newDataArtifact(type, attributes)
|
||||
: content.newDataArtifact(type, attributes, null);
|
||||
} else {
|
||||
BlackboardArtifact bbart = content.newArtifact(type.getTypeID());
|
||||
bbart.addAttributes(attributes);
|
||||
@ -537,28 +538,4 @@ abstract class Extract {
|
||||
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the appropriate OsAccount for the given file.
|
||||
*
|
||||
* @param file
|
||||
*
|
||||
* @return An Optional OsACcount object.
|
||||
*
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
Optional<OsAccount> getOsAccount(Content content) throws TskCoreException {
|
||||
if(content instanceof AbstractFile) {
|
||||
if(osAccountCache == null) {
|
||||
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 Optional.empty();
|
||||
}
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ class ExtractRegistry extends Extract {
|
||||
} else {
|
||||
results.get(0).addAttributes(bbattributes);
|
||||
}
|
||||
for (Map.Entry userMap : userNameMap.entrySet()) {
|
||||
for (Map.Entry userMap : getUserNameMap().entrySet()) {
|
||||
String sid = "";
|
||||
try{
|
||||
sid = (String)userMap.getKey();
|
||||
@ -1116,17 +1116,6 @@ class ExtractRegistry extends Extract {
|
||||
accountMgr.newOsAccountInstance(osAccount, (DataSource)dataSource, OsAccountInstance.OsAccountInstanceType.LAUNCHED);
|
||||
updateOsAccount(osAccount, userInfo, groupMap.get(userInfo.get(SID_KEY)), regAbstractFile);
|
||||
}
|
||||
|
||||
// Get a mapping of user sids to user names and save globally so it can be used for other areas
|
||||
// of the registry, ie: BAM key
|
||||
try {
|
||||
userNameMap = makeUserNameMap(dataSource);
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Unable to create OS Account user name map", ex);
|
||||
// This is not the end of the world we will just continue without
|
||||
// user names
|
||||
userNameMap = new HashMap<>();
|
||||
}
|
||||
return true;
|
||||
} catch (FileNotFoundException ex) {
|
||||
logger.log(Level.WARNING, "Error finding the registry file.", ex); //NON-NLS
|
||||
@ -1261,7 +1250,7 @@ class ExtractRegistry extends Extract {
|
||||
// We can add the S- back to the string that we split on since S- is a valid beginning of a User SID
|
||||
String fileNameSid[] = tokens[4].split("\\s+\\(S-");
|
||||
String userSid = "S-" + fileNameSid[1].substring(0, fileNameSid[1].length() - 1);
|
||||
String userName = userNameMap.get(userSid);
|
||||
String userName = getUserNameMap().get(userSid);
|
||||
if (userName == null) {
|
||||
userName = userSid;
|
||||
}
|
||||
@ -1738,6 +1727,28 @@ class ExtractRegistry extends Extract {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mapping of user sids to user names.
|
||||
*
|
||||
* @return username man or empty list if none where found.
|
||||
*/
|
||||
private Map<String, String> getUserNameMap() {
|
||||
if(userNameMap == null) {
|
||||
// Get a mapping of user sids to user names and save globally so it can be used for other areas
|
||||
// of the registry, ie: BAM key
|
||||
try {
|
||||
userNameMap = makeUserNameMap(dataSource);
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Unable to create OS Account user name map", ex);
|
||||
// This is not the end of the world we will just continue without
|
||||
// user names
|
||||
userNameMap = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
return userNameMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the attribute for the given type from the given artifact.
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user