chg: tests with ansi-colors
This commit is contained in:
@@ -2239,7 +2239,7 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
|
|||||||
int keyitems = 0;
|
int keyitems = 0;
|
||||||
|
|
||||||
if ( !(f = fopen( filename , "r")) ) {
|
if ( !(f = fopen( filename , "r")) ) {
|
||||||
PrintAndLog("[!] File: %s: not found or locked.", filename);
|
PrintAndLog(_RED_([!]) " file: %s: not found or locked.", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2255,7 +2255,7 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
|
|||||||
|
|
||||||
// doesn't this only test first char only?
|
// doesn't this only test first char only?
|
||||||
if (!isxdigit(buf[0])){
|
if (!isxdigit(buf[0])){
|
||||||
PrintAndLog("[!] File content error. '%s' must include 16 HEX symbols", buf);
|
PrintAndLog(_RED_([!]) " file content error. '%s' must include 16 HEX symbols", buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2264,7 +2264,7 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
|
|||||||
|
|
||||||
p = realloc(*keys, 8 * (keyitems += 64));
|
p = realloc(*keys, 8 * (keyitems += 64));
|
||||||
if (!p) {
|
if (!p) {
|
||||||
PrintAndLog("[!] Cannot allocate memory for default keys");
|
PrintAndLog(_RED_([!])" cannot allocate memory for default keys");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@@ -2276,7 +2276,7 @@ int LoadDictionaryKeyFile( char* filename, uint8_t **keys, int *keycnt) {
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
PrintAndLog("[+] %s Loaded %2d keys from %s", BLUE_MSG("[+]"), *keycnt, filename);
|
PrintAndLog(_BLUE_([+]) " loaded " _GREEN_(%2d) " keys from %s", *keycnt, filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,11 +139,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || (__APPLE__)
|
#if defined(__linux__) || (__APPLE__)
|
||||||
# define BLUE_MSG(s) "\e[34m" #s "\e[0m"
|
# define _BLUE_(s) "\x1b[34m" #s "\x1b[0m"
|
||||||
#else
|
#else
|
||||||
# define BLUE_MSG(s) #s
|
# define _BLUE_(s) #s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || (__APPLE__)
|
||||||
|
# define _RED_(s) "\x1b[31m" #s "\x1b[0m"
|
||||||
|
#else
|
||||||
|
# define _RED_(s) #s
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || (__APPLE__)
|
||||||
|
# define _GREEN_(s) "\x1b[32m" #s "\x1b[0m"
|
||||||
|
#else
|
||||||
|
# define _GREEN_(s) #s
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || (__APPLE__)
|
||||||
|
# define _YELLOW_(s) "\x1b[33m" #s "\x1b[0m"
|
||||||
|
#else
|
||||||
|
# define _YELLOW_(s) #s
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef DropField
|
#ifndef DropField
|
||||||
#define DropField() { \
|
#define DropField() { \
|
||||||
UsbCommand c = {CMD_READER_ISO_14443a, {0,0,0}}; clearCommandBuffer(); SendCommand(&c); \
|
UsbCommand c = {CMD_READER_ISO_14443a, {0,0,0}}; clearCommandBuffer(); SendCommand(&c); \
|
||||||
|
|||||||
Reference in New Issue
Block a user