Determine Version of Autopsy in a Python Plugin

If you ever need to determine the version of Autopsy that you are using here is some code that you can use to get the version numbers. You may want to do this to support different versions of Autopsy with your code:

In your import section include the following import:

    from org.sleuthkit.autopsy.coreutils import Version**

In your process method include the following code:

    currentVersion = Version.getVersion();
    (majorVersion, minorVersion, dotReleaseVersion) = currentVersion.split(".")
    autopsyVersion = float(majorVersion + "." + minorVersion)
    
    self.log(Level.INFO, "Version of Autopsy is ==> " + currentVersion)
    self.log(Level.INFO, "Major Version ==> " + majorVersion)
    self.log(Level.INFO, "Minor Version ==> " + minorVersion)
    self.log(Level.INFO, "Dot Release Version ==> " + dotReleaseVersion)
    
    if (autopsyVersion >= 4.12):
        self.log(Level.INFO, " This version is equal or greator then 4.12")
    else:
        self.Log(Level.INFO, " Less then 4.12")

The self.log statements are there so you can see what the different pieces look like, they can be removed if you do not want them.

Thanks heaps for this post, saved me heaps of time!!