mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
style
This commit is contained in:
+1
-1
@@ -2395,7 +2395,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
base = NULL;
|
||||
// Boundary check against end of addressable space.
|
||||
if (offset > 0)
|
||||
count=MIN(count, -offset);
|
||||
count = MIN(count, -offset);
|
||||
}
|
||||
|
||||
if (isok) {
|
||||
|
||||
+9
-9
@@ -328,24 +328,24 @@ uint32_t flash_size_from_cidr(uint32_t cidr) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 8*1024;
|
||||
return 8 * 1024;
|
||||
case 2:
|
||||
return 16*1024;
|
||||
return 16 * 1024;
|
||||
case 3:
|
||||
return 32*1024;
|
||||
return 32 * 1024;
|
||||
case 5:
|
||||
return 64*1024;
|
||||
return 64 * 1024;
|
||||
case 7:
|
||||
return 128*1024;
|
||||
return 128 * 1024;
|
||||
case 9:
|
||||
return 256*1024;
|
||||
return 256 * 1024;
|
||||
case 10:
|
||||
return 512*1024;
|
||||
return 512 * 1024;
|
||||
case 12:
|
||||
return 1024*1024;
|
||||
return 1024 * 1024;
|
||||
case 14:
|
||||
default: // for 'reserved' values, guess 2MB
|
||||
return 2048*1024;
|
||||
return 2048 * 1024;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -95,24 +95,24 @@ static uint32_t flash_size_from_cidr(uint32_t cidr) {
|
||||
case 0:
|
||||
return 0;
|
||||
case 1:
|
||||
return 8*1024;
|
||||
return 8 * 1024;
|
||||
case 2:
|
||||
return 16*1024;
|
||||
return 16 * 1024;
|
||||
case 3:
|
||||
return 32*1024;
|
||||
return 32 * 1024;
|
||||
case 5:
|
||||
return 64*1024;
|
||||
return 64 * 1024;
|
||||
case 7:
|
||||
return 128*1024;
|
||||
return 128 * 1024;
|
||||
case 9:
|
||||
return 256*1024;
|
||||
return 256 * 1024;
|
||||
case 10:
|
||||
return 512*1024;
|
||||
return 512 * 1024;
|
||||
case 12:
|
||||
return 1024*1024;
|
||||
return 1024 * 1024;
|
||||
case 14:
|
||||
default: // for 'reserved' values, guess 2MB
|
||||
return 2048*1024;
|
||||
return 2048 * 1024;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ static void UsbPacketReceived(uint8_t *packet) {
|
||||
base = NULL;
|
||||
// Boundary check against end of addressable space.
|
||||
if (offset > 0)
|
||||
count=MIN(count, -offset);
|
||||
count = MIN(count, -offset);
|
||||
}
|
||||
|
||||
if (isok) {
|
||||
|
||||
@@ -3690,7 +3690,7 @@ static int CmdCryptography(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
} else {
|
||||
if (datilen % 16 != 0 && ((type & 0x2) >>1==0)) {
|
||||
if (datilen % 16 != 0 && ((type & 0x2) >> 1 == 0)) {
|
||||
PrintAndLogEx(ERR, "<data> length must be a multiple of 16. Got %d", datilen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
+14
-14
@@ -793,24 +793,24 @@ static void print_sr_blocks(uint8_t *data, size_t len, const uint8_t *uid, bool
|
||||
|
||||
if (in_repeated_block == false) {
|
||||
PrintAndLogEx(INFO,
|
||||
"%3d/0x%02X | %s| %s | %s",
|
||||
i,
|
||||
i,
|
||||
sprint_hex(data + (i * ST25TB_SR_BLOCK_SIZE), ST25TB_SR_BLOCK_SIZE),
|
||||
get_st_lock_info(chipid, systemblock, i),
|
||||
sprint_ascii(data + (i * ST25TB_SR_BLOCK_SIZE), ST25TB_SR_BLOCK_SIZE)
|
||||
);
|
||||
"%3d/0x%02X | %s| %s | %s",
|
||||
i,
|
||||
i,
|
||||
sprint_hex(data + (i * ST25TB_SR_BLOCK_SIZE), ST25TB_SR_BLOCK_SIZE),
|
||||
get_st_lock_info(chipid, systemblock, i),
|
||||
sprint_ascii(data + (i * ST25TB_SR_BLOCK_SIZE), ST25TB_SR_BLOCK_SIZE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO,
|
||||
"%3d/0x%02X | %s| %s | %s",
|
||||
0xFF,
|
||||
0xFF,
|
||||
sprint_hex(systemblock, ST25TB_SR_BLOCK_SIZE),
|
||||
get_st_lock_info(chipid, systemblock, 0xFF),
|
||||
sprint_ascii(systemblock, ST25TB_SR_BLOCK_SIZE)
|
||||
);
|
||||
"%3d/0x%02X | %s| %s | %s",
|
||||
0xFF,
|
||||
0xFF,
|
||||
sprint_hex(systemblock, ST25TB_SR_BLOCK_SIZE),
|
||||
get_st_lock_info(chipid, systemblock, 0xFF),
|
||||
sprint_ascii(systemblock, ST25TB_SR_BLOCK_SIZE)
|
||||
);
|
||||
|
||||
print_footer();
|
||||
}
|
||||
|
||||
+12
-12
@@ -2065,7 +2065,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) {
|
||||
if (len > -1) {
|
||||
has_auth_key = true;
|
||||
ak_len = 4;
|
||||
memcpy(authenticationkey, key, 4);
|
||||
memcpy(authenticationkey, key, 4);
|
||||
PrintAndLogEx(SUCCESS, "Found password... " _GREEN_("%s") " pack... " _GREEN_("%02X%02X"), sprint_hex_inrow(key, 4), pack[0], pack[1]);
|
||||
goto out;
|
||||
}
|
||||
@@ -2080,7 +2080,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) {
|
||||
if (len > -1) {
|
||||
has_auth_key = true;
|
||||
ak_len = 4;
|
||||
memcpy(authenticationkey, key, 4);
|
||||
memcpy(authenticationkey, key, 4);
|
||||
PrintAndLogEx(SUCCESS, "Found password... " _GREEN_("%s") " pack... " _GREEN_("%02X%02X"), sprint_hex_inrow(key, 4), pack[0], pack[1]);
|
||||
goto out;
|
||||
}
|
||||
@@ -2095,7 +2095,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) {
|
||||
if (len > -1) {
|
||||
has_auth_key = true;
|
||||
ak_len = 4;
|
||||
memcpy(authenticationkey, key, 4);
|
||||
memcpy(authenticationkey, key, 4);
|
||||
PrintAndLogEx(SUCCESS, "Found password... " _GREEN_("%s") " pack... " _GREEN_("%02X%02X"), sprint_hex_inrow(key, 4), pack[0], pack[1]);
|
||||
goto out;
|
||||
}
|
||||
@@ -2110,7 +2110,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) {
|
||||
if (len > -1) {
|
||||
has_auth_key = true;
|
||||
ak_len = 4;
|
||||
memcpy(authenticationkey, key, 4);
|
||||
memcpy(authenticationkey, key, 4);
|
||||
PrintAndLogEx(SUCCESS, "Found password... " _GREEN_("%s") " pack... " _GREEN_("%02X%02X"), sprint_hex_inrow(key, 4), pack[0], pack[1]);
|
||||
break;
|
||||
} else {
|
||||
@@ -2566,12 +2566,12 @@ void printMFUdumpEx(mfu_dump_t *card, uint16_t pages, uint8_t startpage, bool de
|
||||
|
||||
if (in_repeated_block == false) {
|
||||
PrintAndLogEx(INFO, "%3d/0x%02X | %s| %s | %s"
|
||||
, i + startpage
|
||||
, i + startpage
|
||||
, sprint_hex(data + i * 4, 4)
|
||||
, (lckbit) ? _RED_("1") : "0"
|
||||
, sprint_ascii(data + i * 4, 4)
|
||||
);
|
||||
, i + startpage
|
||||
, i + startpage
|
||||
, sprint_hex(data + i * 4, 4)
|
||||
, (lckbit) ? _RED_("1") : "0"
|
||||
, sprint_ascii(data + i * 4, 4)
|
||||
);
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(INFO, "---------------------------------");
|
||||
@@ -3010,7 +3010,7 @@ static int CmdHF14AMfURestore(const char *Cmd) {
|
||||
arg_lit0("e", NULL, "enable special write version/signature -MAGIC NTAG 21* ONLY-"),
|
||||
arg_lit0("r", NULL, "use password found in dumpfile to configure tag. Requires " _YELLOW_("'-e'") " parameter to work"),
|
||||
arg_lit0("v", "verbose", "verbose output"),
|
||||
arg_lit0("z", "dense", "dense dump output style"),
|
||||
arg_lit0("z", "dense", "dense dump output style"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
@@ -4797,7 +4797,7 @@ static int CmdHF14AMfuView(const char *Cmd) {
|
||||
arg_param_begin,
|
||||
arg_str1("f", "file", "<fn>", "Specify a filename for dump file"),
|
||||
arg_lit0("v", "verbose", "Verbose output"),
|
||||
arg_lit0("z", "dense", "dense dump output style"),
|
||||
arg_lit0("z", "dense", "dense dump output style"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
+16
-16
@@ -466,26 +466,26 @@ static void xerox_print(uint8_t *data, uint16_t datalen, bool dense_output) {
|
||||
(memcmp(blk, blk - XEROX_BLOCK_SIZE, XEROX_BLOCK_SIZE) == 0) &&
|
||||
(memcmp(blk, blk + XEROX_BLOCK_SIZE, XEROX_BLOCK_SIZE) == 0) &&
|
||||
(memcmp(blk, blk + (XEROX_BLOCK_SIZE * 2), XEROX_BLOCK_SIZE) == 0)
|
||||
) {
|
||||
) {
|
||||
// we're in a user block that isn't the first user block nor last two user blocks,
|
||||
// and the current block data is the same as the previous and next two block
|
||||
in_repeated_block = true;
|
||||
PrintAndLogEx(INFO, " ......");
|
||||
} else if (in_repeated_block &&
|
||||
(memcmp(blk, blk + XEROX_BLOCK_SIZE, XEROX_BLOCK_SIZE) || i == blockno)
|
||||
) {
|
||||
(memcmp(blk, blk + XEROX_BLOCK_SIZE, XEROX_BLOCK_SIZE) || i == blockno)
|
||||
) {
|
||||
// in a repeating block, but the next block doesn't match anymore, or we're at the end block
|
||||
in_repeated_block = false;
|
||||
}
|
||||
|
||||
if (in_repeated_block == false) {
|
||||
PrintAndLogEx(INFO,
|
||||
"%3d/0x%02X | %s | %s",
|
||||
i,
|
||||
i,
|
||||
sprint_hex(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE),
|
||||
sprint_ascii(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE)
|
||||
);
|
||||
"%3d/0x%02X | %s | %s",
|
||||
i,
|
||||
i,
|
||||
sprint_hex(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE),
|
||||
sprint_ascii(data + (i * XEROX_BLOCK_SIZE), XEROX_BLOCK_SIZE)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -503,7 +503,7 @@ typedef struct {
|
||||
|
||||
//Toner related details
|
||||
const char *color; // cyan, magenta, gold, silver, clear, white, fluo
|
||||
|
||||
|
||||
const char *region; // DMO, WW, NA/ESG (NA - North America, MNA - Metred North America, DMO - Developing Markets, XE - Europe
|
||||
const char *ms; // sold, metered
|
||||
|
||||
@@ -560,7 +560,7 @@ static const xerox_part_t xerox_part_mappings[] = {
|
||||
static const xerox_part_t *get_xerox_part_info(const char *pn) {
|
||||
for (int i = 0; i < ARRAYLEN(xerox_part_mappings); i++) {
|
||||
// Todo: make str_startswith, accept additional "Maximum number of characters to compare"
|
||||
if(strncmp(pn, xerox_part_mappings[i].partnumber, strlen(pn)-3) == 0){
|
||||
if (strncmp(pn, xerox_part_mappings[i].partnumber, strlen(pn) - 3) == 0) {
|
||||
return &xerox_part_mappings[i];
|
||||
}
|
||||
}
|
||||
@@ -605,20 +605,20 @@ static void xerox_print_info(uint8_t *d) {
|
||||
PrintAndLogEx(SUCCESS, " PartNo....... " _YELLOW_("%s"), pn);
|
||||
PrintAndLogEx(SUCCESS, " Date......... %02d.%02d.%02d", d[8], d[9], d[10]);
|
||||
PrintAndLogEx(SUCCESS, " Serial....... %d", (d[14] << 16) | (d[13] << 8) | d[12]);
|
||||
PrintAndLogEx(SUCCESS, " Type......... %s", (d[18] <= 4) ? xerox_c_type[d[18]] : "Unknown");
|
||||
PrintAndLogEx(SUCCESS, " Type......... %s", (d[18] <= 4) ? xerox_c_type[d[18]] : "Unknown");
|
||||
|
||||
const xerox_part_t *item = get_xerox_part_info(pn);
|
||||
if (strlen(item->partnumber) > 0) {
|
||||
|
||||
if(strcmp(xerox_c_type[d[18]], "drum") == 0) {
|
||||
if (strcmp(xerox_c_type[d[18]], "drum") == 0) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, " Consumable... drum");
|
||||
PrintAndLogEx(SUCCESS, " Slots........ %s", item->r); // Interchangeability
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, " Consumable... toner");
|
||||
PrintAndLogEx(SUCCESS, " Region....... %s", item->region);
|
||||
PrintAndLogEx(SUCCESS, " Region....... %s", item->region);
|
||||
PrintAndLogEx(SUCCESS, " M/s.......... %s", item->ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ static int CmdHFXeroxDump(const char *Cmd) {
|
||||
arg_lit0("d", "decrypt", "decrypt secret blocks"),
|
||||
arg_lit0(NULL, "ns", "no save to file"),
|
||||
arg_lit0("v", "verbose", "verbose output"),
|
||||
arg_lit0("z", "dense", "dense dump output style"),
|
||||
arg_lit0("z", "dense", "dense dump output style"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
+2
-2
@@ -656,7 +656,7 @@ static int CmdReadmem(const char *Cmd) {
|
||||
bool save_to_file = fnlen > 0;
|
||||
|
||||
// default len to 512KB when saving to file, to 32 bytes when viewing on the console.
|
||||
uint32_t default_len = save_to_file ? 512*1024 : 32;
|
||||
uint32_t default_len = save_to_file ? 512 * 1024 : 32;
|
||||
|
||||
uint32_t address = arg_get_u32_def(ctx, 1, 0);
|
||||
uint32_t len = arg_get_u32_def(ctx, 2, default_len);
|
||||
@@ -672,7 +672,7 @@ static int CmdReadmem(const char *Cmd) {
|
||||
|
||||
const char *flash_str = raw ? "" : " flash";
|
||||
PrintAndLogEx(INFO, "reading "_YELLOW_("%u")" bytes from processor%s memory",
|
||||
len, flash_str);
|
||||
len, flash_str);
|
||||
|
||||
DeviceMemType_t type = raw ? MCU_MEM : MCU_FLASH;
|
||||
if (!GetFromDevice(type, buffer, len, address, NULL, 0, NULL, -1, true)) {
|
||||
|
||||
@@ -2203,9 +2203,9 @@ mfu_df_e detect_mfu_dump_format(uint8_t **dump, bool verbose) {
|
||||
retval = MFU_DF_NEWBIN;
|
||||
}
|
||||
|
||||
// Memory layout is different for NTAG I2C 1K/2K plus
|
||||
// Memory layout is different for NTAG I2C 1K/2K plus
|
||||
// Sak 00, atqa 44 00
|
||||
if (0 == new->data[7] && 0x44 == new->data[8] && 0x00 == new->data[9] ) {
|
||||
if (0 == new->data[7] && 0x44 == new->data[8] && 0x00 == new->data[9]) {
|
||||
retval = MFU_DF_NEWBIN;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 0, "data bitsamples" },
|
||||
{ 1, "data bmap" },
|
||||
{ 1, "data clear" },
|
||||
{ 1, "data crypto" },
|
||||
{ 1, "data diff" },
|
||||
{ 0, "data hexsamples" },
|
||||
{ 1, "data hex2bin" },
|
||||
|
||||
@@ -724,16 +724,15 @@ static int dumpmem_pm3(char *serial_port_name, const char *filename, uint32_t ad
|
||||
if (in_bootloader) {
|
||||
if ((dev_info & DEVICE_INFO_FLAG_UNDERSTANDS_READ_MEM) != 0) {
|
||||
PrintAndLogEx(INFO, "Device is running the bootloader.");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PrintAndLogEx(ERR, "Device is running the bootloader, but the bootloader"
|
||||
" doesn't understand the READ MEM command.");
|
||||
" doesn't understand the READ MEM command.");
|
||||
goto finish2;
|
||||
}
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS,"Dump requested from address "_YELLOW_("%u")", length "_YELLOW_("%u")"%s.",
|
||||
addr, len, raw ? ", in raw address mode" : "");
|
||||
PrintAndLogEx(SUCCESS, "Dump requested from address "_YELLOW_("%u")", length "_YELLOW_("%u")"%s.",
|
||||
addr, len, raw ? ", in raw address mode" : "");
|
||||
|
||||
PrintAndLogEx(SUCCESS, _CYAN_("Memory dumping to file..."));
|
||||
ret = dumpmem_to_file(filename, addr, len, raw, in_bootloader);
|
||||
@@ -918,7 +917,7 @@ int main(int argc, char *argv[]) {
|
||||
bool dumpmem_mode = false;
|
||||
const char *dumpmem_filename = NULL;
|
||||
uint32_t dumpmem_addr = 0;
|
||||
uint32_t dumpmem_len = 512*1024;
|
||||
uint32_t dumpmem_len = 512 * 1024;
|
||||
bool dumpmem_raw = false;
|
||||
|
||||
// color management:
|
||||
|
||||
+50
-37
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user