]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhflegic.c
put legic back in the system and add rumpletux's fast legic / prng code from forum
[proxmark3-svn] / client / cmdhflegic.c
index 62ff942820004ad6ada453d4c577afd5fae3b00e..e2229a730475ef22344bb50a88849cd9d42e9362 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+#include <string.h>
 #include "proxusb.h"
 #include "cmdparser.h"
 #include "cmdhflegic.h"
@@ -6,7 +8,11 @@ static int CmdHelp(const char *Cmd);
 
 int CmdLegicRFRead(const char *Cmd)
 {
-  UsbCommand c = {CMD_READER_LEGIC_RF};
+  int byte_count=0,offset=0;
+  sscanf(Cmd, "%i %i", &offset, &byte_count);
+  if(byte_count == 0) byte_count = 256;
+  if(byte_count + offset > 256) byte_count = 256 - offset;
+  UsbCommand c={CMD_READER_LEGIC_RF, {offset, byte_count, 0}};
   SendCommand(&c);
   return 0;
 }
@@ -14,7 +20,7 @@ int CmdLegicRFRead(const char *Cmd)
 static command_t CommandTable[] = 
 {
   {"help",        CmdHelp,        1, "This help"},
-  {"reader",      CmdLegicRFRead, 0, "Start the LEGIC RF reader"},
+  {"reader",      CmdLegicRFRead, 0, "[offset [length]] -- read bytes from a LEGIC card"},
   {NULL, NULL, 0, NULL}
 };
 
Impressum, Datenschutz