mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
delete the report file if ingestprocesscancelled in runexe.py
This commit is contained in:
parent
0cc0e29ba9
commit
6f280309ac
@ -136,8 +136,10 @@ class RunExeIngestModule(DataSourceIngestModule):
|
|||||||
# We'll save our output to a file in the reports folder, named based on EXE and data source ID
|
# We'll save our output to a file in the reports folder, named based on EXE and data source ID
|
||||||
reportFile = File(Case.getCurrentCase().getCaseDirectory() + "\\Reports" + "\\img_stat-" + str(dataSource.getId()) + ".txt")
|
reportFile = File(Case.getCurrentCase().getCaseDirectory() + "\\Reports" + "\\img_stat-" + str(dataSource.getId()) + ".txt")
|
||||||
# Run the EXE, saving output to the report
|
# Run the EXE, saving output to the report
|
||||||
# NOTE: we should really be checking for if the module has been
|
# Check if the ingest is terminated and delete the incomplete report file
|
||||||
# cancelled and then killing the process.
|
# Do not add report to the case tree if the ingest is cancelled before finish.
|
||||||
|
# This can be done by using IngestJobContext.dataSourceIngestIsCancelled
|
||||||
|
# See: http://sleuthkit.org/autopsy/docs/api-docs/4.7.0/_ingest_job_context_8java.html
|
||||||
self.log(Level.INFO, "Running program on data source")
|
self.log(Level.INFO, "Running program on data source")
|
||||||
cmd = ArrayList()
|
cmd = ArrayList()
|
||||||
cmd.add(self.pathToEXE.toString())
|
cmd.add(self.pathToEXE.toString())
|
||||||
@ -150,5 +152,9 @@ class RunExeIngestModule(DataSourceIngestModule):
|
|||||||
# Add the report to the case, so it shows up in the tree
|
# Add the report to the case, so it shows up in the tree
|
||||||
if not self.context.dataSourceIngestIsCancelled():
|
if not self.context.dataSourceIngestIsCancelled():
|
||||||
Case.getCurrentCase().addReport(reportFile.toString(), "Run EXE", "img_stat output")
|
Case.getCurrentCase().addReport(reportFile.toString(), "Run EXE", "img_stat output")
|
||||||
|
else:
|
||||||
|
if reportFile.exists():
|
||||||
|
if not reportFile.delete():
|
||||||
|
self.log(LEVEL.warning,"Error deleting the incomplete report file")
|
||||||
|
|
||||||
return IngestModule.ProcessResult.OK
|
return IngestModule.ProcessResult.OK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user