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.74k stars 392 forks source link

Bugfix with -I option #252

Open Klami opened 4 years ago

Klami commented 4 years ago

If another command after the -I option is issues the script fails

I've edited the 'readResponse(self)' to read until the end of the response instead of only one line

skuep commented 4 years ago

This poses a severe race condition problem! The protocol "framing" using CRLF was originally put in place (by me) to solve the issue of finding the end of the response. Whereas your code only works when the underlying operating system routines process the response in a single chunk. This however cannot be guaranteed. What exactly does trigger the problem?

Klami commented 4 years ago

A Command like this: ./chamtool.py -p /dev/ttyACM0 -s1 -c ISO14443A_READER -I -s2 -c -U

without my fix I've get a error that ATQA is not parse able to int base10 because the the second line from the identify command is interpreted as status response from the next command. It's also possible to clear the buffer after each read and lose the rest of information or change the firmware that it responses as one line