From 3d411bee02cd2f1310a577683e0cf5c9eea5b8de Mon Sep 17 00:00:00 2001 From: g3gg0 Date: Tue, 19 May 2020 01:11:55 +0200 Subject: [PATCH] removed some commands again moved internal commands to only build in standalone mode send NACK if DisablePrivacySlixLIso15693 fails --- armsrc/appmain.c | 12 ----- armsrc/iso15693.c | 70 +++++++++++++++-------------- client/cmdhf15.c | 109 ---------------------------------------------- include/usb_cmd.h | 3 -- 4 files changed, 37 insertions(+), 157 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index c98b5c17..41993089 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1195,21 +1195,9 @@ void UsbPacketReceived(UsbCommand *c) { DirectTag15693Command(c->arg[0],c->arg[1],c->arg[2],c->d.asBytes); break; - case CMD_ISO_15693_SLIX_L_CHANGE_PASS: - ChangePassSlixLIso15693(c->arg[0], c->arg[1], c->arg[2]); - break; - case CMD_ISO_15693_SLIX_L_DISABLE_PRIVACY: DisablePrivacySlixLIso15693(c->arg[0]); break; - - case CMD_ISO_15693_SLIX_L_LOCK_PASS: - LockPassSlixLIso15693(c->arg[0], c->arg[1]); - break; - - case CMD_ISO_15693_BRUTE_FORCE: - BruteforceIso15693(c->arg[0], c->arg[1]); - break; case CMD_ISO_15693_FIND_AFI: BruteforceIso15693Afi(c->arg[0]); diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index d8463b55..b2e654b7 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -1821,6 +1821,42 @@ int ReadMemoryIso15693(uint32_t start_time, uint32_t *eof_time, uint8_t bank, ui return SLIX_ERR_OK; } +void DisablePrivacySlixLIso15693(uint32_t password) { + uint32_t start_time = 0; + uint32_t eof_time = 0; + + Dbprintf(" [x] Set password"); + + LED_D_ON(); + Iso15693InitReader(); + StartCountSspClk(); + + switch(SetPassSlixLIso15693(start_time, &eof_time, 4, password)) { + case SLIX_ERR_NORESP: + Dbprintf(" [i] No tag found"); + cmd_send(CMD_NACK, 0, 0, 0, NULL, ISO15693_MAX_RESPONSE_LENGTH); + LED_C_ON(); + return; + + case SLIX_ERR_INVPASS: + Dbprintf(" [E] Password was not accepted"); + cmd_send(CMD_NACK, 1, 0, 0, NULL, ISO15693_MAX_RESPONSE_LENGTH); + LED_B_ON(); + return; + } + Dbprintf(" [x] Success"); + + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); + + cmd_send(CMD_ACK,1,0,0,0,0); + LED_A_OFF(); + LED_B_OFF(); + LED_C_OFF(); + LED_D_OFF(); +} + +#if defined(WITH_ISO15693_StandAlone) + void ChangePassSlixLIso15693(uint32_t pass_id, uint32_t old_password, uint32_t password) { uint8_t uid[8]; bool done = false; @@ -2209,38 +2245,6 @@ void LockPassSlixLIso15693(uint32_t pass_id, uint32_t password) { LED_D_OFF(); } -void DisablePrivacySlixLIso15693(uint32_t password) { - uint32_t start_time = 0; - uint32_t eof_time = 0; - - Dbprintf(" [x] Set password"); - - LED_D_ON(); - Iso15693InitReader(); - StartCountSspClk(); - - switch(SetPassSlixLIso15693(start_time, &eof_time, 4, password)) { - case SLIX_ERR_NORESP: - Dbprintf(" [i] No tag found"); - LED_C_ON(); - return; - - case SLIX_ERR_INVPASS: - Dbprintf(" [E] Password was not accepted"); - LED_B_ON(); - return; - } - Dbprintf(" [x] Success"); - - FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); - - cmd_send(CMD_ACK,1,0,0,0,0); - LED_A_OFF(); - LED_B_OFF(); - LED_C_OFF(); - LED_D_OFF(); -} - void BruteforceIso15693(uint32_t start_cmd, uint32_t end_cmd) { uint8_t cmd_buffer[64]; @@ -2363,7 +2367,7 @@ void BruteforceIso15693(uint32_t start_cmd, uint32_t end_cmd) { LED_C_OFF(); LED_D_OFF(); } - +#endif // Initialize the proxmark as iso15k tag void Iso15693InitTag(void) { diff --git a/client/cmdhf15.c b/client/cmdhf15.c index cd008131..a48e8b64 100644 --- a/client/cmdhf15.c +++ b/client/cmdhf15.c @@ -306,112 +306,6 @@ static int CmdHF15Afi(const char *Cmd) { return 0; } - - -static int CmdHF15SlixChangePass(const char *Cmd) -{ - char cmdp = param_getchar(Cmd, 0); - uint8_t old_pass[4] = {0x00}; - uint8_t new_pass[4] = {0x00}; - uint8_t pass_id[1] = {0x00}; - - if (cmdp == 'h' || cmdp == 'H') { - PrintAndLog("Usage: hf 15 slix_change_pass "); - PrintAndLog(""); - PrintAndLog(" pass_id 04: privacy, 08: destroy, 10: EAS/AFI"); - PrintAndLog(""); - PrintAndLog(" example: hf 15 slix_change_pass 04 00000000 0F0F0F0F"); - return 0; - } - - if (param_gethex(Cmd, 0, pass_id, 2)) { - PrintAndLog("pass_id must have 2 HEX symbols"); - return 0; - } - if (param_gethex(Cmd, 1, old_pass, 8)) { - PrintAndLog("pass must have 8 HEX symbols"); - return 0; - } - if (param_gethex(Cmd, 2, new_pass, 8)) { - PrintAndLog("pass must have 8 HEX symbols"); - return 0; - } - - PrintAndLog("Setting new password %02X%02X%02X%02X for ID 0x%02X", new_pass[0], new_pass[1], new_pass[2], new_pass[3], *pass_id); - - UsbCommand c = {CMD_ISO_15693_SLIX_L_CHANGE_PASS, {*pass_id, 0, 0}}; - - memcpy(&c.arg[1],old_pass,4); - memcpy(&c.arg[2],new_pass,4); - - SendCommand(&c); - return 0; -} - -static int CmdHF15SlixLockPass(const char *Cmd) -{ - char cmdp = param_getchar(Cmd, 0); - uint8_t pass[4] = {0x00}; - uint8_t pass_id[1] = {0x00}; - - if (cmdp == 'h' || cmdp == 'H') { - PrintAndLog("Usage: hf 15 slix_lock_pass "); - PrintAndLog(""); - PrintAndLog(" pass_id 04: privacy, 08: destroy, 10: EAS/AFI"); - PrintAndLog(""); - PrintAndLog(" example: hf 15 slix_lock_pass 04 0F0F0F0F"); - return 0; - } - - if (param_gethex(Cmd, 0, pass_id, 2)) { - PrintAndLog("pass_id must have 2 HEX symbols"); - return 0; - } - if (param_gethex(Cmd, 1, pass, 8)) { - PrintAndLog("pass must have 8 HEX symbols"); - return 0; - } - - PrintAndLog("Locking password %02X%02X%02X%02X for ID 0x%02X", pass[0], pass[1], pass[2], pass[3], *pass_id); - - UsbCommand c = {CMD_ISO_15693_SLIX_L_LOCK_PASS, {*pass_id, 0, 0}}; - - memcpy(&c.arg[1],pass,4); - - SendCommand(&c); - return 0; -} - -static int CmdHF15Bruteforce(const char *Cmd) -{ - char cmdp = param_getchar(Cmd, 0); - uint8_t start_cmd = 0x00; - uint8_t end_cmd = 0x00; - - if (cmdp == 'h' || cmdp == 'H') { - PrintAndLog("Usage: hf 15 brute "); - PrintAndLog(""); - PrintAndLog(" example: hf 15 brute 40 A0"); - return 0; - } - - if (param_gethex(Cmd, 0, &start_cmd, 2)) { - PrintAndLog("start_cmd must have 2 HEX symbols"); - return 0; - } - if (param_gethex(Cmd, 1, &end_cmd, 2)) { - PrintAndLog("end_cmd must have 2 HEX symbols"); - return 0; - } - - PrintAndLog("Scanning commands 0x%02X - 0x%02X", start_cmd, end_cmd); - - UsbCommand c = {CMD_ISO_15693_BRUTE_FORCE, {start_cmd, end_cmd, 0}}; - - SendCommand(&c); - return 0; -} - static int CmdHF15SlixDisablePrivacy(const char *Cmd) { char cmdp = param_getchar(Cmd, 0); @@ -1201,10 +1095,7 @@ static command_t CommandTable15[] = { {"reader", CmdHF15Reader, 0, "Act like an ISO15693 reader"}, {"sim", CmdHF15Sim, 0, "Fake an ISO15693 tag"}, {"cmd", CmdHF15Cmd, 0, "Send direct commands to ISO15693 tag"}, - {"brute", CmdHF15Bruteforce, 0, "Brute force ISO15693 commands"}, {"slix_disable_privacy", CmdHF15SlixDisablePrivacy, 0, "Disable privacy mode on SLIX ISO15693 tag"}, - {"slix_change_pass", CmdHF15SlixChangePass, 0, "Change password of SLIX ISO15693 tag"}, - {"slix_lock_pass", CmdHF15SlixLockPass, 0, "Lock password on SLIX ISO15693 tag"}, {"findafi", CmdHF15Afi, 0, "Brute force AFI of an ISO15693 tag"}, {"dumpmemory", CmdHF15DumpMem, 0, "Read all memory pages of an ISO15693 tag"}, {"csetuid", CmdHF15CSetUID, 0, "Set UID for magic Chinese card"}, diff --git a/include/usb_cmd.h b/include/usb_cmd.h index 6093bd61..6dd00b9f 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -147,9 +147,6 @@ typedef struct { #define CMD_LF_SNOOP_RAW_ADC_SAMPLES 0x0317 #define CMD_CSETUID_ISO_15693 0x0318 #define CMD_ISO_15693_SLIX_L_DISABLE_PRIVACY 0x0319 -#define CMD_ISO_15693_SLIX_L_CHANGE_PASS 0x031A -#define CMD_ISO_15693_SLIX_L_LOCK_PASS 0x031B -#define CMD_ISO_15693_BRUTE_FORCE 0x031C // For Hitag2 transponders #define CMD_SNOOP_HITAG 0x0370