Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Mar 16, 2024
1 parent 555fe15 commit 59bc927
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 38 deletions.
6 changes: 3 additions & 3 deletions client/src/cmdhfmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2608,14 +2608,14 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
// Add KDF keys...
uint16_t key1_offset = in_keys_len;
uint64_t key1 = 0;

// iceman: todo, need to add all generated keys
mfc_algo_mizip_one(card.uid, 0, MF_KEY_A, &key1);
num_to_bytes(key1, MIFARE_KEY_SIZE, in_keys + key1_offset + (0 * MIFARE_KEY_SIZE));

mfc_algo_di_one(card.uid, 0, MF_KEY_A, &key1);
num_to_bytes(key1, MIFARE_KEY_SIZE, in_keys + key1_offset + (1 * MIFARE_KEY_SIZE));

mfc_algo_sky_one(card.uid, 15, MF_KEY_A, &key1);
num_to_bytes(key1, MIFARE_KEY_SIZE, in_keys + key1_offset + (2 * MIFARE_KEY_SIZE));

Expand Down
36 changes: 18 additions & 18 deletions client/src/cmdlfem4x70.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static void fill_buffer_prng_bytes(void *buffer, size_t byte_count) {
if (byte_count <= 0) {
return;
}

srand((unsigned) time(NULL));
for (size_t i = 0; i < byte_count; i++) {
((uint8_t *)buffer)[i] = (uint8_t)rand();
Expand Down Expand Up @@ -1237,10 +1237,10 @@ static int CmdEM4x70AutoRecover(const char *Cmd) {
return result;
} else if (memcmp(&opts.grn, &tag_grn, sizeof(ID48LIB_GRN)) != 0) {
PrintAndLogEx(FAILED, "Authenticating with new key returned %02x %02x %02x"
, tag_grn.grn.grn[0]
, tag_grn.grn.grn[1]
, tag_grn.grn.grn[2]
);
, tag_grn.grn.grn[0]
, tag_grn.grn.grn[1]
, tag_grn.grn.grn[2]
);
PrintAndLogEx(FAILED, "Expected %s [maybe 5 lsb of key wrong?] ( " _RED_("fail") " )", grn_string);
result = PM3_EWRONGANSWER;
return result;
Expand Down Expand Up @@ -1308,10 +1308,10 @@ static int CmdEM4x70AutoRecover(const char *Cmd) {
return result;
} else {
PrintAndLogEx(INFO, " Found: Partial key in block %d is " _GREEN_("%02X%02X")
, block
, brute.partial_key[0]
, brute.partial_key[1]
);
, block
, brute.partial_key[0]
, brute.partial_key[1]
);
// Save the partial key...
if (block == 9) {
opts.key.k[0] = brute.partial_key[0];
Expand Down Expand Up @@ -1376,15 +1376,15 @@ static int CmdEM4x70AutoRecover(const char *Cmd) {
for (uint8_t idx = 0; idx < data.potential_key_count; ++idx) {
ID48LIB_KEY q = data.potential_keys[idx];
PrintAndLogEx(DEBUG, " Potential Key %d: %s %02X%02X%02X%02X%02X%02X"
, idx
, key_string
, q.k[ 6]
, q.k[ 7]
, q.k[ 8]
, q.k[ 9]
, q.k[10]
, q.k[11]
);
, idx
, key_string
, q.k[ 6]
, q.k[ 7]
, q.k[ 8]
, q.k[ 9]
, q.k[10]
, q.k[11]
);
}
last_successful_step = 5;
}
Expand Down
34 changes: 18 additions & 16 deletions client/src/proxmark3.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,22 @@ static void showBanner_logo(LogoMode mode) {
}

static uint8_t detect_current_lang(void) {
#ifndef _WIN32
const char* lang = setlocale(LC_ALL, "");
if (lang == NULL) {
return 1;
}
if (memcmp(lang, "fr", 2) == 0) {
return 2;
}
if (memcmp(lang, "es", 2) == 0) {
return 3;
}
#endif
#ifndef _WIN32
const char *lang = setlocale(LC_ALL, "");
if (lang == NULL) {
return 1;
}
if (memcmp(lang, "fr", 2) == 0) {
return 2;
}
if (memcmp(lang, "es", 2) == 0) {
return 3;
}
#endif
return 1;
}

static const char* get_quote(void) {
static const char *get_quote(void) {

const char *quotes_en[] = {
"Fund creativity, empower dreams",
Expand Down Expand Up @@ -193,9 +193,11 @@ static const char* get_quote(void) {
int r = rand() % ARRAYLEN(quotes_en);

uint8_t lang = detect_current_lang();
switch(lang) {
case 2: return quotes_fr[r];
case 3: return quotes_es[r];
switch (lang) {
case 2:
return quotes_fr[r];
case 3:
return quotes_es[r];
case 1:
default:
return quotes_en[r];
Expand Down
2 changes: 1 addition & 1 deletion doc/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -12568,6 +12568,6 @@
"metadata": {
"commands_extracted": 725,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2024-03-14T10:14:29"
"extracted_on": "2024-03-16T18:47:48"
}
}

0 comments on commit 59bc927

Please sign in to comment.