RfidResearchGroup / proxmark3

Iceman Fork - Proxmark3
http://www.icedev.se
GNU General Public License v3.0
3.95k stars 1.05k forks source link

[idea]Upgrade HF_CRAFTBYTE.C #1543

Closed amerinoj closed 2 years ago

amerinoj commented 2 years ago

Hi,

When I went to test the standalone mode using hf_craftbyte I realized that isn't working to mifare 1k, reviewing the code I found the problem , isn't checking the tag type when the UID is emulated.

If replace these lines:

Dbprintf("Starting simulation, press pm3-button to stop and go back to search state."); SimulateIso14443aTag(3, flags, card.uid, 0);

For these:

            Dbprintf("Starting simulation, press pm3-button to stop and go back to search state.");

                if (card.sak == 8 && card.atqa[0] == 4 && card.atqa[1] == 0) {
                    Dbprintf("Mifare Classic");
                    SimulateIso14443aTag(1, flags, card.uid, 0); // Mifare Classic
                } else if (card.sak == 0 && card.atqa[0] == 0x44 && card.atqa[1] == 0) {
                    Dbprintf("Mifare Ultralight");
                    SimulateIso14443aTag(2, flags, card.uid, 0);// Mifare Ultralight
                } else if (card.sak == 20 && card.atqa[0] == 0x44 && card.atqa[1] == 3) {
                    Dbprintf("Mifare DESFire");
                    SimulateIso14443aTag(3, flags, card.uid, 0);  // Mifare DESFire
                } else {
                    Dbprintf("Unrecognized tag type -- defaulting to Mifare Classic emulation");
                    SimulateIso14443aTag(1, flags, card.uid, 0); 
                }

The simulation work better.

Regards.

iceman1001 commented 2 years ago

Feel free to make a PR with the fixes