def test_carved_padding_file_has_correct_labels(self): self._create_padding_file_in_directory() fileresult = self._create_fileresult_for_file(self.padding_file, self.parent_dir, []) scanjob = ScanJob(fileresult) scanjob.set_scanenvironment(self.scan_environment) unpacker = Unpacker() scanjob.prepare_for_unpacking() scanjob.check_unscannable_file() unpacker.append_unpacked_range(0, 5) # bytes [0:5) are unpacked scanjob.carve_file_data(unpacker) j = self.scanfile_queue.get() self.assertSetEqual(j.fileresult.labels, set(['padding', 'synthesized']))
def test_carved_padding_file_has_correct_labels(scan_environment): padding_file = _create_padding_file_in_unpack_directory(scan_environment) fileresult = FileResult(None, scan_environment.unpackdirectory / padding_file, set()) fileresult.set_filesize( (scan_environment.unpackdirectory / padding_file).stat().st_size) scanjob = ScanJob(fileresult) scanjob.set_scanenvironment(scan_environment) scanjob.initialize() unpacker = UnpackManager(scan_environment.unpackdirectory) scanjob.prepare_for_unpacking() scanjob.check_unscannable_file() unpacker.append_unpacked_range(0, 5) # bytes [0:5) are unpacked scanjob.carve_file_data(unpacker) j = scan_environment.scanfilequeue.get() assert j.fileresult.labels == set(['padding', 'synthesized'])