CHG: 'mem load' - the possibility to upload default_iclass_keys.dic, default_keys.dic, default_pwd.dic to predefined flashmemory sections. These will be used in pwd / key checking algorithms on device.

CHG: 'script run read_pwd_mem.lua' - script now can print those uploaded dictionary files.

How to upload
pm3 --> mem load f default_iclass_keys i
pm3 --> mem load f default_keys m
pm3 --> mem load f default_pwd t

How to validate / view
PM3 -->scr run read_pwd_mem -o 237568 -k 8
pm3 -->scr run read_pwd_mem -o 241664 -k 6
pm3 -->scr run read_pwd_mem -o 245760 -k 4
This commit is contained in:
iceman1001 2019-01-01 18:01:40 +01:00
commit 0fb0c35308
9 changed files with 276 additions and 65 deletions

View file

@ -2316,7 +2316,8 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
while (fgetc(f) != '\n' && !feof(f)) {};
//The line start with # is comment, skip
if( buf[0]=='#' ) continue;
if( buf[0]=='#' )
continue;
// doesn't this only test first char only?
if (!isxdigit(buf[0])){
@ -2329,7 +2330,7 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
p = realloc(*keys, 8 * (keyitems += 64));
if (!p) {
PrintAndLogEx(NORMAL, _RED_([!])" cannot allocate memory for default keys");
PrintAndLogEx(ERR, "cannot allocate memory for default keys");
fclose(f);
return 2;
}
@ -2341,7 +2342,7 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
memset(buf, 0, sizeof(buf));
}
fclose(f);
PrintAndLogEx(NORMAL, _BLUE_([+]) "Loaded " _GREEN_(%2d) " keys from %s", *keycnt, filename);
PrintAndLogEx(SUCCESS, "Loaded " _GREEN_(%2d) " keys from %s", *keycnt, filename);
return 0;
}