From: iceman1001 Date: Fri, 13 May 2016 20:52:25 +0000 (+0200) Subject: ADD: AWID 50bit demod X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/c5e8b91696cbd54c5cd1471397e856efb0f290ef ADD: AWID 50bit demod --- diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 5c074c3a..69b76d12 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -270,7 +270,7 @@ void AcquireTiType(void) AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(32) | AT91C_SSC_MSBF; AT91C_BASE_SSC->SSC_TCMR = 0; AT91C_BASE_SSC->SSC_TFMR = 0; - + // iceman, FpgaSetupSsc() ?? the code above? can it be replaced? LED_D_ON(); // modulate antenna @@ -870,7 +870,6 @@ void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol) size = removeParity(dest, idx+8, 4, 1, 88); if (size != 66) continue; - // ok valid card found! // Index map // 0 10 20 30 40 50 60 @@ -880,37 +879,51 @@ void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol) // 00011010 1 01110101 0000000010001110 1 000000000000000000000000000000000 // bbbbbbbb w ffffffff cccccccccccccccc w xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // |26 bit| |-117--| |-----142------| + // + // 00110010 0 0000011111010000000000000001000100101000100001111 0 00000000 + // bbbbbbbb w ffffffffffffffffccccccccccccccccccccccccccccccccc w xxxxxxxx + // |50 bit| |----4000------||-----------2248975-------------| + // // b = format bit len, o = odd parity of last 3 bits // f = facility code, c = card number // w = wiegand parity - // (26 bit format shown) uint32_t fc = 0; uint32_t cardnum = 0; uint32_t code1 = 0; uint32_t code2 = 0; uint8_t fmtLen = bytebits_to_byte(dest,8); - if (fmtLen==26){ - fc = bytebits_to_byte(dest+9, 8); - cardnum = bytebits_to_byte(dest+17, 16); - code1 = bytebits_to_byte(dest+8,fmtLen); - Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); - } else { - cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16); - if (fmtLen>32){ - code1 = bytebits_to_byte(dest+8,fmtLen-32); - code2 = bytebits_to_byte(dest+8+(fmtLen-32),32); - Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); - } else{ - code1 = bytebits_to_byte(dest+8,fmtLen); - Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); - } + switch(fmtLen) { + case 26: + fc = bytebits_to_byte(dest + 9, 8); + cardnum = bytebits_to_byte(dest + 17, 16); + code1 = bytebits_to_byte(dest + 8,fmtLen); + Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); + break; + case 50: + fc = bytebits_to_byte(dest + 9, 16); + cardnum = bytebits_to_byte(dest + 25, 32); + code1 = bytebits_to_byte(dest + 8, (fmtLen-32) ); + code2 = bytebits_to_byte(dest + 8 + (fmtLen-32), 32); + Dbprintf("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + break; + default: + if (fmtLen > 32 ) { + cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16); + code1 = bytebits_to_byte(dest+8,fmtLen-32); + code2 = bytebits_to_byte(dest+8+(fmtLen-32),32); + Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); + } else { + cardnum = bytebits_to_byte(dest+8+(fmtLen-17), 16); + code1 = bytebits_to_byte(dest+8,fmtLen); + Dbprintf("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); + } + break; } if (findone){ if (ledcontrol) LED_A_OFF(); return; } - // reset idx = 0; WDT_HIT(); }