make style (excepted cmdhficlass...)

This commit is contained in:
Philippe Teuwen 2019-08-26 22:28:39 +02:00
commit 16a7cfd7b2
9 changed files with 120 additions and 115 deletions

View file

@ -232,8 +232,7 @@ void ReadPCF7931() {
} }
Dbprintf("(dbg) got %d blocks (%d/%d found) (%d tries, %d errors)", n, found_blocks, (max_blocks == 0 ? found_blocks : max_blocks), tries, errors); Dbprintf("(dbg) got %d blocks (%d/%d found) (%d tries, %d errors)", n, found_blocks, (max_blocks == 0 ? found_blocks : max_blocks), tries, errors);
for (i = 0; i < n; ++i) for (i = 0; i < n; ++i) {
{
print_result("got consecutive blocks", tmp_blocks[i], 16); print_result("got consecutive blocks", tmp_blocks[i], 16);
} }

View file

@ -1759,7 +1759,8 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
if (know_target_key == false) { if (know_target_key == false) {
num_to_bytes(e_sector[i].Key[i2], 6, key); num_to_bytes(e_sector[i].Key[i2], 6, key);
know_target_key = true; know_target_key = true;
blockNo = i; keyType = i2; blockNo = i;
keyType = i2;
PrintAndLogEx(SUCCESS, "[ SETTINGS ] The following key will be used for the nested / hardnested attack: sector:" PrintAndLogEx(SUCCESS, "[ SETTINGS ] The following key will be used for the nested / hardnested attack: sector:"
_RED_("%3d") " key type:"_RED_("%c") " key: " _RED_("0x%02x%02x%02x%02x%02x%02x"), _RED_("%3d") " key type:"_RED_("%c") " key: " _RED_("0x%02x%02x%02x%02x%02x%02x"),
blockNo, blockNo,
@ -1808,7 +1809,8 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
// Check if the key is known // Check if the key is known
if (e_sector[i].foundKey[i2] == 0) { if (e_sector[i].foundKey[i2] == 0) {
for (i3 = 0; i3 < key_cnt; i3++) { for (i3 = 0; i3 < key_cnt; i3++) {
printf("."); fflush(stdout); printf(".");
fflush(stdout);
if (mfCheckKeys(FirstBlockOfSector(i), i2, true, 1, (keyBlock + (6 * i3)), &key64) == PM3_SUCCESS) { if (mfCheckKeys(FirstBlockOfSector(i), i2, true, 1, (keyBlock + (6 * i3)), &key64) == PM3_SUCCESS) {
e_sector[i].Key[i2] = bytes_to_num((keyBlock + (6 * i3)), 6); e_sector[i].Key[i2] = bytes_to_num((keyBlock + (6 * i3)), 6);
e_sector[i].foundKey[i2] = 1; e_sector[i].foundKey[i2] = 1;
@ -1818,7 +1820,8 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
} }
} }
} }
printf("\n"); fflush(stdout); printf("\n");
fflush(stdout);
} else { } else {
int chunksize = key_cnt > (PM3_CMD_DATA_SIZE / 6) ? (PM3_CMD_DATA_SIZE / 6) : key_cnt; int chunksize = key_cnt > (PM3_CMD_DATA_SIZE / 6) ? (PM3_CMD_DATA_SIZE / 6) : key_cnt;
bool firstChunk = true, lastChunk = false; bool firstChunk = true, lastChunk = false;
@ -1829,7 +1832,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
if (kbd_enter_pressed()) { if (kbd_enter_pressed()) {
PrintAndLogEx(WARNING, "\naborted via keyboard!\n"); PrintAndLogEx(WARNING, "\naborted via keyboard!\n");
i = key_cnt; strategy = 3; break; // Exit the loop i = key_cnt;
strategy = 3;
break; // Exit the loop
} }
uint32_t size = ((key_cnt - i) > chunksize) ? chunksize : key_cnt - i; uint32_t size = ((key_cnt - i) > chunksize) ? chunksize : key_cnt - i;
// last chunk? // last chunk?
@ -1840,7 +1845,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
firstChunk = false; firstChunk = false;
// all keys, aborted // all keys, aborted
if (res == 0 || res == 2) { if (res == 0 || res == 2) {
i = key_cnt; strategy = 3; break; // Exit the loop i = key_cnt;
strategy = 3;
break; // Exit the loop
} }
} // end chunks of keys } // end chunks of keys
firstChunk = true; firstChunk = true;
@ -1862,7 +1869,8 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
if (know_target_key == false) { if (know_target_key == false) {
num_to_bytes(e_sector[i].Key[i2], 6, key); num_to_bytes(e_sector[i].Key[i2], 6, key);
know_target_key = true; know_target_key = true;
blockNo = i; keyType = i2; blockNo = i;
keyType = i2;
PrintAndLogEx(SUCCESS, "[ SETTINGS ] The following key will be used for the nested / hardnested attack: sector:" PrintAndLogEx(SUCCESS, "[ SETTINGS ] The following key will be used for the nested / hardnested attack: sector:"
_RED_("%3d") " key type:"_RED_("%c") " key: " _RED_("0x%02x%02x%02x%02x%02x%02x"), _RED_("%3d") " key type:"_RED_("%c") " key: " _RED_("0x%02x%02x%02x%02x%02x%02x"),
blockNo, blockNo,

View file

@ -733,13 +733,11 @@ static int searchFinalFile(char **foundpath, const char *pm3dir, const char *sea
if (filename == NULL) return PM3_EMALLOC; if (filename == NULL) return PM3_EMALLOC;
strcpy(filename, searchname); strcpy(filename, searchname);
if (((strlen(filename) > 1) && (filename[0] == '/')) || if (((strlen(filename) > 1) && (filename[0] == '/')) ||
((strlen(filename) > 2) && (filename[0] == '.') && (filename[1] == '/'))) ((strlen(filename) > 2) && (filename[0] == '.') && (filename[1] == '/'))) {
{
if (fileExists(filename)) { if (fileExists(filename)) {
*foundpath = filename; *foundpath = filename;
return PM3_SUCCESS; return PM3_SUCCESS;
} } else {
else {
goto out; goto out;
} }
} }