@@ -1174,6 +1174,11 @@ int handle_tearoff(tearoff_params_t *params, bool verbose) {
11741174 if (params -> delay_us > 0 && verbose )
11751175 PrintAndLogEx (INFO , "Tear-off hook configured with delay of " _GREEN_ ("%i us" ), params -> delay_us );
11761176
1177+ if (params -> skip > 0 && verbose )
1178+ PrintAndLogEx (INFO , "Tear-off hook will be skipped " _YELLOW_ ("%i times" ) " before being activated" , params -> skip );
1179+ if (params -> skip == 0 && verbose )
1180+ PrintAndLogEx (INFO , "Tear-off hook skipping " _GREEN_ ("disabled" ));
1181+
11771182 if (params -> on && verbose )
11781183 PrintAndLogEx (INFO , "Tear-off hook " _GREEN_ ("enabled" ));
11791184
@@ -1201,6 +1206,7 @@ static int CmdTearoff(const char *Cmd) {
12011206 arg_int0 (NULL , "delay" , "<dec>" , "Delay in us before triggering tear-off, must be between 1 and 43000" ),
12021207 arg_lit0 (NULL , "on" , "Activate tear-off hook" ),
12031208 arg_lit0 (NULL , "off" , "Deactivate tear-off hook" ),
1209+ arg_int0 (NULL , "skip" , "<dec>" , "Skip N triggers before activating the hook" ),
12041210 arg_lit0 ("s" , "silent" , "less verbose output" ),
12051211 arg_lit0 (NULL , "list" , "List commands implementing tear-off hooks" ),
12061212 arg_param_end
@@ -1211,8 +1217,9 @@ static int CmdTearoff(const char *Cmd) {
12111217 int delay = arg_get_int_def (ctx , 1 , -1 );
12121218 params .on = arg_get_lit (ctx , 2 );
12131219 params .off = arg_get_lit (ctx , 3 );
1214- bool silent = arg_get_lit (ctx , 4 );
1215- bool list = arg_get_lit (ctx , 5 );
1220+ int skip = arg_get_int_def (ctx , 4 , -1 );
1221+ bool silent = arg_get_lit (ctx , 5 );
1222+ bool list = arg_get_lit (ctx , 6 );
12161223 CLIParserFree (ctx );
12171224
12181225 if (list ) {
@@ -1223,8 +1230,8 @@ static int CmdTearoff(const char *Cmd) {
12231230 PrintAndLogEx (INFO , " hf 15 raw" );
12241231 PrintAndLogEx (INFO , " hf iclass creditepurse" );
12251232 PrintAndLogEx (INFO , " hf iclass wrbl" );
1226- PrintAndLogEx (INFO , " hf mfc wrbl" );
1227- // PrintAndLogEx(INFO, " hf mfu wrbl");
1233+ PrintAndLogEx (INFO , " hf mf wrbl" );
1234+ PrintAndLogEx (INFO , " hf mfu wrbl (with --skip 3) " );
12281235 PrintAndLogEx (INFO , " hf topaz wrbl" );
12291236 PrintAndLogEx (INFO , " lf em 4x05 write" );
12301237 PrintAndLogEx (INFO , " lf em 4x50 wrbl" );
@@ -1251,6 +1258,16 @@ static int CmdTearoff(const char *Cmd) {
12511258 }
12521259
12531260 params .delay_us = delay ;
1261+
1262+ if (skip != -1 ) {
1263+ if ((skip < 0 ) || (skip > 127 )) {
1264+ PrintAndLogEx (WARNING , "You can't set skip out of 0..127 range!" );
1265+ return PM3_EINVARG ;
1266+ }
1267+ }
1268+
1269+ params .skip = skip ;
1270+
12541271 if (params .on && params .off ) {
12551272 PrintAndLogEx (WARNING , "You can't set both --on and --off!" );
12561273 return PM3_EINVARG ;
0 commit comments