From 7b081ec58a7fc893fc8aa7a89ac525bab07357ac Mon Sep 17 00:00:00 2001 From: itycodes Date: Fri, 31 May 2024 14:06:20 +0200 Subject: [PATCH 3/4] Add a temporary patch that replaces '*' with '\0' in --password --- smartmontools/atacmds.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/smartmontools/atacmds.cpp b/smartmontools/atacmds.cpp index 0c465c8b..b1164a13 100644 --- a/smartmontools/atacmds.cpp +++ b/smartmontools/atacmds.cpp @@ -797,7 +797,7 @@ bool ata_nodata_command(ata_device * device, unsigned char command, return device->ata_pass_through(in); } -// Issue a no-data ATA command with optional sector count register value +// Issue a password ATA command with optional sector count register value bool ata_password_command(ata_device * device, unsigned char command, unsigned char flags, unsigned short password[16]) { @@ -808,7 +808,15 @@ bool ata_password_command(ata_device * device, unsigned char command, unsigned c memset(unlock, 0, sizeof(ata_security_unlock_data_content)); memcpy(&unlock->flags, &flags, sizeof(unlock->flags)); memcpy(&unlock->password, password, sizeof(unlock->password)); - printf("The password is: %s\n", (char*)&unlock->password); + printf("The password is: %s (", (char*)&unlock->password); + char* passwd = (char*)&unlock->password; + for(int i = 0; i < 32; i++){ + if(passwd[i] == '*'){ + passwd[i] = 0; + } + printf(" %d ", passwd[i]); + } + printf("\n)"); in.set_data_out(unlock, 1); return device->ata_pass_through(in); -- 2.45.1