mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
Merge branch 'master' into iceclass-read-sim
Signed-off-by: Nate Sales <nate@natesales.net>
This commit is contained in:
commit
917b99ff47
3 changed files with 24 additions and 5 deletions
|
@ -4,6 +4,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
|||
|
||||
## [unreleased][unreleased]
|
||||
- Add ICECLASS standalone read/sim mode (@natesales)
|
||||
- Added verbose flag to `hf iclass encode` (@natesales)
|
||||
- Fixed `Makefile` regression that broke `make install` (@henrygab)
|
||||
- Fixed `lf em 4x70 brute` - now works as expected (@adite)
|
||||
- Fixed the lf sampling when bits_per_sample is less than 8 (@wh201906)
|
||||
|
|
|
@ -35,11 +35,14 @@ void SpinDelayUsPrecision(int us) {
|
|||
AT91C_BASE_PWMC_CH0->PWMC_CDTYR = 0; // Channel Duty Cycle Register
|
||||
AT91C_BASE_PWMC_CH0->PWMC_CPRDR = 0xFFFF; // Channel Period Register
|
||||
|
||||
uint16_t start = AT91C_BASE_PWMC_CH0->PWMC_CCNTR;
|
||||
uint16_t end = AT91C_BASE_PWMC_CH0->PWMC_CCNTR + ticks;
|
||||
if (end == 0) // AT91C_BASE_PWMC_CH0->PWMC_CCNTR is never == 0
|
||||
end++; // so we have to end++ to avoid inivity loop
|
||||
|
||||
for (;;) {
|
||||
uint16_t now = AT91C_BASE_PWMC_CH0->PWMC_CCNTR;
|
||||
if (now == (uint16_t)(start + ticks))
|
||||
|
||||
if (now == end)
|
||||
return;
|
||||
|
||||
WDT_HIT();
|
||||
|
@ -59,13 +62,15 @@ void SpinDelayUs(int us) {
|
|||
AT91C_BASE_PWMC_CH0->PWMC_CDTYR = 0; // Channel Duty Cycle Register
|
||||
AT91C_BASE_PWMC_CH0->PWMC_CPRDR = 0xffff; // Channel Period Register
|
||||
|
||||
uint16_t start = AT91C_BASE_PWMC_CH0->PWMC_CCNTR;
|
||||
uint16_t end = AT91C_BASE_PWMC_CH0->PWMC_CCNTR + ticks;
|
||||
if (end == 0) // AT91C_BASE_PWMC_CH0->PWMC_CCNTR is never == 0
|
||||
end++; // so we have to end++ to avoid inivity loop
|
||||
|
||||
for (;;) {
|
||||
uint16_t now = AT91C_BASE_PWMC_CH0->PWMC_CCNTR;
|
||||
if (now == (uint16_t)(start + ticks))
|
||||
return;
|
||||
|
||||
if (now == end)
|
||||
return;
|
||||
WDT_HIT();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3832,6 +3832,7 @@ static int CmdHFiClassEncode(const char *Cmd) {
|
|||
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
||||
arg_str0("w", "wiegand", "<format>", "see " _YELLOW_("`wiegand list`") " for available formats"),
|
||||
arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"),
|
||||
arg_lit0("v", NULL, "verbose (print encoded blocks)"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
@ -3877,6 +3878,7 @@ static int CmdHFiClassEncode(const char *Cmd) {
|
|||
CLIParamStrToBuf(arg_get_str(ctx, 9), (uint8_t *)format, sizeof(format), &format_len);
|
||||
|
||||
bool shallow_mod = arg_get_lit(ctx, 10);
|
||||
bool verbose = arg_get_lit(ctx, 11);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -3996,6 +3998,17 @@ static int CmdHFiClassEncode(const char *Cmd) {
|
|||
iclass_encrypt_block_data(credential + 24, enc_key);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
PrintAndLogEx(INFO, "Block %d/0x0%x -> " _YELLOW_("%s"), 6 + i, 6 + i, sprint_hex_inrow(credential + (i * 8), 8));
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_session.pm3_present) {
|
||||
PrintAndLogEx(ERR, "Device offline\n");
|
||||
return PM3_EFAILED;
|
||||
}
|
||||
|
||||
int isok = PM3_SUCCESS;
|
||||
// write
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue