X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/269a820f9e9eed1ce34f39e9eb2b5df399a31bdc..c86cc30801a3ea718df1daa45e989cb40f8c5950:/winsrc/command.cpp diff --git a/winsrc/command.cpp b/winsrc/command.cpp index 929cff07..45683074 100644 --- a/winsrc/command.cpp +++ b/winsrc/command.cpp @@ -107,6 +107,20 @@ static void CmdSri512read(char *str) c.ext1 = atoi(str); SendCommand(&c, FALSE); } + +/* New command to read the contents of a SRIX4K tag + * SRIX4K tags are ISO14443-B modulated memory tags, + * this command just dumps the contents of the memory/ + */ +static void CmdSrix4kread(char *str) +{ + UsbCommand c; + c.cmd = CMD_READ_SRIX4K_TAG; + c.ext1 = atoi(str); + SendCommand(&c, FALSE); +} + + // ## New command static void CmdHi14areader(char *str) @@ -207,6 +221,20 @@ static void CmdHi14asnoop(char *str) SendCommand(&c, FALSE); } +static void CmdLegicRfSim(char *str) +{ + UsbCommand c; + c.cmd = CMD_SIMULATE_TAG_LEGIC_RF; + SendCommand(&c, FALSE); +} + +static void CmdLegicRfRead(char *str) +{ + UsbCommand c; + c.cmd = CMD_READER_LEGIC_RF; + SendCommand(&c, FALSE); +} + static void CmdFPGAOff(char *str) // ## FPGA Control { UsbCommand c; @@ -1808,6 +1836,40 @@ static void CmdNorm(char *str) RepaintGraphWindow(); } +static void CmdAmp(char *str) +{ + int i, rising, falling; + int max = INT_MIN, min = INT_MAX; + for(i = 10; i < GraphTraceLen; i++) { + if(GraphBuffer[i] > max) { + max = GraphBuffer[i]; + } + if(GraphBuffer[i] < min) { + min = GraphBuffer[i]; + } + } + if(max != min) { + rising= falling= 0; + for(i = 0; i < GraphTraceLen; i++) { + if(GraphBuffer[i+1] < GraphBuffer[i]) { + if(rising) { + GraphBuffer[i]= max; + rising= 0; + } + falling= 1; + } + if(GraphBuffer[i+1] > GraphBuffer[i]) { + if(falling) { + GraphBuffer[i]= min; + falling= 0; + } + rising= 1; + } + } + } + RepaintGraphWindow(); +} + static void CmdDec(char *str) { int i; @@ -2238,9 +2300,11 @@ static void Cmdaskdemod(char *str) { int c, high = 0, low = 0; // TODO: complain if we do not give 2 arguments here ! + // (AL - this doesn't make sense! we're only using one argument!!!) sscanf(str, "%i", &c); /* Detect high and lows and clock */ + // (AL - clock???) for (i = 0; i < GraphTraceLen; i++) { if (GraphBuffer[i] > high) @@ -2248,6 +2312,10 @@ static void Cmdaskdemod(char *str) { else if (GraphBuffer[i] < low) low = GraphBuffer[i]; } + if(c != 0 && c != 1) { + PrintToScrollback("Invalid argument: %s",str); + return; + } if (GraphBuffer[0] > 0) { GraphBuffer[0] = 1-c; @@ -2492,7 +2560,12 @@ static void Cmdmanchesterdemod(char *str) { /* Detect first transition */ /* Lo-Hi (arbitrary) */ - for (i = 0; i < GraphTraceLen; i++) + /* skip to the first high */ + for (i= 0; i < GraphTraceLen; i++) + if(GraphBuffer[i] == high) + break; + /* now look for the first low */ + for (; i < GraphTraceLen; i++) { if (GraphBuffer[i] == low) { @@ -2785,6 +2858,22 @@ static void CmdSetDivisor(char *str) } } +static void CmdSetMux(char *str) +{ + UsbCommand c; + c.cmd = CMD_SET_ADC_MUX; + if(strcmp(str, "lopkd") == 0) { + c.ext1 = 0; + } else if(strcmp(str, "loraw") == 0) { + c.ext1 = 1; + } else if(strcmp(str, "hipkd") == 0) { + c.ext1 = 2; + } else if(strcmp(str, "hiraw") == 0) { + c.ext1 = 3; + } + SendCommand(&c, FALSE); +} + typedef void HandlerFunction(char *cmdline); /* in alphabetic order */ @@ -2794,7 +2883,8 @@ static struct { int offline; // 1 if the command can be used when in offline mode char *docString; } CommandTable[] = { - {"askdemod", Cmdaskdemod, 1, " <0|1> -- Attempt to demodulate simple ASK tags"}, + {"amp", CmdAmp, 1, "Amplify peaks"}, + {"askdemod", Cmdaskdemod, 1, "<0|1> -- Attempt to demodulate simple ASK tags"}, {"autocorr", CmdAutoCorr, 1, " -- Autocorrelation over window"}, {"bitsamples", CmdBitsamples, 0, "Get raw samples as bitstring"}, {"bitstream", Cmdbitstream, 1, "[clock rate] -- Convert waveform into a bitstream"}, @@ -2838,6 +2928,8 @@ static struct { {"indalademod", CmdIndalademod, 0, "['224'] -- Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"}, {"lcd", CmdLcd, 0, " -- Send command/data to LCD"}, {"lcdreset", CmdLcdReset, 0, "Hardware reset LCD"}, + {"legicrfsim", CmdLegicRfSim, 0, "Start the LEGIC RF tag simulator"}, + {"legicrfread", CmdLegicRfRead, 0, "Start the LEGIC RF reader"}, {"load", CmdLoad, 1, " -- Load trace (to graph window"}, {"locomread", CmdLoCommandRead, 0, " <'0' period> <'1' period> ['h'] -- Modulate LF reader field to send command before read (all periods in microseconds) (option 'h' for 134)"}, {"loread", CmdLoread, 0, "['h'] -- Read 125/134 kHz LF ID-only tag (option 'h' for 134)"}, @@ -2855,7 +2947,9 @@ static struct { {"save", CmdSave, 1, " -- Save trace (from graph window)"}, {"scale", CmdScale, 1, " -- Set cursor display scale"}, {"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"}, + {"setmux", CmdSetMux, 0, " -- Set the ADC mux to a specific value"}, {"sri512read", CmdSri512read, 0, " -- Read contents of a SRI512 tag"}, + {"srix4kread", CmdSrix4kread, 0, " -- Read contents of a SRIX4K tag"}, {"tidemod", CmdTIDemod, 1, "Demodulate raw bits for TI-type LF tag"}, {"tiread", CmdTIRead, 0, "Read and decode a TI 134 kHz tag"}, {"tiwrite", CmdTIWrite, 0, "Write new data to a r/w TI 134 kHz tag"},