canari
canari copied to clipboard
generate-entities failing with multiple properties
Not sure why this error is happening, but figure I'd check in before doing a deeper dive. Noticed that when multiple properties are added, data-type agnostic, error occurs. However, does not occur when default properties exist. Haven't been able to spot an immediate discrepancy between the XML entities in both scenarios, but the issue seems XML parsing related.
Your running Canari Framework v1.1 Maltego Carbon
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/canari", line 5, in <module>
pkg_resources.run_script('canari==1.1', 'canari')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 467, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 1200, in run_script
execfile(script_filename, namespace, namespace)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/canari-1.1-py2.7.egg/EGG-INFO/scripts/canari", line 20, in <module>
canari_main()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/canari-1.1-py2.7.egg/canari/commands/framework.py", line 33, in _func
return func(self.parser.parse_args(args_, namespace))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/canari-1.1-py2.7.egg/canari/commands/common.py", line 67, in canari_main
opts.command_function(opts)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/canari-1.1-py2.7.egg/canari/commands/generate_entities.py", line 181, in generate_entities
distribution.read_file(entity_file)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/__init__.py", line 314, in parse
self._parse_children_unordered(node, self._fields, fields_found)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/__init__.py", line 366, in _parse_children_unordered
res = field.parse_child_node(self, child)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/fields.py", line 476, in parse_child_node
inst = typeclass.parse(node)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/__init__.py", line 314, in parse
self._parse_children_unordered(node, self._fields, fields_found)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/__init__.py", line 379, in _parse_children_unordered
self._parse_children_unordered(child, [field], fields_found)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/__init__.py", line 366, in _parse_children_unordered
res = field.parse_child_node(self, child)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/fields.py", line 747, in parse_child_node
res = self.field.parse_child_node(tmpobj, node)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/fields.py", line 476, in parse_child_node
inst = typeclass.parse(node)
File "/Library/Python/2.7/site-packages/safedexml-0.5.1-py2.7.egg/safedexml/__init__.py", line 319, in parse
raise ParseError(err)
safedexml.ParseError: required field not found: 'displayname'
Think I might have an interim fix. Looking at the prototype for the safedexml object for interpreted fields I noticed that the displayname attribute was more or less required, hence why the error was encountered since at least in my iteration of Maltego Carbon (not sure if Chlorine adds in property display names) does not include the display name in the corresponding schema.
So was able to generate a successful entity definition file by changing (https://github.com/allfro/canari/blob/master/src/canari/maltego/configuration.py#L386) to:
displayname = fields_.String(attrname='displayName', required=False)
Not sure what the implications of this would be across the board, but is probably how to handle this error if anyone else comes across it.