X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/650cd714c4527d6c6d054d12e7202bf3587393d0..dfdbfa0702c77877a5b5b9bdf6dcef2d6b550cdf:/client/cmdhfmf.c?ds=sidebyside diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 99a91ced..36896c89 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -32,6 +32,7 @@ int usage_hf14_mf1ksim(void){ PrintAndLog(" i (Optional) Interactive, means that console will not be returned until simulation finishes or is aborted"); PrintAndLog(" x (Optional) Crack, performs the 'reader attack', nr/ar attack against a legitimate reader, fishes out the key(s)"); PrintAndLog(" e (Optional) Fill simulator keys from what we crack"); + PrintAndLog(" m (Optional) Show maths used for cracking reader. Useful for debugging."); PrintAndLog("samples:"); PrintAndLog(" hf mf sim u 0a0a0a0a"); PrintAndLog(" hf mf sim u 11223344556677"); @@ -1364,7 +1365,7 @@ int CmdHF14AMfChk(const char *Cmd) { #define ATTACK_KEY_COUNT 8 sector *k_sector = NULL; uint8_t k_sectorsCount = 16; -void readerAttack(nonces_t data[], bool setEmulatorMem) { +void readerAttack(nonces_t data[], bool setEmulatorMem, bool showMaths) { // initialize storage for found keys if (k_sector == NULL) @@ -1413,7 +1414,7 @@ void readerAttack(nonces_t data[], bool setEmulatorMem) { } #endif //moebius attack - if (tryMfk32_moebius(data[i+ATTACK_KEY_COUNT], &key)) { + if (tryMfk32_moebius(data[i+ATTACK_KEY_COUNT], &key, showMaths)) { uint8_t sectorNum = data[i+ATTACK_KEY_COUNT].sector; uint8_t keyType = data[i+ATTACK_KEY_COUNT].keytype; @@ -1449,11 +1450,14 @@ int CmdHF14AMf1kSim(const char *Cmd) { uint8_t uid[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; uint8_t exitAfterNReads = 0; uint8_t flags = (FLAG_UID_IN_EMUL | FLAG_4B_UID_IN_DATA); - int uidlen = 0; + int uidlen = 0; bool setEmulatorMem = false; uint8_t cmdp = 0; bool errors = false; + // If set to true, we should show our workings when doing NR_AR_ATTACK. + bool showMaths = false; + while(param_getchar(Cmd, cmdp) != 0x00) { switch(param_getchar(Cmd, cmdp)) { case 'e': @@ -1469,6 +1473,11 @@ int CmdHF14AMf1kSim(const char *Cmd) { flags |= FLAG_INTERACTIVE; cmdp++; break; + case 'm': + case 'M': + showMaths = true; + cmdp++; + break; case 'n': case 'N': exitAfterNReads = param_get8(Cmd, cmdp+1); @@ -1524,7 +1533,7 @@ int CmdHF14AMf1kSim(const char *Cmd) { if ( (resp.arg[0] & 0xffff) != CMD_SIMULATE_MIFARE_CARD ) break; memcpy( data, resp.d.asBytes, sizeof(data) ); - readerAttack(data, setEmulatorMem); + readerAttack(data, setEmulatorMem, showMaths); } if (k_sector != NULL) {