Trick if you are using IDA in a virtual machine

I use IDA Pro in a virtual machine and I use a little trick to update plugins without messing with the guest machine:

  1. I mount a directory inside the virtual machine as read-only from the host. I call this
    Z:\readonly
  2. In the guest, I set the environment variable %PYTHONPATH% to include his Z:\readonly directory.
  3. In the plugin directory (found by ida_diskio.get_ida_subdirs("plugins")[0]) I put a placeholder file that has the following content:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

''' Put this file in the IDA/plugins folder and the plugin file somewhere that IDA can reach it. '''

import os
exec(f"from {os.path.basename(__file__).replace('_ida.py','')} import *")
  1. From the host, I place the real file in the readonly directory with the same name except I removed the “_ida” part
  2. This way, I can update the files that are in the readonly directory from the host machine and still revert the guest machine.

Hope this trick helps someone else! Happy reversing!

Thanks for sharing the setup @Harding :clap:
I bet others find it useful!