diff --git a/CHANGELOG.md b/CHANGELOG.md index 745625fdb..162f85729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac ## [unreleased][unreleased] - Fixed fm11rf08s script for non-4B UID (FM11RF08S-7B) (@Foxushka) +- Fixed missing require of ansicolors in `lf_hid_bulkclone_v2.lua` script (@whiteneon) +- Added `lf_t55xx_reset.lua` - a script to aid in quickly resetting t55xx chips (@whiteneon) - Added more fingerprinting in `hf mf info` (@doegox) - Added --issue and (--emu)lator support to `hf iclass encode` command (@micsen) - Added custom CTF Wiegand format from Defcon32 with comments (@micsen) diff --git a/client/luascripts/lf_hid_bulkclone_v2.lua b/client/luascripts/lf_hid_bulkclone_v2.lua index b090d67ec..33d084dd8 100644 --- a/client/luascripts/lf_hid_bulkclone_v2.lua +++ b/client/luascripts/lf_hid_bulkclone_v2.lua @@ -1,9 +1,10 @@ local getopt = require('getopt') +local ansicolors = require('ansicolors') local cmds = require('commands') copyright = '' author = "TheChamop669" -version = 'v1.0.0' +version = 'v1.0.1' desc = [[ Perform bulk enrollment of 26 bit H10301 style RFID Tags For more info, check the comments in the code diff --git a/client/luascripts/lf_t55xx_reset.lua b/client/luascripts/lf_t55xx_reset.lua new file mode 100644 index 000000000..e63b07b66 --- /dev/null +++ b/client/luascripts/lf_t55xx_reset.lua @@ -0,0 +1,89 @@ +local getopt = require('getopt') +local ansicolors = require('ansicolors') +local utils = require('utils') + +copyright = '' +author = 'whiteneon' +version = 'v1.0.0' +desc = [[ +This script attempts to reset the password + - on a T55xx LF chip. + ]] +example = [[ + script run lf_t55xx_reset +]] +usage = [[ +script run lf_t55xx_reset -h +]] +arguments = [[ + -h : this help +]] + +local DEBUG = true +--- +-- A debug printout-function +local function dbg(args) + if not DEBUG then return end + if type(args) == 'table' then + local i = 1 + while args[i] do + dbg(args[i]) + i = i+1 + end + else + print('###', args) + end +end +--- +-- This is only meant to be used when errors occur +local function oops(err) + print('ERROR:', err) + core.clearCommandBuffer() + return nil, err +end +--- +-- Usage help +local function help() + print(copyright) + print(author) + print(version) + print(desc) + print(ansicolors.cyan..'Usage'..ansicolors.reset) + print(usage) + print(ansicolors.cyan..'Arguments'..ansicolors.reset) + print(arguments) + print(ansicolors.cyan..'Example usage'..ansicolors.reset) + print(example) +end +--- +-- The main entry point +function main(args) + local dash = string.rep('--', 20) + + print( dash ) + print( dash ) + print() + + -- Read the parameters + for o, a in getopt.getopt(args, 'h') do + if o == 'h' then return help() end + end + + print('Attempting T55xx chip reset') + print(dash) +-- core.console('lf t55 write -b 0 -d 000880E0 --r0 -t') +-- core.console('lf t55 write -b 0 -d 000880E0 --r1 -t') +-- core.console('lf t55 write -b 0 -d 000880E0 --r2 -t') +-- core.console('lf t55 write -b 0 -d 000880E0 --r3 -t') + core.console('lf t55 write -b 0 -d 000880E0 --r0') + core.console('lf t55 write -b 0 -d 000880E0 --r1') + core.console('lf t55 write -b 0 -d 000880E0 --r2') + core.console('lf t55 write -b 0 -d 000880E0 --r3') + core.console('lf t55 wipe') + core.console('lf t55 detect') + print(dash) + print('all done!') + +end + +main(args) diff --git a/client/pyscripts/fm11rf08s_recovery.py b/client/pyscripts/fm11rf08s_recovery.py index 7dc86a128..6d2400dcb 100755 --- a/client/pyscripts/fm11rf08s_recovery.py +++ b/client/pyscripts/fm11rf08s_recovery.py @@ -62,22 +62,16 @@ args = parser.parse_args() start_time = time.time() p = pm3.pm3() -restore_color = False -p.console("prefs get color") -p.console("prefs set color --off") -for line in p.grabbed_output.split('\n'): - if "ansi" in line: - restore_color = True p.console("hf 14a read") uid = None -for line in p.grabbed_output.split('\n'): - if "UID:" in line: - uid = int(line[10:].replace(' ', '')[-8:], 16) + +if p.grabbed_output is not None: + for line in p.grabbed_output.split('\n'): + if "UID:" in line: + uid = int(line[10:].replace(' ', '')[-8:], 16) + if uid is None: print("Card not found") - if restore_color: - p.console("prefs set color --ansi") - _ = p.grabbed_output exit() print("UID: " + color(f"{uid:08X}", fg="green")) @@ -136,9 +130,6 @@ for sec in range(NUM_SECTORS): nt_enc[sec][key_type] == "" or par_err[sec][key_type] == ""): print("Error, could not collect nonces, abort") - if restore_color: - p.console("prefs set color --ansi") - _ = p.grabbed_output exit() print("Running staticnested_1nt & 2x1nt when doable...") @@ -330,9 +321,6 @@ for sec in range(NUM_SECTORS): print_key(sec, key_type_target, found_keys[sec][key_type_target]) if abort: break -if restore_color: - p.console("prefs set color --ansi") - _ = p.grabbed_output if abort: print("Brute-forcing phase aborted via keyboard!") diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 0b5c7bd0a..d0c9557d9 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -1164,11 +1164,26 @@ int getIndalaBits(uint8_t fc, uint16_t cn, uint8_t *bits) { } // add parity - bits[34] = 1; // p1 64 - 30 = 34 - bits[38] = 1; // p2 68 - 30 = 38 + // bits[34] = 1; // p1 64 - 30 = 34 + // bits[38] = 1; // p2 68 - 30 = 38 // 92 = 62 // 93 = 63 + + bits[34] = 0; // parity for odd bits + bits[38] = 0; // parity for even bits + uint8_t p1 = 1; + uint8_t p2 = 1; + + for (int i=33; i < 64; i++) { + if (i%2) + p1 ^= bits[i]; + else + p2 ^= bits[i]; + } + + bits[34] = p1; // parity for odd bits + bits[38] = p2; // parity for even bits return PM3_SUCCESS; } diff --git a/client/src/flash.c b/client/src/flash.c index 067ad1c7f..2395ffd40 100644 --- a/client/src/flash.c +++ b/client/src/flash.c @@ -635,11 +635,7 @@ static const char ice[] = "...................................................................\n @@@ @@@@@@@ @@@@@@@@ @@@@@@@@@@ @@@@@@ @@@ @@@\n" " @@! !@@ @@! @@! @@! @@! @@! @@@ @@!@!@@@\n !!@ !@! @!!!:! @!! !!@ @!@ @!@!@!@! @!@@!!@!\n" " !!: :!! !!: !!: !!: !!: !!! !!: !!!\n : :: :: : : :: ::: : : : : : :: : \n" - _RED_(" . .. .. . . .. ... . . . . . .. . ") - "\n...................................................................\n" - "...................................................................\n" - "...................................................................\n" - ; + _RED_(" . .. .. . . .. ... . . . . . .. . "); // Write a file's segments to Flash int flash_write(flash_file_t *ctx) { @@ -647,7 +643,11 @@ int flash_write(flash_file_t *ctx) { PrintAndLogEx(SUCCESS, "Writing segments for file: %s", ctx->filename); - bool filter_ansi = !g_session.supports_colors; + char ice2[sizeof(ice)] = {0}; + char ice3[sizeof(ice)] = {0}; + memcpy_filter_ansi(ice2, ice, sizeof(ice), !g_session.supports_colors); + memcpy_filter_emoji(ice3, ice2, sizeof(ice2), g_session.emoji_mode); + size_t ice3len = strlen(ice3); for (int i = 0; i < ctx->num_segs; i++) { flash_seg_t *seg = &ctx->segments[i]; @@ -676,14 +676,14 @@ int flash_write(flash_file_t *ctx) { baddr += block_size; length -= block_size; block++; - if (len < strlen(ice)) { - if (filter_ansi && !isalpha(ice[len])) { - len++; - } else { - fprintf(stdout, "%c", ice[len++]); - } + if (len < ice3len) { + fprintf(stdout, "%c", ice3[len++]); } else { + if ((len - ice3len) % 67 == 0) { + fprintf(stdout, "\n"); + } fprintf(stdout, "."); + len++; } fflush(stdout); }