]> git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlfviking.c
A lot of changes...
[proxmark3-svn] / client / cmdlfviking.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <inttypes.h>
4 #include "proxmark3.h"
5 #include "ui.h"
6 #include "util.h"
7 #include "graph.h"
8 #include "cmdparser.h"
9 #include "cmddata.h"
10 #include "cmdmain.h"
11 #include "cmdlf.h"
12 #include "cmdlfviking.h"
13 #include "lfdemod.h"
14 static int CmdHelp(const char *Cmd);
15 int CmdVikingDemod(const char *Cmd)
16 {
17 uint8_t id[4];
18 if (param_gethex(Cmd,0,id,8) == 1)
19 {
20 PrintAndLog("Usage: lf viking demod <CardID 8 bytes of hex number>");
21 return 0;
22 }
23 UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, {false,0,0}};
24 SendCommand(&c);
25 WaitForResponse(CMD_ACK,NULL);
26 getSamples("40000",true);
27 // try to demod AMViking
28 return AMVikingDemod(id);
29 }
30 int CmdVikingClone(const char *Cmd)
31 {
32 uint32_t b1,b2;
33 // get the tag number 64 bits (8 bytes) in hex
34 uint8_t id[8];
35 if (param_gethex(Cmd,0,id,16) == 1)
36 {
37 PrintAndLog("Usage: lf viking clone <Card ID 16 bytes of hex number>");
38 return 0;
39 }
40 b1 = bytes_to_num(id,sizeof(uint32_t));
41 b2 = bytes_to_num(id + sizeof(uint32_t),sizeof(uint32_t));
42 UsbCommand c = {CMD_VIKING_CLONE_TAG,{b1,b2}};
43 SendCommand(&c);
44 return 0;
45 }
46
47 static command_t CommandTable[] =
48 {
49 {"help", CmdHelp, 1, "This help"},
50 {"demod",CmdVikingDemod ,1, "<8 digits tag id> -- Extract tag data"},
51 {"clone", CmdVikingClone, 1, "<16 digits card data> clone viking tag"},
52 {NULL, NULL, 0, NULL}
53 };
54
55 int CmdLFViking(const char *Cmd)
56 {
57 CmdsParse(CommandTable, Cmd);
58 return 0;
59 }
60
61 int CmdHelp(const char *Cmd)
62 {
63 CmdsHelp(CommandTable);
64 return 0;
65 }
Impressum, Datenschutz