Commit Graph

874 Commits

Author SHA1 Message Date
PartialVolume
30997876a5 HPA_DCO_010 Continuation of HPA/DCO integration.
The Seagate EXOS family of drives don't support the ATA
drive configuration overlay (DCO) command, however they do
support host protected area (HPA). Therefore these drives
can have hidden sectors.

The code was changed to accommodate the slightly different
way these drives respond to a hdparm -N, that is, the
response is accessible max address enabled or
accessible max address disabled. The new code correctly
determines a the status of a drive in regards to
whether it has hidden sectors or not and what it's
apparent and real size is.
2023-04-05 18:05:54 +01:00
PartialVolume
0c41d895e2 Merge pull request #461 from PartialVolume/HPA_DCO_009
HPA_DCO_009 Continuation of HPA/DCO integration.
2023-04-04 23:58:42 +01:00
PartialVolume
776717a729 HPA_DCO_009 Continuation of HPA/DCO integration.
Changed the way percentage is calculated. As we
are dealing with large numbers and for some reason
printf prints a double that is 99.99999999999 as
100.00 when a precision of two is specified I wrote
a function that creates a percentage string such that
99.99999999999 is displayed as 99.99%. This is important
in the report as a disc with one hidden sector will now
correctly show as 99.99% erased and not 100.00% erased.
2023-04-04 23:52:40 +01:00
PartialVolume
a1e607dc02 Merge pull request #460 from PartialVolume/HPA_DCO_008
HPA_DCO_008 continuation of HPA/DCO integration.
2023-04-03 23:19:20 +01:00
PartialVolume
0b720b155c HPA_DCO_008 continuation of HPA/DCO integration.
Many changes related to DCO real max sectors and HPA set and real
sectors and how they are processed and used in the PDF creation
function. More testing is required until I'm happy this works
correctly with lots of different hardware including USB adapters
that don't support DCO/HPA and also drives that don't support
DCO/HPA such as the Seagate Enterprise EXOS drives.
2023-04-03 23:11:41 +01:00
PartialVolume
4fc1806880 Merge pull request #459 from PartialVolume/Fix_very_obscure_incorrect_percentage_on_fill_ones_only
Fix obscure incorrect percentage on completion.
2023-03-20 19:51:34 +00:00
PartialVolume
bbfaa0e9f7 Fix obscure incorrect percentage on completion.
This bug only applies to ones wipe and one or zero's
verification.

A very rare occurrence of a incorrect percentage on
completion. The actual wipe was completed correctly it
was just that the percentage calculation was wrong.

This was due to a variable that was initialised for
all methods except ones, & ones & zeros verification.

For those three method's the uninitialised variable
would have had to have the value 1 or 6 for the
incorrect percentage to be calculated, this is why
it was so rare.

Corrected by initialising the variable with a -1 so
that if no method was found in the array then no
extra calculations as regards the percentage are
performed.
2023-03-20 19:39:16 +00:00
PartialVolume
4f5c15ffad Merge pull request #458 from PartialVolume/nwipe_conf_001
nwipe_conf_001 Add /etc/nwipe/nwipe.conf
2023-03-17 23:23:54 +00:00
PartialVolume
dbde867974 nwipe_conf_001 Add /etc/nwipe/nwipe.conf
1. Started constructing the code we will use to access
and write to /etc/nwipe/nwipe.conf. The initial use of
the nwipe.conf file will be to hold information such
as organisation and technician details that will be used
on the PDF report certificate. We are using the libconfig
library enable us to read and write the conf file. libconfig
is very well documented so editing the conf file manually
should be pretty straight forward. Nwipe will build a basic
conf file to give the user an idea how it should be edited.

2. Updated the README.md, showing the libconfig-dev, libconfig++-dev
needs to be installed.

3. Added some information about the use of hdparm to detect hidden
sectors and also noted that as from v0.35 nwipe will detect hidden
sectors, and may well have an extra method to expose those hidden#
sectors by restoring the DCO.
2023-03-17 23:18:39 +00:00
PartialVolume
a51a9b3e2a Merge pull request #457 from PartialVolume/HPA_DCO_007
HPA_DCO_007 - Add HPA/DCO capability
2023-03-16 21:12:24 +00:00
PartialVolume
3d5fdd3f11 HPA_DCO_007 - Add HPA/DCO capability
1. Fix issue in PDF certificate where a drive that doesn't
support device configuration overlay, shows 512 bytes as the
disc size in the "Size(Real)" area on the certificate.

2. Fix a comment in the log that suggests you might be using a USB
adapter or memory stick and those device can cause an indeterminate
HPA/DCO status. This is now corrected so that we check the bus
is USB before we issue that message.

3. Changes to some GUI text, replaced 'area' with 'sectors'.

4. Aligned "HPA/DCO No hidden sectors detected" to the drive
model/serial text that it alternates with. One character left.

5. Nwipe's version and operating system information that is always
printed to the console on exit, was not appearing in the optional
log file, as optionally specified on the command line. This was
caused because those nwipe_log() calls were happening before the
command line options had been parsed. Essentially there was no log file.
Comments were made in the nwipe.c as a reminder to use nwipe_log()
calls with caution, prior to the options parser.

6. Made changes to the logic in the HPA_dco functions such that
a device that does not appear to support device configuration
overlay and host protected area is classified as HPA_NOT APPLICABLE
in regards to the hpa_status which is important for the PDF
certificate code so that the fields in the certificate are updated
appropriately.
2023-03-16 20:57:07 +00:00
PartialVolume
5051e5c7bf Merge pull request #456 from PartialVolume/Validate_temperatures_before_using_to_change_temperature_text_color
Validate temperatures.
2023-03-16 00:54:20 +00:00
PartialVolume
5d8c0cc4bf Validate temperatures.
Now validates temperatures rather than assuming the data
is valid.

1. Checks for 0 in high critical and max.
2. Copes with missing critical or max min data or
partially missing data.
3. Checks the high critical and max are the right way round
4. Checks the low critical and min are the right way round
5. Temperature is displayed in 5 different ways
i. white text on blue - temperature with spec. (or no spec available)
ii. red text on blue - max temperature reached.
iii. white text on red - critical high temperature reached.
iv. black text on blue - minimum temperature reached.
v. white text on black - critical low temperature reached.
2023-03-16 00:43:19 +00:00
PartialVolume
c79c8ad8f7 Merge pull request #455 from PartialVolume/add_min_max_temperatures_to_log
Added max, min drive temperatures to log
2023-03-14 23:57:09 +00:00
PartialVolume
79cedf47fc Added max, min drive temperatures to log
Added the max and min drive temperatures to the nwipe
log. We now have upto six temperatures that may be reported
for each drive. Whether all these fields are populated is
down to each drive manufacturer.
2023-03-14 23:53:21 +00:00
PartialVolume
08cba2ee5e Merge pull request #454 from PartialVolume/Fix_anomaly_when_temperature_changes_color
Fix anomaly with color change of temperature
2023-03-14 22:30:19 +00:00
PartialVolume
4368092d11 Fix anomaly with color change of temperature
Temperature text now changes red when it's exceeded
the high critical temperature and black when it's dropped below the low
critical temperature. See nwipes log for what those values actually are
as those critical temperature values are obtained from each drive.

When the drive temperature is within the drives specification the temperature
text will be white text on blue background.

The temperature text no longer flashes red or black.
2023-03-14 22:27:34 +00:00
PartialVolume
ac96c51120 Merge pull request #453 from PartialVolume/add_temperature_limits_to_log_info
Add temperature limits to nwipe log
2023-03-14 20:42:37 +00:00
PartialVolume
c4490a89d1 Add temperature limits to nwipe log
1. For each drive we now show the following temperature
limits that are obtained directly from the drive. These are
shown in the log under the INFO category. For a given drive
all it's limits are shown on a single line near the start of
the log.

Example:
Temperature limits for /dev/nvme0n1, critical=84c, highest=N/A, lowest=N/A, low critical=N/A.

High critical
Highest
Lowest
Low critical

Whether all these values contain data various between
manufacturer, for instance the Seagate SN570 only shows
the high critical value of 84 deg.C

2. Changed some wording in the GUI for a on screen
message to do with HPA/DCO.
2023-03-14 20:11:00 +00:00
PartialVolume
87d25cf752 Merge pull request #452 from PartialVolume/PDFGen17
PDFGen17 - further work on PDF certificate
2023-03-12 18:15:39 +00:00
PartialVolume
c3cd5011a2 PDFGen17 - further work on PDF certificate
1. I wasn't keen on my first attempt at the exclamation
icon so I redesigned it.I think this one looks better.
2023-03-12 16:34:43 +00:00
PartialVolume
1b3d03faad Merge pull request #451 from PartialVolume/PDFGen16
PDFGen16 - further work on PDF certificate
2023-03-11 22:45:31 +00:00
PartialVolume
f258872c67 PDFGen16 - further work on PDF certificate
1. Added a new icon, a yellow exclamation in a red circle
with the words "erased with a warning" inside the circle.
This is used instead of the green tick icon or red cross icon
when a disk is successfully erase as requested but the user
chose not to expose the hidden sectors by removing the HPA and/or
restoring the drive configuration overlay (DCO).

2. Expanded the size of the "Disk Erasure Details" section on
the certificate by 20 points to provide better spacing for warnings

3. Removed remapped sectors label, as that information already
appears on page 2 in the smart data.

4. Improvements to the logic in regards to text colour changes.

5. Added a additional red warning message in the information section
when the exposed sectors of the disc are erased but the hidden sectors
are not.

6. Added the original images in .xcf (gimp) and jpg formats that are
used to generate the embedded .c and .h files using bin2c.
2023-03-11 22:24:34 +00:00
PartialVolume
d231c863f7 Merge pull request #450 from PartialVolume/PDFGen15
PDFGen15 - further work on PDF certificate
2023-03-10 23:41:45 +00:00
PartialVolume
b35400b22a PDFGen15 - further work on PDF certificate
1. Added page 2 of the report which includes all
smart data as displayed by smartctl -a /dev/sdx

2. Did some more work on the logic, i.e. when certain
data on the certificate should be green and when it should be
red.

3. Made some changes to nwipe's log in regards to the way
it displays disc info right at the beginning of the log.
Separated the drive information by a blank line to make
each drive stand out from the rest.

4. Moved a string function from device.c to miscellaneous.c

more code to follow ..
2023-03-10 23:33:46 +00:00
PartialVolume
c52dfa3d8f Merge pull request #449 from PartialVolume/HPA_DCO_006
HPA_DCO_006 - Add HPA/DCO capability
2023-03-10 00:52:14 +00:00
PartialVolume
e6a9944a7a HPA_DCO_006 - Add HPA/DCO capability
1. If nwipe enumerates a USB bridge that does not support
ATA pass through or you are wiping a USB memory stick,
nwipe will show a message in the GUI that says
"HPA/DCO hidden area indeterminate". If you get this message
you know to either get yourself a better quality USB to SATA
adapter or in the case of a USB memory stick, i've never
come across one that supports HPA/DCO so either don't worry
about it and wipe it as normal or physically destroy it.

2.We now check for a nonsense "real max sectors" as produced
by the bug in hdparm. We use our own low level function to
issue a DCO identify command and retrieve the correct value.

3. Changed the dmidecode info at the start of the log from
a 'notice' classification to 'info'.

4. Made changes to the nwipe_log function so that any messages
logged that are classified as 'debug' will not be logged unless
the --verbose flag has been set on the command line options. I
send the hex data structures and hex sense data to the logs as debug
information and as they can take up a lot of space and make the
log look untidy they will only appear in --verbose mode.

5. I also extended the nwipe's log message length from 512 to 1024
as some of the sense data was being truncated in the log.
2023-03-10 00:28:31 +00:00
PartialVolume
9c0dd6a25a Merge pull request #448 from PartialVolume/HPA_DCO_005
HPA_DCO_005 - Add HPA/DCO capability
2023-03-08 23:37:46 +00:00
PartialVolume
67ca3b260d HPA_DCO_005 - Add HPA/DCO capability
1. Created the function nwipe_read_dco_real_max_sectors()
which directly accesses the disk drive sending a 0xB1
device configuration overlay identify command to the drive.
We read the returned data structure extracting the real max
sectors value. We do this if hdparm returns nonsense for the
real max sector (as it does in hdparm v9.60) for some larger
drives. This value is automatically sent to the nwipe log FYI.

2. Added a stdout & stderr pipe to the hdparm commands as verbose
data appears to be sent to stderr, as we are interested in that
data this pipe captures stderr as well as stdout.

3. Added headers "scsi/sg.h" and "scsi/scsi_ioctl.h" as we
are now sending low level commands to the drives.
2023-03-08 23:30:14 +00:00
PartialVolume
c97d1c9166 Merge pull request #447 from PartialVolume/HPA_DCO_004
HPA_DCO_004 - Add HPA/DCO Capability
2023-03-08 00:34:53 +00:00
PartialVolume
4b6399a93f HPA_DCO_004 - Add HPA/DCO Capability
1. In the GUI I switched the HPA/DCO status position
from overlaying the [drive size][temp] and instead
positioning the HPA/DCO status over the drive model
and serial number. HPA/DCO information and drive details
alternating every couple of seconds. This allowed me to
extend the length of the HPA message and make it more
meaningful to somebody that doesn't know the HPA/DCO
terminology. Therefore "HPA Enabled" is replaced with
"HPA/DCO Warning, hidden area detected"

2. Started adding bad/missing sense data detection ..

more code to follow ..
2023-03-08 00:20:22 +00:00
PartialVolume
518b8b536a Merge pull request #446 from PartialVolume/PDFGen14
PDFGen14 - further work on PDF certificate
2023-03-05 23:48:26 +00:00
PartialVolume
b79eea6c9f PDFGen14 - further work on PDF certificate
1. Changes to colour on some items under certain
conditions.

2. Changed the HPA labels to include DCO, and changed
the text from HPA enabled/disabled to something more
meaningful to a user, i.e Hidden area found, no hidden
area.

3. Added a new define "HPA_NOT_SUPPORTED_BY_DRIVE" for
recent SATA drives that no longer support HPA/DCO.
Further work needs to be done determining whether a drive
supports HPA/DCO or not in the hpa_dco.c functions.

more code to follow ..
2023-03-05 23:24:49 +00:00
PartialVolume
88cec08854 Merge pull request #445 from PartialVolume/PDFGen13
PDFGen13 - further work on PDF certificate
2023-03-05 00:49:34 +00:00
PartialVolume
dc6d76176a PDFGen13 - further work on PDF certificate
1. Reduced font size for data info.
2. Used a define for text point size to make it easier
to change size.
3. Started work on function to parse sense data for older
versions of hdparm (9.60) that fail to parse the real max
sectors correctly. (fixed in 9.65).
4. Miscellaneous changes.

More changes to follow ..
2023-03-05 00:42:37 +00:00
PartialVolume
3eb5a43a32 Merge pull request #443 from PartialVolume/HPA_DCO_003
HPA_DCO_003 - Add HPA,DCO capability
2023-02-28 23:55:46 +00:00
PartialVolume
8abab96a3e HPA_DCO_003 - Add HPA,DCO capability
1. For devices that support HPA/DCO (not NVMe) nwipe
displays the HPA status, it toggles every two seconds
the size and the temperature i.e "[  1TB][ 35C]" with
the HPA status such as [HPA disabled], [HPA ENABLED!],
[HPA unknown]. The HPA ENABLED is highlighted with red
text and a white background. HPA_disabled is standard
white text on blue background.

More code to follow, a new option to be added, HPA, disable/enable
which will disable the HPA and shut down the system. On manually
powering back up the HPA should be reported as disabled.

Then lots of testing.
2023-02-28 23:48:17 +00:00
PartialVolume
7ccb68675b Merge pull request #442 from PartialVolume/HPA_DCO_002
HPA_DCO_002 - Add HPA, DCO capability
2023-02-28 00:10:26 +00:00
PartialVolume
c7d17df7f8 HPA_DCO_002 - Add HPA, DCO capability
1. Further work was completed, putting the HPA status and HPA size into
the report/certificate.

2. Moved some general functions that may be used throughout nwipe
into miscellaneous.c These tend to be string processing functions.

3. Tested certificate HPA status. There are three possible states of the HPA
i. Enabled and HPA size is displayed on the certificate
ii. Disabled, the drive reports it's real size to the O.S.
iii. Unknown. Nwipe could not determine whether there is a HPA or not.
This may be caused by the use of a USB adapter or could be a bad drive,
or finally a change in hdparms format when displaying HPA information.

More code to follow, next on the list is to add the HPA status into the
drive selection screen in the GUI, so when you select the drive you can see
the status of HPA and choose to disable it.
2023-02-28 00:02:01 +00:00
PartialVolume
ea9d76132e Merge pull request #441 from PartialVolume/HPA_DCO_001
HPA_DCO_001 - Add HPA, DCO capability
2023-02-26 23:23:22 +00:00
PartialVolume
bba050fa71 HPA_DCO_1 - Add HPA, DCO capability
1. nwipe now reads the HPA set and real number of
sectors and the DSO real max sectors. It determines
from these values whether the HPA is enabled, disabled
or in a unknown state. The values are logged to nwipes
log and flags are set in the drives context.

More code will follow that adds this information to the PDF
certificate and to the drive selection window in the GUI.
2023-02-26 22:59:33 +00:00
PartialVolume
00e2053ab4 Merge pull request #440 from PartialVolume/HPA_DCO
HPA_DCO_1 - Add HPA, DCO capability
2023-02-23 22:52:38 +00:00
PartialVolume
ef84c65846 HPA_DCO_1 - Add HPA, DCO capability
1. debugging.
2023-02-23 22:30:18 +00:00
PartialVolume
09af2bc5a6 HPA_DCO_1 - Add HPA, DCO capability
1. More debugging.
2023-02-23 21:44:08 +00:00
PartialVolume
2747ab5d4f HPA_DCO_1 - Add HPA, DCO capability
1. More corrections to hdparm command
2023-02-23 21:22:21 +00:00
PartialVolume
a2d6735b89 HPA_DCO_1 - Add HPA, DCO capability
1. Corrections to hdparm command.
2023-02-23 21:14:48 +00:00
PartialVolume
e4ecd6a68e HPA_DCO_1 - Add HPA, DCO capability
1. Initial commit
2023-02-23 20:46:19 +00:00
PartialVolume
6f7ca938f4 Merge pull request #439 from PartialVolume/PDFGen12
PDFGen12 - further work on PDF certificate
2023-02-23 12:50:18 +00:00
PartialVolume
ecfc252015 PDFGen12 - further work on PDF certificate
1. Add information regarding how many pass, sync
and verify errors, if any.
2023-02-23 12:31:41 +00:00
PartialVolume
40f1e31225 Merge pull request #438 from PartialVolume/PDFGen11
PDFGen11 - further work on PDF certificate
2023-02-22 16:28:42 +00:00