resolve conflict

This commit is contained in:
Cayo Puigdefabregas 2023-06-08 11:44:08 +02:00
commit f7a60647b9
18 changed files with 202 additions and 75 deletions

View File

@ -521,10 +521,10 @@ class NewDeviceForm(FlaskForm):
self.depth.errors = txt self.depth.errors = txt
is_valid = False is_valid = False
if self.imei.data and self.amount.data == 1: # if self.imei.data and self.amount.data == 1:
if not 13 < len(str(self.imei.data)) < 17: # if not 13 < len(str(self.imei.data)) < 17:
self.imei.errors = error # self.imei.errors = error
is_valid = False # is_valid = False
if self.meid.data and self.amount.data == 1: if self.meid.data and self.amount.data == 1:
meid = self.meid.data meid = self.meid.data

View File

@ -547,7 +547,8 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
v += '. ' v += '. '
if 's' in format_spec: if 's' in format_spec:
if self.standards: if self.standards:
std = 'with standards {}'.format(self.standards) standard = ','.join([x.value for x in self.standards])
std = 'with standards {}'.format(standard)
else: else:
std = 'no standard' std = 'no standard'
v += 'Method used: {}, {}. '.format(self.method, std) v += 'Method used: {}, {}. '.format(self.method, std)
@ -573,14 +574,15 @@ class EraseSectors(EraseBasic):
steps_random += 1 steps_random += 1
if s.type == 'StepZero': if s.type == 'StepZero':
steps_zeros += 1 steps_zeros += 1
if steps_zeros < 1:
if steps_zeros == 0 and steps_random == 1:
return "Basic" return "Basic"
if 0 < steps_random < 3: if steps_zeros == 1 and steps_random == 1:
return "Baseline" return "Baseline"
if steps_random > 2: if steps_zeros == 1 and steps_random == 2:
return "Enhanced" return "Enhanced"
return "Basic" return "Custom"
class ErasePhysical(EraseBasic): class ErasePhysical(EraseBasic):

View File

@ -36,7 +36,7 @@ from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import ColumnProperty, backref, relationship, validates from sqlalchemy.orm import ColumnProperty, backref, relationship, validates
from sqlalchemy.util import OrderedSet from sqlalchemy.util import OrderedSet
from sqlalchemy_utils import ColorType from sqlalchemy_utils import ColorType
from stdnum import imei, meid from stdnum import meid
from ereuse_devicehub.db import db from ereuse_devicehub.db import db
from ereuse_devicehub.ereuse_utils.naming import HID_CONVERSION_DOC from ereuse_devicehub.ereuse_utils.naming import HID_CONVERSION_DOC
@ -1528,11 +1528,11 @@ class Mobile(Device):
) )
display_size.comment = """The total size of the device screen""" display_size.comment = """The total size of the device screen"""
@validates('imei') # @validates('imei')
def validate_imei(self, _, value: int): # def validate_imei(self, _, value: int):
if value and not imei.is_valid(str(value)): # if value and not imei.is_valid(str(value)):
raise ValidationError('{} is not a valid imei.'.format(value)) # raise ValidationError('{} is not a valid imei.'.format(value))
return value # return value
@validates('meid') @validates('meid')
def validate_meid(self, _, value: str): def validate_meid(self, _, value: str):

View File

@ -16,7 +16,7 @@ from marshmallow.fields import (
) )
from marshmallow.validate import Length, OneOf, Range from marshmallow.validate import Length, OneOf, Range
from sqlalchemy.util import OrderedSet from sqlalchemy.util import OrderedSet
from stdnum import imei, meid from stdnum import meid
from ereuse_devicehub.marshmallow import NestedOn from ereuse_devicehub.marshmallow import NestedOn
from ereuse_devicehub.resources import enums from ereuse_devicehub.resources import enums
@ -304,7 +304,8 @@ class Mobile(Device):
@pre_load @pre_load
def convert_check_imei(self, data): def convert_check_imei(self, data):
if data.get('imei', None): if data.get('imei', None):
data['imei'] = int(imei.validate(data['imei'])) # data['imei'] = int(imei.validate(data['imei']))
data['imei'] = int(data['imei'].replace("-", ""))
return data return data
@pre_load @pre_load

View File

@ -264,6 +264,7 @@ class BaseDeviceRow(OrderedDict):
self['Data Storage Rate'] = '' self['Data Storage Rate'] = ''
self['Data Storage Range'] = '' self['Data Storage Range'] = ''
self['Benchmark RamSysbench (points)'] = '' self['Benchmark RamSysbench (points)'] = ''
self['IMEI'] = ''
class DeviceRow(BaseDeviceRow): class DeviceRow(BaseDeviceRow):
@ -340,6 +341,9 @@ class DeviceRow(BaseDeviceRow):
self.get_placeholder_datas() self.get_placeholder_datas()
if isinstance(device, d.Mobile):
self['IMEI'] = device.imei or ''
def components(self): def components(self):
"""Function to get all components information of a device.""" """Function to get all components information of a device."""
assert isinstance(self.device, d.Computer) assert isinstance(self.device, d.Computer)

View File

@ -394,6 +394,13 @@ class ErasureStandards(Enum):
isinstance(step, actions.StepRandom) for step in other_steps isinstance(step, actions.StepRandom) for step in other_steps
): ):
standards.add(cls.HMG_IS5) 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 return standards

View File

@ -134,13 +134,14 @@
</div> </div>
</div> </div>
{% if not demo %} {% if not demo %}
{# WB V14.4 #}
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="pt-8 pb-2"> <div class="pt-8 pb-2">
<h5 class="card-title pb-0 fs-4">Usody Data Erasure v14</h5> <h5 class="card-title pb-0 fs-4">Usody Data Erasure v14.4</h5>
<p class="mb-5"> <p class="mb-5">
A certified data erasure software to irreversibly removing data sored on hard drives.<br /> A certified data erasure software to irreversibly removing data sored on hard drives.<br />
<small>Desktops, Servers and Laptops.</small> <small>Desktops, Servers and Laptops.</small>
@ -148,13 +149,13 @@
<div class="row"> <div class="row">
<div class="col-2"> <div class="col-2">
<a href="{{ iso_erease.url }}{{ iso_erease.iso }}" class="btn btn-primary" style="max-width: 200px;"> <a href="{{ iso_erease4.url }}{{ iso_erease4.iso }}" class="btn btn-primary" style="max-width: 200px;">
Download ISO Download ISO
</a> </a>
</div> </div>
<div class="col-3"> <div class="col-3">
<p class="small"> <p class="small">
Download Checksum: <a class="help" href="{{ iso_erease.url }}SHA512SUM">SHA512SUM</a> | Download Checksum: <a class="help" href="{{ iso_erease4.url }}SHA512SUM">SHA512SUM</a> |
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a> <a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a>
</p> </p>
</div> </div>
@ -226,6 +227,82 @@
</div> </div>
</div> </div>
</div> </div>
{# WB V14.2 #}
<div class="row">
<div class="col">
<div class="card">
<div class="card-body">
<div class="pt-8 pb-2">
<h5 class="card-title pb-0 fs-4">Usody Data Erasure v14.2</h5>
<p class="mb-5">
A certified data erasure software to irreversibly removing data sored on hard drives.<br />
<small>Desktops, Servers and Laptops.</small>
</p>
<div class="row">
<div class="col-2">
<a href="{{ iso_erease2.url }}{{ iso_erease2.iso }}" class="btn btn-primary" style="max-width: 200px;">
Download ISO
</a>
</div>
<div class="col-3">
<p class="small">
Download Checksum: <a class="help" href="{{ iso_erease2.url }}SHA512SUM">SHA512SUM</a> |
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a>
</p>
</div>
<div class="col"></div>
</div>
<div class="row mt-3">
<div class="col-3">
<div class="border mr-2 p-2">
<h5>Basic Erasure</h5>
<p>
Settings for basic data erasure using shred Linux command.
A software-based fast non-100%-secured way of erasing data storage.
</p>
<p>
Performs <strong>1</strong> pass overwriting one round using all zeros.
Compliant with <strong>NIST SP-800-88</strong>.
</p>
<a href="{{ url_for('workbench.settings') }}?opt=erease_basic"
class="btn btn-primary"
style="width: 100%;">
Download settings file
</a>
</div>
</div>
<div class="col-3">
<div class="border mr-2 p-2">
<h5>Baseline Secure Erasure</h5>
<p>
Settings for advanced data erasure using badblocks Linux software.
A secured-way of erasing data storages, erase hidden areas, checking the erase sector by sector.
</p>
<p>
Performs <strong>1</strong> pass overwriting each sector with zeros and a final verification.
Compliant with <strong>HMG Infosec Standard 5 Baseline</strong>.
</p>
<a href="{{ url_for('workbench.settings') }}?opt=baseline_erease"
class="btn btn-primary"
style="width: 100%;">
Download settings file
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %} {% endif %}
</section> </section>

View File

@ -1,38 +0,0 @@
[settings]
DH_TOKEN = {{ token }}
DH_URL = {{ url }}
{% if erease_basic %}
DH_HOST = {{ api_host }}
DH_DATABASE = {{ schema }}
DEVICEHUB_URL = https://${DB_HOST}/${DB_DATABASE}/
WB_BENCHMARK = False
WB_STRESS_TEST = 0
WB_SMART_TEST = short
WB_ERASE = EraseBasic
WB_ERASE_STEPS = 1
WB_ERASE_LEADING_ZEROS = False
VERSION = Basic Erasure (BE)
{% elif baseline_erease %}
DH_HOST = {{ api_host }}
DH_DATABASE = {{ schema }}
DEVICEHUB_URL = https://${DB_HOST}/${DB_DATABASE}/
WB_BENCHMARK = False
WB_STRESS_TEST = 0
WB_SMART_TEST = short
WB_ERASE = EraseSectors
WB_ERASE_STEPS = {{ erase_steps }}
WB_ERASE_LEADING_ZEROS = True
VERSION = {%if erase_steps < 3 %}Baseline Secure Erasure (BSE){% else %}Enhanced Secure Erasure (ESE){% endif %}
{% else %}
SNAPSHOTS_PATH = /mnt
LOGS_PATH = /mnt
VERSION = Basic Metadata (BM)
{% endif %}

View File

@ -0,0 +1,17 @@
[settings]
VERSION = Basic Erasure (BE)
DH_TOKEN = {{ token }}
DH_URL = {{ url }}
DH_HOST = {{ api_host }}
DH_DATABASE = {{ schema }}
WB_BENCHMARK = False
WB_STRESS_TEST = 0
WB_SMART_TEST = short
WB_ERASE = EraseBasic
WB_ERASE_STEPS = 1
WB_ERASE_LEADING_ZEROS = False
#WB_ERASE_CONFIRMATION = True

View File

@ -0,0 +1,8 @@
[settings]
VERSION = Basic Metadata (BM)
DH_TOKEN = {{ token }}
DH_URL = {{ url }}
SNAPSHOTS_PATH = /mnt
LOGS_PATH = /mnt

View File

@ -0,0 +1,22 @@
[settings]
VERSION = Baseline Secure Erasure (BSE)
DH_TOKEN = {{ token }}
DH_URL = {{ url }}
DH_HOST = {{ api_host }}
DH_DATABASE = {{ schema }}
WB_BENCHMARK = False
WB_STRESS_TEST = 0
WB_SMART_TEST = short
WB_ERASE = EraseSectors
WB_ERASE_STEPS = 1
WB_ERASE_LEADING_ZEROS = True
#WB_ERASE_CONFIRMATION = True
WB_ERASE_1_METHOD = EraseBasic
WB_ERASE_1_STEP_TYPE = 0
WB_ERASE_2_METHOD = EraseSectors
WB_ERASE_2_STEP_TYPE = 1

View File

@ -0,0 +1,23 @@
[settings]
VERSION = Enhanced Secure Erasure (ESE)
DH_TOKEN = {{ token }}
DH_URL = {{ url }}
DH_HOST = {{ api_host }}
DH_DATABASE = {{ schema }}
WB_BENCHMARK = False
WB_STRESS_TEST = 0
WB_SMART_TEST = short
WB_ERASE = EraseSectors
WB_ERASE_LEADING_ZEROS = True
#WB_ERASE_CONFIRMATION = True
WB_ERASE_1_METHOD = EraseBasic
WB_ERASE_1_STEP_TYPE = 1
WB_ERASE_2_METHOD = EraseBasic
WB_ERASE_2_STEP_TYPE = 0
WB_ERASE_3_METHOD = EraseSectors
WB_ERASE_3_STEP_TYPE = 1

View File

@ -7,8 +7,12 @@ isos = {
'iso': "USODY_2022.12.2-beta.iso", 'iso': "USODY_2022.12.2-beta.iso",
'url': 'https://releases.usody.com/2022/', 'url': 'https://releases.usody.com/2022/',
}, },
"erease": { "erease2": {
'iso': "USODY_14.2.0.iso", 'iso': "USODY_14.2.0.iso",
'url': 'https://releases.usody.com/v14/', 'url': 'https://releases.usody.com/v14.2/',
},
"erease4": {
'iso': "USODY_14.4.2.iso",
'url': 'https://releases.usody.com/v14.4/',
}, },
} }

View File

@ -34,7 +34,8 @@ class SettingsView(GenericMixin):
'demo': g.user.email == app.config['EMAIL_DEMO'], 'demo': g.user.email == app.config['EMAIL_DEMO'],
'iso_demo': isos['demo'], 'iso_demo': isos['demo'],
'iso_register': isos['register'], 'iso_register': isos['register'],
'iso_erease': isos['erease'], 'iso_erease2': isos['erease2'],
'iso_erease4': isos['erease4'],
'form': form_kangaroo, 'form': form_kangaroo,
} }
) )
@ -64,6 +65,7 @@ class SettingsView(GenericMixin):
} }
# if is a v14 version # if is a v14 version
# TODO when not use more v14, we can remove this if # TODO when not use more v14, we can remove this if
template = 'workbench/wbSettings_BM.ini'
if 'erease' in self.opt: if 'erease' in self.opt:
url = "https://{}/actions/".format(app.config['API_HOST']) url = "https://{}/actions/".format(app.config['API_HOST'])
self.wbContext['url'] = url self.wbContext['url'] = url
@ -72,14 +74,13 @@ class SettingsView(GenericMixin):
self.wbContext['schema'] = app.config['SCHEMA'] self.wbContext['schema'] = app.config['SCHEMA']
if self.opt == 'erease_basic': if self.opt == 'erease_basic':
self.wbContext['erease_basic'] = True template = 'workbench/wbSettings_BE.ini'
if self.opt in ['baseline_erease', 'enhanced_erease']: if self.opt == 'baseline_erease':
self.wbContext['baseline_erease'] = True template = 'workbench/wbSettings_BSE.ini'
self.wbContext['erase_steps'] = 1
if self.opt == 'enhanced_erease': if self.opt == 'enhanced_erease':
self.wbContext['erase_steps'] = 3 template = 'workbench/wbSettings_ESE.ini'
data = flask.render_template('workbench/wbSettings.ini', **self.wbContext) data = flask.render_template(template, **self.wbContext)
return self.response_download(data) return self.response_download(data)
def response_download(self, data): def response_download(self, data):

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2239,7 +2239,6 @@ def test_manual_binding(user3: UserClientFlask):
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)
def test_edit_and_binding(user3: UserClientFlask): def test_edit_and_binding(user3: UserClientFlask):
# TODO
uri = '/inventory/device/add/' uri = '/inventory/device/add/'
user3.get(uri) user3.get(uri)