So I have successfully extracted Mifare Classic 1k keys using mfoc
:
mfoc -O dump.mdf
now I duplicate the file into dump-new.mdf and I modify this with corresponding values. I only intend to edit sector 02, so I do my changes, save file and proceed with upload to card using
nfc-mfclassic w b dump-new.mdf dump.mdf f
As I understand, this looks up every 4th block in dump.mdf
, extracts key B (the b
after w
in command), and uses this key to write dump-new.mdf
contents into corresponding sectors/blocks on the card.
Now it happened to me that I blocked sector 00 by writing probably a damaged version of the file onto the card (access bits were not set properly as mentioned here), so in order to prevent this in future,
Id like to write only to specific sectors. How to do that?
If not possible, what happens if some of the sectors do not have write enabled for B but just for key A. by putting arg b into nfc-mfclassic
call this will result in error. How should I upload an image of the card back to the card? Using key A, key B or both in some specific order?
Thanks guys
After few days of researching and working with libnfc, the answer is no, it is not possible. Always use the dump of the card and edit it with desired values, then save and upload to card using nfc-mfclassic