Exemple #1
0
 def mount_storage_devs(self):
     mountpath = os.path.dirname(
         os.path.realpath(__file__))[:-2] + ".mount/{}"
     mountcmd = commands['mount']
     checkcmd = commands['mount_check']
     for dev in self.allowed_devs:
         output = cmdexec(checkcmd.format(dev), nullable=True)
         if dev in output:
             continue
         if not os.path.exists(mountpath.format(dev)):
             os.makedirs(mountpath.format(dev))
         cmdexec(mountcmd.format(dev, mountpath.format(dev)))
Exemple #2
0
    def find_files(self, device):
        xmlfile = "prifiwalk/.temp/{}.xml".format(device)
        command = commands['fiwalk']
        cmdexec(command.format(xmlfile, device))
        self.temp_files = fiwalk_xml(xmlfile)
        self.temp_files = clean_file_names(self.temp_files)
        self.clear_temp_folder()

        if self.storage.system.mode == 'full':
            self.create_files()
            self.find_hardlinks()
        elif self.storage.system.mode == 'half':
            pass
Exemple #3
0
    def get_allowed_devs(self):
        all_devs = []
        command = commands['lsblk_small']

        output = cmdexec(command)
        output = output.split('\n')
        for dev in output:
            all_devs.append(dev.split(' '))

        if config.ignore_own_dev:
            own_dev = self.get_own_device()
            return self.filter_devs(all_devs, own_dev)
        else:
            return self.filter_devs(all_devs)
Exemple #4
0
 def get_blocksize(self, dev):
     command = commands['blocksize']
     output = cmdexec(command.format(dev))
     return output
Exemple #5
0
 def get_own_device(self):
     command = commands['owndev']
     path = os.getcwd()
     output = cmdexec(command.format(path + '/' + __file__))
     dev = output.split('/')[-1]
     return dev
Exemple #6
0
 def get_dev_hardware_id(self, dev):
     command = commands['serial']
     output = cmdexec(command.format(dev))
     return output
Exemple #7
0
 def get_dev_model(self, dev):
     command = commands['model']
     output = cmdexec(command.format(dev))
     return output
Exemple #8
0
 def get_dev_size(self, dev):
     command = commands['devsize']
     output = cmdexec(command.format(dev))
     return output
Exemple #9
0
 def get_dev_meta(self):
     command = commands['lsblk_big']
     output = cmdexec(command)
     devices = json.loads(output)
     return devices