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

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

Open
timbolle-unil opened this issue Mar 24, 2020 · 0 comments

Comments

@timbolle-unil
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant