mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 05:13:22 -07:00
Add EM410x bruteforcing error checks
This commit is contained in:
parent
50acfd37e2
commit
47af8c5fa9
1 changed files with 108 additions and 108 deletions
|
@ -301,6 +301,7 @@ int usage_lf_em410x_brute(void) {
|
|||
int CmdEM410xBrute(const char *Cmd)
|
||||
{
|
||||
char filename[FILE_PATH_SIZE]={0};
|
||||
FILE *f = NULL;
|
||||
char buf[11];
|
||||
int i, n, j, binary[4], parity[4];
|
||||
|
||||
|
@ -314,14 +315,17 @@ int CmdEM410xBrute(const char *Cmd)
|
|||
param_getdec(Cmd,1, &clock);
|
||||
|
||||
param_getstr(Cmd, 0, filename);
|
||||
PrintAndLog("Filename: %s", filename);
|
||||
|
||||
FILE *f = fopen(filename, "r");
|
||||
|
||||
if(!f) {
|
||||
PrintAndLog("Couldn't open '%s'", Cmd);
|
||||
return 0;
|
||||
if (strlen(filename) > 0) {
|
||||
if ((f = fopen(filename, "r")) == NULL) {
|
||||
PrintAndLog("Error: Could not open IDs file [%s]",filename);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
PrintAndLog("Error: Please specify a filename");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
while( fgets(buf, sizeof(buf), f) ) {
|
||||
msleep(1000);
|
||||
|
@ -341,7 +345,6 @@ int CmdEM410xBrute(const char *Cmd)
|
|||
|
||||
PrintAndLog("Starting simulating UID %02X%02X%02X%02X%02X clock: %d", uid[0],uid[1],uid[2],uid[3],uid[4],clock);
|
||||
|
||||
|
||||
/* clear our graph */
|
||||
ClearGraph(0);
|
||||
|
||||
|
@ -385,15 +388,12 @@ int CmdEM410xBrute(const char *Cmd)
|
|||
|
||||
CmdLFSim("0"); //240 start_gap.
|
||||
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue