예제 #1
0
파일: aff4.py 프로젝트: yazici/pyaff4
def verify(file):
    volume = container.Container.openURNtoContainer(rdfvalue.URN.FromFileName(file))
    printVolumeInfo(file, volume)
    printCaseInfo(volume)
    resolver = volume.resolver

    if type(volume) == container.PhysicalImageContainer:
        image = volume.image
        listener = VerificationListener()
        validator = block_hasher.Validator(listener)
        print("Verifying AFF4 File: %s" % file)
        validator.validateContainer(rdfvalue.URN.FromFileName(file))
        for result in listener.results:
            print("\t%s" % result)
    elif type(volume) == container.LogicalImageContainer:
        #print ("\tLogical Images:")
        hasher = linear_hasher.LinearHasher2(resolver, LinearVerificationListener())
        for image in volume.images():
            print ("\t%s <%s>" % (image.name(), trimVolume(volume.urn, image.urn)))
            hasher.hash(image)
예제 #2
0
파일: aff4.py 프로젝트: ydkhatri/pyaff4
def verify(file, password):
    with container.Container.openURNtoContainer(
            rdfvalue.URN.FromFileName(file)) as volume:
        if password != None:
            assert not issubclass(volume.__class__,
                                  container.PhysicalImageContainer)
            volume.setPassword(password[0])
            childVolume = volume.getChildContainer()
            printVolumeInfo(file, childVolume)
            printCaseInfo(childVolume)
            resolver = childVolume.resolver
            hasher = linear_hasher.LinearHasher2(resolver,
                                                 LinearVerificationListener())
            for image in childVolume.images():
                print("\t%s <%s>" %
                      (image.name(), trimVolume(childVolume.urn, image.urn)))
                hasher.hash(image)
        else:
            printVolumeInfo(file, volume)
            printCaseInfo(volume)
            resolver = volume.resolver

            if type(volume) == container.PhysicalImageContainer:
                image = volume.image
                listener = VerificationListener()
                validator = block_hasher.Validator(listener)
                print("Verifying AFF4 File: %s" % file)
                validator.validateContainer(rdfvalue.URN.FromFileName(file))
                for result in listener.results:
                    print("\t%s" % result)
            elif type(volume) == container.LogicalImageContainer:
                #print ("\tLogical Images:")
                hasher = linear_hasher.LinearHasher2(
                    resolver, LinearVerificationListener())
                for image in volume.images():
                    print("\t%s <%s>" %
                          (image.name(), trimVolume(volume.urn, image.urn)))
                    hasher.hash(image)
예제 #3
0
 def testBlockHashPreStdPartialAllocatedImage(self):
     validator = block_hasher.Validator()
     validator.validateContainer(self.preStdAllocatedURN)
예제 #4
0
 def testBlockHashPreStdLinearImage(self):
     validator = block_hasher.Validator()
     validator.validateContainer(self.preStdLinearURN)
예제 #5
0
 def testBlockHashStdLinearAllHashesImage(self):
     validator = block_hasher.Validator()
     validator.validateContainer(self.stdLinearAllHashesURN)
예제 #6
0
 def testBlockHashStdContainerPartialAllocated(self):
     validator = block_hasher.Validator()
     validator.validateContainer(self.stdAllocatedURN)
예제 #7
0
 def testBlockHashStdLinearStriped(self):
     validator = block_hasher.Validator()
     validator.validateContainerMultiPart(self.stripedLinearBURN,
                                          self.stripedLinearAURN)
예제 #8
0
 def testBlockHashStdLinearReadError(self):
     validator = block_hasher.Validator()
     validator.validateContainer(self.stdLinearReadErrorURN)