From 10489db97da9cc256124dd12412880c9ff8ad374 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 1 May 2019 21:09:23 +0200 Subject: [PATCH] capabilities: more IsAvailable helpers --- client/cmdparser.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++ client/cmdparser.h | 14 ++++++++ 2 files changed, 99 insertions(+) diff --git a/client/cmdparser.c b/client/cmdparser.c index b205a0d1f..0eeb6c8d5 100644 --- a/client/cmdparser.c +++ b/client/cmdparser.c @@ -27,12 +27,97 @@ bool IfPm3Present(void) { return session.pm3_present; } +bool IfPm3Flash(void) { + if (!IfPm3Present()) + return false; +// TODO +// capabilities.hw_available_flash + return pm3_capabilities.compiled_with_flash; +} + +bool IfPm3Smartcard(void) { + if (!IfPm3Present()) + return false; +// TODO +// capabilities.hw_available_smartcard + return pm3_capabilities.compiled_with_smartcard; +} + +bool IfPm3Fpc(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_fpc; +} + +bool IfPm3FpcHost(void) { + if (!IfPm3Present()) + return false; +// TODO +// capabilities.hw_available_fpc_host + return pm3_capabilities.compiled_with_fpc_host; +} + +bool IfPm3Lf(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_lf; +} + +bool IfPm3Hitag(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_hitag; +} + bool IfPm3Hfsniff(void) { if (!IfPm3Present()) return false; return pm3_capabilities.compiled_with_hfsniff; } +bool IfPm3Iso14443a(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_iso14443a; +} + +bool IfPm3Iso14443a(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_iso14443b; +} + +bool IfPm3Iso15693(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_iso15693; +} + +bool IfPm3Felica(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_felica; +} + +bool IfPm3Legicrf(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_legicrf; +} + +bool IfPm3Iclass(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_iclass; +} + +bool IfPm3Lcd(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_lcd; +} + + void CmdsHelp(const command_t Commands[]) { if (Commands[0].Name == NULL) return; int i = 0; diff --git a/client/cmdparser.h b/client/cmdparser.h index 9b7e9e734..48e465075 100644 --- a/client/cmdparser.h +++ b/client/cmdparser.h @@ -19,9 +19,23 @@ typedef struct command_s { } command_t; // command_t array are expected to be NULL terminated +// helpers for command_t IsAvailable bool AlwaysAvailable(void); bool IfPm3Present(void); +bool IfPm3Flash(void); +bool IfPm3Smartcard(void); +bool IfPm3Fpc(void); +bool IfPm3FpcHost(void); +bool IfPm3Lf(void); +bool IfPm3Hitag(void); bool IfPm3Hfsniff(void); +bool IfPm3Iso14443a(void); +bool IfPm3Iso14443a(void); +bool IfPm3Iso15693(void); +bool IfPm3Felica(void); +bool IfPm3Legicrf(void); +bool IfPm3Iclass(void); +bool IfPm3Lcd(void); // Print help for each command in the command array void CmdsHelp(const command_t Commands[]);