]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlfparadox.c
1 //-----------------------------------------------------------------------------
3 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
4 // at your option, any later version. See the LICENSE.txt file for the text of
6 //-----------------------------------------------------------------------------
7 // Low frequency Paradox tag commands
8 // FSK2a, rf/50, 96 bits (completely known)
9 //-----------------------------------------------------------------------------
13 #include "cmdlfparadox.h"
14 #include "proxmark3.h"
18 #include "cmdparser.h"
22 static int CmdHelp(const char *Cmd
);
25 //Paradox Prox demod - FSK RF/50 with preamble of 00001111 (then manchester encoded)
26 //print full Paradox Prox ID and some bit format details if found
27 int CmdFSKdemodParadox(const char *Cmd
)
29 //raw fsk demod no manchester decoding no start bit finding just get binary from wave
30 uint32_t hi2
=0, hi
=0, lo
=0;
32 uint8_t BitStream
[MAX_GRAPH_TRACE_LEN
]={0};
33 size_t BitLen
= getFromGraphBuf(BitStream
);
34 if (BitLen
==0) return 0;
35 //get binary from fsk wave
36 int idx
= ParadoxdemodFSK(BitStream
,&BitLen
,&hi2
,&hi
,&lo
);
40 PrintAndLog("DEBUG: Just Noise Detected");
41 } else if (idx
== -2) {
42 PrintAndLog("DEBUG: Error demoding fsk");
43 } else if (idx
== -3) {
44 PrintAndLog("DEBUG: Preamble not found");
45 } else if (idx
== -4) {
46 PrintAndLog("DEBUG: Error in Manchester data");
48 PrintAndLog("DEBUG: Error demoding fsk %d", idx
);
53 if (hi2
==0 && hi
==0 && lo
==0){
54 if (g_debugMode
) PrintAndLog("DEBUG: Error - no value found");
57 uint32_t fc
= ((hi
& 0x3)<<6) | (lo
>>26);
58 uint32_t cardnum
= (lo
>>10)&0xFFFF;
59 uint32_t rawLo
= bytebits_to_byte(BitStream
+idx
+64,32);
60 uint32_t rawHi
= bytebits_to_byte(BitStream
+idx
+32,32);
61 uint32_t rawHi2
= bytebits_to_byte(BitStream
+idx
,32);
63 PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x",
64 hi
>>10, (hi
& 0x3)<<26 | (lo
>>10), fc
, cardnum
, (lo
>>2) & 0xFF, rawHi2
, rawHi
, rawLo
);
65 setDemodBuf(BitStream
,BitLen
,idx
);
67 PrintAndLog("DEBUG: idx: %d, len: %d, Printing Demod Buffer:", idx
, BitLen
);
73 //see ASKDemod for what args are accepted
74 int CmdParadoxRead(const char *Cmd
) {
77 // demod and output viking ID
78 return CmdFSKdemodParadox(Cmd
);
81 static command_t CommandTable
[] = {
82 {"help", CmdHelp
, 1, "This help"},
83 {"demod", CmdFSKdemodParadox
, 1, "Demodulate a Paradox FSK tag from the GraphBuffer"},
84 {"read", CmdParadoxRead
, 0, "Attempt to read and Extract tag data from the antenna"},
88 int CmdLFParadox(const char *Cmd
) {
89 CmdsParse(CommandTable
, Cmd
);
93 int CmdHelp(const char *Cmd
) {
94 CmdsHelp(CommandTable
);