emsec / ChameleonMini

The ChameleonMini is a versatile contactless smartcard emulator compliant to NFC. The ChameleonMini was developed by https://kasper-oswald.de. The device is available at https://shop.kasper.it. For further information see the Getting Started Page https://rawgit.com/emsec/ChameleonMini/master/Doc/Doxygen/html/_page__getting_started.html or the Wiki tab above.
Other
1.73k stars 392 forks source link

Add multiline result support #67

Open doegox opened 7 years ago

doegox commented 7 years ago

Issue #16 (VERSION returning several lines) was solved by simply writing all the info in a single line. But dump_mfu returns also several lines and probably more commands will do in the future. So what about adding a new response type for multiline result? E.g.

102:OK WITH MULTILINE TEXT

that would e.g. terminate on a last line containing only EOT (end of transmission)

Example:

VERSION?
102:OK WITH MULTILINE TEXT
ChameleonMini RevG 161027 using LUFA 151115 compiled with AVR-GCC 4.9.2.
Based on the open-source NFC tool ChameleonMini.
https://github.com/emsec/ChameleonMini commit 70b6cce
EOT

DUMP_MFU
102:OK WITH MULTILINE TEXT
04575B8031BF02800C48000000000000
000000009632F4000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
EOT
dev-zzo commented 7 years ago

This approach is bound to fail in case someone willing to send the EOT itself. I would suggest separating human-readable and machine-readable output, for example, by providing separate commands where there are such issues (VERSION is a good example). This is not as bad in case of DUMP_MFU as the output has some expected format, which can be easily parsed by both humans and machines.

skuep commented 7 years ago

I would just replace the string "EOT" by 0x04 from the ASCII table ("End Of Transmission"), since all output from the chameleon is ASCII. A human readable terminal application would probably not display the EOT character.

geo-rg commented 7 years ago

I added a pull request with a first draft of multiline response handling (see #105). I would suggest to use the pull request to discuss and solve the problem, but I also will leave this issue open until this thing is solved.