Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make output close to original mfoc tool #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add more SAK for emulated cards
  • Loading branch information
unkernet committed Mar 28, 2023
commit b31f94162dc90126edff2640923e18ebca303d67
8 changes: 7 additions & 1 deletion src/mfoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,13 @@ int main(int argc, char *const argv[])
t.authuid = (uint32_t) bytes_to_num(t.nt.nti.nai.abtUid + t.nt.nti.nai.szUidLen - 4, 4);

// Get Mifare Classic type from SAK
// see https://www.nxp.com/documents/application_note/AN10833.pdf Section 3.2
// see https://www.nxp.com/docs/en/application-note/AN10833.pdf Section 3.2
// and https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/nfc/tech/MifareClassic.java
switch (t.nt.nti.nai.btSak)
{
case 0x01:
case 0x08:
case 0x10:
case 0x88:
case 0x28:
if (get_rats_is_2k(t, r)) {
Expand All @@ -300,7 +302,11 @@ int main(int argc, char *const argv[])
t.num_sectors = NR_TRAILERS_MINI;
t.num_blocks = NR_BLOCKS_MINI;
break;
case 0x11:
case 0x18:
case 0x38:
case 0x98:
case 0xB8:
printf("Found Mifare Classic 4k tag\n");
t.num_sectors = NR_TRAILERS_4k;
t.num_blocks = NR_BLOCKS_4k;
Expand Down