removed printvar

This commit is contained in:
iceman1001 2020-05-14 17:17:47 +02:00
commit bddd2a9fc1
4 changed files with 14 additions and 18 deletions

View file

@ -1078,7 +1078,7 @@ static int CmdHFiClassEncryptBlk(const char *Cmd) {
} else { } else {
iClassEncryptBlkData(blk_data, key); iClassEncryptBlkData(blk_data, key);
} }
printvar("encrypted block", blk_data, 8); PrintAndLogEx(SUCCESS, "encrypted block %s", sprint_hex(blk_data, 8));
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -164,10 +164,6 @@ void printarr(const char *name, uint8_t *arr, int len) {
free(output); free(output);
} }
void printvar(const char *name, uint8_t *arr, int len) {
PrintAndLogEx(INFO, "%s = " _YELLOW_("%s"), name, sprint_hex(arr, len));
}
void printarr_human_readable(const char *title, uint8_t *arr, int len) { void printarr_human_readable(const char *title, uint8_t *arr, int len) {
if (arr == NULL) return; if (arr == NULL) return;

View file

@ -70,6 +70,5 @@ uint8_t reversebytes(uint8_t b);
void reverse_arraybytes(uint8_t *arr, size_t len); void reverse_arraybytes(uint8_t *arr, size_t len);
void reverse_arraycopy(uint8_t *arr, uint8_t *dest, size_t len); void reverse_arraycopy(uint8_t *arr, uint8_t *dest, size_t len);
void printarr(const char *name, uint8_t *arr, int len); void printarr(const char *name, uint8_t *arr, int len);
void printvar(const char *name, uint8_t *arr, int len);
void printarr_human_readable(const char *title, uint8_t *arr, int len); void printarr_human_readable(const char *title, uint8_t *arr, int len);
#endif // CIPHERUTILS_H #endif // CIPHERUTILS_H

View file

@ -221,15 +221,16 @@ void hash2(uint8_t *key64, uint8_t *outp_keytable) {
// Once again, key is on iclass-format // Once again, key is on iclass-format
desencrypt_iclass(key64, key64_negated, z[0]); desencrypt_iclass(key64, key64_negated, z[0]);
// PrintAndLogEx(NORMAL, "\n"); PrintAndLogEx(NORMAL, "High security custom key (Kcus):"); // PrintAndLogEx(NORMAL, "");
// printvar("z0 ", z[0],8); // PrintAndLogEx(INFO, "High security custom key (Kcus):");
// PrintAndLogEx(INFO, "z0 %s", sprint_hex(z[0],8));
uint8_t y[8][8] = {{0}, {0}}; uint8_t y[8][8] = {{0}, {0}};
// y[0]=DES_dec(z[0],~key) // y[0]=DES_dec(z[0],~key)
// Once again, key is on iclass-format // Once again, key is on iclass-format
desdecrypt_iclass(z[0], key64_negated, y[0]); desdecrypt_iclass(z[0], key64_negated, y[0]);
// printvar("y0 ", y[0],8); // PrintAndLogEx(INFO, "y0 %s", sprint_hex(y[0],8));
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
// z [i] = DES dec (rk(K cus , i), z [i1] ) // z [i] = DES dec (rk(K cus , i), z [i1] )
@ -272,9 +273,9 @@ static int _readFromDump(uint8_t dump[], dumpdata *item, uint8_t i) {
memcpy(item, dump + i * itemsize, itemsize); memcpy(item, dump + i * itemsize, itemsize);
if (true) { if (true) {
printvar("csn", item->csn, sizeof(item->csn)); PrintAndLogEx(INFO, "csn %s", sprint_hex(item->csn, sizeof(item->csn)));
printvar("cc_nr", item->cc_nr, sizeof(item->cc_nr)); PrintAndLogEx(INFO, "cc_nr %s", sprint_hex(item->cc_nr, sizeof(item->cc_nr)));
printvar("mac", item->mac, sizeof(item->mac)); PrintAndLogEx(INFO, "mac %s", sprint_hex(item->mac, sizeof(item->mac)));
} }
return 0; return 0;
} }
@ -326,8 +327,8 @@ int bruteforceItem(dumpdata item, uint16_t keytable[]) {
if (numbytes_to_recover > 3) { if (numbytes_to_recover > 3) {
PrintAndLogEx(FAILED, "The CSN requires > 3 byte bruteforce, not supported"); PrintAndLogEx(FAILED, "The CSN requires > 3 byte bruteforce, not supported");
printvar("[-] CSN", item.csn, 8); PrintAndLogEx(INFO, "CSN %s", sprint_hex(item.csn, 8));
printvar("[-] HASH1", key_index, 8); PrintAndLogEx(INFO, "HASH1 %s", sprint_hex(key_index, 8));
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
//Before we exit, reset the 'BEING_CRACKED' to zero //Before we exit, reset the 'BEING_CRACKED' to zero
keytable[bytes_to_recover[0]] &= ~BEING_CRACKED; keytable[bytes_to_recover[0]] &= ~BEING_CRACKED;
@ -400,9 +401,9 @@ int bruteforceItem(dumpdata item, uint16_t keytable[]) {
} }
if (!found) { if (!found) {
PrintAndLogEx(NORMAL, "\n"); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(WARNING, "Failed to recover %d bytes using the following CSN", numbytes_to_recover); PrintAndLogEx(WARNING, "Failed to recover %d bytes using the following CSN", numbytes_to_recover);
printvar("[!] CSN", item.csn, 8); PrintAndLogEx(INFO, "CSN %s", sprint_hex(item.csn, 8));
errors++; errors++;
//Before we exit, reset the 'BEING_CRACKED' to zero //Before we exit, reset the 'BEING_CRACKED' to zero
@ -468,8 +469,8 @@ int calculateMasterKey(uint8_t first16bytes[], uint64_t master_key[]) {
mbedtls_des_crypt_ecb(&ctx_e, key64_negated, result); mbedtls_des_crypt_ecb(&ctx_e, key64_negated, result);
PrintAndLogEx(NORMAL, "\n"); PrintAndLogEx(NORMAL, "\n");
PrintAndLogEx(SUCCESS, "-- High security custom key (Kcus) --"); PrintAndLogEx(SUCCESS, "-- High security custom key (Kcus) --");
printvar("[+] Standard format ", key64_stdformat, 8); PrintAndLogEx(SUCCESS, "Standard format %s", sprint_hex(key64_stdformat, 8));
printvar("[+] iClass format ", key64, 8); PrintAndLogEx(SUCCESS, "iClass format %s", sprint_hex(key64, 8));
if (master_key != NULL) if (master_key != NULL)
memcpy(master_key, key64, 8); memcpy(master_key, key64, 8);