mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
Merge branch 'develop' of github.com:sleuthkit/autopsy into 1761
This commit is contained in:
commit
4aa3df620d
@ -31,8 +31,8 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -54,26 +54,26 @@ import org.openide.windows.WindowManager;
|
|||||||
import org.sleuthkit.autopsy.casemodule.CaseMetadata.CaseMetadataException;
|
import org.sleuthkit.autopsy.casemodule.CaseMetadata.CaseMetadataException;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceEvent;
|
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceEvent;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceFailedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.AddingDataSourceFailedEvent;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.DataSourceAddedEvent;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.events.ReportAddedEvent;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.services.Services;
|
|
||||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
|
||||||
import org.sleuthkit.autopsy.corecomponentinterfaces.CoreComponentControl;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.FileUtil;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.Version;
|
|
||||||
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
|
|
||||||
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
|
||||||
import org.sleuthkit.autopsy.events.AutopsyEventException;
|
|
||||||
import org.sleuthkit.autopsy.events.AutopsyEventPublisher;
|
|
||||||
import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagAddedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagAddedEvent;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagDeletedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagDeletedEvent;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
||||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.events.DataSourceAddedEvent;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.events.ReportAddedEvent;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.services.Services;
|
||||||
import org.sleuthkit.autopsy.core.RuntimeProperties;
|
import org.sleuthkit.autopsy.core.RuntimeProperties;
|
||||||
|
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||||
import org.sleuthkit.autopsy.core.UserPreferencesException;
|
import org.sleuthkit.autopsy.core.UserPreferencesException;
|
||||||
|
import org.sleuthkit.autopsy.corecomponentinterfaces.CoreComponentControl;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.FileUtil;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||||
|
import org.sleuthkit.autopsy.coreutils.Version;
|
||||||
|
import org.sleuthkit.autopsy.events.AutopsyEvent;
|
||||||
|
import org.sleuthkit.autopsy.events.AutopsyEventException;
|
||||||
|
import org.sleuthkit.autopsy.events.AutopsyEventPublisher;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestJob;
|
import org.sleuthkit.autopsy.ingest.IngestJob;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifactTag;
|
import org.sleuthkit.datamodel.BlackboardArtifactTag;
|
||||||
@ -437,7 +437,7 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
|||||||
* CaseActionException.getCause will return a Throwable
|
* CaseActionException.getCause will return a Throwable
|
||||||
* (null otherwise).
|
* (null otherwise).
|
||||||
*
|
*
|
||||||
* @throws CaseActionException if there is a problem creating the case.
|
* @throws CaseActionException if there is a problem creating the case.
|
||||||
*/
|
*/
|
||||||
@Messages({"Case.creationException=Could not create case: failed to make metadata file."})
|
@Messages({"Case.creationException=Could not create case: failed to make metadata file."})
|
||||||
public static void create(String caseDir, String caseName, String caseNumber, String examiner, CaseType caseType) throws CaseActionException {
|
public static void create(String caseDir, String caseName, String caseNumber, String examiner, CaseType caseType) throws CaseActionException {
|
||||||
@ -1629,29 +1629,32 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
public void deleteReports(Collection<? extends Report> reports, boolean deleteFromDisk) throws TskCoreException {
|
public void deleteReports(Collection<? extends Report> reports, boolean deleteFromDisk) throws TskCoreException {
|
||||||
|
|
||||||
String pathToReportsFolder = Paths.get(this.db.getDbDirPath(), "Reports").normalize().toString(); // NON-NLS
|
|
||||||
for (Report report : reports) {
|
for (Report report : reports) {
|
||||||
|
|
||||||
// delete from the database.
|
// delete from the database.
|
||||||
this.db.deleteReport(report);
|
this.db.deleteReport(report);
|
||||||
|
|
||||||
if (deleteFromDisk) {
|
if (deleteFromDisk) {
|
||||||
// traverse to the root directory of Report report.
|
|
||||||
String reportPath = report.getPath();
|
String reportPath = report.getPath();
|
||||||
while (!Paths.get(reportPath, "..").normalize().toString().equals(pathToReportsFolder)) { // NON-NLS
|
|
||||||
reportPath = Paths.get(reportPath, "..").normalize().toString(); // NON-NLS
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete from the disk.
|
// delete from the disk.
|
||||||
try {
|
File toDelete = new File(reportPath);
|
||||||
FileUtils.deleteDirectory(new File(reportPath));
|
if (toDelete.isDirectory()) {
|
||||||
} catch (IOException | SecurityException ex) {
|
try {
|
||||||
logger.log(Level.WARNING, NbBundle.getMessage(Case.class, "Case.deleteReports.deleteFromDiskException.log.msg"), ex);
|
FileUtils.deleteDirectory(toDelete);
|
||||||
JOptionPane.showMessageDialog(null, NbBundle.getMessage(Case.class, "Case.deleteReports.deleteFromDiskException.msg", report.getReportName(), reportPath));
|
} catch (IOException | SecurityException ex) {
|
||||||
|
logger.log(Level.WARNING, "Unable to delete the report from the disk.", ex);
|
||||||
|
JOptionPane.showMessageDialog(null, NbBundle.getMessage(Case.class, "Case.deleteReports.deleteFromDiskException.msg", report.getReportName(), reportPath));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean deleted = toDelete.delete();
|
||||||
|
if (!deleted) {
|
||||||
|
logger.log(Level.WARNING, "Unable to delete the report from the disk.");
|
||||||
|
JOptionPane.showMessageDialog(null, NbBundle.getMessage(Case.class, "Case.deleteReports.deleteFromDiskException.msg", report.getReportName(), reportPath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
eventPublisher.publish(new AutopsyEvent(Events.REPORT_DELETED.toString(), null, null));
|
eventPublisher.publish(new AutopsyEvent(Events.REPORT_DELETED.toString(), null, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1676,11 +1679,12 @@ public class Case implements SleuthkitCase.ErrorObserver {
|
|||||||
* Gets the full path to the case metadata file for this case.
|
* Gets the full path to the case metadata file for this case.
|
||||||
*
|
*
|
||||||
* @return configFilePath The case metadata file path.
|
* @return configFilePath The case metadata file path.
|
||||||
|
*
|
||||||
* @deprecated Use getCaseMetadata and CaseMetadata.getFilePath instead.
|
* @deprecated Use getCaseMetadata and CaseMetadata.getFilePath instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
String getConfigFilePath() {
|
String getConfigFilePath() {
|
||||||
return getCaseMetadata().getFilePath().toString();
|
return getCaseMetadata().getFilePath().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user