This commit is contained in:
iceman1001 2023-10-15 13:21:16 +02:00
parent 0442e04e05
commit 026cd7d53d
7 changed files with 40 additions and 41 deletions

View file

@ -719,7 +719,7 @@ void I2C_print_status(void) {
Dbprintf(" version................. v%x.%02d ( %s )" Dbprintf(" version................. v%x.%02d ( %s )"
, major , major
, minor , minor
, ( (major == 4) && (minor == 42) ) ? _GREEN_("ok") : _RED_("Outdated") , ((major == 4) && (minor == 42)) ? _GREEN_("ok") : _RED_("Outdated")
); );
} else { } else {
DbpString(" version................. ( " _RED_("fail") " )"); DbpString(" version................. ( " _RED_("fail") " )");

View file

@ -365,7 +365,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
// KEYROLL need to encrypt // KEYROLL need to encrypt
uint8_t key_en[16] = {0}; uint8_t key_en[16] = {0};
uint8_t *keyptr_en = NULL; uint8_t *keyptr_en = NULL;
if (IsCardHelperPresent(false) == false){ if (IsCardHelperPresent(false) == false) {
size_t keylen = 0; size_t keylen = 0;
int res_key = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr_en, &keylen); int res_key = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr_en, &keylen);
if (res_key != PM3_SUCCESS) { if (res_key != PM3_SUCCESS) {
@ -384,13 +384,13 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
PrintAndLogEx(INFO, "Setting up encryption... " NOLF); PrintAndLogEx(INFO, "Setting up encryption... " NOLF);
uint8_t ffs[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t ffs[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
if (IsCardHelperPresent(false) != false){ if (IsCardHelperPresent(false) != false) {
if (Encrypt(ffs, ffs) == false) { if (Encrypt(ffs, ffs) == false) {
PrintAndLogEx(WARNING, "failed to encrypt FF"); PrintAndLogEx(WARNING, "failed to encrypt FF");
} else { } else {
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
} }
}else{ } else {
iclass_encrypt_block_data(ffs, key_en); iclass_encrypt_block_data(ffs, key_en);
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
} }
@ -400,13 +400,13 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
uint8_t lkey[8]; uint8_t lkey[8];
memcpy(lkey, key, sizeof(lkey)); memcpy(lkey, key, sizeof(lkey));
uint8_t enckey1[8]; uint8_t enckey1[8];
if (IsCardHelperPresent(false) != false){ if (IsCardHelperPresent(false) != false) {
if (Encrypt(lkey, enckey1) == false) { if (Encrypt(lkey, enckey1) == false) {
PrintAndLogEx(WARNING, "failed to encrypt key1"); PrintAndLogEx(WARNING, "failed to encrypt key1");
} else { } else {
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
} }
}else{ } else {
iclass_encrypt_block_data(lkey, key_en); iclass_encrypt_block_data(lkey, key_en);
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
} }
@ -416,7 +416,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
memcpy(data + (6 * 8), o->data, sizeof(o->data)); memcpy(data + (6 * 8), o->data, sizeof(o->data));
// encrypted keyroll key 0D // encrypted keyroll key 0D
if (IsCardHelperPresent(false) != false){ if (IsCardHelperPresent(false) != false) {
memcpy(data + (0x0D * 8), enckey1, sizeof(enckey1)); memcpy(data + (0x0D * 8), enckey1, sizeof(enckey1));
} else { } else {
memcpy(data + (0x0D * 8), lkey, sizeof(enckey1)); memcpy(data + (0x0D * 8), lkey, sizeof(enckey1));
@ -432,14 +432,14 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
uint8_t foo[8] = {0x15}; uint8_t foo[8] = {0x15};
memcpy(foo + 1, key, 7); memcpy(foo + 1, key, 7);
uint8_t enckey2[8]; uint8_t enckey2[8];
if (IsCardHelperPresent(false) != false){ if (IsCardHelperPresent(false) != false) {
if (Encrypt(foo, enckey2) == false) { if (Encrypt(foo, enckey2) == false) {
PrintAndLogEx(WARNING, "failed to encrypt partial 1"); PrintAndLogEx(WARNING, "failed to encrypt partial 1");
} else { } else {
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
memcpy(data + (0x14 * 8), enckey2, sizeof(enckey2)); memcpy(data + (0x14 * 8), enckey2, sizeof(enckey2));
} }
}else{ } else {
iclass_encrypt_block_data(foo, key_en); iclass_encrypt_block_data(foo, key_en);
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
memcpy(data + (0x14 * 8), foo, sizeof(enckey2)); memcpy(data + (0x14 * 8), foo, sizeof(enckey2));
@ -449,14 +449,14 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
PrintAndLogEx(INFO, "Setting encrypted partial key15... " NOLF); PrintAndLogEx(INFO, "Setting encrypted partial key15... " NOLF);
memset(foo, 0xFF, sizeof(foo)); memset(foo, 0xFF, sizeof(foo));
foo[0] = lkey[7]; foo[0] = lkey[7];
if (IsCardHelperPresent(false) != false){ if (IsCardHelperPresent(false) != false) {
if (Encrypt(foo, enckey2) == false) { if (Encrypt(foo, enckey2) == false) {
PrintAndLogEx(WARNING, "failed to encrypt partial 2"); PrintAndLogEx(WARNING, "failed to encrypt partial 2");
} else { } else {
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
memcpy(data + (0x15 * 8), enckey2, sizeof(enckey2)); memcpy(data + (0x15 * 8), enckey2, sizeof(enckey2));
} }
}else{ } else {
iclass_encrypt_block_data(foo, key_en); iclass_encrypt_block_data(foo, key_en);
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
memcpy(data + (0x15 * 8), foo, sizeof(enckey2)); memcpy(data + (0x15 * 8), foo, sizeof(enckey2));

View file

@ -3178,10 +3178,10 @@
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-b, --blk <dec> block number", "--blk <dec> block number",
"-d, --data <hex> bytes to write, 8 hex bytes" "-d, --data <hex> bytes to write, 8 hex bytes"
], ],
"usage": "hf iclass esetblk [-h] -b <dec> [-d <hex>]" "usage": "hf iclass esetblk [-h] --blk <dec> [-d <hex>]"
}, },
"hf iclass eview": { "hf iclass eview": {
"command": "hf iclass eview", "command": "hf iclass eview",
@ -3309,16 +3309,16 @@
"command": "hf iclass rdbl", "command": "hf iclass rdbl",
"description": "Read a iCLASS block from tag", "description": "Read a iCLASS block from tag",
"notes": [ "notes": [
"hf iclass rdbl -b 6 -k 0011223344556677", "hf iclass rdbl --blk 6 -k 0011223344556677",
"hf iclass rdbl -b 27 -k 0011223344556677 --credit", "hf iclass rdbl --blk 27 -k 0011223344556677 --credit",
"hf iclass rdbl -b 10 --ki 0" "hf iclass rdbl --blk 10 --ki 0"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-k, --key <hex> Access key as 8 hex bytes", "-k, --key <hex> Access key as 8 hex bytes",
"--ki <dec> Key index to select key from memory 'hf iclass managekeys'", "--ki <dec> Key index to select key from memory 'hf iclass managekeys'",
"-b, --block <dec> The block number to read", "--blk <dec> Block number",
"--credit key is assumed to be the credit key", "--credit key is assumed to be the credit key",
"--elite elite computations applied to key", "--elite elite computations applied to key",
"--raw no computations applied to key", "--raw no computations applied to key",
@ -3326,7 +3326,7 @@
"-v, --verbose verbose output", "-v, --verbose verbose output",
"--shallow use shallow (ASK) reader modulation instead of OOK" "--shallow use shallow (ASK) reader modulation instead of OOK"
], ],
"usage": "hf iclass rdbl [-hv] [-k <hex>] [--ki <dec>] -b <dec> [--credit] [--elite] [--raw] [--nr] [--shallow]" "usage": "hf iclass rdbl [-hv] [-k <hex>] [--ki <dec>] --blk <dec> [--credit] [--elite] [--raw] [--nr] [--shallow]"
}, },
"hf iclass reader": { "hf iclass reader": {
"command": "hf iclass reader", "command": "hf iclass reader",
@ -3368,17 +3368,16 @@
}, },
"hf iclass sam": { "hf iclass sam": {
"command": "hf iclass sam", "command": "hf iclass sam",
"description": "Manage via SAM", "description": "Extract PACS via a HID SAM",
"notes": [ "notes": [
"hf iclass sam" "hf iclass sam"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-d, --data <hex> data",
"-v, --verbose verbose output" "-v, --verbose verbose output"
], ],
"usage": "hf iclass sam [-hv] [-d <hex>]" "usage": "hf iclass sam [-hv]"
}, },
"hf iclass sim": { "hf iclass sim": {
"command": "hf iclass sim", "command": "hf iclass sim",
@ -3437,16 +3436,16 @@
"command": "hf iclass wrbl", "command": "hf iclass wrbl",
"description": "Write data to an iCLASS tag", "description": "Write data to an iCLASS tag",
"notes": [ "notes": [
"hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B", "hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B",
"hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B --credit", "hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B --credit",
"hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA --ki 0" "hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA --ki 0"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-k, --key <hex> Access key as 8 hex bytes", "-k, --key <hex> Access key as 8 hex bytes",
"--ki <dec> Key index to select key from memory 'hf iclass managekeys'", "--ki <dec> Key index to select key from memory 'hf iclass managekeys'",
"-b, --block <dec> The block number to read", "--blk <dec> block number",
"-d, --data <hex> data to write as 8 hex bytes", "-d, --data <hex> data to write as 8 hex bytes",
"-m, --mac <hex> replay mac data (4 hex bytes)", "-m, --mac <hex> replay mac data (4 hex bytes)",
"--credit key is assumed to be the credit key", "--credit key is assumed to be the credit key",
@ -3456,7 +3455,7 @@
"-v, --verbose verbose output", "-v, --verbose verbose output",
"--shallow use shallow (ASK) reader modulation instead of OOK" "--shallow use shallow (ASK) reader modulation instead of OOK"
], ],
"usage": "hf iclass wrbl [-hv] [-k <hex>] [--ki <dec>] -b <dec> -d <hex> [-m <hex>] [--credit] [--elite] [--raw] [--nr] [--shallow]" "usage": "hf iclass wrbl [-hv] [-k <hex>] [--ki <dec>] --blk <dec> -d <hex> [-m <hex>] [--credit] [--elite] [--raw] [--nr] [--shallow]"
}, },
"hf jooki clone": { "hf jooki clone": {
"command": "hf jooki clone", "command": "hf jooki clone",
@ -3951,15 +3950,15 @@
"command": "hf lto wrbl", "command": "hf lto wrbl",
"description": "Write data to block on LTO tag", "description": "Write data to block on LTO tag",
"notes": [ "notes": [
"hf lto wrbl --block 128 -d 0001020304050607080910111213141516171819202122232425262728293031" "hf lto wrbl --blk 128 -d 0001020304050607080910111213141516171819202122232425262728293031"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-d, --data <hex> 32 bytes of data to write (64 hex symbols, no spaces)", "-d, --data <hex> 32 bytes of data to write (64 hex symbols, no spaces)",
"--block <dec> The block number to write to as an integer" "--blk <dec> The block number to write to as an integer"
], ],
"usage": "hf lto wrbl [-h] -d <hex> --block <dec>" "usage": "hf lto wrbl [-h] -d <hex> --blk <dec>"
}, },
"hf mf acl": { "hf mf acl": {
"command": "hf mf acl", "command": "hf mf acl",
@ -11857,6 +11856,6 @@
"metadata": { "metadata": {
"commands_extracted": 687, "commands_extracted": 687,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-10-12T12:53:10" "extracted_on": "2023-10-15T11:21:02"
} }
} }