diff --git a/src/drive_handle.py b/src/drive_handle.py index 28e2672224d05d07b211596f0d3d2c662f03e924..3ba65a5c266066e1df64ea66031786f74d4511cc 100644 --- a/src/drive_handle.py +++ b/src/drive_handle.py @@ -157,7 +157,7 @@ class DriveHandle: progressbar = Spinner('[DriveHandle] Writing the pattern file') with open(path, "wb") as file_descriptor: while os.path.getsize(path) + cluster_size < self.get_free_drive_space(): - current_pattern_symbol : chr = chr(ord(pattern_start_symbol) + iteration) + current_pattern_symbol: chr = chr(ord(pattern_start_symbol) + iteration) file_descriptor.write(current_pattern_symbol.encode() * cluster_size) iteration = (iteration + 1) % 26 progressbar.next() diff --git a/src/tests/slack_test.py b/src/tests/slack_test.py index 370d4930c5d98aadd2ba4afd62ee35af503e9384..e58429d44d96398f719c6e146c4123fae21b9c02 100644 --- a/src/tests/slack_test.py +++ b/src/tests/slack_test.py @@ -12,11 +12,11 @@ class SlackTest(DecisionTest): @property def WEIGHT(self): return 2 - + def __init__(self, drive_handle: DriveHandle, check_cluster_overlap: bool) -> None: self._drive_handle = drive_handle self._check_cluster_overlap = check_cluster_overlap - + def determine_probability(self) -> bool: """ Determines wether the drive abstracted by the DriveHandle uses SSD technology @@ -58,19 +58,19 @@ class SlackTest(DecisionTest): print(colored("[SlackTest] The last cluster of the overwrite file is disjoint with these of the pattern file.", "red")) # If both clusters are not part, this test is useless raise RuntimeError("SlackTest could not be performed.") - + # analyse the slack space (sector_size, sectors_per_cluster, _) = self._drive_handle.get_allocation_unit_sizes() half_cluster: int = sector_size * (sectors_per_cluster // 2) print("[SlackTest] Showing the RAM slack:") - print(colored(overwrite_file_last_cluster[half_cluster:half_cluster+(sector_size//2)].hex(' ', 1), "light_grey"), end=' ') - print(colored(overwrite_file_last_cluster[half_cluster+(sector_size//2):half_cluster+sector_size].hex(' ', 1), 'green')) + print(colored(overwrite_file_last_cluster[half_cluster:half_cluster + (sector_size // 2)].hex(' ', 1), "light_grey"), end=' ') + print(colored(overwrite_file_last_cluster[half_cluster + (sector_size // 2):half_cluster + sector_size].hex(' ', 1), 'green')) print("[SlackTest] Showing the drive slack:") - print(colored(overwrite_file_last_cluster[half_cluster+sector_size:].hex(' ', 1),'yellow')) - - found_non_zero_byte : bool = False - for hex_value in overwrite_file_last_cluster[half_cluster+sector_size:].hex(): + print(colored(overwrite_file_last_cluster[half_cluster + sector_size:].hex(' ', 1),'yellow')) + + found_non_zero_byte: bool = False + for hex_value in overwrite_file_last_cluster[half_cluster + sector_size:].hex(): if hex_value != '0': found_non_zero_byte = True break @@ -83,7 +83,6 @@ class SlackTest(DecisionTest): print(colored("[SlackTest] Slack test completed.", "light_blue")) return found_non_zero_byte - @property def drive_handle(self) -> DriveHandle: