Skip to content

Commit

Permalink
Linux - update recover_filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
atcuno committed May 27, 2014
1 parent b6f569a commit 7d8f349
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions volatility/plugins/linux/recover_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ def _write_file(self, ff, file_path, file_dentry):
ents = file_path.split("/")
out_path = os.path.join(self._config.DUMP_DIR, *ents)

contents = ff.get_file_contents(inode)
try:
fd = open(out_path, "wb")
except IOError, e:
debug.warning("Unable to process file: %s : %s" % (out_path, str(e)))
return

for page in ff.get_file_contents(inode):
fd.write(page)

fd = open(out_path, "wb")
fd.write(contents)
fd.close()

def _make_path(self, file_path, file_dentry):
inode = file_dentry.d_inode

Expand Down Expand Up @@ -95,9 +100,9 @@ def calculate(self):

num_files = num_files + 1

yield num_files, 0, 0
yield num_files

def render_text(self, outfd, data):
for (num_files, real_bytes, total_bytes) in data:
outfd.write("Recovered %d bytes of %d bytes in %d files\n" % (real_bytes, total_bytes, num_files))
for (num_files) in data:
outfd.write("Recovered %d files\n" % num_files)

0 comments on commit 7d8f349

Please sign in to comment.