From 5ceeba3af71029f00c893161a56ae9f5b70e6004 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 31 May 2023 10:54:11 +0200 Subject: [PATCH] fix pdf --- ereuse_devicehub/resources/action/models.py | 12 +++++++----- ereuse_devicehub/resources/enums.py | 15 +++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 30be54c8..fae963ae 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -501,7 +501,8 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): v += '. ' if 's' in format_spec: if self.standards: - std = 'with standards {}'.format(self.standards) + standard = ','.join([x.value for x in self.standards]) + std = 'with standards {}'.format(standard) else: std = 'no standard' v += 'Method used: {}, {}. '.format(self.method, std) @@ -527,14 +528,15 @@ class EraseSectors(EraseBasic): steps_random += 1 if s.type == 'StepZero': steps_zeros += 1 - if steps_zeros < 1: + + if steps_zeros == 0 and steps_random == 1: return "Basic" - if 0 < steps_random < 3: + if steps_zeros == 1 and steps_random == 1: return "Baseline" - if steps_random > 2: + if steps_zeros == 1 and steps_random == 2: return "Enhanced" - return "Basic" + return "Custom" class ErasePhysical(EraseBasic): diff --git a/ereuse_devicehub/resources/enums.py b/ereuse_devicehub/resources/enums.py index 2d527802..dd82fbc6 100644 --- a/ereuse_devicehub/resources/enums.py +++ b/ereuse_devicehub/resources/enums.py @@ -365,16 +365,16 @@ class ErasureStandards(Enum): """Software erasure standards.""" HMG_IS5 = 'British HMG Infosec Standard 5 (HMG IS5)' - """`British HMG Infosec Standard 5 (HMG IS5) + """`British HMG Infosec Standard 5 (HMG IS5) `_. - + In order to follow this standard, an erasure must have the following steps: - + 1. A first step writing zeroes to the data-storage units. 2. A second step erasing with random data, verifying the erasure success in each hard-drive sector. - + And be an :class:`ereuse_devicehub.resources.action.models.EraseSectors`. """ @@ -394,6 +394,13 @@ class ErasureStandards(Enum): isinstance(step, actions.StepRandom) for step in other_steps ): standards.add(cls.HMG_IS5) + + if len(other_steps) == 2: + step1 = isinstance(first_step, actions.StepRandom) + step2 = isinstance(other_steps[0], actions.StepZero) + step3 = isinstance(other_steps[1], actions.StepRandom) + if step1 and step2 and step3: + standards.add(cls.HMG_IS5) return standards