allfro / canari

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

Clarification on how to use canari create-profile on windows? #21

Closed Ezekiel-Kruglick closed 10 years ago

Ezekiel-Kruglick commented 10 years ago

I have Canari installed and all appears well (2 computers tried, one windows 7, one win 8.1, both 64 bit, running python 32-bit 2.7 recent)

create-package creates a file/dir tree including templates and create-transform also works to make a template file. Any use of canari create-profile on either computer generates:

Looking for transforms in test.transforms
Does not appear to be a valid canari package. Couldn't import the 'test.transfor
ms' package in 'test'. Error message: No module named transforms

Even if I use "canari create-package test" and then immediately run "canari create-profile test" from the same directory canari gives this error so even the canari generated example is being seen as not a valid canari package.

I'm wondering if there is some particular detail on how to use canari create-profile that one should know. Does it need to be run in a particular subdirectory for example?

Update: I checked the source and tried create-profile from the "src" subdirectory of the created package and it generates a profile, but running the transforms from that imported profile in Maltego fails with a traceback on run_transform line 73, to line 192 of common.py with ImportError:No module named transforms.helloworld

So one can trick it into generating a profile with a change to src directory to avoid the import error at profile creation but that just results in the import error at execution time.

allfro commented 10 years ago

Hi @darkgreen,

Hope you had a good holiday season and a happy new year. The best thing you can do right now is just install the package into your python site packages directory first and then run create-profile. I'm working on a few updates to Canari as we speak to fix a couple of the issues you're running into right now. In order to install it, just run python setup.py install and then you can run the canari create-profile command and everything will work properly. In your case, canari create-profile was failing because canari commander is trying to import the package in order to inspect it and create all the necessary links. It will try to import the package from your local directory first and then from the python site-package directory. If you were at the root of your project (not in src/) then this would have failed since there is no test directory anywhere in site that contains python modules. That's why when you entered your src/ directory, create-profile worked.

The second issue you ran into was caused by a bug in canari. By default the working directory for Maltego transforms is set to %APPDATA%/.canari. When the transform was being invoked by Maltego, Maltego switches to that directory and attempts to execute the transform. Since you transform package was not at that directory either, canari will fail to import the package and execute the transform. Hope that helps!

Cheers,

Nadeem

Ezekiel-Kruglick commented 10 years ago

Hi Nadeem, thanks for your response. I'm very impressed by the framework you've created and your continuing dedication to it!

I was surprised to hear this diagnosed as an install issue as I had used pip to install it and all seemed to go well - it already appeared to be in my site-packages. I went ahead and grabbed the github repo and used your manual install as described, there were no errors and the install appeared to succeed with all dependencies as well.

The problem with "canari create-profile test" remains unaffected by reinstallations. I repeated all steps as originally described with identical results.

Please note that I cannot tell from your directory discussion which one you actually consider to be the right one so that is still undefined. Are you saying "run it from the src directory and it will work once I fix a few bugs" ? That is one possible interpretation I can see.

Thanks again for your time, my apologies if I'm not "getting it"!

allfro commented 10 years ago

Hi @darkgreen

Thanks for the kind words. I'd be glad to clarify. What I meant was that you need to install your transform package into your python site-package directory (i.e. create transform-package foo & cd foo & python setup.py install & canari create-profile foo. This will fix your create-profile and transform execution issues for now :). The working directory issue (second issue) is a bug that will be fixed in the next version of Canari. Hope that helps!

Cheers,

Nadeem

Ezekiel-Kruglick commented 10 years ago

Aha! Thank you! I see now. Slight gap in my understanding that you meant the canari package and not the python package that delivers canari... yikes. It would never have occurred to me to install the maltego tranform package to my python site-packages directory. Now that I did so as you described the test transform imports and works fine, thank you!

I'm impressed that it works at all before the updates you're working on given Maltego changed the imports on you in 3.4, this is quite nice work, kudos sir.

Thank you again! As I learn canari better and come up to speed perhaps I can even help out, I have quite the "to-do" list for Maltego transforms and entities.

ADDED: I also note that now that the install problem is diagnosed, it is almost the same as the immediately previous closed issue, too bad I didn't recognize that issue as related to my install issue!

Ezekiel-Kruglick commented 10 years ago

Hi allfro-

I just wanted to let you know that I was able to get canari working great, you've done a real bang-up job here! I was able to export custom entities and build transforms that generated some really useful data.

Unfortunately I hadn't realized Maltego CE would limit even my custom-written transforms to 12 returned entities (for some reason I thought that was throttled by the transform server). I can't really justify $760 to my wife for what is essentially my crazy data analytics hobby :( I've done work with networkx and mayavi before and may try a custom viewer or maybe gephi.

Your software works great and I just regret I won't get to contribute code.

Cheers.

allfro commented 10 years ago

Hi @darkgreen,

Thanks for the compliments and I'm very sad that it's come to this :(. Have you tried talking to the folks at Paterva regarding your project? They might be willing to give you a development license discount or something... Or maybe even an evaluation. Why don't you show'em what you've done so far. If you release a video it might catch their attention.

Ezekiel-Kruglick commented 10 years ago

That sounds like a very neat idea and hadn't occurred to me. I can probably put together a sizable package showing the things my tools can pull down. Ideally I'd like to say "hi" before dumping tens of megabytes into someone's mailbox, is there someone in particular you would recommend I talk to?

allfro commented 10 years ago

Hi @darkgreen,

Add me on Skype: nadeem.douba