Fixed MFC 1k/4k issue and Ultralight detection

This commit is contained in:
michael
2026-01-26 14:06:49 -08:00
parent b27baf5dec
commit 2409ec3625
10 changed files with 237 additions and 57 deletions

View File

@@ -35,7 +35,6 @@ export function matchChipToProducts(chip: Transponder): MatchResult {
if (product.canReceiveClone && cloneability?.cloneable) {
if ((product.name.startsWith("xMagic") || product.name.startsWith("xM1") || product.name.startsWith("flexM1")) && chip.rawData.uid.replaceAll(":", "").length / 2 !== 4) {
// This skips things without a 4-byte UID
} else {
cloneTargets.push(product);
}
@@ -177,6 +176,32 @@ export function getDesfireEvLevel(chipType: ChipType): DesfireEvLevel | null {
}
}
/**
* IDs of products that only support MIFARE Classic 1K (not 4K)
*/
const MIFARE_1K_ONLY_PRODUCTS = new Set(['xmagic', 'xm1', 'flexm1-v2']);
/**
* Check if a scanned 4K card is being matched to a 1K-only implant
* Returns warning message if capacity mismatch, null if no issue
*/
export function getMifareClassicCapacityWarning(
chipType: ChipType,
product: Product,
): string | null {
// Only applies to MIFARE Classic 4K cards
if (chipType !== ChipType.MIFARE_CLASSIC_4K) {
return null;
}
// Only warn for 1K-only implants
if (!MIFARE_1K_ONLY_PRODUCTS.has(product.id)) {
return null;
}
return 'This implant has 1K memory only - might not have capacity to clone your 4K card.';
}
/**
* Check if there's a DESFire EV mismatch between chip and product
* Returns warning message if mismatch, null if no issue