mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 22:23:38 -07:00
added gen1b flag to hf mf cwipe command
This commit is contained in:
parent
657d82f11e
commit
472800e847
4 changed files with 15 additions and 9 deletions
|
@ -1185,9 +1185,14 @@ void MifareCWipe(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain){
|
||||||
// var
|
// var
|
||||||
byte_t isOK = 0;
|
byte_t isOK = 0;
|
||||||
uint32_t numBlocks = arg0;
|
uint32_t numBlocks = arg0;
|
||||||
uint8_t needWipe = arg1;
|
// cmdParams:
|
||||||
uint8_t needFill = arg2;
|
// bit 0 - wipe gen1a
|
||||||
bool gen1b = FALSE;
|
// bit 1 - fill card with default data
|
||||||
|
// bit 2 - gen1a = 0, gen1b = 1
|
||||||
|
uint8_t cmdParams = arg1;
|
||||||
|
bool needWipe = cmdParams & 0x01;
|
||||||
|
bool needFill = cmdParams & 0x02;
|
||||||
|
bool gen1b = cmdParams & 0x04;
|
||||||
|
|
||||||
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE];
|
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE];
|
||||||
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE];
|
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE];
|
||||||
|
|
|
@ -1914,10 +1914,10 @@ int CmdHF14AMfCWipe(const char *Cmd)
|
||||||
if (wipeCard) {
|
if (wipeCard) {
|
||||||
PrintAndLog("WARNING: can't wipe magic card 1b generation");
|
PrintAndLog("WARNING: can't wipe magic card 1b generation");
|
||||||
}
|
}
|
||||||
res = mfCWipe(numBlocks, false, fillCard);
|
res = mfCWipe(numBlocks, true, false, fillCard);
|
||||||
} else {
|
} else {
|
||||||
/* generation 1a magic card by default */
|
/* generation 1a magic card by default */
|
||||||
res = mfCWipe(numBlocks, wipeCard, fillCard);
|
res = mfCWipe(numBlocks, false, wipeCard, fillCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
|
@ -452,9 +452,10 @@ int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, bool wantWipe, uin
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mfCWipe(uint32_t numSectors, bool wantWipe, bool wantFill) {
|
int mfCWipe(uint32_t numSectors, bool gen1b, bool wantWipe, bool wantFill) {
|
||||||
uint8_t isOK = 0;
|
uint8_t isOK = 0;
|
||||||
UsbCommand c = {CMD_MIFARE_CWIPE, {numSectors, wantWipe, wantFill}};
|
uint8_t cmdParams = wantWipe + wantFill * 0x02 + gen1b * 0x04;
|
||||||
|
UsbCommand c = {CMD_MIFARE_CWIPE, {numSectors, cmdParams, 0}};
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
|
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
|
|
|
@ -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(uint32_t numSectors, bool wantWipe, bool wantFill);
|
extern int mfCWipe(uint32_t numSectors, bool gen1b, bool wantWipe, bool wantFill);
|
||||||
extern int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID);
|
extern int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID);
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue