Blame view

vars/ntfsvol.py 1.12 KB
1
from modulevar import Modulevar
2
3
from dialog import Dialog
from runcmd import runProcess
4
5
6
def getInstance(modname):
    return NTFSVol(modname)
7
8
9

class NTFSVol(Modulevar):
10
    def __init__(self,modname):
11
        self.name = "ntfsvol"
12
        self.parentModule = modname
13
14
15
        self.description = "NTFS Volume"
        self.value = None
16
17
18
19
20
21
22
23
24
    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
25
    def query(self):
26
27
28
29
30
31
32
33
34
35
        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")