diff --git a/Firmware/Chameleon-Mini/Application/Reader14443A.c b/Firmware/Chameleon-Mini/Application/Reader14443A.c index 8146ccc..bb5826d 100644 --- a/Firmware/Chameleon-Mini/Application/Reader14443A.c +++ b/Firmware/Chameleon-Mini/Application/Reader14443A.c @@ -683,6 +683,7 @@ uint16_t Reader14443AAppProcess(uint8_t *Buffer, uint16_t BitCount) { return rVal; } + case Reader14443_Clone_MF_Ultralight: case Reader14443_Read_MF_Ultralight: { static uint8_t MFURead_CurrentAdress = 0; static uint8_t MFUContents[64]; @@ -717,18 +718,28 @@ uint16_t Reader14443AAppProcess(uint8_t *Buffer, uint16_t BitCount) { if (MFURead_CurrentAdress == 16) { Selected = false; MFURead_CurrentAdress = 0; - Reader14443CurrentCommand = Reader14443_Do_Nothing; - char tmpBuf[135]; // 135 = 128 hex digits + 3 * \r\n + \0 - BufferToHexString(tmpBuf, 135, MFUContents, 16); - snprintf(tmpBuf + 32, 135 - 32, "\r\n"); - BufferToHexString(tmpBuf + 32 + 2, 135 - 32 - 2, MFUContents + 16, 16); - snprintf(tmpBuf + 32 + 2 + 32, 135 - 32 - 2 - 32, "\r\n"); - BufferToHexString(tmpBuf + 32 + 2 + 32 + 2, 135 - 32 - 2 - 32 - 2, MFUContents + 32, 16); - snprintf(tmpBuf + 32 + 2 + 32 + 2 + 32, 135 - 32 - 2 - 32 - 2 - 32, "\r\n"); - BufferToHexString(tmpBuf + 32 + 2 + 32 + 2 + 32 + 2, 135 - 32 - 2 - 32 - 2 - 32 - 2, MFUContents + 48, 16); - CodecReaderFieldStop(); - CommandLinePendingTaskFinished(COMMAND_INFO_OK_WITH_TEXT_ID, tmpBuf); + if (Reader14443CurrentCommand == Reader14443_Read_MF_Ultralight) { // dump + Reader14443CurrentCommand = Reader14443_Do_Nothing; + char tmpBuf[135]; // 135 = 128 hex digits + 3 * \r\n + \0 + BufferToHexString(tmpBuf, 135, MFUContents, 16); + snprintf(tmpBuf + 32, 135 - 32, "\r\n"); + BufferToHexString(tmpBuf + 32 + 2, 135 - 32 - 2, MFUContents + 16, 16); + snprintf(tmpBuf + 32 + 2 + 32, 135 - 32 - 2 - 32, "\r\n"); + BufferToHexString(tmpBuf + 32 + 2 + 32 + 2, 135 - 32 - 2 - 32 - 2, MFUContents + 32, 16); + snprintf(tmpBuf + 32 + 2 + 32 + 2 + 32, 135 - 32 - 2 - 32 - 2 - 32, "\r\n"); + BufferToHexString(tmpBuf + 32 + 2 + 32 + 2 + 32 + 2, 135 - 32 - 2 - 32 - 2 - 32 - 2, MFUContents + 48, 16); + CodecReaderFieldStop(); + CommandLinePendingTaskFinished(COMMAND_INFO_OK_WITH_TEXT_ID, tmpBuf); + } else { // clone + Reader14443CurrentCommand = Reader14443_Do_Nothing; + CodecReaderFieldStop(); + MemoryUploadBlock(&MFUContents, 0, 64); + CommandLinePendingTaskFinished(COMMAND_INFO_OK_WITH_TEXT_ID, "Card Cloned to Slot"); + ConfigurationSetById(CONFIG_MF_ULTRALIGHT); + MemoryStore(); + SettingsSave(); + } return 0; } Buffer[0] = 0x30; // MiFare Ultralight read command diff --git a/Firmware/Chameleon-Mini/Latest/Chameleon-Mini.hex b/Firmware/Chameleon-Mini/Latest/Chameleon-Mini.hex index 901436e..49d7e50 100644 --- a/Firmware/Chameleon-Mini/Latest/Chameleon-Mini.hex +++ b/Firmware/Chameleon-Mini/Latest/Chameleon-Mini.hex @@ -213,8 +213,8 @@ :100D40002E2068747470733A2F2F67697468756207 :100D50002E636F6D2F656D7365632F4368616D65DD :100D60006C656F6E4D696E6920636F6D6D6974207F -:100D7000255300313931313235003135313131359A -:100D800000342E392E320063383537363936000DAF +:100D7000255300313931323036003135313131359A +:100D800000342E392E320031633862303564000D64 :100D90000A000D0A000D0A000D0A000D0A000D0AD6 :100DA00000643130303A4F4B00000000000000007A :100DB0000000000000000000000000000000000033