2010-02-21 08:47:22 +08:00
//-----------------------------------------------------------------------------
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// Low frequency commands
//-----------------------------------------------------------------------------
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
# include "cmdlf.h"
2017-02-27 21:04:50 +08:00
2017-07-12 00:31:10 +08:00
bool g_lf_threshold_set = false ;
2017-02-27 21:04:50 +08:00
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
static int CmdHelp ( const char * Cmd ) ;
2015-10-21 15:07:36 +08:00
int usage_lf_cmdread ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf cmdread d <delay period> z <zero period> o <one period> c <cmdbytes> " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " d <delay> delay OFF period, (0 for bitbang mode) (decimal) " ) ;
PrintAndLogEx ( NORMAL , " z <zero> time period ZERO, (decimal) " ) ;
PrintAndLogEx ( NORMAL , " o <one> time period ONE, (decimal) " ) ;
PrintAndLogEx ( NORMAL , " c <cmd> Command bytes (in ones and zeros) " ) ;
PrintAndLogEx ( NORMAL , " " ) ;
PrintAndLogEx ( NORMAL , " ************* All periods in microseconds (ms) " ) ;
PrintAndLogEx ( NORMAL , " ************* Use lf config to configure options. " ) ;
PrintAndLogEx ( NORMAL , " Examples: " ) ;
PrintAndLogEx ( NORMAL , " lf cmdread d 80 z 100 o 200 c 11000 " ) ;
2015-10-05 00:01:33 +08:00
return 0 ;
}
2015-10-21 15:07:36 +08:00
int usage_lf_read ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf read [h] [s] [d numofsamples] " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " s silent run no printout " ) ;
PrintAndLogEx ( NORMAL , " d #samples # samples to collect (optional) " ) ;
PrintAndLogEx ( NORMAL , " Use 'lf config' to set parameters. " ) ;
PrintAndLogEx ( NORMAL , " " ) ;
PrintAndLogEx ( NORMAL , " Examples: " ) ;
PrintAndLogEx ( NORMAL , " lf read s d 12000 - collects 12000samples silent " ) ;
PrintAndLogEx ( NORMAL , " lf read s " ) ;
2015-10-21 15:07:36 +08:00
return 0 ;
}
int usage_lf_snoop ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Snoop low frequence signal. Use 'lf config' to set parameters. " ) ;
PrintAndLogEx ( NORMAL , " Usage: lf snoop [h] " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " This function takes no arguments. " ) ;
PrintAndLogEx ( NORMAL , " Use 'lf config' to set parameters. " ) ;
2015-10-21 15:07:36 +08:00
return 0 ;
}
int usage_lf_config ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf config [h] [H|<divisor>] [b <bps>] [d <decim>] [a 0|1] " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " L Low frequency (125 KHz) " ) ;
PrintAndLogEx ( NORMAL , " H High frequency (134 KHz) " ) ;
PrintAndLogEx ( NORMAL , " q <divisor> Manually set divisor. 88-> 134KHz, 95-> 125 Hz " ) ;
PrintAndLogEx ( NORMAL , " b <bps> Sets resolution of bits per sample. Default (max): 8 " ) ;
PrintAndLogEx ( NORMAL , " d <decim> Sets decimation. A value of N saves only 1 in N samples. Default: 1 " ) ;
PrintAndLogEx ( NORMAL , " a [0|1] Averaging - if set, will average the stored sample value when decimating. Default: 1 " ) ;
PrintAndLogEx ( NORMAL , " t <threshold> Sets trigger threshold. 0 means no threshold (range: 0-128) " ) ;
PrintAndLogEx ( NORMAL , " Examples: " ) ;
PrintAndLogEx ( NORMAL , " lf config b 8 L " ) ;
PrintAndLogEx ( NORMAL , " Samples at 125KHz, 8bps. " ) ;
PrintAndLogEx ( NORMAL , " lf config H b 4 d 3 " ) ;
PrintAndLogEx ( NORMAL , " Samples at 134KHz, averages three samples into one, stored with " ) ;
PrintAndLogEx ( NORMAL , " a resolution of 4 bits per sample. " ) ;
PrintAndLogEx ( NORMAL , " lf read " ) ;
PrintAndLogEx ( NORMAL , " Performs a read (active field) " ) ;
PrintAndLogEx ( NORMAL , " lf snoop " ) ;
PrintAndLogEx ( NORMAL , " Performs a snoop (no active field) " ) ;
2015-10-21 15:07:36 +08:00
return 0 ;
}
int usage_lf_simfsk ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf simfsk [h] [c <clock>] [H <fcHigh>] [L <fcLow>] [d <hexdata>] " ) ;
PrintAndLogEx ( NORMAL , " there are about four FSK modulations to know of. " ) ;
PrintAndLogEx ( NORMAL , " FSK1 - where fc/8 = high and fc/5 = low " ) ;
PrintAndLogEx ( NORMAL , " FSK1a - is inverted FSK1, ie: fc/5 = high and fc/8 = low " ) ;
PrintAndLogEx ( NORMAL , " FSK2 - where fc/10 = high and fc/8 = low " ) ;
PrintAndLogEx ( NORMAL , " FSK2a - is inverted FSK2, ie: fc/10 = high and fc/8 = low " ) ;
PrintAndLogEx ( NORMAL , " " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " c <clock> Manually set clock - can autodetect if using DemodBuffer " ) ;
PrintAndLogEx ( NORMAL , " H <fcHigh> Manually set the larger Field Clock " ) ;
PrintAndLogEx ( NORMAL , " L <fcLow> Manually set the smaller Field Clock " ) ;
//PrintAndLogEx(NORMAL, " s TBD- -STT to enable a gap between playback repetitions - default: no gap");
PrintAndLogEx ( NORMAL , " d <hexdata> Data to sim as hex - omit to sim from DemodBuffer " ) ;
PrintAndLogEx ( NORMAL , " \n NOTE: if you set one clock manually set them all manually " ) ;
PrintAndLogEx ( NORMAL , " " ) ;
PrintAndLogEx ( NORMAL , " Examples: " ) ;
PrintAndLogEx ( NORMAL , " lf simfsk c 40 H 8 L 5 d 010203 - FSK1 rf/40 data 010203 " ) ;
PrintAndLogEx ( NORMAL , " lf simfsk c 40 H 5 L 8 d 010203 - FSK1a rf/40 data 010203 " ) ;
PrintAndLogEx ( NORMAL , " lf simfsk c 64 H 10 L 8 d 010203 - FSK2 rf/64 data 010203 " ) ;
PrintAndLogEx ( NORMAL , " lf simfsk c 64 H 8 L 10 d 010203 - FSK2a rf/64 data 010203 " ) ;
PrintAndLogEx ( NORMAL , " " ) ;
2016-01-10 00:19:09 +08:00
return 0 ;
2015-10-21 15:07:36 +08:00
}
int usage_lf_simask ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf simask [c <clock>] [i] [b|m|r] [s] [d <raw hex to sim>] " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " c <clock> Manually set clock - can autodetect if using DemodBuffer " ) ;
PrintAndLogEx ( NORMAL , " i invert data " ) ;
PrintAndLogEx ( NORMAL , " b sim ask/biphase " ) ;
PrintAndLogEx ( NORMAL , " m sim ask/manchester - Default " ) ;
PrintAndLogEx ( NORMAL , " r sim ask/raw " ) ;
PrintAndLogEx ( NORMAL , " s add t55xx Sequence Terminator gap - default: no gaps (only manchester) " ) ;
PrintAndLogEx ( NORMAL , " d <hexdata> Data to sim as hex - omit to sim from DemodBuffer " ) ;
2016-01-10 00:19:09 +08:00
return 0 ;
2015-10-21 15:07:36 +08:00
}
int usage_lf_simpsk ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf simpsk [1|2|3] [c <clock>] [i] [r <carrier>] [d <raw hex to sim>] " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " c <clock> Manually set clock - can autodetect if using DemodBuffer " ) ;
PrintAndLogEx ( NORMAL , " i invert data " ) ;
PrintAndLogEx ( NORMAL , " 1 set PSK1 (default) " ) ;
PrintAndLogEx ( NORMAL , " 2 set PSK2 " ) ;
PrintAndLogEx ( NORMAL , " 3 set PSK3 " ) ;
PrintAndLogEx ( NORMAL , " r <carrier> 2|4|8 are valid carriers: default = 2 " ) ;
PrintAndLogEx ( NORMAL , " d <hexdata> Data to sim as hex - omit to sim from DemodBuffer " ) ;
2016-01-10 00:19:09 +08:00
return 0 ;
2015-10-21 15:07:36 +08:00
}
2015-11-10 18:42:59 +08:00
int usage_lf_find ( void ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Usage: lf search [h] <0|1> [u] " ) ;
PrintAndLogEx ( NORMAL , " " ) ;
PrintAndLogEx ( NORMAL , " Options: " ) ;
PrintAndLogEx ( NORMAL , " h This help " ) ;
PrintAndLogEx ( NORMAL , " <0|1> Use data from Graphbuffer, if not set, try reading data from tag. " ) ;
PrintAndLogEx ( NORMAL , " u Search for Unknown tags, if not set, reads only known tags. " ) ;
PrintAndLogEx ( NORMAL , " Examples: " ) ;
PrintAndLogEx ( NORMAL , " lf search = try reading data from tag & search for known tags " ) ;
PrintAndLogEx ( NORMAL , " lf search 1 = use data from GraphBuffer & search for known tags " ) ;
PrintAndLogEx ( NORMAL , " lf search u = try reading data from tag & search for known and unknown tags " ) ;
PrintAndLogEx ( NORMAL , " lf search 1 u = use data from GraphBuffer & search for known and unknown tags " ) ;
2015-11-10 18:42:59 +08:00
return 0 ;
}
2015-10-05 00:01:33 +08:00
2015-10-17 05:16:46 +08:00
/* send a LF command before reading */
2016-07-31 01:30:53 +08:00
int CmdLFCommandRead ( const char * Cmd ) {
2016-07-31 01:36:48 +08:00
2018-02-15 04:40:52 +08:00
UsbCommand c = { CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K , { 0 , 0 , 0 } } ;
2017-07-12 00:31:10 +08:00
bool errors = false ;
2018-02-15 04:40:52 +08:00
2015-10-21 01:00:02 +08:00
uint8_t cmdp = 0 ;
2018-09-09 18:34:43 +08:00
while ( param_getchar ( Cmd , cmdp ) ! = 0x00 & & ! errors ) {
switch ( tolower ( param_getchar ( Cmd , cmdp ) ) ) {
2015-10-05 00:01:33 +08:00
case ' h ' :
2018-02-15 04:40:52 +08:00
return usage_lf_cmdread ( ) ;
2015-10-21 01:00:02 +08:00
case ' c ' :
2017-11-12 06:23:01 +08:00
param_getstr ( Cmd , cmdp + 1 , ( char * ) & c . d . asBytes , sizeof ( c . d . asBytes ) ) ;
2018-02-09 07:27:30 +08:00
cmdp + = 2 ;
2015-10-21 01:00:02 +08:00
break ;
case ' d ' :
c . arg [ 0 ] = param_get32ex ( Cmd , cmdp + 1 , 0 , 10 ) ;
2018-02-09 07:27:30 +08:00
cmdp + = 2 ;
2015-10-21 01:00:02 +08:00
break ;
case ' z ' :
2018-02-15 04:40:52 +08:00
c . arg [ 1 ] = param_get32ex ( Cmd , cmdp + 1 , 0 , 10 ) & 0xFFFF ;
2018-02-09 07:27:30 +08:00
cmdp + = 2 ;
2015-10-21 01:00:02 +08:00
break ;
case ' o ' :
2018-02-15 04:40:52 +08:00
c . arg [ 2 ] = param_get32ex ( Cmd , cmdp + 1 , 0 , 10 ) & 0xFFFF ;
2018-02-09 07:27:30 +08:00
cmdp + = 2 ;
2015-10-05 00:01:33 +08:00
break ;
default :
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " Unknown parameter '%c' " , param_getchar ( Cmd , cmdp ) ) ;
2018-02-15 04:40:52 +08:00
errors = true ;
2015-10-05 00:01:33 +08:00
break ;
}
}
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2015-10-05 00:01:33 +08:00
//Validations
2017-07-15 02:54:11 +08:00
if ( errors | | cmdp = = 0 ) return usage_lf_cmdread ( ) ;
2015-10-08 05:00:46 +08:00
2015-10-05 00:01:33 +08:00
clearCommandBuffer ( ) ;
SendCommand ( & c ) ;
2018-02-15 04:40:52 +08:00
WaitForResponse ( CMD_ACK , NULL ) ;
getSamples ( 0 , true ) ;
2015-10-05 00:01:33 +08:00
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2017-07-31 18:31:39 +08:00
int CmdFlexdemod ( const char * Cmd ) {
2019-02-25 03:11:05 +08:00
if ( GraphTraceLen < 0 )
return 0 ;
# ifndef LONG_WAIT
# define LONG_WAIT 100
# endif
2018-09-09 18:34:43 +08:00
int i , j , start , bit , sum , phase = 0 ;
2016-08-14 23:38:11 +08:00
2019-02-25 02:57:57 +08:00
int data [ GraphTraceLen ] ;
memcpy ( data , GraphBuffer , GraphTraceLen ) ;
size_t size = GraphTraceLen ;
for ( i = 0 ; i < GraphTraceLen ; + + i )
2018-09-09 18:34:43 +08:00
data [ i ] = ( data [ i ] < 0 ) ? - 1 : 1 ;
2016-08-14 23:38:11 +08:00
2018-09-09 18:34:43 +08:00
for ( start = 0 ; start < size - LONG_WAIT ; start + + ) {
int first = data [ start ] ;
2016-08-14 23:38:11 +08:00
for ( i = start ; i < start + LONG_WAIT ; i + + ) {
2018-09-09 18:34:43 +08:00
if ( data [ i ] ! = first ) {
2016-08-14 23:38:11 +08:00
break ;
}
}
if ( i = = ( start + LONG_WAIT ) )
break ;
}
2018-09-09 18:34:43 +08:00
if ( start = = size - LONG_WAIT ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " nothing to wait for " ) ;
2016-08-14 23:38:11 +08:00
return 0 ;
}
2018-09-09 18:34:43 +08:00
data [ start ] = 4 ;
data [ start + 1 ] = 0 ;
2015-01-05 22:51:27 +08:00
uint8_t bits [ 64 ] = { 0x00 } ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2016-08-14 23:38:11 +08:00
i = start ;
for ( bit = 0 ; bit < 64 ; bit + + ) {
2015-01-05 22:51:27 +08:00
sum = 0 ;
for ( int j = 0 ; j < 16 ; j + + ) {
2018-09-09 18:34:43 +08:00
sum + = data [ i + + ] ;
2016-08-14 23:38:11 +08:00
}
2015-01-05 22:51:27 +08:00
bits [ bit ] = ( sum > 0 ) ? 1 : 0 ;
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " bit %d sum %d " , bit , sum ) ;
2016-08-14 23:38:11 +08:00
}
2015-01-05 22:51:27 +08:00
2016-08-14 23:38:11 +08:00
for ( bit = 0 ; bit < 64 ; bit + + ) {
sum = 0 ;
for ( j = 0 ; j < 16 ; j + + )
2018-09-09 18:34:43 +08:00
sum + = data [ i + + ] ;
2016-08-14 23:38:11 +08:00
2018-02-21 15:31:24 +08:00
if ( sum > 0 & & bits [ bit ] ! = 1 ) PrintAndLogEx ( NORMAL , " oops1 at %d " , bit ) ;
2016-08-14 23:38:11 +08:00
2018-02-21 15:31:24 +08:00
if ( sum < 0 & & bits [ bit ] ! = 0 ) PrintAndLogEx ( NORMAL , " oops2 at %d " , bit ) ;
2016-08-14 23:38:11 +08:00
}
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2018-09-09 18:34:43 +08:00
// iceman, use demod buffer? blue line?
2015-01-05 22:51:27 +08:00
// HACK writing back to graphbuffer.
2018-09-09 18:34:43 +08:00
GraphTraceLen = 32 * 64 ;
2016-08-14 23:38:11 +08:00
i = 0 ;
for ( bit = 0 ; bit < 64 ; bit + + ) {
2015-01-05 22:51:27 +08:00
phase = ( bits [ bit ] = = 0 ) ? 0 : 1 ;
2016-08-14 23:38:11 +08:00
for ( j = 0 ; j < 32 ; j + + ) {
GraphBuffer [ i + + ] = phase ;
phase = ! phase ;
}
}
RepaintGraphWindow ( ) ;
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2012-07-02 16:37:50 +08:00
2016-08-14 23:38:11 +08:00
int CmdLFSetConfig ( const char * Cmd ) {
2015-01-31 06:03:44 +08:00
uint8_t divisor = 0 ; //Frequency divisor
uint8_t bps = 0 ; // Bits per sample
uint8_t decimation = 0 ; //How many to keep
bool averaging = 1 ; // Defaults to true
2017-07-12 00:31:10 +08:00
bool errors = false ;
2016-01-10 00:19:09 +08:00
int trigger_threshold = - 1 ; //Means no change
2015-01-31 06:03:44 +08:00
uint8_t unsigned_trigg = 0 ;
2015-01-29 07:57:22 +08:00
2016-01-10 00:19:09 +08:00
uint8_t cmdp = 0 ;
2018-09-09 18:34:43 +08:00
while ( param_getchar ( Cmd , cmdp ) ! = 0x00 & & ! errors ) {
switch ( param_getchar ( Cmd , cmdp ) ) {
2015-01-31 06:03:44 +08:00
case ' h ' :
return usage_lf_config ( ) ;
case ' H ' :
divisor = 88 ;
cmdp + + ;
break ;
case ' L ' :
divisor = 95 ;
cmdp + + ;
break ;
case ' q ' :
2017-02-01 21:11:11 +08:00
errors | = param_getdec ( Cmd , cmdp + 1 , & divisor ) ;
2015-01-31 06:03:44 +08:00
cmdp + = 2 ;
break ;
case ' t ' :
2017-02-01 21:11:11 +08:00
errors | = param_getdec ( Cmd , cmdp + 1 , & unsigned_trigg ) ;
2015-01-31 06:03:44 +08:00
cmdp + = 2 ;
2017-02-27 21:04:50 +08:00
if ( ! errors ) {
trigger_threshold = unsigned_trigg ;
g_lf_threshold_set = ( trigger_threshold > 0 ) ;
}
2015-01-31 06:03:44 +08:00
break ;
case ' b ' :
2017-02-01 21:11:11 +08:00
errors | = param_getdec ( Cmd , cmdp + 1 , & bps ) ;
2015-01-31 06:03:44 +08:00
cmdp + = 2 ;
break ;
case ' d ' :
2017-02-01 21:11:11 +08:00
errors | = param_getdec ( Cmd , cmdp + 1 , & decimation ) ;
2015-01-31 06:03:44 +08:00
cmdp + = 2 ;
break ;
case ' a ' :
2017-02-01 21:11:11 +08:00
averaging = param_getchar ( Cmd , cmdp + 1 ) = = ' 1 ' ;
2015-01-31 06:03:44 +08:00
cmdp + = 2 ;
break ;
default :
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " Unknown parameter '%c' " , param_getchar ( Cmd , cmdp ) ) ;
2015-01-31 06:03:44 +08:00
errors = 1 ;
break ;
}
2015-01-29 07:57:22 +08:00
}
2016-01-10 00:19:09 +08:00
2015-01-29 07:57:22 +08:00
//Validations
2017-07-15 02:54:11 +08:00
if ( errors | | cmdp = = 0 ) return usage_lf_config ( ) ;
2016-01-10 00:19:09 +08:00
2017-02-01 21:11:11 +08:00
//Bps is limited to 8
2016-01-10 00:19:09 +08:00
if ( bps > > 4 ) bps = 8 ;
sample_config config = { decimation , bps , averaging , divisor , trigger_threshold } ;
2015-01-29 07:57:22 +08:00
2017-02-01 21:11:11 +08:00
UsbCommand c = { CMD_SET_LF_SAMPLING_CONFIG , { 0 , 0 , 0 } } ;
memcpy ( c . d . asBytes , & config , sizeof ( sample_config ) ) ;
2015-11-23 00:33:41 +08:00
clearCommandBuffer ( ) ;
2015-01-31 06:03:44 +08:00
SendCommand ( & c ) ;
return 0 ;
}
2015-01-29 07:57:22 +08:00
2017-07-30 15:17:48 +08:00
bool lf_read ( bool silent , uint32_t samples ) {
2018-09-07 03:43:20 +08:00
if ( IsOffline ( ) ) return false ;
2017-07-30 15:17:48 +08:00
UsbCommand c = { CMD_ACQUIRE_RAW_ADC_SAMPLES_125K , { silent , samples , 0 } } ;
clearCommandBuffer ( ) ;
SendCommand ( & c ) ;
UsbCommand resp ;
if ( g_lf_threshold_set ) {
WaitForResponse ( CMD_ACK , & resp ) ;
} else {
if ( ! WaitForResponseTimeout ( CMD_ACK , & resp , 2500 ) ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " command execution time out " ) ;
2017-07-30 15:17:48 +08:00
return false ;
}
}
2017-07-31 03:21:02 +08:00
// resp.arg[0] is bits read not bytes read.
getSamples ( resp . arg [ 0 ] / 8 , silent ) ;
2017-07-30 15:17:48 +08:00
return true ;
}
2016-08-14 23:38:11 +08:00
int CmdLFRead ( const char * Cmd ) {
2017-02-27 21:04:50 +08:00
2018-09-07 03:43:20 +08:00
if ( IsOffline ( ) ) return 0 ;
2017-02-27 21:04:50 +08:00
2017-07-15 02:54:11 +08:00
bool errors = false ;
2017-07-30 15:17:48 +08:00
bool silent = false ;
uint32_t samples = 0 ;
2017-02-24 21:15:36 +08:00
uint8_t cmdp = 0 ;
2018-09-09 18:34:43 +08:00
while ( param_getchar ( Cmd , cmdp ) ! = 0x00 & & ! errors ) {
switch ( tolower ( param_getchar ( Cmd , cmdp ) ) ) {
2017-02-24 21:15:36 +08:00
case ' h ' :
return usage_lf_read ( ) ;
case ' s ' :
2017-07-30 15:17:48 +08:00
silent = true ;
2017-02-24 21:15:36 +08:00
cmdp + + ;
break ;
2017-07-30 15:17:48 +08:00
case ' d ' :
samples = param_get32ex ( Cmd , cmdp , 0 , 10 ) ;
cmdp + = 2 ;
break ;
2017-02-24 21:15:36 +08:00
default :
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " Unknown parameter '%c' " , param_getchar ( Cmd , cmdp ) ) ;
2017-07-15 02:54:11 +08:00
errors = true ;
2017-02-24 21:15:36 +08:00
break ;
}
}
//Validations
if ( errors ) return usage_lf_read ( ) ;
2015-10-21 15:07:36 +08:00
2017-07-30 15:17:48 +08:00
return lf_read ( silent , samples ) ;
2015-01-31 06:03:44 +08:00
}
2015-01-29 07:57:22 +08:00
2016-08-14 23:38:11 +08:00
int CmdLFSnoop ( const char * Cmd ) {
2018-09-09 18:34:43 +08:00
uint8_t cmdp = tolower ( param_getchar ( Cmd , 0 ) ) ;
if ( cmdp = = ' h ' ) return usage_lf_snoop ( ) ;
2015-10-21 15:07:36 +08:00
2017-01-31 23:11:57 +08:00
UsbCommand c = { CMD_LF_SNOOP_RAW_ADC_SAMPLES , { 0 , 0 , 0 } } ;
2015-10-21 15:07:36 +08:00
clearCommandBuffer ( ) ;
2015-01-29 07:57:22 +08:00
SendCommand ( & c ) ;
2018-04-27 23:38:41 +08:00
WaitForResponse ( CMD_ACK , NULL ) ;
2017-07-30 15:17:48 +08:00
getSamples ( 0 , false ) ;
2015-01-29 07:57:22 +08:00
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2016-08-14 23:38:11 +08:00
static void ChkBitstream ( const char * str ) {
// convert to bitstream if necessary
for ( int i = 0 ; i < ( int ) ( GraphTraceLen / 2 ) ; i + + ) {
2015-01-08 05:00:29 +08:00
if ( GraphBuffer [ i ] > 1 | | GraphBuffer [ i ] < 0 ) {
2016-08-14 23:38:11 +08:00
CmdGetBitStream ( " " ) ;
break ;
}
}
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2015-04-05 12:58:57 +08:00
//Attempt to simulate any wave in buffer (one bit per output sample)
// converts GraphBuffer to bitstream (based on zero crossings) if needed.
2016-08-14 23:38:11 +08:00
int CmdLFSim ( const char * Cmd ) {
2017-09-14 17:13:10 +08:00
# define FPGA_LF 1
# define FPGA_HF 2
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2017-09-14 17:13:10 +08:00
int gap = 0 ;
2015-10-21 15:07:36 +08:00
sscanf ( Cmd , " %i " , & gap ) ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2015-04-05 12:58:57 +08:00
// convert to bitstream if necessary
2015-10-21 15:07:36 +08:00
ChkBitstream ( Cmd ) ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2018-02-21 23:31:34 +08:00
PrintAndLogEx ( DEBUG , " DEBUG: Sending [%d bytes] \n " , GraphTraceLen ) ;
2016-10-20 07:16:32 +08:00
2015-04-05 12:58:57 +08:00
//can send only 512 bits at a time (1 byte sent per bit...)
2017-09-14 17:13:10 +08:00
for ( uint16_t i = 0 ; i < GraphTraceLen ; i + = USB_CMD_DATA_SIZE ) {
UsbCommand c = { CMD_UPLOAD_SIM_SAMPLES_125K , { i , FPGA_LF , 0 } } ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
2017-09-14 17:13:10 +08:00
for ( uint16_t j = 0 ; j < USB_CMD_DATA_SIZE ; j + + )
2015-10-21 15:07:36 +08:00
c . d . asBytes [ j ] = GraphBuffer [ i + j ] ;
2017-01-16 22:02:10 +08:00
2015-10-21 15:07:36 +08:00
clearCommandBuffer ( ) ;
SendCommand ( & c ) ;
2016-10-20 06:41:34 +08:00
WaitForResponse ( CMD_ACK , NULL ) ;
2018-03-06 03:07:29 +08:00
printf ( " . " ) ; fflush ( stdout ) ;
2015-10-21 15:07:36 +08:00
}
2015-02-20 10:35:34 +08:00
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Simulating " ) ;
2016-10-20 07:16:32 +08:00
2015-10-21 15:07:36 +08:00
UsbCommand c = { CMD_SIMULATE_TAG_125K , { GraphTraceLen , gap , 0 } } ;
clearCommandBuffer ( ) ;
SendCommand ( & c ) ;
return 0 ;
2015-02-22 10:36:02 +08:00
}
2015-03-08 12:31:23 +08:00
2016-07-29 17:04:12 +08:00
// by marshmellow - sim fsk data given clock, fcHigh, fcLow, invert
2015-02-20 10:35:34 +08:00
// - allow pull data from DemodBuffer
2017-07-31 18:31:39 +08:00
int CmdLFfskSim ( const char * Cmd ) {
2015-04-05 12:58:57 +08:00
//might be able to autodetect FCs and clock from Graphbuffer if using demod buffer
// otherwise will need FChigh, FClow, Clock, and bitstream
2016-07-29 17:04:12 +08:00
uint8_t fcHigh = 0 , fcLow = 0 , clk = 0 ;
2017-09-14 17:13:10 +08:00
bool errors = false , separator = false ;
2017-11-12 06:23:01 +08:00
char hexData [ 64 ] = { 0x00 } ; // store entered hex data
2016-07-29 17:04:12 +08:00
uint8_t data [ 255 ] = { 0x00 } ;
int dataLen = 0 ;
2017-09-14 17:13:10 +08:00
uint8_t cmdp = 0 ;
2016-07-29 17:04:12 +08:00
2018-09-09 18:34:43 +08:00
while ( param_getchar ( Cmd , cmdp ) ! = 0x00 & & ! errors ) {
switch ( param_getchar ( Cmd , cmdp ) ) {
2016-07-29 17:04:12 +08:00
case ' h ' :
return usage_lf_simfsk ( ) ;
case ' c ' :
errors | = param_getdec ( Cmd , cmdp + 1 , & clk ) ;
cmdp + = 2 ;
break ;
case ' H ' :
errors | = param_getdec ( Cmd , cmdp + 1 , & fcHigh ) ;
cmdp + = 2 ;
break ;
case ' L ' :
errors | = param_getdec ( Cmd , cmdp + 1 , & fcLow ) ;
cmdp + = 2 ;
break ;
2017-09-14 17:13:10 +08:00
case ' s ' :
separator = 1 ;
cmdp + + ;
break ;
2016-07-29 17:04:12 +08:00
case ' d ' :
2017-11-12 06:23:01 +08:00
dataLen = param_getstr ( Cmd , cmdp + 1 , hexData , sizeof ( hexData ) ) ;
2016-07-29 17:04:12 +08:00
if ( dataLen = = 0 )
2017-07-12 00:31:10 +08:00
errors = true ;
2016-07-29 17:04:12 +08:00
else
dataLen = hextobinarray ( ( char * ) data , hexData ) ;
2017-07-12 00:31:10 +08:00
if ( dataLen = = 0 ) errors = true ;
2018-02-22 09:42:33 +08:00
if ( errors ) PrintAndLogEx ( WARNING , " Error getting hex data " ) ;
2018-09-09 18:34:43 +08:00
cmdp + = 2 ;
2016-07-29 17:04:12 +08:00
break ;
default :
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " Unknown parameter '%c' " , param_getchar ( Cmd , cmdp ) ) ;
2017-07-12 00:31:10 +08:00
errors = true ;
2016-07-29 17:04:12 +08:00
break ;
}
}
// No args
2017-07-15 02:54:11 +08:00
if ( cmdp = = 0 & & DemodBufferLen = = 0 ) return usage_lf_simfsk ( ) ;
2015-02-22 10:36:02 +08:00
2016-07-29 17:04:12 +08:00
//Validations
2017-07-15 02:54:11 +08:00
if ( errors ) return usage_lf_simfsk ( ) ;
2016-07-29 17:04:12 +08:00
2017-07-30 15:17:48 +08:00
int firstClockEdge = 0 ;
2016-07-29 17:04:12 +08:00
if ( dataLen = = 0 ) { //using DemodBuffer
if ( clk = = 0 | | fcHigh = = 0 | | fcLow = = 0 ) { //manual settings must set them all
2017-11-10 02:15:56 +08:00
uint8_t ans = fskClocks ( & fcHigh , & fcLow , & clk , & firstClockEdge ) ;
2016-07-29 17:04:12 +08:00
if ( ans = = 0 ) {
if ( ! fcHigh ) fcHigh = 10 ;
if ( ! fcLow ) fcLow = 8 ;
if ( ! clk ) clk = 50 ;
}
}
} else {
setDemodBuf ( data , dataLen , 0 ) ;
}
2015-04-05 12:58:57 +08:00
//default if not found
2016-07-29 17:04:12 +08:00
if ( clk = = 0 ) clk = 50 ;
if ( fcHigh = = 0 ) fcHigh = 10 ;
if ( fcLow = = 0 ) fcLow = 8 ;
2015-02-20 10:35:34 +08:00
2016-07-29 17:04:12 +08:00
uint16_t arg1 , arg2 ;
arg1 = fcHigh < < 8 | fcLow ;
2017-09-14 17:13:10 +08:00
arg2 = separator < < 8 | clk ;
2016-07-29 17:04:12 +08:00
size_t size = DemodBufferLen ;
if ( size > USB_CMD_DATA_SIZE ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " DemodBuffer too long for current implementation - length: %d - max: %d " , size , USB_CMD_DATA_SIZE ) ;
2016-07-29 17:04:12 +08:00
size = USB_CMD_DATA_SIZE ;
}
UsbCommand c = { CMD_FSK_SIM_TAG , { arg1 , arg2 , size } } ;
2015-03-10 03:58:06 +08:00
2016-07-29 17:04:12 +08:00
memcpy ( c . d . asBytes , DemodBuffer , size ) ;
2015-11-23 00:33:41 +08:00
clearCommandBuffer ( ) ;
2016-07-29 17:04:12 +08:00
SendCommand ( & c ) ;
2017-09-14 17:13:10 +08:00
setClockGrid ( clk , 0 ) ;
2016-07-29 17:04:12 +08:00
return 0 ;
2015-02-20 10:35:34 +08:00
}
// by marshmellow - sim ask data given clock, invert, manchester or raw, separator
// - allow pull data from DemodBuffer
2017-07-31 18:31:39 +08:00
int CmdLFaskSim ( const char * Cmd ) {
2016-07-29 17:04:12 +08:00
// autodetect clock from Graphbuffer if using demod buffer
2015-04-05 12:58:57 +08:00
// needs clock, invert, manchester/raw as m or r, separator as s, and bitstream
2016-07-29 17:04:12 +08:00
uint8_t encoding = 1 , separator = 0 , clk = 0 , invert = 0 ;
2017-07-12 00:31:10 +08:00
bool errors = false ;
2017-11-12 06:23:01 +08:00
char hexData [ 64 ] = { 0x00 } ;
2018-09-09 18:34:43 +08:00
uint8_t data [ 255 ] = { 0x00 } ; // store entered hex data
2016-02-29 06:28:38 +08:00
int dataLen = 0 ;
uint8_t cmdp = 0 ;
2017-07-15 02:54:11 +08:00
while ( param_getchar ( Cmd , cmdp ) ! = 0x00 & & ! errors ) {
2018-09-09 18:34:43 +08:00
switch ( tolower ( param_getchar ( Cmd , cmdp ) ) ) {
2016-02-29 06:28:38 +08:00
case ' h ' : return usage_lf_simask ( ) ;
case ' i ' :
invert = 1 ;
cmdp + + ;
break ;
case ' c ' :
2016-07-29 17:04:12 +08:00
errors | = param_getdec ( Cmd , cmdp + 1 , & clk ) ;
cmdp + = 2 ;
2016-02-29 06:28:38 +08:00
break ;
case ' b ' :
2016-07-29 17:04:12 +08:00
encoding = 2 ; //biphase
2016-02-29 06:28:38 +08:00
cmdp + + ;
break ;
case ' m ' :
2016-07-29 17:04:12 +08:00
encoding = 1 ; //manchester
2016-02-29 06:28:38 +08:00
cmdp + + ;
break ;
case ' r ' :
2016-07-29 17:04:12 +08:00
encoding = 0 ; //raw
2016-02-29 06:28:38 +08:00
cmdp + + ;
break ;
case ' s ' :
2016-07-29 17:04:12 +08:00
separator = 1 ;
2016-02-29 06:28:38 +08:00
cmdp + + ;
break ;
case ' d ' :
2017-11-12 06:23:01 +08:00
dataLen = param_getstr ( Cmd , cmdp + 1 , hexData , sizeof ( hexData ) ) ;
2016-07-29 17:04:12 +08:00
if ( dataLen = = 0 )
2017-07-12 00:31:10 +08:00
errors = true ;
2016-02-29 06:28:38 +08:00
else
dataLen = hextobinarray ( ( char * ) data , hexData ) ;
2017-07-12 00:31:10 +08:00
if ( dataLen = = 0 ) errors = true ;
2018-02-22 09:42:33 +08:00
if ( errors ) PrintAndLogEx ( WARNING , " Error getting hex data, datalen: %d " , dataLen ) ;
2016-07-29 17:04:12 +08:00
cmdp + = 2 ;
2016-02-29 06:28:38 +08:00
break ;
default :
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " Unknown parameter '%c' " , param_getchar ( Cmd , cmdp ) ) ;
2017-07-12 00:31:10 +08:00
errors = true ;
2016-02-29 06:28:38 +08:00
break ;
}
}
2016-07-29 17:04:12 +08:00
// No args
2017-07-15 02:54:11 +08:00
if ( cmdp = = 0 & & DemodBufferLen = = 0 ) return usage_lf_simask ( ) ;
2015-02-20 10:35:34 +08:00
2016-02-29 06:28:38 +08:00
//Validations
2017-07-15 02:54:11 +08:00
if ( errors ) return usage_lf_simask ( ) ;
2016-02-29 06:28:38 +08:00
if ( dataLen = = 0 ) { //using DemodBuffer
if ( clk = = 0 )
2017-11-10 02:15:56 +08:00
clk = GetAskClock ( " 0 " , false ) ;
2016-02-29 06:28:38 +08:00
} else {
setDemodBuf ( data , dataLen , 0 ) ;
}
if ( clk = = 0 ) clk = 64 ;
2017-07-12 00:31:10 +08:00
if ( encoding = = 0 ) clk / = 2 ; //askraw needs to double the clock speed
2016-02-29 06:28:38 +08:00
size_t size = DemodBufferLen ;
if ( size > USB_CMD_DATA_SIZE ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " DemodBuffer too long for current implementation - length: %d - max: %d " , size , USB_CMD_DATA_SIZE ) ;
2016-02-29 06:28:38 +08:00
size = USB_CMD_DATA_SIZE ;
}
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " preparing to sim ask data: %d bits " , size ) ;
2016-02-29 06:28:38 +08:00
uint16_t arg1 , arg2 ;
arg1 = clk < < 8 | encoding ;
arg2 = invert < < 8 | separator ;
UsbCommand c = { CMD_ASK_SIM_TAG , { arg1 , arg2 , size } } ;
memcpy ( c . d . asBytes , DemodBuffer , size ) ;
2015-11-23 00:33:41 +08:00
clearCommandBuffer ( ) ;
2016-02-29 06:28:38 +08:00
SendCommand ( & c ) ;
return 0 ;
2015-02-20 10:35:34 +08:00
}
2015-02-22 10:36:02 +08:00
// by marshmellow - sim psk data given carrier, clock, invert
// - allow pull data from DemodBuffer or parameters
2016-08-14 23:38:11 +08:00
int CmdLFpskSim ( const char * Cmd ) {
//might be able to autodetect FC and clock from Graphbuffer if using demod buffer
//will need carrier, Clock, and bitstream
uint8_t carrier = 0 , clk = 0 ;
uint8_t invert = 0 ;
2017-07-12 00:31:10 +08:00
bool errors = false ;
2017-11-12 06:23:01 +08:00
char hexData [ 64 ] = { 0x00 } ; // store entered hex data
2016-08-14 23:38:11 +08:00
uint8_t data [ 255 ] = { 0x00 } ;
int dataLen = 0 ;
uint8_t cmdp = 0 ;
uint8_t pskType = 1 ;
2018-09-09 18:34:43 +08:00
while ( param_getchar ( Cmd , cmdp ) ! = 0x00 & & ! errors ) {
switch ( tolower ( param_getchar ( Cmd , cmdp ) ) ) {
2016-08-14 23:38:11 +08:00
case ' h ' :
return usage_lf_simpsk ( ) ;
case ' i ' :
invert = 1 ;
cmdp + + ;
break ;
case ' c ' :
errors | = param_getdec ( Cmd , cmdp + 1 , & clk ) ;
cmdp + = 2 ;
break ;
case ' r ' :
errors | = param_getdec ( Cmd , cmdp + 1 , & carrier ) ;
cmdp + = 2 ;
break ;
case ' 1 ' :
pskType = 1 ;
cmdp + + ;
break ;
case ' 2 ' :
pskType = 2 ;
cmdp + + ;
break ;
case ' 3 ' :
pskType = 3 ;
cmdp + + ;
break ;
case ' d ' :
2017-11-12 06:23:01 +08:00
dataLen = param_getstr ( Cmd , cmdp + 1 , hexData , sizeof ( hexData ) ) ;
2016-08-14 23:38:11 +08:00
if ( dataLen = = 0 )
2017-07-12 00:31:10 +08:00
errors = true ;
2016-08-14 23:38:11 +08:00
else
dataLen = hextobinarray ( ( char * ) data , hexData ) ;
2017-07-12 00:31:10 +08:00
if ( dataLen = = 0 ) errors = true ;
2018-02-22 09:42:33 +08:00
if ( errors ) PrintAndLogEx ( WARNING , " Error getting hex data " ) ;
2016-08-14 23:38:11 +08:00
cmdp + = 2 ;
break ;
default :
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( WARNING , " Unknown parameter '%c' " , param_getchar ( Cmd , cmdp ) ) ;
2017-07-12 00:31:10 +08:00
errors = true ;
2016-08-14 23:38:11 +08:00
break ;
}
}
// No args
if ( cmdp = = 0 & & DemodBufferLen = = 0 )
2017-07-12 00:31:10 +08:00
errors = true ;
2016-08-14 23:38:11 +08:00
//Validations
if ( errors ) return usage_lf_simpsk ( ) ;
if ( dataLen = = 0 ) { //using DemodBuffer
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Getting Clocks " ) ;
2016-08-14 23:38:11 +08:00
2017-11-10 02:15:56 +08:00
if ( clk = = 0 ) clk = GetPskClock ( " " , false ) ;
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " clk: %d " , clk ) ;
2016-08-14 23:38:11 +08:00
2017-11-10 02:15:56 +08:00
if ( ! carrier ) carrier = GetPskCarrier ( " " , false ) ;
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " carrier: %d " , carrier ) ;
2016-08-14 23:38:11 +08:00
} else {
setDemodBuf ( data , dataLen , 0 ) ;
}
if ( clk < = 0 ) clk = 32 ;
2017-08-10 20:19:57 +08:00
if ( carrier ! = 2 & & carrier ! = 4 & & carrier ! = 8 )
carrier = 2 ;
2015-03-07 01:28:54 +08:00
2016-08-14 23:38:11 +08:00
if ( pskType ! = 1 ) {
if ( pskType = = 2 ) {
//need to convert psk2 to psk1 data before sim
psk2TOpsk1 ( DemodBuffer , DemodBufferLen ) ;
} else {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Sorry, PSK3 not yet available " ) ;
2016-08-14 23:38:11 +08:00
}
}
uint16_t arg1 , arg2 ;
arg1 = clk < < 8 | carrier ;
arg2 = invert ;
size_t size = DemodBufferLen ;
if ( size > USB_CMD_DATA_SIZE ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " DemodBuffer too long for current implementation - length: %d - max: %d " , size , USB_CMD_DATA_SIZE ) ;
2016-08-14 23:38:11 +08:00
size = USB_CMD_DATA_SIZE ;
}
UsbCommand c = { CMD_PSK_SIM_TAG , { arg1 , arg2 , size } } ;
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( DEBUG , " DEBUG: Sending DemodBuffer Length: %d " , size ) ;
2016-08-14 23:38:11 +08:00
memcpy ( c . d . asBytes , DemodBuffer , size ) ;
clearCommandBuffer ( ) ;
SendCommand ( & c ) ;
return 0 ;
2015-02-22 10:36:02 +08:00
}
2015-02-20 10:35:34 +08:00
2016-08-14 23:38:11 +08:00
int CmdLFSimBidir ( const char * Cmd ) {
// Set ADC to twice the carrier for a slight supersampling
// HACK: not implemented in ARMSRC.
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( INFO , " Not implemented yet. " ) ;
2016-08-14 23:38:11 +08:00
UsbCommand c = { CMD_LF_SIMULATE_BIDIR , { 47 , 384 , 0 } } ;
SendCommand ( & c ) ;
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2018-09-09 18:34:43 +08:00
// ICEMAN, todo, swap from Graphbuffer.
2016-08-14 23:38:11 +08:00
int CmdVchDemod ( const char * Cmd ) {
// Is this the entire sync pattern, or does this also include some
// data bits that happen to be the same everywhere? That would be
// lovely to know.
static const int SyncPattern [ ] = {
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ,
} ;
// So first, we correlate for the sync pattern, and mark that.
int bestCorrel = 0 , bestPos = 0 ;
int i , j , sum = 0 ;
// It does us no good to find the sync pattern, with fewer than 2048 samples after it.
for ( i = 0 ; i < ( GraphTraceLen - 2048 ) ; i + + ) {
for ( j = 0 ; j < ARRAYLEN ( SyncPattern ) ; j + + ) {
sum + = GraphBuffer [ i + j ] * SyncPattern [ j ] ;
}
if ( sum > bestCorrel ) {
bestCorrel = sum ;
bestPos = i ;
}
}
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " best sync at %d [metric %d] " , bestPos , bestCorrel ) ;
2016-08-14 23:38:11 +08:00
char bits [ 257 ] ;
bits [ 256 ] = ' \0 ' ;
int worst = INT_MAX , worstPos = 0 ;
for ( i = 0 ; i < 2048 ; i + = 8 ) {
sum = 0 ;
for ( j = 0 ; j < 8 ; j + + )
sum + = GraphBuffer [ bestPos + i + j ] ;
if ( sum < 0 )
bits [ i / 8 ] = ' . ' ;
else
bits [ i / 8 ] = ' 1 ' ;
if ( abs ( sum ) < worst ) {
worst = abs ( sum ) ;
worstPos = i ;
}
}
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " bits: " ) ;
PrintAndLogEx ( NORMAL , " %s " , bits ) ;
PrintAndLogEx ( NORMAL , " worst metric: %d at pos %d " , worst , worstPos ) ;
2016-08-14 23:38:11 +08:00
// clone
if ( strcmp ( Cmd , " clone " ) = = 0 ) {
GraphTraceLen = 0 ;
char * s ;
for ( s = bits ; * s ; s + + ) {
for ( j = 0 ; j < 16 ; j + + ) {
GraphBuffer [ GraphTraceLen + + ] = ( * s = = ' 1 ' ) ? 1 : 0 ;
}
}
RepaintGraphWindow ( ) ;
}
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2017-02-27 04:32:51 +08:00
//by marshmellow
2017-07-30 15:17:48 +08:00
int CheckChipType ( bool getDeviceData ) {
2017-02-27 04:32:51 +08:00
if ( ! getDeviceData ) return 0 ;
2017-07-31 03:21:02 +08:00
save_restoreDB ( GRAPH_SAVE ) ;
2017-02-27 04:32:51 +08:00
//check for em4x05/em4x69 chips first
2017-07-31 03:21:02 +08:00
uint32_t word = 0 ;
2017-02-27 04:32:51 +08:00
if ( EM4x05IsBlock0 ( & word ) ) {
2019-02-24 22:10:19 +08:00
PrintAndLogEx ( SUCCESS , " \n Valid EM4x05/EM4x69 Chip Found " ) ;
2019-02-24 22:16:57 +08:00
PrintAndLogEx ( SUCCESS , " Try " _YELLOW_ ( ` lf em 4 x05 ` ) " commands " ) ;
2017-07-30 15:17:48 +08:00
save_restoreGB ( GRAPH_RESTORE ) ;
2017-02-27 04:32:51 +08:00
return 1 ;
}
2017-07-30 15:17:48 +08:00
//check for t55xx chip...
if ( tryDetectP1 ( true ) ) {
2019-02-24 22:10:19 +08:00
PrintAndLogEx ( SUCCESS , " \n Valid T55xx Chip Found " ) ;
2019-02-24 22:16:57 +08:00
PrintAndLogEx ( SUCCESS , " Try " _YELLOW_ ( ` lf t55xx ` ) " commands " ) ;
2017-07-30 15:17:48 +08:00
save_restoreGB ( GRAPH_RESTORE ) ;
return 1 ;
}
save_restoreDB ( GRAPH_RESTORE ) ;
2017-02-27 04:32:51 +08:00
return 0 ;
}
2014-12-31 05:08:33 +08:00
//by marshmellow
2015-11-23 04:48:15 +08:00
int CmdLFfind ( const char * Cmd ) {
int ans = 0 ;
2017-10-31 05:20:08 +08:00
size_t minLength = 2000 ;
2018-08-13 03:54:31 +08:00
char cmdp = tolower ( param_getchar ( Cmd , 0 ) ) ;
2015-11-23 04:48:15 +08:00
char testRaw = param_getchar ( Cmd , 1 ) ;
2017-07-31 18:31:39 +08:00
2018-08-13 03:54:31 +08:00
if ( strlen ( Cmd ) > 3 | | cmdp = = ' h ' ) return usage_lf_find ( ) ;
2017-02-27 04:32:51 +08:00
2018-08-13 03:54:31 +08:00
if ( cmdp = = ' u ' ) testRaw = ' u ' ;
2017-07-31 18:31:39 +08:00
2018-09-07 03:43:20 +08:00
bool isOnline = ( ! IsOffline ( ) & & ( cmdp ! = ' 1 ' ) ) ;
2017-07-31 18:31:39 +08:00
if ( isOnline )
2017-07-30 15:17:48 +08:00
lf_read ( true , 30000 ) ;
2017-07-31 18:31:39 +08:00
if ( GraphTraceLen < minLength ) {
2018-04-26 20:39:11 +08:00
PrintAndLogEx ( FAILED , " Data in Graphbuffer was too small. " ) ;
2015-11-23 04:48:15 +08:00
return 0 ;
}
2015-03-23 03:28:48 +08:00
2019-02-24 22:13:31 +08:00
PrintAndLogEx ( INFO , " NOTE: some demods output possible binary " ) ;
PrintAndLogEx ( INFO , " if it finds something that looks like a tag " ) ;
PrintAndLogEx ( INFO , " False Positives " _YELLOW_ ( ARE ) " possible \n " ) ;
PrintAndLogEx ( INFO , " \n Checking for known tags: \n " ) ;
2017-02-04 19:41:30 +08:00
// only run these tests if device is online
2017-07-31 18:31:39 +08:00
if ( isOnline ) {
2017-10-31 05:20:08 +08:00
// only run if graphbuffer is just noise as it should be for hitag
// The improved noise detection will find Cotag.
2017-11-06 22:06:42 +08:00
signal_t * sp = getSignalProperties ( ) ;
if ( sp - > isnoise ) {
2017-07-31 18:31:39 +08:00
2018-04-26 20:39:11 +08:00
PrintAndLogEx ( INFO , " Signal looks just like noise. Looking for Hitag signal now. " ) ;
2018-02-28 15:12:21 +08:00
// 26 === RHT2F_UID_ONLY
2018-04-26 20:39:11 +08:00
if ( CmdLFHitagReader ( " 26 " ) = = 0 ) { PrintAndLogEx ( SUCCESS , " \n Valid Hitag Found! " ) ; return 1 ; }
if ( CmdCOTAGRead ( " " ) > 0 ) { PrintAndLogEx ( SUCCESS , " \n Valid COTAG ID Found! " ) ; return 1 ; }
2018-05-06 01:00:08 +08:00
PrintAndLogEx ( FAILED , " \n No Data Found! - maybe not an LF tag? " ) ;
2017-02-04 19:41:30 +08:00
return 0 ;
}
}
2017-10-31 05:20:08 +08:00
2018-04-26 20:39:11 +08:00
if ( EM4x50Read ( " " , false ) ) { PrintAndLogEx ( SUCCESS , " \n Valid EM4x50 ID Found! " ) ; return 1 ; }
if ( CmdAWIDDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid AWID ID Found! " ) ; goto out ; }
if ( CmdEM410xDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid EM410x ID Found! " ) ; goto out ; }
if ( CmdFdxDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid FDX-B ID Found! " ) ; goto out ; }
if ( CmdGuardDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Guardall G-Prox II ID Found! " ) ; goto out ; }
if ( CmdHIDDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid HID Prox ID Found! " ) ; goto out ; }
if ( CmdPSKIdteck ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Idteck ID Found! " ) ; goto out ; }
if ( CmdIndalaDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Indala ID Found! " ) ; goto out ; }
if ( CmdIOProxDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid IO Prox ID Found! " ) ; goto out ; }
if ( CmdJablotronDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Jablotron ID Found! " ) ; goto out ; }
if ( CmdLFNedapDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid NEDAP ID Found! " ) ; goto out ; }
if ( CmdNexWatchDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid NexWatch ID Found! " ) ; goto out ; }
if ( CmdNoralsyDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Noralsy ID Found! " ) ; goto out ; }
2019-02-23 22:56:11 +08:00
if ( CmdKeriDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid KERI ID Found! " ) ; goto out ; }
2018-04-26 20:39:11 +08:00
if ( CmdPacDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid PAC/Stanley ID Found! " ) ; goto out ; }
if ( CmdParadoxDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Paradox ID Found! " ) ; goto out ; }
if ( CmdPrescoDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Presco ID Found! " ) ; goto out ; }
if ( CmdPyramidDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Pyramid ID Found! " ) ; goto out ; }
if ( CmdSecurakeyDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Securakey ID Found! " ) ; goto out ; }
if ( CmdVikingDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Viking ID Found! " ) ; goto out ; }
if ( CmdVisa2kDemod ( " " ) ) { PrintAndLogEx ( SUCCESS , " \n Valid Visa2000 ID Found! " ) ; goto out ; }
//if (CmdFermaxDemod("")) { PrintAndLogEx(SUCCESS, "\nValid Fermax ID Found!"); goto out;}
2017-07-31 18:31:39 +08:00
// TIdemod? flexdemod?
2017-02-27 04:32:51 +08:00
2018-05-06 01:00:08 +08:00
PrintAndLogEx ( FAILED , " \n No known 125/134 KHz tags Found! \n " ) ;
2017-07-31 18:31:39 +08:00
2018-08-13 03:54:31 +08:00
if ( testRaw = = ' u ' ) {
2015-11-23 04:48:15 +08:00
//test unknown tag formats (raw mode)
2018-04-26 20:39:11 +08:00
PrintAndLogEx ( INFO , " \n Checking for Unknown tags: \n " ) ;
2017-07-31 18:31:39 +08:00
ans = AutoCorrelate ( GraphBuffer , GraphBuffer , GraphTraceLen , 4000 , false , false ) ;
2015-11-23 04:48:15 +08:00
if ( ans > 0 ) {
2015-03-19 03:32:53 +08:00
2018-04-26 20:39:11 +08:00
PrintAndLogEx ( INFO , " Possible Auto Correlation of %d repeating samples " , ans ) ;
2015-03-19 03:32:53 +08:00
2018-04-26 20:39:11 +08:00
if ( ans % 8 = = 0 )
PrintAndLogEx ( INFO , " Possible %d bytes " , ( ans / 8 ) ) ;
2015-11-23 04:48:15 +08:00
}
2017-07-31 18:31:39 +08:00
//fsk
2017-11-10 02:15:56 +08:00
if ( GetFskClock ( " " , false ) ) {
if ( FSKrawDemod ( " " , true ) ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " \n Unknown FSK Modulated Tag Found! " ) ; goto out ;
2015-03-19 03:32:53 +08:00
}
}
2017-07-31 18:31:39 +08:00
2017-07-27 15:28:43 +08:00
bool st = true ;
2018-04-26 20:39:11 +08:00
if ( ASKDemod_ext ( " 0 0 0 " , true , false , 1 , & st ) ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " \n Unknown ASK Modulated and Manchester encoded Tag Found! " ) ;
PrintAndLogEx ( NORMAL , " \n if it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab' " ) ;
2017-07-31 18:31:39 +08:00
goto out ;
2015-11-23 04:48:15 +08:00
}
2017-07-31 18:31:39 +08:00
if ( CmdPSK1rawDemod ( " " ) ) {
2018-02-21 15:31:24 +08:00
PrintAndLogEx ( NORMAL , " Possible unknown PSK1 Modulated Tag Found above! \n \n Could also be PSK2 - try 'data rawdemod p2' " ) ;
PrintAndLogEx ( NORMAL , " \n Could also be PSK3 - [currently not supported] " ) ;
PrintAndLogEx ( NORMAL , " \n Could also be NRZ - try 'data nrzrawdemod " ) ;
2017-07-31 18:31:39 +08:00
goto out ;
2015-11-10 18:42:59 +08:00
}
2017-07-31 18:31:39 +08:00
2018-04-26 20:39:11 +08:00
PrintAndLogEx ( FAILED , " \n No Data Found! \n " ) ;
2015-11-23 04:48:15 +08:00
}
2017-07-31 18:31:39 +08:00
out :
// identify chipset
CheckChipType ( isOnline ) ;
2015-11-23 04:48:15 +08:00
return 0 ;
2014-12-31 05:08:33 +08:00
}
2017-02-26 06:00:20 +08:00
static command_t CommandTable [ ] = {
2015-11-10 04:46:15 +08:00
{ " help " , CmdHelp , 1 , " This help " } ,
2017-07-14 22:20:34 +08:00
{ " awid " , CmdLFAWID , 1 , " { AWID RFIDs... } " } ,
2017-07-30 15:17:48 +08:00
{ " cotag " , CmdLFCOTAG , 1 , " { COTAG CHIPs... } " } ,
{ " em " , CmdLFEM4X , 1 , " { EM4X CHIPs & RFIDs... } " } ,
{ " fdx " , CmdLFFdx , 1 , " { FDX-B RFIDs... } " } ,
{ " gproxii " , CmdLFGuard , 1 , " { Guardall Prox II RFIDs... } " } ,
2017-07-14 22:20:34 +08:00
{ " hid " , CmdLFHID , 1 , " { HID RFIDs... } " } ,
2017-07-30 15:17:48 +08:00
{ " hitag " , CmdLFHitag , 1 , " { Hitag CHIPs... } " } ,
{ " indala " , CmdLFINDALA , 1 , " { Indala RFIDs... } " } ,
{ " io " , CmdLFIO , 1 , " { ioProx RFIDs... } " } ,
2017-07-14 22:20:34 +08:00
{ " jablotron " , CmdLFJablotron , 1 , " { Jablotron RFIDs... } " } ,
2019-02-23 22:47:37 +08:00
{ " keri " , CmdLFKeri , 1 , " { KERI RFIDs... } " } ,
2017-07-14 22:20:34 +08:00
{ " nedap " , CmdLFNedap , 1 , " { Nedap RFIDs... } " } ,
2017-07-30 15:17:48 +08:00
{ " nexwatch " , CmdLFNEXWATCH , 1 , " { NexWatch RFIDs... } " } ,
2017-07-14 22:20:34 +08:00
{ " noralsy " , CmdLFNoralsy , 1 , " { Noralsy RFIDs... } " } ,
{ " pac " , CmdLFPac , 1 , " { PAC/Stanley RFIDs... } " } ,
2017-07-30 15:17:48 +08:00
{ " paradox " , CmdLFParadox , 1 , " { Paradox RFIDs... } " } ,
{ " pcf7931 " , CmdLFPCF7931 , 1 , " { PCF7931 CHIPs... } " } ,
2017-07-14 22:20:34 +08:00
{ " presco " , CmdLFPresco , 1 , " { Presco RFIDs... } " } ,
2016-02-27 16:21:19 +08:00
{ " pyramid " , CmdLFPyramid , 1 , " { Farpointe/Pyramid RFIDs... } " } ,
2017-07-14 21:51:12 +08:00
{ " securakey " , CmdLFSecurakey , 1 , " { Securakey RFIDs... } " } ,
2017-07-30 15:17:48 +08:00
{ " ti " , CmdLFTI , 1 , " { TI CHIPs... } " } ,
{ " t55xx " , CmdLFT55XX , 1 , " { T55xx CHIPs... } " } ,
2017-07-14 22:20:34 +08:00
{ " viking " , CmdLFViking , 1 , " { Viking RFIDs... } " } ,
{ " visa2000 " , CmdLFVisa2k , 1 , " { Visa2000 RFIDs... } " } ,
2015-11-10 04:46:15 +08:00
{ " config " , CmdLFSetConfig , 0 , " Set config for LF sampling, bit/sample, decimation, frequency " } ,
{ " cmdread " , CmdLFCommandRead , 0 , " <off period> <'0' period> <'1' period> <command> ['h' 134] \n \t \t -- Modulate LF reader field to send command before read (all periods in microseconds) " } ,
{ " flexdemod " , CmdFlexdemod , 1 , " Demodulate samples for FlexPass " } ,
{ " read " , CmdLFRead , 0 , " ['s' silent] Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help " } ,
{ " search " , CmdLFfind , 1 , " [offline] ['u'] Read and Search for valid known tag (in offline mode it you can load first then search) \n \t \t -- 'u' to search for unknown tags " } ,
{ " sim " , CmdLFSim , 0 , " [GAP] -- Simulate LF tag from buffer with optional GAP (in microseconds) " } ,
{ " simask " , CmdLFaskSim , 0 , " [clock] [invert <1|0>] [biphase/manchester/raw <'b'|'m'|'r'>] [msg separator 's'] [d <hexdata>] \n \t \t -- Simulate LF ASK tag from demodbuffer or input " } ,
{ " simfsk " , CmdLFfskSim , 0 , " [c <clock>] [i] [H <fcHigh>] [L <fcLow>] [d <hexdata>] \n \t \t -- Simulate LF FSK tag from demodbuffer or input " } ,
{ " simpsk " , CmdLFpskSim , 0 , " [1|2|3] [c <clock>] [i] [r <carrier>] [d <raw hex to sim>] \n \t \t -- Simulate LF PSK tag from demodbuffer or input " } ,
{ " simbidir " , CmdLFSimBidir , 0 , " Simulate LF tag (with bidirectional data transmission between reader and tag) " } ,
2017-01-31 23:11:57 +08:00
{ " snoop " , CmdLFSnoop , 0 , " Snoop LF " } ,
2015-11-10 04:46:15 +08:00
{ " vchdemod " , CmdVchDemod , 1 , " ['clone'] -- Demodulate samples for VeriChip " } ,
{ NULL , NULL , 0 , NULL }
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
} ;
2016-02-14 22:24:11 +08:00
int CmdLF ( const char * Cmd ) {
clearCommandBuffer ( ) ;
CmdsParse ( CommandTable , Cmd ) ;
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}
2016-02-14 22:24:11 +08:00
int CmdHelp ( const char * Cmd ) {
CmdsHelp ( CommandTable ) ;
return 0 ;
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
}