Skip to content

Commit

Permalink
ℹ️
Browse files Browse the repository at this point in the history
ℹ️ fix for windows permissions issues in forensics
  • Loading branch information
securisecctf committed Nov 30, 2019
1 parent 92005ce commit 340e29b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions chepy/modules/forensics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import logging
import pathlib
import shutil
import tempfile
import pprint

Expand Down Expand Up @@ -53,7 +54,8 @@ def get_mime(self, set_state: bool = False):
logging.info(mimetype)
if set_state:
self.state = mimetype
pathlib.Path(filename).unlink()
parser.close()
shutil.rmtree(filename)
return self

@ChepyDecorators.call_stack
Expand All @@ -80,7 +82,7 @@ def get_metadata(self, set_state: bool = False):
self.state = meta
else: # pragma: no cover
logging.info(pprint.pformat(meta))
pathlib.Path(filename).unlink()
shutil.rmtree(filename)
return self

@ChepyDecorators.call_stack
Expand All @@ -102,7 +104,7 @@ def embedded_files(self, extract_path: str = None):
subfile.setOutput(extract_path)
subfile.loadParsers()
subfile.main()
pathlib.Path(filename).unlink()
shutil.rmtree(filename)
return self

@ChepyDecorators.call_stack
Expand All @@ -117,5 +119,5 @@ def get_exif(self): # pragma: no cover
exif = et.get_metadata(filename)
if exif:
self.state = exif
pathlib.Path(filename).unlink()
shutil.rmtree(filename)
return self

0 comments on commit 340e29b

Please sign in to comment.