diff --git a/.gitignore b/.gitignore index 76b1aff..ffb5c43 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ *.egg-info/ dist/ /.idea/ +/build/ *~ \ No newline at end of file diff --git a/aff4.py b/aff4.py index 1ce9b31..4f6385b 100644 --- a/aff4.py +++ b/aff4.py @@ -292,7 +292,7 @@ def extractAll(container_name, destFolder): urn = None with container.Container.openURNtoContainer(container_urn) as volume: - printVolumeInfo(file, volume) + printVolumeInfo(container_urn.original_filename, volume) resolver = volume.resolver for imageUrn in resolver.QueryPredicateObject(volume.urn, lexicon.AFF4_TYPE, lexicon.standard11.FileImage): imageUrn = utils.SmartUnicode(imageUrn) @@ -328,7 +328,7 @@ def extract(container_name, imageURNs, destFolder): urn = None with container.Container.openURNtoContainer(container_urn) as volume: - printVolumeInfo(file, volume) + printVolumeInfo(container_urn.original_filename, volume) resolver = volume.resolver for imageUrn in imageURNs: imageUrn = utils.SmartUnicode(imageUrn) @@ -347,7 +347,7 @@ def extract(container_name, imageURNs, destFolder): except OSError as exc: # Guard against race condition if exc.errno != errno.EEXIST: raise - with open(destFile, "w") as destStream: + with open(destFile, "wb") as destStream: shutil.copyfileobj(srcStream, destStream, length=32*2014) print ("\tExtracted %s to %s" % (pathName, destFile)) else: diff --git a/pyaff4/container.py b/pyaff4/container.py index f872a38..ee8092a 100644 --- a/pyaff4/container.py +++ b/pyaff4/container.py @@ -262,7 +262,7 @@ def images(self): def open(self, urn): pathName = next(self.resolver.QuerySubjectPredicate(self.urn, urn, lexicon.standard11.pathName)) - return aff4.LogicalImage(self.resolver, self.urn, urn, pathName) + return aff4.LogicalImage(self, self.resolver, self.urn, urn, pathName) def __exit__(self, exc_type, exc_value, traceback): # Return ourselves to the resolver cache. @@ -277,11 +277,11 @@ def images(self): _images = self.resolver.QueryPredicateObject(self.urn, lexicon.AFF4_TYPE, lexicon.standard.Image) for image in _images: pathName = next(self.resolver.QuerySubjectPredicate(self.urn, image, self.lexicon.pathName)) - yield aff4.LogicalImage(self.resolver, self.urn, image, pathName) + yield aff4.LogicalImage(self, self.resolver, self.urn, image, pathName) def open(self, urn): pathName = next(self.resolver.QuerySubjectPredicate(self.urn, urn, self.lexicon.pathName)) - return aff4.LogicalImage(self.resolver, self.urn, urn, pathName) + return aff4.LogicalImage(self, self.resolver, self.urn, urn, pathName) def __exit__(self, exc_type, exc_value, traceback): # Return ourselves to the resolver cache.