]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlfparadox.c
add verification data was entered-lf em 4x05 write
[proxmark3-svn] / client / cmdlfparadox.c
1 //-----------------------------------------------------------------------------
2 //
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
5 // the license.
6 //-----------------------------------------------------------------------------
7 // Low frequency Paradox tag commands
8 //-----------------------------------------------------------------------------
9 #include <stdio.h>
10 #include <string.h>
11 #include <inttypes.h>
12 #include "cmdlfparadox.h"
13 #include "proxmark3.h"
14 #include "ui.h"
15 #include "util.h"
16 #include "graph.h"
17 #include "cmdparser.h"
18 #include "cmddata.h"
19 #include "cmdlf.h"
20 #include "lfdemod.h"
21 static int CmdHelp(const char *Cmd);
22
23 //by marshmellow
24 //Paradox Prox demod - FSK RF/50 with preamble of 00001111 (then manchester encoded)
25 //print full Paradox Prox ID and some bit format details if found
26 int CmdFSKdemodParadox(const char *Cmd)
27 {
28 //raw fsk demod no manchester decoding no start bit finding just get binary from wave
29 uint32_t hi2=0, hi=0, lo=0;
30
31 uint8_t BitStream[MAX_GRAPH_TRACE_LEN]={0};
32 size_t BitLen = getFromGraphBuf(BitStream);
33 if (BitLen==0) return 0;
34 //get binary from fsk wave
35 int idx = ParadoxdemodFSK(BitStream,&BitLen,&hi2,&hi,&lo);
36 if (idx<0){
37 if (g_debugMode){
38 if (idx==-1){
39 PrintAndLog("DEBUG: Just Noise Detected");
40 } else if (idx == -2) {
41 PrintAndLog("DEBUG: Error demoding fsk");
42 } else if (idx == -3) {
43 PrintAndLog("DEBUG: Preamble not found");
44 } else if (idx == -4) {
45 PrintAndLog("DEBUG: Error in Manchester data");
46 } else {
47 PrintAndLog("DEBUG: Error demoding fsk %d", idx);
48 }
49 }
50 return 0;
51 }
52 if (hi2==0 && hi==0 && lo==0){
53 if (g_debugMode) PrintAndLog("DEBUG: Error - no value found");
54 return 0;
55 }
56 uint32_t fc = ((hi & 0x3)<<6) | (lo>>26);
57 uint32_t cardnum = (lo>>10)&0xFFFF;
58 uint32_t rawLo = bytebits_to_byte(BitStream+idx+64,32);
59 uint32_t rawHi = bytebits_to_byte(BitStream+idx+32,32);
60 uint32_t rawHi2 = bytebits_to_byte(BitStream+idx,32);
61
62 PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x",
63 hi>>10, (hi & 0x3)<<26 | (lo>>10), fc, cardnum, (lo>>2) & 0xFF, rawHi2, rawHi, rawLo);
64 setDemodBuf(BitStream,BitLen,idx);
65 if (g_debugMode){
66 PrintAndLog("DEBUG: idx: %d, len: %d, Printing Demod Buffer:", idx, BitLen);
67 printDemodBuff();
68 }
69 return 1;
70 }
71 //by marshmellow
72 //see ASKDemod for what args are accepted
73 int CmdParadoxRead(const char *Cmd) {
74 // read lf silently
75 CmdLFRead("s");
76 // get samples silently
77 getSamples("10000",false);
78 // demod and output viking ID
79 return CmdFSKdemodParadox(Cmd);
80 }
81
82 static command_t CommandTable[] = {
83 {"help", CmdHelp, 1, "This help"},
84 {"demod", CmdFSKdemodParadox, 1, "Demodulate a Paradox FSK tag from the GraphBuffer"},
85 {"read", CmdParadoxRead, 0, "Attempt to read and Extract tag data from the antenna"},
86 {NULL, NULL, 0, NULL}
87 };
88
89 int CmdLFParadox(const char *Cmd) {
90 CmdsParse(CommandTable, Cmd);
91 return 0;
92 }
93
94 int CmdHelp(const char *Cmd) {
95 CmdsHelp(CommandTable);
96 return 0;
97 }
Impressum, Datenschutz