make style
This commit is contained in:
1 parent
09b31b5978
commit
a13b1db49f
7 files changed
+85
-41
No files matched your search
@@ -21,7 +21,7 @@ spi = {
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
0x85:{
|
||||
|
||||
+14
-14
@@ -305,7 +305,7 @@ static iclass_config_card_item_t iclass_config_options[33] = {
|
||||
//Sets block 3 of card 0 presented to the reader to 0, sets block 3 of card 1 presented to the reader to the original value of card 0's block 3
|
||||
//Continues setting block 3 of presented cards to block 3 of the previous card the reader scanned
|
||||
//This renders cards unreadable and hardly recoverable unless the order of the scanned cards is known.
|
||||
{"(ELITE Bugger) - Renders cards unusable." , {0x0C, 0x00, 0x00, 0x01, 0x00, 0x00, 0xBF, 0x18, 0xBF, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}},
|
||||
{"(ELITE Bugger) - Renders cards unusable.", {0x0C, 0x00, 0x00, 0x01, 0x00, 0x00, 0xBF, 0x18, 0xBF, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}},
|
||||
//Reset Operations
|
||||
{"(RESET) - Reset READER to defaults", {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
|
||||
{"(RESET) - Reset ENROLLER to defaults", {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF}},
|
||||
@@ -4181,7 +4181,7 @@ static void generate_single_key_block_inverted_opt(const uint8_t *startingKey, u
|
||||
0x95, 0x96, 0x99, 0x9A, 0x9C, 0xA3, 0xA5, 0xA6, 0xA9, 0xAA,
|
||||
0xAC, 0xB1, 0xB2, 0xB4, 0xB8, 0xC3, 0xC5, 0xC6, 0xC9, 0xCA,
|
||||
0xCC, 0xD1, 0xD2, 0xD4, 0xD8, 0xE1, 0xE2, 0xE4, 0xE8, 0xF0
|
||||
};
|
||||
};
|
||||
|
||||
uint8_t binary_endings[8]; // Array to store binary values for each ending bit
|
||||
// Extract each bit from the ending_bits[k] and store it in binary_endings
|
||||
@@ -4226,25 +4226,25 @@ static int CmdHFiClassLegacyRecSim(void) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
HFiClassCalcDivKey(csn, iClass_Key_Table[0], new_div_key, false);
|
||||
memcpy(key,new_div_key,PICOPASS_BLOCK_SIZE);
|
||||
memcpy(key, new_div_key, PICOPASS_BLOCK_SIZE);
|
||||
memcpy(original_key, key, PICOPASS_BLOCK_SIZE);
|
||||
|
||||
uint8_t zero_key[PICOPASS_BLOCK_SIZE] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t zero_key_two[PICOPASS_BLOCK_SIZE] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
int bits_found = -1;
|
||||
uint32_t index = 0;
|
||||
#define MAX_UPDATES 16777216
|
||||
#define MAX_UPDATES 16777216
|
||||
while (bits_found == -1 && index < MAX_UPDATES) {
|
||||
uint8_t genkeyblock[PICOPASS_BLOCK_SIZE];
|
||||
uint8_t xorkeyblock[PICOPASS_BLOCK_SIZE] = {0};
|
||||
|
||||
generate_single_key_block_inverted_opt(zero_key, index, genkeyblock);
|
||||
memcpy(xorkeyblock, genkeyblock, PICOPASS_BLOCK_SIZE);
|
||||
generate_single_key_block_inverted_opt(zero_key, index, genkeyblock);
|
||||
memcpy(xorkeyblock, genkeyblock, PICOPASS_BLOCK_SIZE);
|
||||
|
||||
for (int i = 0; i < 8 ; i++) {
|
||||
key[i] = xorkeyblock[i] ^ original_key[i];
|
||||
memcpy(zero_key_two, xorkeyblock, PICOPASS_BLOCK_SIZE);
|
||||
}
|
||||
for (int i = 0; i < 8 ; i++) {
|
||||
key[i] = xorkeyblock[i] ^ original_key[i];
|
||||
memcpy(zero_key_two, xorkeyblock, PICOPASS_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
// Extract the last 3 bits of the first byte
|
||||
uint8_t last_three_bits = key[0] & 0x07; // 0x07 is 00000111 in binary - bitmask
|
||||
@@ -4255,15 +4255,15 @@ static int CmdHFiClassLegacyRecSim(void) {
|
||||
same_bits = false;
|
||||
}
|
||||
}
|
||||
if (same_bits){
|
||||
if (same_bits) {
|
||||
bits_found = index;
|
||||
PrintAndLogEx(SUCCESS, "Original Key: " _GREEN_("%s"), sprint_hex(original_key, sizeof(original_key)));
|
||||
PrintAndLogEx(SUCCESS, "Weak Key: " _GREEN_("%s"), sprint_hex(key, sizeof(key)));
|
||||
PrintAndLogEx(SUCCESS, "Key Updates Required to Weak Key: " _GREEN_("%d"), index);
|
||||
PrintAndLogEx(SUCCESS, "Estimated Time: ~" _GREEN_("%d")" hours", index/6545);
|
||||
PrintAndLogEx(SUCCESS, "Estimated Time: ~" _GREEN_("%d")" hours", index / 6545);
|
||||
}
|
||||
|
||||
index++;
|
||||
index++;
|
||||
}//end while
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
@@ -4305,7 +4305,7 @@ static int CmdHFiClassLegacyRecover(const char *Cmd) {
|
||||
bool allnight = arg_get_lit(ctx, 6);
|
||||
bool sim = arg_get_lit(ctx, 7);
|
||||
|
||||
if (sim){
|
||||
if (sim) {
|
||||
CmdHFiClassLegacyRecSim();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
+19
-19
@@ -5828,10 +5828,10 @@ out:
|
||||
static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hf mfu incr",
|
||||
"Increment a MIFARE Ultralight Ev1 counter\n"
|
||||
"Will read but not increment counter if NTAG is detected",
|
||||
"hf mfu incr -c 0 -v 1337\n"
|
||||
"hf mfu incr -c 2 -v 0 -p FFFFFFFF");
|
||||
"Increment a MIFARE Ultralight Ev1 counter\n"
|
||||
"Will read but not increment counter if NTAG is detected",
|
||||
"hf mfu incr -c 0 -v 1337\n"
|
||||
"hf mfu incr -c 2 -v 0 -p FFFFFFFF");
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int1("c", "cnt", "<dec>", "Counter index from 0"),
|
||||
@@ -5840,10 +5840,10 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
|
||||
uint8_t counter = arg_get_int_def(ctx, 1, 3);
|
||||
uint32_t value = arg_get_u32_def(ctx, 2, 16777216);
|
||||
|
||||
|
||||
int pwd_len;
|
||||
uint8_t pwd[4] = { 0x00 };
|
||||
CLIGetHexWithReturn(ctx, 3, pwd, &pwd_len);
|
||||
@@ -5855,9 +5855,9 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
||||
if (counter > 2) {
|
||||
PrintAndLogEx(WARNING, "Counter index must be in range 0-2");
|
||||
return PM3_EINVARG;
|
||||
@@ -5866,19 +5866,19 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
PrintAndLogEx(WARNING, "Value to increment must be in range 0-16777215");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
||||
uint8_t increment_cmd[6] = { MIFARE_ULEV1_INCR_CNT, counter, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
increment_cmd[i + 2] = (value >> (8 * i)) & 0xff;
|
||||
}
|
||||
|
||||
|
||||
iso14a_card_select_t card;
|
||||
if (ul_select(&card) == false) {
|
||||
PrintAndLogEx(FAILED, "failed to select card, exiting...");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
uint64_t tagtype = GetHF14AMfU_Type();
|
||||
uint64_t tags_with_counter_ul = MFU_TT_UL_EV1_48 | MFU_TT_UL_EV1_128 | MFU_TT_UL_EV1;
|
||||
uint64_t tags_with_counter_ntag = MFU_TT_NTAG_213 | MFU_TT_NTAG_213_F | MFU_TT_NTAG_213_C | MFU_TT_NTAG_213_TT | MFU_TT_NTAG_215 | MFU_TT_NTAG_216;
|
||||
@@ -5887,14 +5887,14 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
bool is_ntag = (tagtype & tags_with_counter_ntag) != 0;
|
||||
if (is_ntag && (counter != 2)) {
|
||||
PrintAndLogEx(WARNING, "NTAG only has one counter at index 2");
|
||||
DropField();
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
||||
uint8_t pack[4] = { 0, 0, 0, 0 };
|
||||
if (has_key) {
|
||||
if (ulev1_requestAuthentication(pwd, pack, sizeof(pack)) == PM3_EWRONGANSWER) {
|
||||
@@ -5903,7 +5903,7 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t current_counter[3] = { 0, 0, 0 };
|
||||
int len = ulev1_readCounter(counter, current_counter, sizeof(current_counter));
|
||||
if (len != sizeof(current_counter)) {
|
||||
@@ -5914,7 +5914,7 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
uint32_t current_counter_num = current_counter[0] | (current_counter[1] << 8) | (current_counter[2] << 16);
|
||||
PrintAndLogEx(INFO, "Current counter... " _GREEN_("%8d") " - " _GREEN_("%s"), current_counter_num, sprint_hex(current_counter, 3));
|
||||
|
||||
@@ -5930,7 +5930,7 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
uint8_t new_counter[3] = { 0, 0, 0 };
|
||||
int new_len = ulev1_readCounter(counter, new_counter, sizeof(new_counter));
|
||||
if (new_len != sizeof(current_counter)) {
|
||||
@@ -5938,10 +5938,10 @@ static int CmdHF14AMfUIncr(const char *Cmd) {
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
uint32_t new_counter_num = new_counter[0] | (new_counter[1] << 8) | (new_counter[2] << 16);
|
||||
PrintAndLogEx(INFO, "New counter....... " _GREEN_("%8d") " - " _GREEN_("%s"), new_counter_num, sprint_hex(new_counter, 3));
|
||||
|
||||
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ static int CmdLFHitagSDump(const char *Cmd) {
|
||||
|
||||
// read all pages
|
||||
packet.page = 0;
|
||||
packet.page_count = 0;
|
||||
packet.page_count = 0;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_HITAGS_READ, (uint8_t *) &packet, sizeof(packet));
|
||||
|
||||
@@ -428,6 +428,7 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 0, "hf mfu cauth" },
|
||||
{ 0, "hf mfu setpwd" },
|
||||
{ 0, "hf mfu dump" },
|
||||
{ 0, "hf mfu incr" },
|
||||
{ 0, "hf mfu info" },
|
||||
{ 0, "hf mfu ndefread" },
|
||||
{ 0, "hf mfu rdbl" },
|
||||
@@ -677,6 +678,7 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 1, "lf hitag hts list" },
|
||||
{ 0, "lf hitag hts reader" },
|
||||
{ 0, "lf hitag hts rdbl" },
|
||||
{ 0, "lf hitag hts dump" },
|
||||
{ 0, "lf hitag hts wrbl" },
|
||||
{ 0, "lf hitag hts sim" },
|
||||
{ 1, "lf idteck help" },
|
||||
|
||||
Reference in new issue
Block a user