make style

This commit is contained in:
Philippe Teuwen 2023-07-21 18:22:46 +02:00
commit 1a19640d18
9 changed files with 198 additions and 136 deletions

View file

@ -382,7 +382,7 @@ function getInputBytes(infile)
local arr = split(infile, ".") local arr = split(infile, ".")
local path = core.search_file(arr[1], "."..arr[2]) local path = core.search_file(arr[1], "."..arr[2])
if (path == nil) then oops("failed to read from file ".. infile); return false; end if (path == nil) then oops("failed to read from file ".. infile); return false; end
local fhi,err = io.open(path,"rb") local fhi,err = io.open(path,"rb")
if err then oops("failed to read from file ".. path); return false; end if err then oops("failed to read from file ".. path); return false; end
@ -688,7 +688,7 @@ end
-- write bytes to file -- write bytes to file
function writeFile(bytes, filename) function writeFile(bytes, filename)
local emlext = ".eml" local emlext = ".eml"
local res, path local res, path
if (filename ~= 'MyLegicClone') then if (filename ~= 'MyLegicClone') then
res, path = file_check(filename..emlext) res, path = file_check(filename..emlext)
if res then if res then
@ -765,7 +765,7 @@ function readFromPM3()
if not res then return nil end if not res then return nil end
os.remove(path) os.remove(path)
res, path = file_check(infile..".eml") res, path = file_check(infile..".eml")
os.remove(path) os.remove(path)
res, path = file_check(infile..".json") res, path = file_check(infile..".json")
@ -886,7 +886,7 @@ function loadTagMap(filename)
if not res then if not res then
return oops("input file: "..acyellow..filename..acoff.." not found") return oops("input file: "..acyellow..filename..acoff.." not found")
else else
local fhi,err = io.open(path) local fhi,err = io.open(path)
while true do while true do
line = fhi:read() line = fhi:read()
@ -956,7 +956,7 @@ function dumpTagMap(tag, tagMap)
else else
io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..((v['highlight']) and acmagenta or acyellow)..v['name']..acoff) io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..((v['highlight']) and acmagenta or acyellow)..v['name']..acoff)
end end
temp = "" temp = ""
while (#v['name'] + temp:len()) < 20 do temp = temp.." " end while (#v['name'] + temp:len()) < 20 do temp = temp.." " end
@ -1015,14 +1015,14 @@ function editTagMap(tag, tagMap)
]]..acc..[[Mappings]]..acr..[[ ]]..acc..[[Mappings]]..acr..[[
]]..acy..[[im]]..acr..[[ - insert ]]..acy..[[am]]..acr..[[ - add ]]..acy..[[im]]..acr..[[ - insert ]]..acy..[[am]]..acr..[[ - add
]]..acy..[[rm]]..acr..[[ - remove ]]..acy..[[mas]]..acr..[[ - map all segments ]]..acy..[[rm]]..acr..[[ - remove ]]..acy..[[mas]]..acr..[[ - map all segments
]]..acc..[[CRC8]]..acr..[[ ]]..acc..[[CRC8]]..acr..[[
]]..acy..[[ac8]]..acr..[[ - add ]]..acy..[[sc8]]..acr..[[ - show ]]..acy..[[ac8]]..acr..[[ - add ]]..acy..[[sc8]]..acr..[[ - show
]]..acy..[[rc8]]..acr..[[ - remove ]]..acy..[[rc8]]..acr..[[ - remove
]]..acy..[[q]]..acr..[[ - exit ]]..acy..[[h]]..acr..[[ - Help ]]..acy..[[q]]..acr..[[ - exit ]]..acy..[[h]]..acr..[[ - Help
]] ]]
@ -2446,7 +2446,7 @@ function modifyMode()
outfile = input("enter filename:", "hf-legic-"..inTAG.MCD..inTAG.MSN0..inTAG.MSN1..inTAG.MSN2) outfile = input("enter filename:", "hf-legic-"..inTAG.MCD..inTAG.MSN0..inTAG.MSN1..inTAG.MSN2)
bytes = tagToBytes(inTAG) bytes = tagToBytes(inTAG)
--bytes=xorBytes(bytes, inTAG.MCC) --bytes=xorBytes(bytes, inTAG.MCC)
if (bytes) then if (bytes) then
writeFile(bytes, outfile) writeFile(bytes, outfile)
end end
end end
@ -2854,7 +2854,7 @@ function main(args)
-- write to outfile -- write to outfile
if (bytes) then if (bytes) then
if (outfile) then if (outfile) then
writeFile(bytes, outfile) writeFile(bytes, outfile)
end end

View file

@ -3320,14 +3320,14 @@ int centerThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down)
for (size_t i = 0; i < len; ++i) { for (size_t i = 0; i < len; ++i) {
if ((in[i] <= up) && (in[i] >= down)) { if ((in[i] <= up) && (in[i] >= down)) {
out[i] = 0; out[i] = 0;
} }
} }
// clean out spikes. // clean out spikes.
for (size_t i = 2; i < len - 2; ++i) { for (size_t i = 2; i < len - 2; ++i) {
int a = out[i-2] + out[i-1]; int a = out[i - 2] + out[i - 1];
int b = out[i+2] + out[i+1]; int b = out[i + 2] + out[i + 1];
if (a == 0 && b == 0) { if (a == 0 && b == 0) {
out[i] = 0; out[i] = 0;
} }
@ -3372,7 +3372,7 @@ static int envelope_square(const int *in, int *out, size_t len) {
for (size_t i = 0; i < len - 5; i++) { for (size_t i = 0; i < len - 5; i++) {
if (in[i] == 0 && in[i+1] == 0 && in[i+2] == 0 && in[i+3] == 0 && in[i+4] == 0) { if (in[i] == 0 && in[i + 1] == 0 && in[i + 2] == 0 && in[i + 3] == 0 && in[i + 4] == 0) {
i += 4; i += 4;
continue; continue;
} }

View file

@ -273,7 +273,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
MifareAuthState = masNone; MifareAuthState = masNone;
break; break;
case ISO14443A_CMD_RATS: case ISO14443A_CMD_RATS:
snprintf(exp, size, "RATS - FSDI=%x, CID=%x", (cmd[1] & 0xF0) >> 4, (cmd[1] & 0x0F) ); snprintf(exp, size, "RATS - FSDI=%x, CID=%x", (cmd[1] & 0xF0) >> 4, (cmd[1] & 0x0F));
break; break;
/* Actually, PPSS is Dx /* Actually, PPSS is Dx
case ISO14443A_CMD_PPS: case ISO14443A_CMD_PPS:
@ -428,7 +428,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
break; break;
default: default:
if ( (cmd[0] & 0xF0) == 0xD0 && ( cmdsize == 4 || cmdsize == 5 )) { if ((cmd[0] & 0xF0) == 0xD0 && (cmdsize == 4 || cmdsize == 5)) {
snprintf(exp, size, "PPS - CID=%x", cmd[0] & 0x0F) ; snprintf(exp, size, "PPS - CID=%x", cmd[0] & 0x0F) ;
} else { } else {
return PM3_ESOFT; return PM3_ESOFT;
@ -1241,7 +1241,7 @@ const char *mfpGetAnnotationForCode(uint8_t code) {
{ 0, NULL} { 0, NULL}
} ; } ;
for (struct mfp_code_msg *p=messages ; p->annotation != NULL ; p++) { for (struct mfp_code_msg *p = messages ; p->annotation != NULL ; p++) {
if (p->code == code) { if (p->code == code) {
return p->annotation ; return p->annotation ;
} }
@ -1249,8 +1249,8 @@ const char *mfpGetAnnotationForCode(uint8_t code) {
return NULL ; return NULL ;
} }
const char *mfpGetEncryptedForCode(uint8_t code){ const char *mfpGetEncryptedForCode(uint8_t code) {
/* /*
encrypted |plain : bit 1 encrypted |plain : bit 1
30 A0 0000 32 A2 0010 30 A0 0000 32 A2 0010
31 A1 0001 33 A3 0011 31 A1 0001 33 A3 0011
@ -1263,10 +1263,10 @@ const char *mfpGetEncryptedForCode(uint8_t code){
return "ENCRYPTED" ; return "ENCRYPTED" ;
} }
/* /*
response |command response |command
NOMAC MAC UnMACed MACed NOMAC MAC UnMACed MACed
30 31 34 30,A0 30 31 34 30,A0
32 33 35 31,A1 32 33 35 31,A1
A0 A1 36 32,A2 A0 A1 36 32,A2
A2 A3 37 33,A3 A2 A3 37 33,A3
@ -1274,14 +1274,14 @@ const char *mfpGetEncryptedForCode(uint8_t code){
bit 2 is command: UNMACed if 1, MACed if 0 bit 2 is command: UNMACed if 1, MACed if 0
*/ */
const char *mfpGetResponseMacedForCode(uint8_t code) { const char *mfpGetResponseMacedForCode(uint8_t code) {
if (( code & 0x01) == 0x00) { if ((code & 0x01) == 0x00) {
return "NoMAC" ; return "NoMAC" ;
} }
return "MAC" ; return "MAC" ;
} }
const char *mfpGetCommandMacedForCode(uint8_t code) { const char *mfpGetCommandMacedForCode(uint8_t code) {
if (( code & 0x04) == 0x04) { if ((code & 0x04) == 0x04) {
return "UnMACed" ; return "UnMACed" ;
} }
return "MACed" ; return "MACed" ;
@ -1322,14 +1322,14 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
if (cmdsize > (data - cmd)) { if (cmdsize > (data - cmd)) {
data_size = cmdsize - (data - cmd); data_size = cmdsize - (data - cmd);
} }
uint8_t opcode=cmd[pos] ; uint8_t opcode = cmd[pos] ;
switch (opcode) { switch (opcode) {
case MFP_AUTHENTICATEFIRST: case MFP_AUTHENTICATEFIRST:
case MFP_AUTHENTICATEFIRST_VARIANT: case MFP_AUTHENTICATEFIRST_VARIANT:
if (data_size > 1) { if (data_size > 1) {
// key : uint16_t uKeyNum = 0x4000 + sectorNum * 2 + (keyB ? 1 : 0); // key : uint16_t uKeyNum = 0x4000 + sectorNum * 2 + (keyB ? 1 : 0);
uint16_t uKeyNum = MemLeToUint2byte(data) ; uint16_t uKeyNum = MemLeToUint2byte(data) ;
snprintf(exp, size, "FIRST AUTH (Keynr 0x%04X: %c sector %d)", uKeyNum, uKeyNum & 0x0001 ? 'B' : 'A', (uKeyNum - 0x4000)/2 ); snprintf(exp, size, "FIRST AUTH (Keynr 0x%04X: %c sector %d)", uKeyNum, uKeyNum & 0x0001 ? 'B' : 'A', (uKeyNum - 0x4000) / 2);
} else { } else {
snprintf(exp, size, "FIRST AUTH") ; snprintf(exp, size, "FIRST AUTH") ;
} }
@ -1360,7 +1360,7 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
uint16_t uBlockNum = MemLeToUint2byte(data) ; uint16_t uBlockNum = MemLeToUint2byte(data) ;
uint8_t uQty = data[2] ; uint8_t uQty = data[2] ;
if (uQty != 1) { if (uQty != 1) {
snprintf(exp, size, "READ %s(%u-%u) %s_%s", encrypted, uBlockNum, uBlockNum+uQty-1, responseMaced, commandMaced); snprintf(exp, size, "READ %s(%u-%u) %s_%s", encrypted, uBlockNum, uBlockNum + uQty - 1, responseMaced, commandMaced);
} else { } else {
snprintf(exp, size, "READ %s(%u) %s_%s", encrypted, uBlockNum, responseMaced, commandMaced); snprintf(exp, size, "READ %s(%u) %s_%s", encrypted, uBlockNum, responseMaced, commandMaced);
} }
@ -1369,11 +1369,11 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
} }
break; break;
} }
case MFP_WRITEPLAINNOMAC : case MFP_WRITEPLAINNOMAC :
case MFP_WRITEPLAINMAC : case MFP_WRITEPLAINMAC :
case MFP_WRITEENCRYPTEDNOMAC: case MFP_WRITEENCRYPTEDNOMAC:
case MFP_WRITEENCRYPTEDMAC :{ case MFP_WRITEENCRYPTEDMAC : {
const char *encrypted = mfpGetEncryptedForCode(opcode) ; const char *encrypted = mfpGetEncryptedForCode(opcode) ;
const char *responseMaced = mfpGetResponseMacedForCode(opcode) ; const char *responseMaced = mfpGetResponseMacedForCode(opcode) ;
@ -1397,12 +1397,12 @@ void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
case MFP_DECREMENTTRANSFERNOMAC: case MFP_DECREMENTTRANSFERNOMAC:
case MFP_DECREMENTTRANSFERMAC : case MFP_DECREMENTTRANSFERMAC :
case MFP_RESTORENOMAC : case MFP_RESTORENOMAC :
case MFP_RESTOREMAC :{ case MFP_RESTOREMAC : {
const char *responseMaced = mfpGetResponseMacedForCode(opcode) ; const char *responseMaced = mfpGetResponseMacedForCode(opcode) ;
const char *annotation = mfpGetAnnotationForCode(opcode) ; const char *annotation = mfpGetAnnotationForCode(opcode) ;
if (annotation == NULL) { if (annotation == NULL) {
//should not happen outside of default case: it means an entry is mising in mfpGetAnnotationForCode() //should not happen outside of default case: it means an entry is mising in mfpGetAnnotationForCode()
annotation="?? MISSING OPCODE" ; annotation = "?? MISSING OPCODE" ;
} }
if (data_size > 1) { if (data_size > 1) {

View file

@ -7035,12 +7035,12 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
uint8_t aCHANGE[] = {0x00, 0xa6, 0xa0, 0x00, 0x05, 0xff, 0xff, 0xff, 0xff, 0x00}; uint8_t aCHANGE[] = {0x00, 0xa6, 0xa0, 0x00, 0x05, 0xff, 0xff, 0xff, 0xff, 0x00};
memcpy(aCHANGE + 5, uid, uidlen); memcpy(aCHANGE + 5, uid, uidlen);
res = ExchangeAPDU14a( res = ExchangeAPDU14a(
aCHANGE, sizeof(aCHANGE), aCHANGE, sizeof(aCHANGE),
activate_field, activate_field,
keep_field_on, keep_field_on,
response, sizeof(response), response, sizeof(response),
&resplen &resplen
); );
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Super card UID change [ " _RED_("fail") " ]"); PrintAndLogEx(FAILED, "Super card UID change [ " _RED_("fail") " ]");
@ -7061,12 +7061,12 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
// --------------- RESET CARD ---------------- // --------------- RESET CARD ----------------
uint8_t aRESET[] = {0x00, 0xa6, 0xc0, 0x00}; uint8_t aRESET[] = {0x00, 0xa6, 0xc0, 0x00};
res = ExchangeAPDU14a( res = ExchangeAPDU14a(
aRESET, sizeof(aRESET), aRESET, sizeof(aRESET),
activate_field, activate_field,
keep_field_on, keep_field_on,
response, sizeof(response), response, sizeof(response),
&resplen &resplen
); );
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Super card reset [ " _RED_("fail") " ]"); PrintAndLogEx(FAILED, "Super card reset [ " _RED_("fail") " ]");
@ -7157,11 +7157,11 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
uint64_t key64 = -1; uint64_t key64 = -1;
if (mfkey32_moebius(&data, &key64)) { if (mfkey32_moebius(&data, &key64)) {
PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ " _GREEN_("%012" PRIX64) " ]", PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ " _GREEN_("%012" PRIX64) " ]",
sprint_hex_inrow(outA, 4), sprint_hex_inrow(outA, 4),
data.sector, data.sector,
(data.keytype == 0x60) ? 'A' : 'B', (data.keytype == 0x60) ? 'A' : 'B',
key64 key64
); );
} else { } else {
PrintAndLogEx(FAILED, "failed to recover any key"); PrintAndLogEx(FAILED, "failed to recover any key");
} }

View file

@ -631,7 +631,7 @@ static int CmdLFHitagReader(const char *Cmd) {
memcpy(key, "MIKR", 4); memcpy(key, "MIKR", 4);
keylen = 4; keylen = 4;
} }
if ((keylen == 0) && use_crypto) { if ((keylen == 0) && use_crypto) {
memcpy(key, "ONMIKR", 6); memcpy(key, "ONMIKR", 6);
keylen = 6; keylen = 6;
} }
@ -888,7 +888,7 @@ static int CmdLFHitagWriter(const char *Cmd) {
memcpy(key, "MIKR", 4); memcpy(key, "MIKR", 4);
keylen = 4; keylen = 4;
} }
if ((keylen == 0) && use_crypto) { if ((keylen == 0) && use_crypto) {
memcpy(key, "ONMIKR", 6); memcpy(key, "ONMIKR", 6);
keylen = 6; keylen = 6;
} }
@ -1047,7 +1047,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
memcpy(key, "MIKR", 4); memcpy(key, "MIKR", 4);
keylen = 4; keylen = 4;
} }
if ((keylen == 0) && use_crypto) { if ((keylen == 0) && use_crypto) {
memcpy(key, "ONMIKR", 6); memcpy(key, "ONMIKR", 6);
keylen = 6; keylen = 6;
} }

View file

@ -120,12 +120,12 @@ int asn1_selftest(void) {
/* /*
ICEMAN: ICEMAN:
Problem to be solved, how to extract data back from our asn1 decoder to compare with the expected text found in the following test cases. Problem to be solved, how to extract data back from our asn1 decoder to compare with the expected text found in the following test cases.
Thanks @Mistial for the suggestion and links. Thanks @Mistial for the suggestion and links.
These test cases are from the project lapo-luchini's asn1js (ISC license which is like MIT license) These test cases are from the project lapo-luchini's asn1js (ISC license which is like MIT license)
https://github.com/lapo-luchini/asn1js/blob/trunk/test.js https://github.com/lapo-luchini/asn1js/blob/trunk/test.js
const asn1_test tests[] = { const asn1_test tests[] = {
@ -211,7 +211,7 @@ int asn1_selftest(void) {
{"181531393835313130363231303632372E332D31323334", "1985-11-06 21:06:27.3 UTC-12:34", "UTC offsets with minutes"}, {"181531393835313130363231303632372E332D31323334", "1985-11-06 21:06:27.3 UTC-12:34", "UTC offsets with minutes"},
// GitHub issue #54 // GitHub issue #54
{"181331393835313130363231303632372E332B3134", "1985-11-06 21:06:27.3 UTC+14:00", "UTC offset +13 and +14"}, {"181331393835313130363231303632372E332B3134", "1985-11-06 21:06:27.3 UTC+14:00", "UTC offset +13 and +14"},
}; };
int tot = ARRAYLEN(tests); int tot = ARRAYLEN(tests);
@ -238,7 +238,7 @@ int asn1_selftest(void) {
if (t) { if (t) {
bool candump = false; bool candump = false;
if (asn1_tag_dump(&t->tag, 0, &candump)) { if (asn1_tag_dump(&t->tag, 0, &candump)) {
count++; count++;
} }
tlvdb_free(t); tlvdb_free(t);
} }
@ -250,6 +250,6 @@ int asn1_selftest(void) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
*/ */
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -83,6 +83,7 @@ const static vocabulory_t vocabulory[] = {
{ 1, "data autocorr" }, { 1, "data autocorr" },
{ 1, "data dirthreshold" }, { 1, "data dirthreshold" },
{ 1, "data decimate" }, { 1, "data decimate" },
{ 1, "data envelope" },
{ 1, "data undecimate" }, { 1, "data undecimate" },
{ 1, "data hide" }, { 1, "data hide" },
{ 1, "data hpf" }, { 1, "data hpf" },
@ -92,6 +93,7 @@ const static vocabulory_t vocabulory[] = {
{ 1, "data mtrim" }, { 1, "data mtrim" },
{ 1, "data norm" }, { 1, "data norm" },
{ 1, "data plot" }, { 1, "data plot" },
{ 1, "data cthreshold" },
{ 1, "data rtrim" }, { 1, "data rtrim" },
{ 1, "data setgraphmarkers" }, { 1, "data setgraphmarkers" },
{ 1, "data shiftgraphzero" }, { 1, "data shiftgraphzero" },
@ -599,15 +601,16 @@ const static vocabulory_t vocabulory[] = {
{ 0, "lf hid brute" }, { 0, "lf hid brute" },
{ 0, "lf hid watch" }, { 0, "lf hid watch" },
{ 1, "lf hitag help" }, { 1, "lf hitag help" },
{ 0, "lf hitag eload" },
{ 1, "lf hitag list" }, { 1, "lf hitag list" },
{ 0, "lf hitag info" }, { 0, "lf hitag info" },
{ 0, "lf hitag reader" },
{ 0, "lf hitag sim" },
{ 0, "lf hitag sniff" },
{ 0, "lf hitag writer" },
{ 0, "lf hitag dump" }, { 0, "lf hitag dump" },
{ 0, "lf hitag read" },
{ 0, "lf hitag wrbl" },
{ 0, "lf hitag sniff" },
{ 0, "lf hitag cc" }, { 0, "lf hitag cc" },
{ 0, "lf hitag ta" },
{ 0, "lf hitag eload" },
{ 0, "lf hitag sim" },
{ 1, "lf idteck help" }, { 1, "lf idteck help" },
{ 1, "lf idteck demod" }, { 1, "lf idteck demod" },
{ 0, "lf idteck reader" }, { 0, "lf idteck reader" },

View file

@ -199,9 +199,10 @@
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-d <hex> ASN1 encoded byte array" "-d <hex> ASN1 encoded byte array",
"-t, --test perform selftest"
], ],
"usage": "data asn1 [-h] -d <hex>" "usage": "data asn1 [-ht] [-d <hex>]"
}, },
"data autocorr": { "data autocorr": {
"command": "data autocorr", "command": "data autocorr",
@ -283,6 +284,20 @@
], ],
"usage": "data convertbitstream [-h]" "usage": "data convertbitstream [-h]"
}, },
"data cthreshold": {
"command": "data cthreshold",
"description": "Inverse of dirty threshold command, all values between up and down will be average out",
"notes": [
"data cthreshold -u 10 -d -10"
],
"offline": true,
"options": [
"-h, --help This help",
"-d, --down <dec> threshold down",
"-u, --up <dec> threshold up"
],
"usage": "data cthreshold [-h] -d <dec> -u <dec>"
},
"data decimate": { "data decimate": {
"command": "data decimate", "command": "data decimate",
"description": "Performs decimation, by reducing samples N times in the grapbuf. Good for PSK", "description": "Performs decimation, by reducing samples N times in the grapbuf. Good for PSK",
@ -301,20 +316,18 @@
"command": "data detectclock", "command": "data detectclock",
"description": "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer", "description": "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer",
"notes": [ "notes": [
"data detectclock -A -> detect clock of an ask wave in GraphBuffer", "data detectclock --ask",
"data detectclock -F -> detect clock of an fsk wave in GraphBuffer", "data detectclock --nzr -> detect clock of an nrz/direct wave in GraphBuffer"
"data detectclock -N -> detect clock of an psk wave in GraphBuffer",
"data detectclock -P -> detect clock of an nrz/direct wave in GraphBuffer"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-A, --ASK specify ASK modulation clock detection", "--ask specify ASK modulation clock detection",
"-F, --FSK specify FSK modulation clock detection", "--fsk specify FSK modulation clock detection",
"-N, --NZR specify NZR/DIRECT modulation clock detection", "--nzr specify NZR/DIRECT modulation clock detection",
"-P, --PSK specify PSK modulation clock detection" "--psk specify PSK modulation clock detection"
], ],
"usage": "data detectclock [-hAFNP]" "usage": "data detectclock [-h] [--ask] [--fsk] [--nzr] [--psk]"
}, },
"data diff": { "data diff": {
"command": "data diff", "command": "data diff",
@ -352,6 +365,18 @@
], ],
"usage": "data dirthreshold [-h] -d <dec> -u <dec>" "usage": "data dirthreshold [-h] -d <dec> -u <dec>"
}, },
"data envelope": {
"command": "data envelope",
"description": "Create an square envelop of the samples",
"notes": [
"data envelop"
],
"offline": true,
"options": [
"-h, --help This help"
],
"usage": "data envelop [-h]"
},
"data fsktonrz": { "data fsktonrz": {
"command": "data fsktonrz", "command": "data fsktonrz",
"description": "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk) Omitted values are autodetect instead", "description": "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk) Omitted values are autodetect instead",
@ -8638,19 +8663,29 @@
}, },
"lf hitag dump": { "lf hitag dump": {
"command": "lf hitag dump", "command": "lf hitag dump",
"description": "Read all card memory and save to fileIn password mode the default key is 4D494B52 (MIKR) In crypto mode the default key is 4F4E4D494B52 (ONMIKR) format: ISK high + ISK low.", "description": "Read all Hitag 2 card memory and save to file Crypto mode key format: ISK high + ISK low",
"notes": [ "notes": [
"lf hitag dump -k 4F4E4D494B52", "Password mode => use default key 4D494B52 (MIKR)",
"lf hitag dump -k 4D494B52" "lf hitag dump --pwd",
"Short key = password mode",
"lf hitag dump -k 4D494B52",
"Challenge mode",
"lf hitag dump --nrar 0102030411223344",
"Crypto mode => use default key 4F4E4D494B52 (ONMIKR)",
"lf hitag dump --crypto",
"Long key = crypto mode",
"lf hitag dump -k 4F4E4D494B52"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-f, --file <fn> specify file name", "--pwd password mode",
"--nrar <hex> nonce / answer reader, 8 hex bytes",
"--crypto crypto mode",
"-k, --key <hex> key, 4 or 6 hex bytes", "-k, --key <hex> key, 4 or 6 hex bytes",
"--nrar <hex> nonce / answer reader, 8 hex bytes" "-f, --file <fn> specify file name"
], ],
"usage": "lf hitag dump [-h] [-f <fn>] [-k <hex>] [--nrar <hex>]" "usage": "lf hitag dump [-h] [--pwd] [--nrar <hex>] [--crypto] [-k <hex>] [-f <fn>]"
}, },
"lf hitag eload": { "lf hitag eload": {
"command": "lf hitag eload", "command": "lf hitag eload",
@ -8661,11 +8696,11 @@
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-f, --file <fn> Specfiy dump filename", "-f, --file <fn> Specify dump filename",
"-1 Card type Hitag1", "-1, --ht1 Card type Hitag 1",
"-2 Card type Hitag2", "-2, --ht2 Card type Hitag 2",
"-s Card type HitagS", "-s, --hts Card type Hitag S",
"-m Card type HitagM" "-m, --htm Card type Hitag \u03bc"
], ],
"usage": "lf hitag eload [-h12sm] -f <fn>" "usage": "lf hitag eload [-h12sm] -f <fn>"
}, },
@ -8702,46 +8737,54 @@
], ],
"usage": "lf hitag list [-h1crux] [--frame] [-f <fn>]" "usage": "lf hitag list [-h1crux] [--frame] [-f <fn>]"
}, },
"lf hitag reader": { "lf hitag read": {
"command": "lf hitag reader", "command": "lf hitag read",
"description": "Act like a Hitag Reader", "description": "Read Hitag memory Crypto mode key format: ISK high + ISK low",
"notes": [ "notes": [
"Hitag S", "Hitag S, plain mode",
"lf hitag reader --01 --nrar 0102030411223344", "lf hitag read --hts",
"lf hitag reader --02 -k 4F4E4D494B52", "Hitag S, challenge mode",
"Hitag 2", "lf hitag read --hts --nrar 0102030411223344",
"lf hitag reader --21 -k 4D494B52", "Hitag S, crypto mode => use default key 4F4E4D494B52 (ONMIKR)",
"lf hitag reader --22 --nrar 0102030411223344", "lf hitag read --hts --crypto",
"lf hitag reader --23 -k 4F4E4D494B52", "Hitag S, long key = crypto mode",
"lf hitag reader --26" "lf hitag read --hts -k 4F4E4D494B52",
"",
"Hitag 2, password mode => use default key 4D494B52 (MIKR)",
"lf hitag read --ht2 --pwd",
"Hitag 2, providing a short key = password mode",
"lf hitag read --ht2 -k 4D494B52",
"Hitag 2, challenge mode",
"lf hitag read --ht2 --nrar 0102030411223344",
"Hitag 2, crypto mode => use default key 4F4E4D494B52 (ONMIKR)",
"lf hitag read --ht2 --crypto",
"Hitag 2, providing a long key = crypto mode",
"lf hitag read --ht2 -k 4F4E4D494B52"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"--01 HitagS, read all pages, challenge mode", "-s, --hts Hitag S",
"--02 HitagS, read all pages, crypto mode. Set key=0 for no auth", "-2, --ht2 Hitag 2",
"--21 Hitag2, read all pages, password mode. def 4D494B52 (MIKR)", "--pwd password mode",
"--22 Hitag2, read all pages, challenge mode", "--nrar <hex> nonce / answer writer, 8 hex bytes",
"--23 Hitag2, read all pages, crypto mode. Key ISK high + ISK low. def 4F4E4D494B52 (ONMIKR)", "--crypto crypto mode",
"--25 Hitag2, test recorded authentications (replay?)", "-k, --key <hex> key, 4 or 6 hex bytes"
"--26 Hitag2, read UID",
"-k, --key <hex> key, 4 or 6 hex bytes",
"--nrar <hex> nonce / answer reader, 8 hex bytes"
], ],
"usage": "lf hitag reader [-h] [--01] [--02] [--21] [--22] [--23] [--25] [--26] [-k <hex>] [--nrar <hex>]" "usage": "lf hitag read [-hs2] [--pwd] [--nrar <hex>] [--crypto] [-k <hex>]"
}, },
"lf hitag sim": { "lf hitag sim": {
"command": "lf hitag sim", "command": "lf hitag sim",
"description": "Simulate Hitag2 / HitagS transponder You need to `lf hitag eload` first", "description": "Simulate Hitag transponder You need to `lf hitag eload` first",
"notes": [ "notes": [
"lf hitag sim -2" "lf hitag sim -2"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-1 simulate Hitag1", "-1, --ht1 simulate Hitag 1",
"-2 simulate Hitag2", "-2, --ht2 simulate Hitag 2",
"-s simulate HitagS" "-s, --hts simulate Hitag S"
], ],
"usage": "lf hitag sim [-h12s]" "usage": "lf hitag sim [-h12s]"
}, },
@ -8757,30 +8800,43 @@
], ],
"usage": "lf hitag sniff [-h]" "usage": "lf hitag sniff [-h]"
}, },
"lf hitag writer": { "lf hitag wrbl": {
"command": "lf hitag writer", "command": "lf hitag wrbl",
"description": "Act like a Hitag writerIn password mode the default key is 4D494B52 (MIKR) In crypto mode the default key is 4F4E4D494B52 (ONMIKR) format: ISK high + ISK low.", "description": "Write a page in Hitag memory Crypto mode key format: ISK high + ISK low",
"notes": [ "notes": [
"Hitag S", "Hitag S, plain mode",
"lf hitag writer --03 --nrar 0102030411223344 -p 3 -d 01020304", "lf hitag wrbl --hts -p 6 -d 01020304",
"lf hitag writer --04 -k 4F4E4D494B52 -p 3 -d 01020304", "Hitag S, challenge mode",
"Hitag 2", "lf hitag wrbl --hts --nrar 0102030411223344 -p 6 -d 01020304",
"lf hitag writer --24 -k 4F4E4D494B52 -p 3 -d 01020304", "Hitag S, crypto mode => use default key 4F4E4D494B52 (ONMIKR)",
"lf hitag writer --27 -k 4D494B52 -p 3 -d 01020304" "lf hitag wrbl --hts --crypto -p 6 -d 01020304",
"Hitag S, long key = crypto mode",
"lf hitag wrbl --hts -k 4F4E4D494B52 -p 6 -d 01020304",
"",
"Hitag 2, password mode => use default key 4D494B52 (MIKR)",
"lf hitag wrbl --ht2 --pwd -p 6 -d 01020304",
"Hitag 2, providing a short key = password mode",
"lf hitag wrbl --ht2 -k 4D494B52 -p 6 -d 01020304",
"Hitag 2, challenge mode",
"lf hitag wrbl --ht2 --nrar 0102030411223344 -p 6 -d 01020304",
"Hitag 2, crypto mode => use default key 4F4E4D494B52 (ONMIKR)",
"lf hitag wrbl --ht2 --crypto -p 6 -d 01020304",
"Hitag 2, providing a long key = crypto mode",
"lf hitag wrbl --ht2 -k 4F4E4D494B52 -p 6 -d 01020304"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"--03 HitagS, write page, challenge mode", "-s, --hts Hitag S",
"--04 HitagS, write page, crypto mode. Set key=0 for no auth", "-2, --ht2 Hitag 2",
"--24 Hitag2, write page, crypto mode.", "--pwd password mode",
"--27 Hitag2, write page, password mode", "--nrar <hex> nonce / answer writer, 8 hex bytes",
"-p, --page <dec> page address to write to", "--crypto crypto mode",
"-d, --data <hex> data, 4 hex bytes",
"-k, --key <hex> key, 4 or 6 hex bytes", "-k, --key <hex> key, 4 or 6 hex bytes",
"--nrar <hex> nonce / answer writer, 8 hex bytes" "-p, --page <dec> page address to write to",
"-d, --data <hex> data, 4 hex bytes"
], ],
"usage": "lf hitag writer [-h] [--03] [--04] [--24] [--27] -p <dec> [-d <hex>] [-k <hex>] [--nrar <hex>]" "usage": "lf hitag wrbl [-hs2] [--pwd] [--nrar <hex>] [--crypto] [-k <hex>] -p <dec> -d <hex>"
}, },
"lf idteck clone": { "lf idteck clone": {
"command": "lf idteck clone", "command": "lf idteck clone",
@ -11693,8 +11749,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 679, "commands_extracted": 681,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-07-19T19:11:10" "extracted_on": "2023-07-21T16:22:30"
} }
} }

View file

@ -98,10 +98,11 @@ Check column "offline" for their availability.
|`data manrawdecode `|Y |`Manchester decode binary stream in DemodBuffer` |`data manrawdecode `|Y |`Manchester decode binary stream in DemodBuffer`
|`data modulation `|Y |`Identify LF signal for clock and modulation` |`data modulation `|Y |`Identify LF signal for clock and modulation`
|`data rawdemod `|Y |`Demodulate the data in the GraphBuffer and output binary` |`data rawdemod `|Y |`Demodulate the data in the GraphBuffer and output binary`
|`data askedgedetect `|Y |`Adjust Graph for manual ASK demod using the length of sample differences to detect the edge of a wave` |`data askedgedetect `|Y |`Adjust Graph for manual ASK demod`
|`data autocorr `|Y |`Autocorrelation over window` |`data autocorr `|Y |`Autocorrelation over window`
|`data dirthreshold `|Y |`Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev.` |`data dirthreshold `|Y |`Max rising higher up-thres/ Min falling lower down-thres`
|`data decimate `|Y |`Decimate samples` |`data decimate `|Y |`Decimate samples`
|`data envelope `|Y |`Generate square envelope of samples`
|`data undecimate `|Y |`Un-decimate samples` |`data undecimate `|Y |`Un-decimate samples`
|`data hide `|Y |`Hide graph window` |`data hide `|Y |`Hide graph window`
|`data hpf `|Y |`Remove DC offset from trace` |`data hpf `|Y |`Remove DC offset from trace`
@ -111,10 +112,11 @@ Check column "offline" for their availability.
|`data mtrim `|Y |`Trim out samples from the specified start to the specified stop` |`data mtrim `|Y |`Trim out samples from the specified start to the specified stop`
|`data norm `|Y |`Normalize max/min to +/-128` |`data norm `|Y |`Normalize max/min to +/-128`
|`data plot `|Y |`Show graph window` |`data plot `|Y |`Show graph window`
|`data cthreshold `|Y |`Average out all values between`
|`data rtrim `|Y |`Trim samples from right of trace` |`data rtrim `|Y |`Trim samples from right of trace`
|`data setgraphmarkers `|Y |`Set blue and orange marker in graph window` |`data setgraphmarkers `|Y |`Set blue and orange marker in graph window`
|`data shiftgraphzero `|Y |`Shift 0 for Graphed wave + or - shift value` |`data shiftgraphzero `|Y |`Shift 0 for Graphed wave + or - shift value`
|`data timescale `|Y |`Set a timescale to get a differential reading between the yellow and purple markers as time duration` |`data timescale `|Y |`Set cursor display timescale`
|`data zerocrossings `|Y |`Count time between zero-crossings` |`data zerocrossings `|Y |`Count time between zero-crossings`
|`data convertbitstream `|Y |`Convert GraphBuffer's 0/1 values to 127 / -127` |`data convertbitstream `|Y |`Convert GraphBuffer's 0/1 values to 127 / -127`
|`data getbitstream `|Y |`Convert GraphBuffer's >=1 values to 1 and <1 to 0` |`data getbitstream `|Y |`Convert GraphBuffer's >=1 values to 1 and <1 to 0`
@ -986,15 +988,16 @@ Check column "offline" for their availability.
|command |offline |description |command |offline |description
|------- |------- |----------- |------- |------- |-----------
|`lf hitag help `|Y |`This help` |`lf hitag help `|Y |`This help`
|`lf hitag eload `|N |`Load Hitag dump file into emulator memory`
|`lf hitag list `|Y |`List Hitag trace history` |`lf hitag list `|Y |`List Hitag trace history`
|`lf hitag info `|N |`Hitag2 tag information` |`lf hitag info `|N |`Hitag 2 tag information`
|`lf hitag reader `|N |`Act like a Hitag reader` |`lf hitag dump `|N |`Dump Hitag 2 tag`
|`lf hitag sim `|N |`Simulate Hitag transponder` |`lf hitag read `|N |`Read Hitag memory`
|`lf hitag wrbl `|N |`Write a block (page) in Hitag memory`
|`lf hitag sniff `|N |`Eavesdrop Hitag communication` |`lf hitag sniff `|N |`Eavesdrop Hitag communication`
|`lf hitag writer `|N |`Act like a Hitag writer` |`lf hitag cc `|N |`Hitag S: test all provided challenges`
|`lf hitag dump `|N |`Dump Hitag2 tag` |`lf hitag ta `|N |`Hitag 2: test all recorded authentications`
|`lf hitag cc `|N |`Test all challenges` |`lf hitag eload `|N |`Load Hitag dump file into emulator memory`
|`lf hitag sim `|N |`Simulate Hitag transponder`
### lf idteck ### lf idteck