Skip to content

Commit

Permalink
Don't rely only on ATQA/SAK while getting card type (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxushka authored Sep 22, 2023
1 parent b24c4ac commit 6c1d0e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
10 changes: 7 additions & 3 deletions chameleonultragui/lib/gui/page/read_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,19 @@ class ReadCardPageState extends State<ReadCardPage> {

CardData card = await appState.communicator!.scan14443aTag();
bool isMifare = await appState.communicator!.detectMf1Support();
bool isMifareClassicEV1 = (await appState.communicator!
.mf1Auth(0x45, 0x61, gMifareClassicKeys[3]));
bool isMifareClassicEV1 = isMifare
? (await appState.communicator!
.mf1Auth(0x45, 0x61, gMifareClassicKeys[3]))
: false;

setState(() {
hfInfo.uid = bytesToHexSpace(card.uid);
hfInfo.sak = card.sak.toRadixString(16).padLeft(2, '0').toUpperCase();
hfInfo.atqa = bytesToHexSpace(card.atqa);
mfcInfo.isEV1 = isMifareClassicEV1;
mfcInfo.type = mfClassicGetType(card.atqa, card.sak);
mfcInfo.type = isMifare
? mfClassicGetType(card.atqa, card.sak)
: MifareClassicType.none;
mfcInfo.state = (mfcInfo.type != MifareClassicType.none)
? MifareClassicState.checkKeys
: MifareClassicState.none;
Expand Down
12 changes: 0 additions & 12 deletions chameleonultragui/untranslated_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
"ble_pairing"
],

"es": [
"ble_pairing"
],

"fr": [
"shared_preferences_logging",
"production_logging",
Expand Down Expand Up @@ -160,13 +156,5 @@
"chameleon_flashing_title_easter_egg",
"chameleon_flashing_title",
"ble_pairing"
],

"ru": [
"ble_pairing"
],

"zh": [
"ble_pairing"
]
}

0 comments on commit 6c1d0e0

Please sign in to comment.