Skip to content

Commit

Permalink
make style (excepted cmdhficlass...)
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Aug 26, 2019
1 parent 9c677e0 commit 16a7cfd
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 115 deletions.
6 changes: 3 additions & 3 deletions armsrc/mifarecmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1992,9 +1992,9 @@ void MifareCIdent() {

int res = iso14443a_select_card(uid, NULL, &cuid, true, 0, true);
if (res == 2) {
if (cuid == 0xAA55C396 ) {
isGen = GEN_UNFUSED;
goto OUT;
if (cuid == 0xAA55C396) {
isGen = GEN_UNFUSED;
goto OUT;
}

ReaderTransmit(rats, sizeof(rats), NULL);
Expand Down
3 changes: 1 addition & 2 deletions armsrc/pcf7931.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
for (i = 0; i < n; ++i)
{
for (i = 0; i < n; ++i) {
print_result("got consecutive blocks", tmp_blocks[i], 16);
}

Expand Down
176 changes: 92 additions & 84 deletions client/cmdhfmf.c

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions client/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, s
memcpy(uid, data, 8);
JsonSaveBufAsHexCompact(root, "$.Card.UID", uid, sizeof(uid));

for (size_t i = 0; i < (datalen / 8 ); i++) {
for (size_t i = 0; i < (datalen / 8); i++) {
char path[PATH_MAX_LENGTH] = {0};
sprintf(path, "$blocks.%zu", i);
JsonSaveBufAsHexCompact(root, path, data + (i * 8), 8);
Expand All @@ -311,7 +311,7 @@ int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, s
return retval;
}

int createMfcKeyDump(uint8_t sectorsCnt, sector_t *e_sector, char* fptr) {
int createMfcKeyDump(uint8_t sectorsCnt, sector_t *e_sector, char *fptr) {
uint8_t tmpKey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
int i;

Expand Down Expand Up @@ -568,8 +568,8 @@ int loadFileJSON(const char *preferredName, void *data, size_t maxdatalen, size_

size_t len = 0;
JsonLoadBufAsHex(root, path, &udata[sptr], 8, &len);
if (!len)
break;
if (!len)
break;

sptr += len;
}
Expand Down Expand Up @@ -694,7 +694,7 @@ static int filelist(const char *path, const char *ext, bool last) {
PrintAndLogEx(NORMAL, "%s── %s", last ? "└" : "├", path);
for (uint16_t i = 0; i < n; i++) {
if (((ext == NULL) && (namelist[i]->d_name[0] != '.')) || (str_endswith(namelist[i]->d_name, ext))) {
PrintAndLogEx(NORMAL, "%s   %s── %-21s", last ? " ":"│", i == n-1 ? "└" : "├", namelist[i]->d_name);
PrintAndLogEx(NORMAL, "%s   %s── %-21s", last ? " " : "│", i == n - 1 ? "└" : "├", namelist[i]->d_name);
}
free(namelist[i]);
}
Expand Down Expand Up @@ -727,19 +727,17 @@ int searchAndList(const char *pm3dir, const char *ext) {
}

static int searchFinalFile(char **foundpath, const char *pm3dir, const char *searchname) {
if ((foundpath == NULL)||(pm3dir == NULL)||(searchname == NULL)) return PM3_ESOFT;
if ((foundpath == NULL) || (pm3dir == NULL) || (searchname == NULL)) return PM3_ESOFT;
// explicit absolute (/) or relative path (./) => try only to match it directly
char *filename = calloc(strlen(searchname) + 1, sizeof(char));
if (filename == NULL) return PM3_EMALLOC;
strcpy(filename, searchname);
if (((strlen(filename) > 1) && (filename[0] == '/')) ||
((strlen(filename) > 2) && (filename[0] == '.') && (filename[1] == '/')))
{
((strlen(filename) > 2) && (filename[0] == '.') && (filename[1] == '/'))) {
if (fileExists(filename)) {
*foundpath = filename;
return PM3_SUCCESS;
}
else {
} else {
goto out;
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, s
* @param fptr string pointer to the filename
* @return 0 for ok, 1 for failz
*/
int createMfcKeyDump(uint8_t sectorsCnt, sector_t *e_sector, char* fptr);
int createMfcKeyDump(uint8_t sectorsCnt, sector_t *e_sector, char *fptr);

/** STUB
* @brief Utility function to load data from a binary file. This method takes a preferred name.
Expand Down
2 changes: 1 addition & 1 deletion client/loclass/cipherutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void printarr(const char *name, uint8_t *arr, int len) {
}

void printvar(const char *name, uint8_t *arr, int len) {
PrintAndLogEx(NORMAL, "%s = " _YELLOW_("%s"), name, sprint_hex(arr, len) );
PrintAndLogEx(NORMAL, "%s = " _YELLOW_("%s"), name, sprint_hex(arr, len));
}

void printarr_human_readable(const char *title, uint8_t *arr, int len) {
Expand Down
20 changes: 10 additions & 10 deletions client/loclass/elite_crack.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ int calculateMasterKey(uint8_t first16bytes[], uint64_t master_key[]) {
return 1;
} else {
PrintAndLogEx(NORMAL, "\n");
PrintAndLogEx(SUCCESS, _GREEN_("Key verified ok!") );
PrintAndLogEx(SUCCESS, _GREEN_("Key verified ok!"));
}
return 0;
}
Expand All @@ -502,18 +502,18 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) {
for (i = 0 ; i * itemsize < dumpsize ; i++) {
memcpy(attack, dump + i * itemsize, itemsize);
errors += bruteforceItem(*attack, keytable);
if ( errors )
break;
if (errors)
break;
}
free(attack);
t1 = msclock() - t1;
PrintAndLogEx(SUCCESS, "time: %" PRIu64 " seconds", t1 / 1000);

if ( errors ) {
PrintAndLogEx(ERR, "loclass exiting. Try run " _YELLOW_("`hf iclass sim 2`") "again and collect new data");
return 1;
}

if (errors) {
PrintAndLogEx(ERR, "loclass exiting. Try run " _YELLOW_("`hf iclass sim 2`") "again and collect new data");
return 1;
}

// Pick out the first 16 bytes of the keytable.
// The keytable is now in 16-bit ints, where the upper 8 bits
Expand All @@ -526,8 +526,8 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) {

if (!(keytable[i] & CRACKED)) {
PrintAndLogEx(WARNING, "Warning: we are missing byte %d, custom key calculation will fail...", i);
return 1;
}
return 1;
}
}
errors += calculateMasterKey(first16bytes, NULL);
return errors;
Expand Down
4 changes: 2 additions & 2 deletions client/scripting.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ int set_pm3_libraries(lua_State *L) {
strcat(scripts_path, LUA_LIBRARIES_WILDCARD);
setLuaPath(L, scripts_path);

// from the ~/.proxmark3/lualib/ directory
// from the ~/.proxmark3/lualib/ directory
char libraries_path[strlen(user_path) + strlen(PM3_USER_DIRECTORY) + strlen(LUA_LIBRARIES_SUBDIR) + strlen(LUA_LIBRARIES_WILDCARD) + 1];
strcpy(libraries_path, user_path);
strcat(libraries_path, PM3_USER_DIRECTORY);
Expand All @@ -1167,7 +1167,7 @@ int set_pm3_libraries(lua_State *L) {
setLuaPath(L, libraries_path);
}

if (strlen(PM3_SHARE_PATH) != 0 || strlen(LUA_SCRIPTS_SUBDIR) != 0 || strlen(LUA_LIBRARIES_WILDCARD) != 0 ) {
if (strlen(PM3_SHARE_PATH) != 0 || strlen(LUA_SCRIPTS_SUBDIR) != 0 || strlen(LUA_LIBRARIES_WILDCARD) != 0) {
// from the /usr/local/share/proxmark3/luascripts/ directory
char scripts_path[strlen(PM3_SHARE_PATH) + strlen(LUA_SCRIPTS_SUBDIR) + strlen(LUA_LIBRARIES_WILDCARD) + 1];
strcpy(scripts_path, PM3_SHARE_PATH);
Expand Down
4 changes: 2 additions & 2 deletions tools/fpga_compress/fpga_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ static int FpgaGatherVersion(FILE *infile, char *infile_name, char *dst, int len
for (uint16_t i = 0; i < fpga_info_len; i++) {
char c = (char)fgetc(infile);
if (i < sizeof(tempstr)) {
if ( c == '/' ) c = '-';
if ( c == ' ' ) c = '0';
if (c == '/') c = '-';
if (c == ' ') c = '0';
tempstr[i] = c;
}
}
Expand Down

0 comments on commit 16a7cfd

Please sign in to comment.