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?

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)

  • Exactly that's the workaround I have taken. – Holmes.Sherlock Jan 17 '17 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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