whitespace

This commit is contained in:
iceman1001 2020-03-10 17:05:45 +01:00
commit 107b474b8a
4 changed files with 36 additions and 33 deletions

View file

@ -218,15 +218,15 @@ static int lto_rdbl(uint8_t blk, uint8_t *block_responce, uint8_t *block_cnt_res
uint16_t resp_len = 18; uint16_t resp_len = 18;
uint8_t rdbl_cmd[] = {0x30, blk}; uint8_t rdbl_cmd[] = {0x30, blk};
uint8_t rdbl_cnt_cmd[] ={0x80}; uint8_t rdbl_cnt_cmd[] = {0x80};
int status = lto_send_cmd_raw(rdbl_cmd, sizeof(rdbl_cmd), block_responce, &resp_len, true, false, verbose); int status = lto_send_cmd_raw(rdbl_cmd, sizeof(rdbl_cmd), block_responce, &resp_len, true, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT ) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT) {
return PM3_EWRONGANSVER; // READ BLOCK failed return PM3_EWRONGANSVER; // READ BLOCK failed
} }
status = lto_send_cmd_raw(rdbl_cnt_cmd, sizeof(rdbl_cnt_cmd), block_cnt_responce, &resp_len, false, false, verbose); status = lto_send_cmd_raw(rdbl_cnt_cmd, sizeof(rdbl_cnt_cmd), block_cnt_responce, &resp_len, false, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT ) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT) {
return PM3_EWRONGANSVER; // READ BLOCK CONTINUE failed return PM3_EWRONGANSVER; // READ BLOCK CONTINUE failed
} }
@ -252,7 +252,7 @@ int rdblLTO(uint8_t st_blk, uint8_t end_blk, bool verbose) {
uint8_t block_data_d16_d31[18]; uint8_t block_data_d16_d31[18];
uint8_t block_data[32]; uint8_t block_data[32];
for(uint8_t i = st_blk; i < end_blk + 1; i++) { for (uint8_t i = st_blk; i < end_blk + 1; i++) {
ret_val = lto_rdbl(i, block_data_d00_d15, block_data_d16_d31, verbose); ret_val = lto_rdbl(i, block_data_d00_d15, block_data_d16_d31, verbose);
@ -286,8 +286,8 @@ static int CmdHfLTOReadBlock(const char *Cmd) {
case 'h': case 'h':
return usage_lto_rdbl(); return usage_lto_rdbl();
case 's': case 's':
st_blk = param_get8(Cmd, cmdp+1); st_blk = param_get8(Cmd, cmdp + 1);
if ( end_blk < st_blk ) { if (end_blk < st_blk) {
errors = true; errors = true;
break; break;
} }
@ -295,10 +295,11 @@ static int CmdHfLTOReadBlock(const char *Cmd) {
break; break;
case 'e': case 'e':
end_blk = param_get8(Cmd, cmdp+1); end_blk = param_get8(Cmd, cmdp + 1);
if ( end_blk < st_blk ) { if (end_blk < st_blk) {
errors = true; errors = true;
break; } break;
}
cmdp += 2; cmdp += 2;
break; break;
@ -328,7 +329,7 @@ static int lto_wrbl(uint8_t blk, uint8_t *data, bool verbose) {
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
wrbl_d00_d15[i] = data[i]; wrbl_d00_d15[i] = data[i];
wrbl_d16_d31[i] = data[i+16]; wrbl_d16_d31[i] = data[i + 16];
} }
int status = lto_send_cmd_raw(wrbl_cmd, sizeof(wrbl_cmd), resp, &resp_len, true, false, verbose); int status = lto_send_cmd_raw(wrbl_cmd, sizeof(wrbl_cmd), resp, &resp_len, true, false, verbose);
@ -390,15 +391,15 @@ static int CmdHfLTOWriteBlock(const char *Cmd) {
case 'h': case 'h':
return usage_lto_wrbl(); return usage_lto_wrbl();
case 'b': case 'b':
blk = param_get8(Cmd, cmdp+1); blk = param_get8(Cmd, cmdp + 1);
b_opt_selected = true; b_opt_selected = true;
cmdp += 2; cmdp += 2;
break; break;
case 'd': case 'd':
if (param_gethex(Cmd, cmdp+1, blkData, 64)) { if (param_gethex(Cmd, cmdp + 1, blkData, 64)) {
PrintAndLogEx(WARNING, "block data must include 64 HEX symbols"); PrintAndLogEx(WARNING, "block data must include 64 HEX symbols");
errors = true; errors = true;
break; break;
} }
d_opt_selected = true; d_opt_selected = true;
cmdp += 2; cmdp += 2;
@ -409,7 +410,7 @@ static int CmdHfLTOWriteBlock(const char *Cmd) {
break; break;
} }
} }
//Validations //Validations
if (errors) { if (errors) {
usage_lto_wrbl(); usage_lto_wrbl();
@ -440,7 +441,7 @@ int dumpLTO(uint8_t *dump, bool verbose) {
uint8_t block_data_d00_d15[18]; uint8_t block_data_d00_d15[18];
uint8_t block_data_d16_d31[18]; uint8_t block_data_d16_d31[18];
for(uint8_t i = 0; i < 255; i++) { for (uint8_t i = 0; i < 255; i++) {
ret_val = lto_rdbl(i, block_data_d00_d15, block_data_d16_d31, verbose); ret_val = lto_rdbl(i, block_data_d00_d15, block_data_d16_d31, verbose);
@ -504,10 +505,10 @@ static int CmdHfLTODump(const char *Cmd) {
int ret_val = dumpLTO(dump, true); int ret_val = dumpLTO(dump, true);
if (ret_val != PM3_SUCCESS) { if (ret_val != PM3_SUCCESS) {
free(dump); free(dump);
return ret_val; return ret_val;
} }
// save to file // save to file
if (filename[0] == '\0') { if (filename[0] == '\0') {
memcpy(serial_number, sprint_hex_inrow(dump, sizeof(serial_number)), sizeof(serial_number)); memcpy(serial_number, sprint_hex_inrow(dump, sizeof(serial_number)), sizeof(serial_number));
char tmp_name[17] = "hf_lto_"; char tmp_name[17] = "hf_lto_";
@ -538,10 +539,10 @@ int restoreLTO(uint8_t *dump_data, bool verbose) {
return ret_val; return ret_val;
} }
uint8_t blkData[32] = {0}; uint8_t blkData[32] = {0};
//Block address 0 and 1 are read-only //Block address 0 and 1 are read-only
for(uint8_t blk = 2; blk < 255; blk++) { for (uint8_t blk = 2; blk < 255; blk++) {
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
blkData[i] = dump_data[i + blk * 32]; blkData[i] = dump_data[i + blk * 32];
@ -550,7 +551,7 @@ int restoreLTO(uint8_t *dump_data, bool verbose) {
ret_val = lto_wrbl(blk, blkData, verbose); ret_val = lto_wrbl(blk, blkData, verbose);
if (ret_val == PM3_SUCCESS) { if (ret_val == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "BLK %03d: " _YELLOW_("write success"), blk); PrintAndLogEx(SUCCESS, "BLK %03d: " _YELLOW_("write success"), blk);
} else { } else {
lto_switch_off_field(); lto_switch_off_field();
return ret_val; return ret_val;
@ -566,7 +567,7 @@ static int CmdHfLTRestore(const char *Cmd) {
uint8_t cmdp = 0; uint8_t cmdp = 0;
bool errors = false; bool errors = false;
int is_data_loaded = PM3_ESOFT; int is_data_loaded = PM3_ESOFT;
char filename[FILE_PATH_SIZE] = {0}; char filename[FILE_PATH_SIZE] = {0};
char extension[FILE_PATH_SIZE] = {0}; char extension[FILE_PATH_SIZE] = {0};
@ -623,7 +624,7 @@ static int CmdHfLTRestore(const char *Cmd) {
} else { } else {
return PM3_EFILE; return PM3_EFILE;
} }
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {

View file

@ -1505,7 +1505,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0); SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
return 1; return 1;
} }
// error during nested_hard // error during nested_hard
if (resp.oldarg[0]) { if (resp.oldarg[0]) {
if (nonce_file_write) { if (nonce_file_write) {
@ -2034,7 +2034,7 @@ static void generate_candidates(uint8_t sum_a0_idx, uint8_t sum_a8_idx) {
// create mutexes for accessing the statelist cache and our "book of work" // create mutexes for accessing the statelist cache and our "book of work"
pthread_mutex_init(&statelist_cache_mutex, NULL); pthread_mutex_init(&statelist_cache_mutex, NULL);
pthread_mutex_init(&book_of_work_mutex, NULL); pthread_mutex_init(&book_of_work_mutex, NULL);
init_statelist_cache(); init_statelist_cache();
init_book_of_work(); init_book_of_work();

View file

@ -1039,9 +1039,9 @@ static int CmdEM4x50Write(const char *Cmd) {
uint8_t ctmp = tolower(param_getchar(Cmd, 0)); uint8_t ctmp = tolower(param_getchar(Cmd, 0));
if (ctmp == 'h') return usage_lf_em4x50_write(); if (ctmp == 'h') return usage_lf_em4x50_write();
PrintAndLogEx(NORMAL, "no implemented yet"); PrintAndLogEx(NORMAL, "no implemented yet");
// //
// PrintAndLogEx(SUCCESS, "Done"); // PrintAndLogEx(SUCCESS, "Done");
// PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x50_read`") "to verify"); // PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x50_read`") "to verify");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -1440,7 +1440,7 @@ static int CmdEM4x05Write(const char *Cmd) {
int status = demodEM4x05resp(&dummy); int status = demodEM4x05resp(&dummy);
if (status == PM3_SUCCESS) if (status == PM3_SUCCESS)
PrintAndLogEx(SUCCESS, "Success writing to tag"); PrintAndLogEx(SUCCESS, "Success writing to tag");
PrintAndLogEx(SUCCESS, "Done"); PrintAndLogEx(SUCCESS, "Done");
PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x05_read`") "to verify"); PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf em 4x05_read`") "to verify");
return status; return status;

View file

@ -346,7 +346,7 @@ static int CmdHIDClone(const char *Cmd) {
clearCommandBuffer(); clearCommandBuffer();
SendCommandMIX(CMD_LF_HID_CLONE, hi2, hi, lo, longid, sizeof(longid)); SendCommandMIX(CMD_LF_HID_CLONE, hi2, hi, lo, longid, sizeof(longid));
PrintAndLogEx(SUCCESS, "Done"); PrintAndLogEx(SUCCESS, "Done");
PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf hid read`") "to verify"); PrintAndLogEx(INFO, "Hint: try " _YELLOW_("`lf hid read`") "to verify");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -450,7 +450,7 @@ static int CmdHIDBrute(const char *Cmd) {
PrintAndLogEx(INFO, "ISSUE#........... %u", cn_hi.IssueLevel); PrintAndLogEx(INFO, "ISSUE#........... %u", cn_hi.IssueLevel);
PrintAndLogEx(INFO, "Facility#........ %u", cn_hi.FacilityCode); PrintAndLogEx(INFO, "Facility#........ %u", cn_hi.FacilityCode);
PrintAndLogEx(INFO, "Card#............ %" PRIu64, cn_hi.CardNumber); PrintAndLogEx(INFO, "Card#............ %" PRIu64, cn_hi.CardNumber);
switch( direction) { switch (direction) {
case 0: case 0:
PrintAndLogEx(INFO, "Brute-forcing direction: " _YELLOW_("BOTH")); PrintAndLogEx(INFO, "Brute-forcing direction: " _YELLOW_("BOTH"));
break; break;
@ -460,7 +460,8 @@ static int CmdHIDBrute(const char *Cmd) {
case 2: case 2:
PrintAndLogEx(INFO, "Brute-forcing direction: " _YELLOW_("DOWN")); PrintAndLogEx(INFO, "Brute-forcing direction: " _YELLOW_("DOWN"));
break; break;
default: break; default:
break;
} }
} }
PrintAndLogEx(INFO, "Brute-forcing HID reader"); PrintAndLogEx(INFO, "Brute-forcing HID reader");
@ -495,7 +496,7 @@ static int CmdHIDBrute(const char *Cmd) {
fin_hi = true; fin_hi = true;
} }
} }
// do one down // do one down
if (direction != 1) { if (direction != 1) {
if (cn_low.CardNumber > 0) { if (cn_low.CardNumber > 0) {
@ -507,7 +508,7 @@ static int CmdHIDBrute(const char *Cmd) {
} }
switch (direction) { switch (direction) {
case 0: case 0:
if (fin_hi && fin_low) { if (fin_hi && fin_low) {
exitloop = true; exitloop = true;
} }
@ -518,7 +519,8 @@ static int CmdHIDBrute(const char *Cmd) {
case 2: case 2:
exitloop = fin_low; exitloop = fin_low;
break; break;
default: break; default:
break;
} }
} while (exitloop == false); } while (exitloop == false);