Added loclass-functionality into the pm3,the functionality provided by loclass can now be invoked directly from the pm3. Also fixed some issues with how prnlog called PrintAndLog, and added some testdata for the loclass self-tests

This commit is contained in:
Martin Holst Swende 2015-01-05 09:16:06 +01:00
commit 6f101995b6
5 changed files with 72 additions and 53 deletions

View file

@ -526,7 +526,7 @@ int bruteforceFile(const char *filename, uint16_t keytable[])
fseek(f, 0, SEEK_SET);
uint8_t *dump = malloc(fsize);
size_t bytes_read = fread(dump, fsize, 1, f);
size_t bytes_read = fread(dump, 1, fsize, f);
fclose(f);
if (bytes_read < fsize)
@ -577,9 +577,18 @@ int _testBruteforce()
**** The 64-bit HS Custom Key Value = 5B7C62C491C11B39 ****
**/
uint16_t keytable[128] = {0};
//save some time...
startvalue = 0x7B0000;
errors |= bruteforceFile("iclass_dump.bin",keytable);
//Test a few variants
if(fileExists("iclass_dump.bin"))
{
errors |= bruteforceFile("iclass_dump.bin",keytable);
}else if(fileExists("loclass/iclass_dump.bin")){
errors |= bruteforceFile("loclass/iclass_dump.bin",keytable);
}else if(fileExists("client/loclass/iclass_dump.bin")){
errors |= bruteforceFile("client/loclass/iclass_dump.bin",keytable);
}else{
prnlog("Error: The file iclass_dump.bin was not found!");
}
}
return errors;
}

View file

@ -57,11 +57,11 @@ int saveFile(const char *preferredName, const char *suffix, const void* data, si
*/
void prnlog(char *fmt, ...)
{
char buffer[2048] = {0};
va_list args;
va_start(args,fmt);
PrintAndLog(fmt, args);
//vprintf(fmt,args);
vsprintf (buffer,fmt, args);
va_end(args);
//printf("\n");
PrintAndLog(buffer);
}

View file

@ -21,4 +21,5 @@ int saveFile(const char *preferredName, const char *suffix, const void* data, si
* @param fmt
*/
void prnlog(char *fmt, ...);
int fileExists(const char *filename);
#endif // FILEUTILS_H

Binary file not shown.