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

Missing maec.utils.idgen module #74

Closed
abulhol opened this issue Oct 30, 2015 · 11 comments
Closed

Missing maec.utils.idgen module #74

abulhol opened this issue Oct 30, 2015 · 11 comments

Comments

@abulhol
Copy link

abulhol commented Oct 30, 2015

I have just started working python-maec, installed the required dependencies and tried out the examples, but some classes and methods are missing.
In particular, the idgen module is missing (see http://maec.readthedocs.org/en/stable/api/utils/idgen.html), and I cannot find the functions set_id_namespace and set_id_method
(see example from manual here: http://maec.readthedocs.org/en/stable/examples.html)
Where have they gone?

@abulhol abulhol changed the title Missing from maec.utils.idgen module Missing maec.utils.idgen module Oct 30, 2015
@ikiril01
Copy link
Member

Hi @abulhol, these modules have all been moved to the mixbox library. Python-maec is still in the process of being updated to use mixbox, so I'd recommend using the latest official release, 4.1.0.12.

@abulhol
Copy link
Author

abulhol commented Oct 30, 2015

Thanks for the fast reply. I found the module in mixbox, but of course it is a bit difficult to follow the manual this way. I got the example working like this (have to improve on my Python skills and how to write the import statements properly...)

from maec.package import Package, MalwareSubject
import mixbox

mixbox.idgen.set_id_method(mixbox.idgen.IDGenerator.METHOD_INT)
p = Package()
ms = MalwareSubject()
p.add_malware_subject(ms)

print p.to_xml(include_namespaces=False)

@abulhol abulhol closed this as completed Oct 30, 2015
@ikiril01
Copy link
Member

Glad you got it working! We'll have to update the documentation to take into account the mixbox-related changes :)

@bworrell
Copy link
Contributor

Posting a comment here because it's super related to an issue I posted in python-stix yesterday: STIXProject/python-stix#280 :D

I agree with everything @ikiril01 said and generally speaking, sticking to the official releases on PyPI is a safer bet than writing code against the latest commit on master, especially right now since we are in a heavy development cycle right now.

Thanks for posting the issue and glad to see you got things working! We're cranking away at all this stuff so it should hopefully stabilize a lot more in the near future!

@abulhol abulhol reopened this Nov 12, 2015
@abulhol
Copy link
Author

abulhol commented Nov 12, 2015

Hi guys,
I wrote a converter based using python-maec and am now testing it on Ubuntu.
I installed maec using pip
pip install maec
which installed version 2.1.0.13.dev2 (and also cybox as a dependency)
However, my converter failed because it could not find maec.utils.idgen
I then ran
pip install maec==2.1.0.12
but I still had problems because some classes from cybox could not be found, so I then uninstalled everything again and explicitly ran

pip install cybox==4.1.0.12
pip install maec==2.1.0.12

With this, my converter finds all imports, but I wonder why pip doesn't automatically give me the latest official release?

@ikiril01
Copy link
Member

Hi @abulhol, thanks for reporting this. I thought that the 'dev' releases were hidden so they shouldn't be installed with pip install maec, but looks like we need to double-check on this.

@abulhol
Copy link
Author

abulhol commented Nov 12, 2015

PyPI is messed up a bit at the moment anyway, if you look for maec or cybox using the "search" box, it won't find them. This has something to do with the indexing and has been reported by many users in their issue tracker.

@gtback
Copy link
Contributor

gtback commented Nov 13, 2015

@abulhol: What version of pip? I seem to remember that some versions of pip installed "pre-release" versions (like 2.1.0.13.dev2) of packages by default, but that's no longer the case.

@ikiril01: I'm not sure if "hiding" a package on PyPI actually keeps pip from downloading them. I know you can explicitly request an old version (like maec=4.1.0.0), and I'm pretty sure "hiding" only affects the web interface. Try pip install maec==99999 to see the versions available.

@abulhol
Copy link
Author

abulhol commented Nov 15, 2015

@gtback: On Ubuntu, I use python-pip 1.0-1build1 (with Python 2.7) I have not changed any settings for pip, so it seems to be the default behavior.

@gtback
Copy link
Contributor

gtback commented Nov 16, 2015

That version of pip is pretty old (the latest is 7.1.2, but Ubuntu typically lags behind that quite a bit). That explains why pip install maec gave you the development version. Older versions of pip didn't distinguish and would always install the newest, development or not.

While the mixbox refactor is ongoing, you'll need to explicitly install the specific versions of cybox (4.1.0.12) and maec (2.1.0.12) like you did above, or upgrade to a newer version of pip.

@abulhol
Copy link
Author

abulhol commented Nov 18, 2015

Thanks for looking into this!

@abulhol abulhol closed this as completed Nov 18, 2015
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

4 participants