opendxl / opendxl-tie-client-python

McAfee Threat Intelligence Exchange (TIE) client library for use with the OpenDXL Python Client
Apache License 2.0
15 stars 8 forks source link

[Question] Easy way to reverse-lookup constants #8

Open SHSauler opened 6 years ago

SHSauler commented 6 years ago

Hi, after querying TIE and receiving an answer, how do I translate the numeric values into useful strings to export to other tools?

In my current test, I'm extracting the constants from their classes and reversing them, which is not ideal.

fileprovider_ids = {}
for key, value in FileProvider.__dict__.items():
    if type(value) == int:
        fileprovider_ids[value] = key

Is there a function I'm overlooking? Thanks a bunch!

jbarlow-mcafee commented 6 years ago

Hi @SHSauler. I don't think we really have a better approach for doing this currently than the one you are doing. I'll flag this with an Enhancement label so that we can look at some point into the possibility of providing a more straightforward API for doing this.