Skip to content

Possible bug using the aff4.py basic script in a Windows environnement #19

@timbolle-unil

Description

@timbolle-unil

Hello,

I tried to create an aff4 container using the following command:
python aff4.py -c container.aff4 source_file
I had the following error:

Creating AFF4Container: file://container.aff4 <aff4://64ec2613-a8cf-4c52-8866-f8d1570f8634>
        Adding: source_file
Traceback (most recent call last):
  File "pyaff4\aff4.py", line 496, in <module>
    main(sys.argv)
  File "pyaff4\aff4.py", line 474, in main
    addPathNames(dest, args.srcFiles, args.recursive, args.append, args.hash, args.password)
  File "pyaff4\aff4.py", line 319, in addPathNames
    addPathNamesToVolume(resolver, volume, pathnames, recursive, hashbased)
  File "pyaff4\aff4.py", line 296, in addPathNamesToVolume
    fsmeta.store(resolver)
  File "C:\Users\Tim\Documents\Projets\Test\AFF4\pyaff4\pyaff4\logical.py", line 130, in store
    resolver.Set(resolver.urn, self.urn, rdfvalue.URN(lexicon.AFF4_STREAM_SIZE), rdfvalue.XSDInteger(self.length))
AttributeError: 'MemoryDataStore' object has no attribute 'urn'

I'm running python27 on a Windows machine. I had the same issue with python37.

I fixed the problem by changing the following lines in pyaff4/logical.py (l.130 to 133):

class WindowsFSMetadata(FSMetadata):
...
    def store(self, resolver):
        resolver.Set(resolver.urn, self.urn, rdfvalue.URN(lexicon.AFF4_STREAM_SIZE), rdfvalue.XSDInteger(self.length))
        resolver.Set(resolver.urn, self.urn, rdfvalue.URN(lexicon.standard11.lastWritten), rdfvalue.XSDDateTime(self.lastWritten))
        resolver.Set(resolver.urn, self.urn, rdfvalue.URN(lexicon.standard11.lastAccessed), rdfvalue.XSDDateTime(self.lastAccessed))
        resolver.Set(resolver.urn, self.urn, rdfvalue.URN(lexicon.standard11.birthTime), rdfvalue.XSDDateTime(self.birthTime))

Changed to:

class WindowsFSMetadata(FSMetadata):
...
    def store(self, resolver):
        resolver.Set(self.urn, self.urn, rdfvalue.URN(lexicon.AFF4_STREAM_SIZE), rdfvalue.XSDInteger(self.length))
        resolver.Set(self.urn, self.urn, rdfvalue.URN(lexicon.standard11.lastWritten), rdfvalue.XSDDateTime(self.lastWritten))
        resolver.Set(self.urn, self.urn, rdfvalue.URN(lexicon.standard11.lastAccessed), rdfvalue.XSDDateTime(self.lastAccessed))
        resolver.Set(self.urn, self.urn, rdfvalue.URN(lexicon.standard11.birthTime), rdfvalue.XSDDateTime(self.birthTime))

I'm not very familiar with bug correction so let me know if you want me to send a pull request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions