This commit is contained in:
iceman1001
2021-04-08 10:44:31 +02:00
parent 31c5722ac0
commit 27184d7f5b
21 changed files with 334 additions and 334 deletions

View File

@@ -148,7 +148,7 @@ bool nfc3d_amiibo_load_keys(nfc3d_amiibo_keys *amiiboKeys) {
return false;
}
if ((amiiboKeys->data.magicBytesSize > 16) || (amiiboKeys->tag.magicBytesSize > 16)) {
if ((amiiboKeys->data.magicBytesSize > 16) || (amiiboKeys->tag.magicBytesSize > 16)) {
free(dump);
return false;
}

View File

@@ -376,7 +376,7 @@ static void precalculate_bit0_bitflip_bitarrays(uint8_t const bitflip, uint16_t
count[odd_even],
odd_even == EVEN_STATE ? "even" : "odd",
bitflip,
(1 << 24) - count[odd_even],
(1 << 24) - count[odd_even],
(float)((1 << 24) - count[odd_even]) / (1 << 24) * 100.0);
#ifndef TEST_RUN
write_bitflips_file(odd_even, bitflip, sum_a0, test_bitarray[odd_even], count[odd_even]);
@@ -404,7 +404,7 @@ static void precalculate_bit0_bitflip_bitarrays(uint8_t const bitflip, uint16_t
count[odd_even],
odd_even == EVEN_STATE ? "even" : "odd",
bitflip | BITFLIP_2ND_BYTE,
(1 << 24) - count[odd_even],
(1 << 24) - count[odd_even],
(float)((1 << 24) - count[odd_even]) / (1 << 24) * 100.0);
#ifndef TEST_RUN
write_bitflips_file(odd_even, bitflip | BITFLIP_2ND_BYTE, sum_a0, test_bitarray_2nd, count[odd_even]);
@@ -490,7 +490,7 @@ static void precalculate_bit0_bitflip_bitarrays(uint8_t const bitflip, uint16_t
count[odd_even],
odd_even == EVEN_STATE ? "even" : "odd",
bitflip | 0x100,
(1 << 24) - count[odd_even],
(1 << 24) - count[odd_even],
(float)((1 << 24) - count[odd_even]) / (1 << 24) * 100.0);
#ifndef TEST_RUN
write_bitflips_file(odd_even, bitflip | 0x100, sum_a0, test_not_bitarray[odd_even], count[odd_even]);
@@ -517,7 +517,7 @@ static void precalculate_bit0_bitflip_bitarrays(uint8_t const bitflip, uint16_t
printf("Writing %u possible %s states for bitflip property %03x (%u (%1.2f%%) states eliminated)\n",
count[odd_even],
odd_even == EVEN_STATE ? "even" : "odd",
bitflip | 0x100 | BITFLIP_2ND_BYTE,
bitflip | 0x100 | BITFLIP_2ND_BYTE,
(1 << 24) - count[odd_even],
(float)((1 << 24) - count[odd_even]) / (1 << 24) * 100.0);
#ifndef TEST_RUN

View File

@@ -14,12 +14,12 @@ Any other input char will exit the script.
You can supply a password, which will set the config block / block 7 on the T5577.
The verify option will issue a 'lf em 410x reader' command, so you can manually verify
The verify option will issue a 'lf em 410x reader' command, so you can manually verify
that the write worked.
]]
example = [[
-- resets and start enrolling EM410x id 11CC334455
-- resets and start enrolling EM410x id 11CC334455
script run lf_em4100_bulk.lua -s 11CC334455
-- continue enrolling from where last iteration
@@ -28,7 +28,7 @@ example = [[
-- reset and start enrolling from 11223344,
-- protecting the tag with password 010203
-- and verify the em id write.
script run lf_em4100_bulk.lua -s 1122334455 -p 01020304 -v
script run lf_em4100_bulk.lua -s 1122334455 -p 01020304 -v
]]
usage = [[
script run lf_en4100_bulk.lua [-h] [-c] [-p password] [-s <start cn>] [-v]
@@ -143,7 +143,7 @@ local function main(args)
end
-- if reset/start over, check -s
if not shall_continue then
if not shall_continue then
if startid == nil then return oops('empty card number string') end
if #startid == 0 then return oops('empty card number string') end
if #startid ~= 10 then return oops('card number wrong length. Must be 5 hex bytes') end
@@ -159,7 +159,7 @@ local function main(args)
print(ac.red..'disable hints for less output'..ac.reset)
core.console('pref set hint --off')
print('')
local hi = tonumber(startid:sub(1, 2), 16)
local low = tonumber(startid:sub(3, 10), 16)
local pwd = tonumber(ipwd, 16)
@@ -178,7 +178,7 @@ local function main(args)
else
print('reset & starting enrolling from refresh')
end
local template = 'EM4100 ID '..ac.green..'%02X%08X'..ac.reset
for i = low, low + 10000, 1 do
print('')
@@ -186,7 +186,7 @@ local function main(args)
local msg = (template):format(hi, i)
local ans = utils.input(msg, 'y'):lower()
if ans == 'y' then
core.console( ('lf em 410x clone --id %02X%08X'):format(hi, i) )
core.console( ('lf em 410x clone --id %02X%08X'):format(hi, i) )
-- print ( ('lf em 410x clone --id %02X%08X'):format(hi, i) )
if got_pwd then

View File

@@ -440,15 +440,15 @@ static void showSavePathState(savePaths_t path_index, prefShowOpt_t opt) {
if (path_index < spItemCount) {
if ((session.defaultPaths[path_index] == NULL) || (strcmp(session.defaultPaths[path_index], "") == 0)) {
PrintAndLogEx(INFO, " %s %s "_WHITE_("not set"),
prefShowMsg(opt),
s
);
prefShowMsg(opt),
s
);
} else {
PrintAndLogEx(INFO, " %s %s "_GREEN_("%s"),
prefShowMsg(opt),
s,
session.defaultPaths[path_index]
);
prefShowMsg(opt),
s,
session.defaultPaths[path_index]
);
}
}
}

View File

@@ -521,7 +521,7 @@ static void set_my_user_directory(void) {
char *cwd_buffer = (char *)calloc(pathLen, sizeof(uint8_t));
if (cwd_buffer == NULL) {
PrintAndLogEx(WARNING, "failed to allocate memory");
return;
return;
}
while (GetCurrentDir(cwd_buffer, pathLen) == NULL) {

View File

@@ -1281,7 +1281,7 @@ static int l_cwd(lua_State *L) {
uint16_t path_len = FILENAME_MAX; // should be a good starting point
char *cwd = (char *)calloc(path_len, sizeof(uint8_t));
if (cwd == NULL) {
return returnToLuaWithError(L, "Failed to allocate memory");
return returnToLuaWithError(L, "Failed to allocate memory");
}
while (GetCurrentDir(cwd, path_len) == NULL) {

View File

@@ -299,7 +299,7 @@ char *sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t brea
// manchester wrong bit marker
if (c == 7)
c = '.';
else
else
c += '0';
*(tmp++) = c;
@@ -308,7 +308,7 @@ char *sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t brea
if (breaks) {
if (((i + 1) % breaks) == 0) {
*(tmp++) = '\n';
*(tmp++) = '\n';
}
}
}
@@ -1026,7 +1026,7 @@ int hexstring_to_u96(uint32_t *hi2, uint32_t *hi, uint32_t *lo, const char *str)
int binstring_to_u96(uint32_t *hi2, uint32_t *hi, uint32_t *lo, const char *str) {
uint32_t n = 0, i = 0;
for(;;) {
for (;;) {
int res = sscanf(&str[i], "%1u", &n);
if ((res != 1) || (n > 1))
@@ -1050,7 +1050,7 @@ int binstring_to_u96(uint32_t *hi2, uint32_t *hi, uint32_t *lo, const char *str)
*/
int binarray_to_u96(uint32_t *hi2, uint32_t *hi, uint32_t *lo, uint8_t *arr, int arrlen) {
int i = 0;
for(; i < arrlen; i++) {
for (; i < arrlen; i++) {
uint8_t n = arr[i];
if (n > 1)
break;