Skip to content

Commit

Permalink
hf legic einfo, now accepts card size params
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Jul 17, 2023
1 parent 73eb8d0 commit 230f1c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ 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]
- Changed `hf legic einfo` - now accepts the three different cardsizes as params (@iceman1001)
- Fix `lf cotag reader -1` - now doesn't fail (@iceman1001)
- Added support for LZ4 compressed hadnested tables (@doegox)
- Changed `emv reader -v` - now tries to print found transactions logs (@iceman1001)
- Added ISO4217 currency lookup (@iceman1001)
Expand Down
21 changes: 21 additions & 0 deletions client/src/cmdhflegic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,15 +1226,36 @@ static int CmdLegicEInfo(const char *Cmd) {
CLIParserInit(&ctx, "hf legic einfo",
"It decodes and displays emulator memory",
"hf legic einfo\n"
"hf legic eview --22\n"
);
void *argtable[] = {
arg_param_begin,
arg_lit0(NULL, "22", "LEGIC Prime MIM22"),
arg_lit0(NULL, "256", "LEGIC Prime MIM256 (def)"),
arg_lit0(NULL, "1024", "LEGIC Prime MIM1024"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
bool m1 = arg_get_lit(ctx, 1);
bool m2 = arg_get_lit(ctx, 2);
bool m3 = arg_get_lit(ctx, 3);
CLIParserFree(ctx);

// validations
if (m1 + m2 + m3 > 1) {
PrintAndLogEx(WARNING, "Only specify one LEGIC Prime Type");
return PM3_EINVARG;
} else if (m1 + m2 + m3 == 0) {
m2 = true;
}

size_t card_size = LEGIC_PRIME_MIM256;
if (m1)
card_size = LEGIC_PRIME_MIM22;
else if (m2)
card_size = LEGIC_PRIME_MIM256;
else if (m3)
card_size = LEGIC_PRIME_MIM1024;

uint8_t *dump = calloc(card_size, sizeof(uint8_t));
if (dump == NULL) {
Expand Down

0 comments on commit 230f1c6

Please sign in to comment.