1

I have an IDAPython script written for a specific analysis. Also, I am using another in-house tool for the same analysis that, too, exposes Python API. My intention is to augment the script such that when it is run within IDA, it'll run IDA specific methods and when it is run outside IDA, it has to call the method specific to the in-house tool. Does IDAPython provide any special environment variable to detect if a Python script is running inside IDA environment?

1 Answer 1

5

I don't think there is directly, but there is a trick I've seen a few times (works with any dependency):

try:
    import idc
    print 'ida'
except Exception as e:
    print 'no ida'

You may set a special variable instead of the print statements.

Disclamer:

Requires that your systems python and IDAs python are actually separate (the default case)

1
  • Exactly that's the workaround I have taken.
    – sherlock
    Jan 17, 2017 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.