Skip to content

Commit

Permalink
fix typos and regenerate command list
Browse files Browse the repository at this point in the history
  • Loading branch information
nvx committed Nov 2, 2024
1 parent e3a6ab7 commit ef0cf93
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 56 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
- Added `lf t55xx recoverpw` - adds a new password recovery using bitflips and partial flips if password write went bad. (@alexgrin)
- `hf legic` - added improved legic data mapping. (jason)
- `hf mf mifare` - added possibility to target key A|B (@douniwan5788)
- Added `analyse lcr` - added a new main command group, to help analysing bytes & bits & nibbles. (@iceman1001)
- Added `analyse lrc` - added a new main command group, to help analysing bytes & bits & nibbles. (@iceman1001)
- Added `lf nedap` - added identification of a NEDAP tag. (@iceman1001)
- `lf viking clone` - fixed a bug. (@iceman1001)
- Added bitsliced bruteforce solver in `hf mf hardnested` (@Aczid)
Expand Down
2 changes: 1 addition & 1 deletion armsrc/Standalone/hf_cardhopper.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ static void read_packet(packet_t *packet) {

if (packet->len == 0x50 && dataReceived >= sizeof(PacketResponseNGPreamble) && packet->dat[0] == 0x4D && packet->dat[1] == 0x33 && packet->dat[2] == 0x61) {
// PM3 NG packet magic
DbpString(_CYAN_("[@]") " PM3 NG packet recieved - ignoring");
DbpString(_CYAN_("[@]") " PM3 NG packet received - ignoring");

// clear any remaining buffered data
while (cardhopper_data_available()) {
Expand Down
6 changes: 3 additions & 3 deletions armsrc/iso14443a.c
Original file line number Diff line number Diff line change
Expand Up @@ -4047,15 +4047,15 @@ void SimulateIso14443aTagAID(uint8_t tagType, uint16_t flags, uint8_t *data, uin

// aid len is found as a hex value in receivedCmd[6] (Index Starts at 0)
int aid_len = receivedCmd[6];
uint8_t *recieved_aid = &receivedCmd[7];
uint8_t *received_aid = &receivedCmd[7];

// aid enumeration flag
if (enumerate == true) {
Dbprintf("Received AID (%d):", aid_len);
Dbhexdump(aid_len, recieved_aid, false);
Dbhexdump(aid_len, received_aid, false);
}

if (memcmp(aidFilter, recieved_aid, aid_len) == 0) { // Evaluate the AID sent by the Reader to the AID supplied
if (memcmp(aidFilter, received_aid, aid_len) == 0) { // Evaluate the AID sent by the Reader to the AID supplied
// AID Response will be parsed here
memcpy(dynamic_response_info.response + 2, aidResponse, respondLen + 2);
dynamic_response_info.response_n = respondLen + 2;
Expand Down
2 changes: 1 addition & 1 deletion armsrc/mifareutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ int mifare_ultra_aes_auth(uint8_t keyno, uint8_t *keybytes) {
mbedtls_aes_setkey_enc(&actx, key, 128);
mbedtls_aes_crypt_cbc(&actx, MBEDTLS_AES_ENCRYPT, sizeof(enc_rnd_ab), IV, rnd_ab, enc_rnd_ab);

// send & recieve
// send & receive
len = mifare_sendcmd(MIFARE_ULAES_AUTH_2, enc_rnd_ab, sizeof(enc_rnd_ab), resp, sizeof(resp), respPar, NULL);
if (len != 19) {
if (g_dbglevel >= DBG_ERROR) Dbprintf("Cmd Error: %02x - expected 19 got " _RED_("%u"), resp[0], len);
Expand Down
16 changes: 8 additions & 8 deletions client/src/cmdanalyse.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
static int CmdHelp(const char *Cmd);

static uint8_t calculateLRC(const uint8_t *d, uint8_t n) {
uint8_t lcr = 0;
uint8_t lrc = 0;
for (uint8_t i = 0; i < n; i++)
lcr ^= d[i];
return lcr;
lrc ^= d[i];
return lrc;
}
/*
static uint16_t matrixadd ( uint8_t* bytes, uint8_t len){
Expand Down Expand Up @@ -242,17 +242,17 @@ static int CmdAnalyseLfsr(const char *Cmd) {
return PM3_SUCCESS;
}

static int CmdAnalyseLCR(const char *Cmd) {
static int CmdAnalyseLRC(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "analyse lcr",
CLIParserInit(&ctx, "analyse lrc",
"Specifying the bytes of a UID with a known LRC will find the last byte value\n"
"needed to generate that LRC with a rolling XOR. All bytes should be specified in HEX.",
"analyse lcr -d 04008064BA -> Target (BA) requires final LRC XOR byte value: 5A"
"analyse lrc -d 04008064BA -> Target (BA) requires final LRC XOR byte value: 5A"
);

void *argtable[] = {
arg_param_begin,
arg_str1("d", "data", "<hex>", "bytes to calc missing XOR in a LCR"),
arg_str1("d", "data", "<hex>", "bytes to calc missing XOR in a LRC"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
Expand Down Expand Up @@ -1171,7 +1171,7 @@ static int CmdAnalyseUnits(const char *Cmd) {

static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"lcr", CmdAnalyseLCR, AlwaysAvailable, "Generate final byte for XOR LRC"},
{"lrc", CmdAnalyseLRC, AlwaysAvailable, "Generate final byte for XOR LRC"},
{"crc", CmdAnalyseCRC, AlwaysAvailable, "Stub method for CRC evaluations"},
{"chksum", CmdAnalyseCHKSUM, AlwaysAvailable, "Checksum with adding, masking and one's complement"},
{"dates", CmdAnalyseDates, AlwaysAvailable, "Look for datestamps in a given array of bytes"},
Expand Down
3 changes: 2 additions & 1 deletion client/src/pm3line_vocabulary.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const static vocabulary_t vocabulary[] = {
{ 1, "prefs set output" },
{ 1, "prefs set plotsliders" },
{ 1, "analyse help" },
{ 1, "analyse lcr" },
{ 1, "analyse lrc" },
{ 1, "analyse crc" },
{ 1, "analyse chksum" },
{ 1, "analyse dates" },
Expand Down Expand Up @@ -267,6 +267,7 @@ const static vocabulary_t vocabulary[] = {
{ 0, "hf gallagher delete" },
{ 1, "hf gallagher diversifykey" },
{ 1, "hf gallagher decode" },
{ 1, "hf gallagher encode" },
{ 1, "hf iclass help" },
{ 1, "hf iclass list" },
{ 0, "hf iclass dump" },
Expand Down
101 changes: 64 additions & 37 deletions doc/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@
},
"analyse help": {
"command": "analyse help",
"description": "help This help lcr Generate final byte for XOR LRC crc Stub method for CRC evaluations chksum Checksum with adding, masking and one's complement dates Look for datestamps in a given array of bytes lfsr LFSR tests a num bits test nuid create NUID from 7byte UID demodbuff Load binary string to DemodBuffer freq Calc wave lengths foo muxer units convert ETU <> US <> SSP_CLK (3.39MHz) --------------------------------------------------------------------------------------- analyse lcr available offline: yes Specifying the bytes of a UID with a known LRC will find the last byte value needed to generate that LRC with a rolling XOR. All bytes should be specified in HEX.",
"description": "help This help lrc Generate final byte for XOR LRC crc Stub method for CRC evaluations chksum Checksum with adding, masking and one's complement dates Look for datestamps in a given array of bytes lfsr LFSR tests a num bits test nuid create NUID from 7byte UID demodbuff Load binary string to DemodBuffer freq Calc wave lengths foo muxer units convert ETU <> US <> SSP_CLK (3.39MHz) --------------------------------------------------------------------------------------- analyse lrc available offline: yes Specifying the bytes of a UID with a known LRC will find the last byte value needed to generate that LRC with a rolling XOR. All bytes should be specified in HEX.",
"notes": [
"analyse lcr -d 04008064BA -> Target (BA) requires final LRC XOR byte value: 5A"
"analyse lrc -d 04008064BA -> Target (BA) requires final LRC XOR byte value: 5A"
],
"offline": true,
"options": [
"-h, --help This help",
"-d, --data <hex> bytes to calc missing XOR in a LCR"
"-d, --data <hex> bytes to calc missing XOR in a LRC"
],
"usage": "analyse lcr [-h] -d <hex>"
"usage": "analyse lrc [-h] -d <hex>"
},
"analyse lfsr": {
"command": "analyse lfsr",
Expand Down Expand Up @@ -380,15 +380,15 @@
},
"data envelope": {
"command": "data envelope",
"description": "Create an square envelop of the samples",
"description": "Create an square envelope of the samples",
"notes": [
"data envelop"
"data envelope"
],
"offline": true,
"options": [
"-h, --help This help"
],
"usage": "data envelop [-h]"
"usage": "data envelope [-h]"
},
"data fsktonrz": {
"command": "data fsktonrz",
Expand Down Expand Up @@ -582,7 +582,7 @@
"description": "Function takes a decimal or hexdecimal number and print it in decimal/hex/binary Will print message if number is a prime number",
"notes": [
"data num --dec 2023",
"data num --hex 0x1000"
"data num --hex 2A"
],
"offline": true,
"options": [
Expand Down Expand Up @@ -3141,9 +3141,25 @@
],
"usage": "hf gallagher diversify [-h] --aid <hex> [--keynum <dec>] [--uid <hex>] [--sitekey <hex>] [--apdu]"
},
"hf gallagher encode": {
"command": "hf gallagher encode",
"description": "Encode a Gallagher credential block Credential block can be specified with or without the bitwise inverse.",
"notes": [
"hf gallagher encode --rc 1 --fc 22153 --cn 1253518 --il 1"
],
"offline": true,
"options": [
"-h, --help This help",
"-r, --rc <dec> Region code. 4 bits max",
"-f, --fc <dec> Facility code. 2 bytes max",
"-c, --cn <dec> Card number. 3 bytes max",
"-i, --il <dec> Issue level. 4 bits max"
],
"usage": "hf gallagher encode [-h] -r <dec> -f <dec> -c <dec> -i <dec>"
},
"hf gallagher help": {
"command": "hf gallagher help",
"description": "help This help diversifykey Diversify Gallagher key decode Decode Gallagher credential block --------------------------------------------------------------------------------------- hf gallagher reader available offline: no Read a Gallagher DESFire tag from the Card Application Directory, CAD Specify site key is required if using non-default key",
"description": "help This help diversifykey Diversify Gallagher key decode Decode Gallagher credential block encode Encode Gallagher credential block --------------------------------------------------------------------------------------- hf gallagher reader available offline: no Read a Gallagher DESFire tag from the Card Application Directory, CAD Specify site key is required if using non-default key",
"notes": [
"hf gallagher reader -@ -> continuous reader mode",
"hf gallagher reader --aid 2081f4 --sitekey 00112233445566778899aabbccddeeff -> skip CAD"
Expand Down Expand Up @@ -4367,9 +4383,10 @@
"options": [
"-h, --help This help",
"-b, --blk <dec> block number",
"-v, --verbose verbose output"
"-v, --verbose verbose output",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf cgetblk [-hv] -b <dec>"
"usage": "hf mf cgetblk [-hv] -b <dec> [--gdm]"
},
"hf mf cgetsc": {
"command": "hf mf cgetsc",
Expand All @@ -4381,9 +4398,10 @@
"options": [
"-h, --help This help",
"-s, --sec <dec> sector number",
"-v, --verbose verbose output"
"-v, --verbose verbose output",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf cgetsc [-hv] -s <dec>"
"usage": "hf mf cgetsc [-hv] -s <dec> [--gdm]"
},
"hf mf chk": {
"command": "hf mf chk",
Expand Down Expand Up @@ -4431,9 +4449,10 @@
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70",
"--emu from emulator memory"
"--emu from emulator memory",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf cload [-h] [-f <fn>] [--mini] [--1k] [--2k] [--4k] [--emu]"
"usage": "hf mf cload [-h] [-f <fn>] [--mini] [--1k] [--2k] [--4k] [--emu] [--gdm]"
},
"hf mf csave": {
"command": "hf mf csave",
Expand All @@ -4450,9 +4469,10 @@
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70",
"--emu to emulator memory"
"--emu to emulator memory",
"--gdm to emulator memory"
],
"usage": "hf mf csave [-h] [-f <fn>] [--mini] [--1k] [--2k] [--4k] [--emu]"
"usage": "hf mf csave [-h] [-f <fn>] [--mini] [--1k] [--2k] [--4k] [--emu] [--gdm]"
},
"hf mf csetblk": {
"command": "hf mf csetblk",
Expand All @@ -4465,9 +4485,10 @@
"-h, --help This help",
"-b, --blk <dec> block number",
"-d, --data <hex> bytes to write, 16 hex bytes",
"-w, --wipe wipes card with backdoor cmd before writing"
"-w, --wipe wipes card with backdoor cmd before writing",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf csetblk [-hw] -b <dec> [-d <hex>]"
"usage": "hf mf csetblk [-hw] -b <dec> [-d <hex>] [--gdm]"
},
"hf mf csetuid": {
"command": "hf mf csetuid",
Expand All @@ -4482,9 +4503,10 @@
"-w, --wipe wipes card with backdoor cmd`",
"-u, --uid <hex> UID, 4/7 hex bytes",
"-a, --atqa <hex> ATQA, 2 hex bytes",
"-s, --sak <hex> SAK, 1 hex byte"
"-s, --sak <hex> SAK, 1 hex byte",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf csetuid [-hw] [-u <hex>] [-a <hex>] [-s <hex>]"
"usage": "hf mf csetuid [-hw] [-u <hex>] [-a <hex>] [-s <hex>] [--gdm]"
},
"hf mf cview": {
"command": "hf mf cview",
Expand All @@ -4500,9 +4522,10 @@
"--1k MIFARE Classic 1k / S50 (def)",
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70",
"-v, --verbose verbose output"
"-v, --verbose verbose output",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf cview [-hv] [--mini] [--1k] [--2k] [--4k]"
"usage": "hf mf cview [-hv] [--mini] [--1k] [--2k] [--4k] [--gdm]"
},
"hf mf cwipe": {
"command": "hf mf cwipe",
Expand All @@ -4516,9 +4539,10 @@
"-h, --help This help",
"-u, --uid <hex> UID, 4 hex bytes",
"-a, --atqa <hex> ATQA, 2 hex bytes",
"-s, --sak <hex> SAK, 1 hex byte"
"-s, --sak <hex> SAK, 1 hex byte",
"--gdm use gdm alt (20/23) magic wakeup"
],
"usage": "hf mf cwipe [-h] [-u <hex>] [-a <hex>] [-s <hex>]"
"usage": "hf mf cwipe [-h] [-u <hex>] [-a <hex>] [-s <hex>] [--gdm]"
},
"hf mf darkside": {
"command": "hf mf darkside",
Expand Down Expand Up @@ -5383,17 +5407,18 @@
"--1k MIFARE Classic 1k / S50",
"--2k MIFARE Classic/Plus 2k",
"--4k MIFARE Classic 4k / S70",
"--atqa <hex> Provide explicit ATQA (2 bytes, overrides option t)",
"--sak <hex> Provide explicit SAK (1 bytes, overrides option t)",
"--atqa <hex> Provide explicit ATQA (2 bytes)",
"--sak <hex> Provide explicit SAK (1 bytes)",
"-n, --num <dec> Automatically exit simulation after <numreads> blocks have been read by reader. 0 = infinite",
"-i, --interactive Console will not be returned until simulation finishes or is aborted",
"-x Performs the 'reader attack', nr/ar attack against a reader.",
"-y Performs the nested 'reader attack'. This requires preloading nt & nt_enc in emulator memory. Implies -x.",
"-e, --emukeys Fill simulator keys from found keys. Requires -x or -y. Implies -i. Simulation will restart automatically.",
"-v, --verbose verbose output",
"--cve trigger CVE 2021_0430"
"--allowkeyb Allow key B even if readable",
"-v, --verbose Verbose output",
"--cve Trigger CVE 2021_0430"
],
"usage": "hf mf sim [-hixyev] [-u <hex>] [--mini] [--1k] [--2k] [--4k] [--atqa <hex>] [--sak <hex>] [-n <dec> ] [--cve]"
"usage": "hf mf sim [-hixyev] [-u <hex>] [--mini] [--1k] [--2k] [--4k] [--atqa <hex>] [--sak <hex>] [-n <dec> ] [--allowkeyb] [--cve]"
},
"hf mf staticnested": {
"command": "hf mf staticnested",
Expand Down Expand Up @@ -8501,7 +8526,7 @@
"lf cmdread -d 50 -z 116 -o 166 -e W3000 -c W11000 -> probing for Hitag 2/S",
"lf cmdread -d 50 -z 116 -o 166 -e W3000 -c W11010 -> probing for Hitag S",
"lf cmdread -d 50 -z 116 -o 166 -e W3000 -c W11000 -s 2000 -@ -> probing for Hitag 2/S, oscilloscope style",
"lf cmdread -d 48 -z 112 -o 176 -e W3000 -e S240 -e E336 -c W0S00000010000E -> probing for Hitag \u00b5(micro)"
"lf cmdread -d 48 -z 112 -o 176 -e W3000 -e S240 -e E336 -c W0S00000010000E -> probing for Hitag \u00e6(micro)"
],
"offline": false,
"options": [
Expand Down Expand Up @@ -9737,7 +9762,7 @@
"-1, --ht1 Card type Hitag 1",
"-2, --ht2 Card type Hitag 2",
"-s, --hts Card type Hitag S",
"-m, --htm Card type Hitag \u03bc"
"-m, --htm Card type Hitag \u00ce\u00bc"
],
"usage": "lf hitag eload [-h12sm] -f <fn>"
},
Expand Down Expand Up @@ -9813,10 +9838,11 @@
"--nrar <hex> nonce / answer writer, 8 hex bytes",
"--crypto crypto mode",
"-k, --key <hex> pwd or key, 4 or 6 hex bytes",
"-m, --mode <dec> response protocol mode. 0 (Standard 00110), 1 (Advanced 11000), 2 (Advanced 11001), 3 (Fast Advanced 11010) (def: 3)",
"-p, --page <dec> page address to read from",
"-c, --count <dec> how many pages to read. '0' reads all pages up to the end page (default: 1)"
"-c, --count <dec> how many pages to read. '0' reads all pages up to the end page (def: 1)"
],
"usage": "lf hitag hts rdbl [-h8] [--nrar <hex>] [--crypto] [-k <hex>] [-p <dec>] [-c <dec>]"
"usage": "lf hitag hts rdbl [-h8] [--nrar <hex>] [--crypto] [-k <hex>] [-m <dec>] [-p <dec>] [-c <dec>]"
},
"lf hitag hts reader": {
"command": "lf hitag hts reader",
Expand Down Expand Up @@ -9863,10 +9889,11 @@
"--nrar <hex> nonce / answer writer, 8 hex bytes",
"--crypto crypto mode",
"-k, --key <hex> pwd or key, 4 or 6 hex bytes",
"-m, --mode <dec> response protocol mode. 0 (Standard 00110), 1 (Advanced 11000), 2 (Advanced 11001), 3 (Fast Advanced 11010) (def: 3)",
"-p, --page <dec> page address to write to",
"-d, --data <hex> data, 4 hex bytes"
],
"usage": "lf hitag hts wrbl [-h8] [--nrar <hex>] [--crypto] [-k <hex>] -p <dec> -d <hex>"
"usage": "lf hitag hts wrbl [-h8] [--nrar <hex>] [--crypto] [-k <hex>] [-m <dec>] -p <dec> -d <hex>"
},
"lf hitag info": {
"command": "lf hitag info",
Expand Down Expand Up @@ -12976,8 +13003,8 @@
}
},
"metadata": {
"commands_extracted": 748,
"commands_extracted": 749,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2024-10-18T15:36:53"
"extracted_on": "2024-11-02T12:57:51"
}
}
Loading

0 comments on commit ef0cf93

Please sign in to comment.