Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #13

Merged
merged 4 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
*.egg-info/
dist/
/.idea/
/build/

*~
6 changes: 3 additions & 3 deletions aff4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions pyaff4/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down