allfro / canari

Local and Remote Maltego Rapid Transform Development Framework
http://www.canariproject.com
102 stars 27 forks source link

create-entities - Error - "Maltego v3.4.0CE" #24

Closed cmlh closed 10 years ago

cmlh commented 10 years ago

I'll send a pull request for https://github.com/allfro/canari/blob/master/src/canari/commands/generate_entities.py#L163 RSN

I executed "create-entities" (with no arguments) against "Maltego v1.0.1CaseFileCE" and "Maltego v3.4.0CE".

"Maltego v3.4.0CE" triggered the following error on Mac OSX:

Traceback (most recent call last):
  File "/usr/local/bin/canari", line 5, in <module>
    pkg_resources.run_script('canari==0.7', 'canari')
  File "build/bdist.macosx-10.6-universal/egg/pkg_resources.py", line 488, in run_script
    """List all distributions needed to (recursively) meet `requirements`
  File "build/bdist.macosx-10.6-universal/egg/pkg_resources.py", line 1338, in run_script
    utime(tmpnam, (timestamp,timestamp))
  File "/Library/Python/2.6/site-packages/canari-0.7-py2.6.egg/EGG-INFO/scripts/canari", line 45, in <module>
    main()
  File "/Library/Python/2.6/site-packages/canari-0.7-py2.6.egg/EGG-INFO/scripts/canari", line 40, in main
    cmds[args[0].command].run(args[1])
  File "/Library/Python/2.6/site-packages/canari-0.7-py2.6.egg/canari/commands/generate_entities.py", line 191, in run
    xml = XML(ar.open(e).read())
  File "<string>", line 85, in XML
SyntaxError: not well-formed (invalid token): line 1, column 1

No error occurred when "Maltego v1.0.1CaseFileCE" was selected and the subsequently generated /[myPackage]/src/[myPackage]/transforms/common/entities.py is also correct.

allfro commented 10 years ago

Hi @cmlh,

This is due to the fact that in v3.4.0 of Maltego all configuration files (including entity definition files) are encrypted. This would explain the problem you are having with generate-entities. What I suggest doing for v3.4.0 and above is export your entities to an mtz and generate-entities against it like so:

shell:mypkgdir$ canari generate-entities -m entities.mtz

Hope that helps.

cmlh commented 10 years ago

@allfro,

The fix I proposed was to modify https://github.com/allfro/canari/blob/master/src/canari/commands/generate_entities.py#L163 but I will need to refresh my memory if this is correct since this was sometime ago.