Merge pull request #3766 from matrix/fix-noralsy-limits

lf noralsy: refuse CN above 9999999 and years outside 1961-2060
This commit is contained in:
Iceman authored and GitHub committed 2026-11-09 10:17:53 +08:00
commit 299be31710
2 files changed
+21 -4

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Fixed `lf noralsy clone` and `sim` - CN above 9999999 and years outside 1961-2060 are refused instead of cut (@matrix)
- Fixed `trace list` - Topaz commands end at the frames their code takes, ISO14443-A frames in Topaz traces and ISO15693 frames in iCLASS traces get their own CRC, five byte ISO14443-A answers and FeliCa frames get a real CRC check, frames of 256 bytes and more are checked and annotated whole (@matrix)
- Fixed `trace list` annotations - none reads past its frame, SEOS answers are no longer shown as reader commands, contactless S-blocks, 14b slots, Xerox WUP2 and the Hitag µ field offsets are corrected (@matrix)
- Fixed `trace list -t ht2` and `-c` - a frame over 30 bytes no longer overwrites the Hitag 2 state or stops the client, a frame longer than the rows shown no longer overflows the row buffer (@matrix)
+20 -4
View File
@@ -173,8 +173,8 @@ static int CmdNoralsyClone(const char *Cmd) {
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
uint32_t id = arg_get_u32_def(ctx, 1, 0);
uint16_t year = arg_get_u32_def(ctx, 2, 2000);
uint64_t cn_arg = arg_get_u64_def(ctx, 1, 0);
uint64_t year_arg = arg_get_u64_def(ctx, 2, 2000);
bool q5 = arg_get_lit(ctx, 3);
bool em = arg_get_lit(ctx, 4);
CLIParserFree(ctx);
@@ -184,6 +184,14 @@ static int CmdNoralsyClone(const char *Cmd) {
return PM3_EINVARG;
}
// the frame carries 7 BCD digits of cn and the last 2 of the year, read back as 1961-2060
if (cn_arg > 9999999 || year_arg < 1961 || year_arg > 2060) {
PrintAndLogEx(FAILED, "CN has a max value of 9999999 and year must be 1961-2060");
return PM3_EINVARG;
}
uint32_t id = (uint32_t)cn_arg;
uint16_t year = (uint16_t)year_arg;
uint32_t blocks[4] = {T55x7_MODULATION_MANCHESTER | T55x7_BITRATE_RF_32 | T55x7_ST_TERMINATOR | 3 << T55x7_MAXBLOCK_SHIFT, 0, 0};
char cardtype[16] = {"T55x7"};
//Q5
@@ -246,10 +254,18 @@ static int CmdNoralsySim(const char *Cmd) {
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
uint32_t id = arg_get_u32_def(ctx, 1, 0);
uint16_t year = arg_get_u32_def(ctx, 2, 2000);
uint64_t cn_arg = arg_get_u64_def(ctx, 1, 0);
uint64_t year_arg = arg_get_u64_def(ctx, 2, 2000);
CLIParserFree(ctx);
// the frame carries 7 BCD digits of cn and the last 2 of the year, read back as 1961-2060
if (cn_arg > 9999999 || year_arg < 1961 || year_arg > 2060) {
PrintAndLogEx(FAILED, "CN has a max value of 9999999 and year must be 1961-2060");
return PM3_EINVARG;
}
uint32_t id = (uint32_t)cn_arg;
uint16_t year = (uint16_t)year_arg;
uint8_t bs[96];
memset(bs, 0, sizeof(bs));