ntfsvol.py 1.12 KB
from modulevar import Modulevar
from dialog import Dialog
from runcmd import runProcess

def getInstance(modname):
    return NTFSVol(modname)

class NTFSVol(Modulevar):

    def __init__(self,modname):
        self.name = "ntfsvol"
        self.parentModule = modname
        self.description = "NTFS Volume"
        self.value = None

    def getNTFSVolumes(self):
        result = runProcess("scripts/list_ntfs.sh")
        volumes = result[0].decode("utf-8").splitlines()
        print(volumes)
        choices = []
        for vol in volumes:
            choices.append((vol,"",False))
        return choices

    def query(self):
        d = Dialog(dialog="dialog", autowidgetsize=True)
        d.set_background_title("[" + self.parentModule + "] Setting variable: ntfsvol")
        volumeList = self.getNTFSVolumes()
        code, vols = d.checklist("Select NTFS volumes to extract the MFT",
                                 choices=volumeList,
                                 title="Module selection")
        if code == d.OK:
            self.value = vols
        else:
            raise Exception("[" + self.name + "] Operation Cancelled")