google / grr

GRR Rapid Response: remote live forensics for incident response
https://grr-doc.readthedocs.io/
Apache License 2.0
4.77k stars 762 forks source link

DataServerMapping can not be initialized from <type 'str'> #467

Closed IntenseWiggling closed 7 years ago

IntenseWiggling commented 7 years ago

Attempting to use manager.py to manage the dataserver appears to fail with unpacking the "/manage" response.

Tweaked the script to show the value of res.dat prior to:

self.mapping = rdf_data_server.DataServerMapping(res.data)

# python lib/python2.7/site-packages/grr/server/data_server/manager.py --config install_data/etc/grr-server.yaml
[#] Value of res.data
"(?P<path>servers_map)")(?P<path>files/hash/generic/sha256/...).*"'(?P<path>files/hash/generic/sha1/...).*"&(?P<path>files/hash/generic/md5/...).*"%(?P<path>files/hash/pecoff/md5/...).*"&(?P<path>files/hash/pecoff/sha1/...).*"(?P<path>files/nsrl/...).*"(?P<path>W/[^/]+).*"(?P<path>CA/[^/]+).*"(?P<path>C\..{1,16}?)($|/.*)"(?P<path>hunts/[^/]+).*"(?P<path>blobs/[^/]+).*"(?P<path>[^/]+).grr-masterdb.hjl3.local
[#]
Traceback (most recent call last):
  File "lib/python2.7/site-packages/grr/server/data_server/manager.py", line 625, in <module>
    flags.StartMain(main)
  File "/usr/share/grr-server/local/lib/python2.7/site-packages/grr/lib/flags.py", line 112, in StartMain
    main([sys.argv[0]])
  File "lib/python2.7/site-packages/grr/server/data_server/manager.py", line 613, in main
    if not manager.Start():
  File "lib/python2.7/site-packages/grr/server/data_server/manager.py", line 50, in Start
    self._PeriodicThread()
  File "lib/python2.7/site-packages/grr/server/data_server/manager.py", line 68, in _PeriodicThread
    self.mapping = rdf_data_server.DataServerMapping(res.data)
  File "/usr/share/grr-server/local/lib/python2.7/site-packages/grr/lib/rdfvalues/structs.py", line 1581, in __init__
    (self.__class__.__name__, type(initializer)))
ValueError: DataServerMapping can not be initialized from <type 'str'>
destijl commented 7 years ago

Have you customized the Datastore.pathing at all? My guess is there's a problem with quoting.

IntenseWiggling commented 7 years ago

Thanks for following up.

Nope, no customization to Datastore.pathing. I encounter this after building straight from google/grr.git HEAD as well.

grrrrrrrrr commented 7 years ago

This is missing a .FromSerializedString(). Will send a patch soon.

IntenseWiggling commented 7 years ago

Yup that was it! Looks like this fixed similar issue. https://github.com/google/grr/commit/b735d9adbbbd3a75492b1b4fa07e5b224b20db04

IntenseWiggling commented 7 years ago

Closing with https://github.com/google/grr/pull/469 .

Thanks!