adapt data bmap to handle calls without -m.

This commit is contained in:
iceman1001 2023-10-30 16:07:13 +01:00
parent b9dcd143d5
commit f47fb2f74d
2 changed files with 11 additions and 8 deletions

View file

@ -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)
@ -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)

View file

@ -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"
);
@ -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
@ -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]);
}