From 91012909d970b010e71340df0f18c90ecaade8d6 Mon Sep 17 00:00:00 2001 From: matamgo Date: Wed, 14 Aug 2019 10:59:04 +0100 Subject: [PATCH 1/4] Added /build/ directory to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From 809613a121b14c40a1578da0b5d8a24c54419409 Mon Sep 17 00:00:00 2001 From: matamgo Date: Wed, 14 Aug 2019 10:59:58 +0100 Subject: [PATCH 2/4] Fixed bug initialising aff4.LogicalImage instances --- pyaff4/container.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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. From fbf246ccc3e7c54c0e22fe53ed9228d87d278e6c Mon Sep 17 00:00:00 2001 From: matamgo Date: Wed, 14 Aug 2019 13:49:50 +0100 Subject: [PATCH 3/4] fixed bugs in extract() --- aff4.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aff4.py b/aff4.py index 1ce9b31..331f961 100644 --- a/aff4.py +++ b/aff4.py @@ -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: From 7e5de2eddecaed444d74658b3b86ec06b8733151 Mon Sep 17 00:00:00 2001 From: matamgo Date: Wed, 28 Aug 2019 09:55:28 +0100 Subject: [PATCH 4/4] fixed aff4.extractAll() NameError exeption --- aff4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aff4.py b/aff4.py index 331f961..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)