mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-19 19:38:52 +08:00
ADD: AWID 50bit demod, thanks to @FrancoisM and @ntk
This commit is contained in:
parent
407d62664d
commit
204b708424
1 changed files with 32 additions and 18 deletions
|
@ -1314,37 +1314,51 @@ int CmdFSKdemodAWID(const char *Cmd)
|
||||||
// 00011010 1 01110101 0000000010001110 1 000000000000000000000000000000000
|
// 00011010 1 01110101 0000000010001110 1 000000000000000000000000000000000
|
||||||
// bbbbbbbb w ffffffff cccccccccccccccc w xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
// bbbbbbbb w ffffffff cccccccccccccccc w xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
// |26 bit| |-117--| |-----142------|
|
// |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
|
// b = format bit len, o = odd parity of last 3 bits
|
||||||
// f = facility code, c = card number
|
// f = facility code, c = card number
|
||||||
// w = wiegand parity
|
// w = wiegand parity
|
||||||
// (26 bit format shown)
|
|
||||||
|
|
||||||
uint32_t fc = 0;
|
uint32_t fc = 0;
|
||||||
uint32_t cardnum = 0;
|
uint32_t cardnum = 0;
|
||||||
uint32_t code1 = 0;
|
uint32_t code1 = 0;
|
||||||
uint32_t code2 = 0;
|
uint32_t code2 = 0;
|
||||||
uint8_t fmtLen = bytebits_to_byte(BitStream,8);
|
uint8_t fmtLen = bytebits_to_byte(BitStream, 8);
|
||||||
if (fmtLen==26){
|
switch(fmtLen) {
|
||||||
fc = bytebits_to_byte(BitStream+9, 8);
|
case 26:
|
||||||
cardnum = bytebits_to_byte(BitStream+17, 16);
|
fc = bytebits_to_byte(BitStream + 9, 8);
|
||||||
code1 = bytebits_to_byte(BitStream+8,fmtLen);
|
cardnum = bytebits_to_byte(BitStream + 17, 16);
|
||||||
PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo);
|
code1 = bytebits_to_byte(BitStream + 8,fmtLen);
|
||||||
} else {
|
PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo);
|
||||||
cardnum = bytebits_to_byte(BitStream+8+(fmtLen-17), 16);
|
break;
|
||||||
if (fmtLen>32){
|
case 50:
|
||||||
code1 = bytebits_to_byte(BitStream+8,fmtLen-32);
|
fc = bytebits_to_byte(BitStream + 9, 16);
|
||||||
code2 = bytebits_to_byte(BitStream+8+(fmtLen-32),32);
|
cardnum = bytebits_to_byte(BitStream + 25, 32);
|
||||||
PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo);
|
code1 = bytebits_to_byte(BitStream + 8, (fmtLen-32) );
|
||||||
} else{
|
code2 = bytebits_to_byte(BitStream + 8 + (fmtLen-32), 32);
|
||||||
code1 = bytebits_to_byte(BitStream+8,fmtLen);
|
PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo);
|
||||||
PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo);
|
break;
|
||||||
}
|
default:
|
||||||
|
if (fmtLen > 32 ) {
|
||||||
|
cardnum = bytebits_to_byte(BitStream+8+(fmtLen-17), 16);
|
||||||
|
code1 = bytebits_to_byte(BitStream+8,fmtLen-32);
|
||||||
|
code2 = bytebits_to_byte(BitStream+8+(fmtLen-32),32);
|
||||||
|
PrintAndLog("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(BitStream+8+(fmtLen-17), 16);
|
||||||
|
code1 = bytebits_to_byte(BitStream+8,fmtLen);
|
||||||
|
PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_debugMode){
|
if (g_debugMode){
|
||||||
PrintAndLog("DEBUG: idx: %d, Len: %d Printing Demod Buffer:", idx, 96);
|
PrintAndLog("DEBUG: idx: %d, Len: %d Printing Demod Buffer:", idx, 96);
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
}
|
}
|
||||||
//todo - convert hi2, hi, lo to demodbuffer for future sim/clone commands
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue