mfCWipe works

This commit is contained in:
merlokk 2017-09-20 13:03:33 +03:00
commit ed41fddb4e
3 changed files with 11 additions and 5 deletions

View file

@ -1917,6 +1917,9 @@ int CmdHF14AMfCWipe(const char *Cmd)
cmdp++; cmdp++;
} }
if (!wipeCard & !fillCard)
wipeCard = TRUE;
PrintAndLog("--sectors count:%2d wipe:%c fill:%c", numSectors, (wipeCard)?'y':'n', (fillCard)?'y':'n'); PrintAndLog("--sectors count:%2d wipe:%c fill:%c", numSectors, (wipeCard)?'y':'n', (fillCard)?'y':'n');
if (gen == 2) { if (gen == 2) {

View file

@ -415,10 +415,11 @@ int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount) {
int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) { int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) {
uint8_t isOK = 0; uint8_t isOK = 0;
return 0;
UsbCommand c = {CMD_MIFARE_CGETBLOCK, {params, 0, blockNo}}; UsbCommand c = {CMD_MIFARE_CGETBLOCK, {params, 0, blockNo}};
SendCommand(&c); SendCommand(&c);
UsbCommand resp; UsbCommand resp;
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) { if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
isOK = resp.arg[0] & 0xff; isOK = resp.arg[0] & 0xff;
memcpy(data, resp.d.asBytes, 16); memcpy(data, resp.d.asBytes, 16);
@ -452,14 +453,16 @@ int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, bool wantWipe, uin
return 0; return 0;
} }
int mfCWipe(uint8_t numSectors, bool wantWipe, bool wantSet) { int mfCWipe(uint8_t numSectors, bool wantWipe, bool wantFill) {
UsbCommand c = {CMD_MIFARE_CWIPE, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}}; uint8_t isOK = 0;
UsbCommand c = {CMD_MIFARE_CWIPE, {numSectors, wantWipe, wantFill}};
SendCommand(&c); SendCommand(&c);
UsbCommand resp; UsbCommand resp;
WaitForResponse(CMD_ACK,&resp); WaitForResponse(CMD_ACK,&resp);
isOK = resp.arg[0] & 0xff;
return 0; return isOK;
} }
int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, bool wantWipe, bool wantFill) { int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, bool wantWipe, bool wantFill) {

View file

@ -33,7 +33,7 @@ extern int mfCheckKeys (uint8_t blockNo, uint8_t keyType, bool clear_trace, uint
extern int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount); extern int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount);
extern int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount); extern int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount);
extern int mfCWipe(uint8_t numSectors, bool wantWipe, bool wantSet); extern int mfCWipe(uint8_t numSectors, bool wantWipe, bool wantFill);
extern int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, bool wantWipe, bool wantFill); extern int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, bool wantWipe, bool wantFill);
extern int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, bool wantWipe, uint8_t params); extern int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, bool wantWipe, uint8_t params);
extern int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params); extern int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params);