remove commented out code
This commit is contained in:
1 parent
b0125c036e
commit
7fade30465
1 file changed
-122
@@ -6723,128 +6723,6 @@ static int CmdHf14AMfNack(const char *Cmd) {
|
|||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
static int CmdHF14AMfice(const char *Cmd) {
|
|
||||||
CLIParserContext *ctx;
|
|
||||||
CLIParserInit(&ctx, "hf mf ice",
|
|
||||||
"Collect MIFARE Classic nonces to file",
|
|
||||||
"hf mf ice\n"
|
|
||||||
"hf mf ice -f nonces.bin");
|
|
||||||
|
|
||||||
void *argtable[] = {
|
|
||||||
arg_param_begin,
|
|
||||||
arg_str0("f", "file", "<fn>", "filename of nonce dump"),
|
|
||||||
arg_u64_0(NULL, "limit", "<dec>", "nonces to be collected"),
|
|
||||||
arg_param_end
|
|
||||||
};
|
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
||||||
|
|
||||||
int fnlen = 0;
|
|
||||||
char filename[FILE_PATH_SIZE] = {0};
|
|
||||||
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
|
||||||
|
|
||||||
uint32_t limit = arg_get_u32_def(ctx, 2, 50000);
|
|
||||||
|
|
||||||
CLIParserFree(ctx);
|
|
||||||
|
|
||||||
// Validations
|
|
||||||
char *fptr;
|
|
||||||
|
|
||||||
if (filename[0] == '\0') {
|
|
||||||
fptr = GenerateFilename("hf-mf-", "-nonces.bin");
|
|
||||||
if (fptr == NULL)
|
|
||||||
return PM3_EFILE;
|
|
||||||
strncpy(filename, fptr, sizeof(filename) - 1);
|
|
||||||
free(fptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t blockNo = 0;
|
|
||||||
uint8_t keyType = MF_KEY_A;
|
|
||||||
uint8_t trgBlockNo = 0;
|
|
||||||
uint8_t trgKeyType = MF_KEY_B;
|
|
||||||
bool slow = false;
|
|
||||||
bool initialize = true;
|
|
||||||
bool acquisition_completed = false;
|
|
||||||
uint32_t total_num_nonces = 0;
|
|
||||||
PacketResponseNG resp;
|
|
||||||
|
|
||||||
uint32_t part_limit = 3000;
|
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "Collecting "_YELLOW_("%u")" nonces \n", limit);
|
|
||||||
|
|
||||||
FILE *fnonces = NULL;
|
|
||||||
if ((fnonces = fopen(filename, "wb")) == NULL) {
|
|
||||||
PrintAndLogEx(WARNING, "Could not create file " _YELLOW_("%s"), filename);
|
|
||||||
return PM3_EFILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
clearCommandBuffer();
|
|
||||||
|
|
||||||
uint64_t t1 = msclock();
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (kbd_enter_pressed()) {
|
|
||||||
PrintAndLogEx(WARNING, "\naborted via keyboard!\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t flags = 0;
|
|
||||||
flags |= initialize ? 0x0001 : 0;
|
|
||||||
flags |= slow ? 0x0002 : 0;
|
|
||||||
clearCommandBuffer();
|
|
||||||
mf_acquire_nonces_t payload = {
|
|
||||||
.blockno = blockNo,
|
|
||||||
.keytype = keyType,
|
|
||||||
.trg_blockno = trgBlockNo,
|
|
||||||
.trg_keytype = trgKeyType,
|
|
||||||
.flags = flags,
|
|
||||||
};
|
|
||||||
SendCommandNG(CMD_HF_MIFARE_ACQ_NONCES, (uint8_t *)&payload, sizeof(payload));
|
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_ACQ_NONCES, &resp, 3000) == false) {
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (resp.status != PM3_SUCCESS) goto out;
|
|
||||||
if (resp.length < sizeof(mf_nonces_resp_t)) goto out;
|
|
||||||
|
|
||||||
const mf_nonces_resp_t *nresp = (const mf_nonces_resp_t *)resp.data.asBytes;
|
|
||||||
uint32_t items = nresp->num_nonces;
|
|
||||||
fwrite(nresp->nonces, 1, items * 4, fnonces);
|
|
||||||
fflush(fnonces);
|
|
||||||
|
|
||||||
total_num_nonces += items;
|
|
||||||
if (total_num_nonces > part_limit) {
|
|
||||||
PrintAndLogEx(INFO, "Total nonces %u\n", total_num_nonces);
|
|
||||||
part_limit += 3000;
|
|
||||||
}
|
|
||||||
|
|
||||||
acquisition_completed = (total_num_nonces > limit);
|
|
||||||
|
|
||||||
initialize = false;
|
|
||||||
|
|
||||||
} while (!acquisition_completed);
|
|
||||||
|
|
||||||
out:
|
|
||||||
PrintAndLogEx(SUCCESS, "time: %" PRIu64 " seconds\n", (msclock() - t1) / 1000);
|
|
||||||
|
|
||||||
if (fnonces) {
|
|
||||||
fflush(fnonces);
|
|
||||||
fclose(fnonces);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearCommandBuffer();
|
|
||||||
mf_acquire_nonces_t off_payload = {
|
|
||||||
.blockno = blockNo,
|
|
||||||
.keytype = keyType,
|
|
||||||
.trg_blockno = trgBlockNo,
|
|
||||||
.trg_keytype = trgKeyType,
|
|
||||||
.flags = 4,
|
|
||||||
};
|
|
||||||
SendCommandNG(CMD_HF_MIFARE_ACQ_NONCES, (uint8_t *)&off_payload, sizeof(off_payload));
|
|
||||||
return PM3_SUCCESS;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int CmdHF14AMfAuth4(const char *Cmd) {
|
static int CmdHF14AMfAuth4(const char *Cmd) {
|
||||||
uint8_t keyn[20] = {0};
|
uint8_t keyn[20] = {0};
|
||||||
int keynlen = 0;
|
int keynlen = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user