Skip to content

Commit

Permalink
adapt data bmap to handle calls without -m.
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Oct 30, 2023
1 parent b9dcd14 commit f47fb2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ 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 `data bmap` - now default `-m` is 8 (@iceman1001)
- Added support for NTAG424 cards. (@dankar)
- Additional fixes to configcard code for keyroll mode based on nfc-iclass output (@Antiklesys)
- Changed lf sampling - improved the performance (@yah01)
- Added `bind` option for network connections to specify the outbound address and port (@wh201906)
- Changed `lf em 4x05 dump` - now supports the `--ns` nosave parameter (@iceman1001)
- Fixed some wrong synchronization waits in usb_write() to increase the communication speed (@wh201906)
Expand Down Expand Up @@ -41,7 +43,6 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
- Modified `hf iclass configcard` to only support online mode (@Antiklesys)
- Modified `hf iclass configcard` command to generate config cards without a cardhelper module by porting the contents of blocks 6 & 7 from nfc-iclass (@Antiklesys)
- Fixed `hf iclass info` command showing incorrectly in offline mode (@Antiklesys)
- Changed lf sampling - improved the performance (@yah01)

## [Raccoon.4.17140][2023-09-09]
- Changed text and adjust pm3_test case for mf_aes_brute (@doegox)
Expand Down
16 changes: 9 additions & 7 deletions client/src/cmddata.c
Original file line number Diff line number Diff line change
Expand Up @@ -3457,6 +3457,7 @@ static int CmdBinaryMap(const char *Cmd) {
"Breaks down a hex value to binary according a template\n"
" data bmap -d 16 -m 4,4\n"
"This will give two rows each with four bits",
"data bmap -d 3B\n"
"data bmap -d 3B -m 2,5,1\n"
);

Expand All @@ -3480,7 +3481,11 @@ static int CmdBinaryMap(const char *Cmd) {
char bits[(8 * 4) + 1] = {0};
hextobinstring_n(bits, (char *)hex, hlen);

int x = 0;
if (tlen == 0) {
template[0] = '8';
template[1] = 0;
}

char *token = strtok((char *)template, ",");

// header
Expand All @@ -3490,19 +3495,16 @@ static int CmdBinaryMap(const char *Cmd) {

uint8_t i = 0;
uint8_t cnt = 1;
int x = 0;
while (token != NULL) {
sscanf(token, "%d", &x);

if (i) {
PrintAndLogEx(INFO, " %d | %*.s" NOLF, cnt, i * 3, " ");
} else {
PrintAndLogEx(INFO, " %d | " NOLF, cnt);
}
PrintAndLogEx(INFO, " %d | %*.s" NOLF, cnt, i * 3, " ");

// incease with previous offset
x += i;

for (; i < x; i++) {
for (; i < (uint8_t)x; i++) {
PrintAndLogEx(NORMAL, "%c " NOLF, bits[7 - i]);
}

Expand Down

0 comments on commit f47fb2f

Please sign in to comment.