mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
less global vars
This commit is contained in:
parent
b6077df68e
commit
d234e2a8f5
4 changed files with 14 additions and 13 deletions
|
@ -438,6 +438,8 @@ int CmdHF14ASim(const char *Cmd) {
|
||||||
bool setEmulatorMem = false;
|
bool setEmulatorMem = false;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
|
sector_t *k_sector = NULL;
|
||||||
|
uint8_t k_sectorsCount = 40;
|
||||||
|
|
||||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||||
|
@ -521,7 +523,7 @@ int CmdHF14ASim(const char *Cmd) {
|
||||||
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK) break;
|
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK) break;
|
||||||
|
|
||||||
nonces_t *data = (nonces_t *)resp.data.asBytes;
|
nonces_t *data = (nonces_t *)resp.data.asBytes;
|
||||||
readerAttack(data[0], setEmulatorMem, verbose);
|
readerAttack(k_sector, k_sectorsCount, data[0], setEmulatorMem, verbose);
|
||||||
|
|
||||||
keypress = kbd_enter_pressed();
|
keypress = kbd_enter_pressed();
|
||||||
}
|
}
|
||||||
|
@ -532,7 +534,7 @@ int CmdHF14ASim(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.status == PM3_EOPABORTED && ((flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK))
|
if (resp.status == PM3_EOPABORTED && ((flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK))
|
||||||
showSectorTable();
|
showSectorTable(k_sector, k_sectorsCount);
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Done");
|
PrintAndLogEx(INFO, "Done");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
|
@ -3129,10 +3129,7 @@ out:
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
sector_t *k_sector = NULL;
|
void showSectorTable(sector_t *k_sector, uint8_t k_sectorsCount) {
|
||||||
uint8_t k_sectorsCount = 40;
|
|
||||||
|
|
||||||
void showSectorTable(void) {
|
|
||||||
if (k_sector != NULL) {
|
if (k_sector != NULL) {
|
||||||
printKeyTable(k_sectorsCount, k_sector);
|
printKeyTable(k_sectorsCount, k_sector);
|
||||||
free(k_sector);
|
free(k_sector);
|
||||||
|
@ -3140,7 +3137,7 @@ void showSectorTable(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void readerAttack(nonces_t data, bool setEmulatorMem, bool verbose) {
|
void readerAttack(sector_t *k_sector, uint8_t k_sectorsCount, nonces_t data, bool setEmulatorMem, bool verbose) {
|
||||||
|
|
||||||
uint64_t key = 0;
|
uint64_t key = 0;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -3196,6 +3193,8 @@ static int CmdHF14AMfSim(const char *Cmd) {
|
||||||
nonces_t data[1];
|
nonces_t data[1];
|
||||||
char csize[13] = { 0 };
|
char csize[13] = { 0 };
|
||||||
char uidsize[8] = { 0 };
|
char uidsize[8] = { 0 };
|
||||||
|
sector_t *k_sector = NULL;
|
||||||
|
uint8_t k_sectorsCount = 40;
|
||||||
|
|
||||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||||
|
@ -3343,9 +3342,9 @@ static int CmdHF14AMfSim(const char *Cmd) {
|
||||||
if ((resp.oldarg[0] & 0xffff) != CMD_HF_MIFARE_SIMULATE) break;
|
if ((resp.oldarg[0] & 0xffff) != CMD_HF_MIFARE_SIMULATE) break;
|
||||||
|
|
||||||
memcpy(data, resp.data.asBytes, sizeof(data));
|
memcpy(data, resp.data.asBytes, sizeof(data));
|
||||||
readerAttack(data[0], setEmulatorMem, verbose);
|
readerAttack(k_sector, k_sectorsCount, data[0], setEmulatorMem, verbose);
|
||||||
}
|
}
|
||||||
showSectorTable();
|
showSectorTable(k_sector, k_sectorsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
k_sectorsCount = MIFARE_4K_MAXSECTOR;
|
k_sectorsCount = MIFARE_4K_MAXSECTOR;
|
||||||
|
|
|
@ -19,8 +19,8 @@ int CmdHFMF(const char *Cmd);
|
||||||
int CmdHF14AMfELoad(const char *Cmd); // used by cmd hf mfu eload
|
int CmdHF14AMfELoad(const char *Cmd); // used by cmd hf mfu eload
|
||||||
int CmdHF14AMfDbg(const char *Cmd); // used by cmd hf mfu dbg
|
int CmdHF14AMfDbg(const char *Cmd); // used by cmd hf mfu dbg
|
||||||
|
|
||||||
void showSectorTable(void);
|
void showSectorTable(sector_t *k_sector, uint8_t k_sectorsCount);
|
||||||
void readerAttack(nonces_t data, bool setEmulatorMem, bool verbose);
|
void readerAttack(sector_t *k_sector, uint8_t k_sectorsCount, nonces_t data, bool setEmulatorMem, bool verbose);
|
||||||
void printKeyTable(uint8_t sectorscnt, sector_t *e_sector);
|
void printKeyTable(uint8_t sectorscnt, sector_t *e_sector);
|
||||||
void printKeyTableEx(uint8_t sectorscnt, sector_t *e_sector, uint8_t start_sector);
|
void printKeyTableEx(uint8_t sectorscnt, sector_t *e_sector, uint8_t start_sector);
|
||||||
void printKeyTable_fast(uint8_t sectorscnt, icesector_t *e_sector, uint64_t bar, uint64_t foo);
|
void printKeyTable_fast(uint8_t sectorscnt, icesector_t *e_sector, uint64_t bar, uint64_t foo);
|
||||||
|
|
|
@ -234,8 +234,8 @@ int CmdsParse(const command_t Commands[], const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
char pparent[512] = {0};
|
static char pparent[512] = {0};
|
||||||
char *parent = pparent;
|
static char *parent = pparent;
|
||||||
|
|
||||||
void dumpCommandsRecursive(const command_t cmds[], int markdown) {
|
void dumpCommandsRecursive(const command_t cmds[], int markdown) {
|
||||||
if (cmds[0].Name == NULL) return;
|
if (cmds[0].Name == NULL) return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue