ikarus23 / MifareClassicTool

An Android NFC app for reading, writing, analyzing, etc. MIFARE Classic RFID tags.
http://www.icaria.de/mct/
GNU General Public License v3.0
4.5k stars 892 forks source link

Write dump file failed #412

Closed btwang0512 closed 1 year ago

btwang0512 commented 1 year ago

test.zip

btwang0512 commented 1 year ago

1677144990087(1)

When the fitst digit of block data is 'C', the writing will be failed.

ikarus23 commented 1 year ago

Strange. Looks perfectly fine to me. Is it only on the C change? Are you able to write the dump at all? e.g. without changing anything at all?

btwang0512 commented 1 year ago

write-dump.zip

Please see attached video file. If the first Digit of block is 'C', the dump write will be failed.

ikarus23 commented 1 year ago

There is no file. I get a 404 (not found) error.

btwang0512 commented 1 year ago

Sorry, the video file cannot be upload successfully. I cut some picture from video.

1 Dump file sector 1, the first digit is 'C'. 2 Write failed.

3 I change the first digit from 'C' to 'A', and save the dump file. 4 Then write successfully.

When any block data of dump file with the first digit 'C', the write will be failed.

ikarus23 commented 1 year ago

I have not the slightest idea what could cause this. This makes absolutely no sens, but I was able to reproduce it. I will have a closer look. Thank you for reporting.

ikarus23 commented 1 year ago

Why is it, when I touch the Android NFC API for MIFARE Classic, something always breaks?...

Writing multiple blocks consecutively sometimes fails. I have no idea why. As we learned, It also depends on the data.

This makes no sense. This error does NOT occurs while debugging which might indicate a timing issue. When adding a delay of 200 ms in between writes, the error does not occur. Retrying to write also works. This why I added an ugly workaround of trying to write at least two times.

You can find a testing version with the fix here: https://tests.icaria.de/MifareClassicTool-4.0.4-test2.apk

Btw: What device are you using and which version of Android?

ikarus23 commented 1 year ago

Any news? Did you try the test version?

ikarus23 commented 1 year ago

Ok, I just pushed the ugly fix (https://github.com/ikarus23/MifareClassicTool/commit/ec3f0477ceb665b482ffb3194762dd76d3efcb8f) and hope it will help.