diff --git a/client/Makefile b/client/Makefile index 051468ba9..d83fbff5f 100644 --- a/client/Makefile +++ b/client/Makefile @@ -158,6 +158,7 @@ CMDSRCS = crapto1/crapto1.c \ emv/emv_roca.c \ mifare/mifare4.c \ mifare/mad.c \ + mifare/ndef.c \ cmdanalyse.c \ cmdhf.c \ cmdhflist.c \ diff --git a/client/cmdhfmfp.c b/client/cmdhfmfp.c index de47d9865..20b6d0fce 100644 --- a/client/cmdhfmfp.c +++ b/client/cmdhfmfp.c @@ -24,6 +24,7 @@ #include "mifare.h" #include "mifare/mifare4.h" #include "mifare/mad.h" +#include "mifare/ndef.h" #include "cliparser/cliparser.h" #include "crypto/libpcrypto.h" #include "emv/dump.h" @@ -743,7 +744,7 @@ int CmdHFMFPNDEF(const char *cmd) { void* argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show technical data"), + arg_litn("vV", "verbose", 0, 2, "show technical data"), arg_str0("aA", "aid", "replace default aid for NDEF", NULL), arg_str0("kK", "key", "replace default key for NDEF", NULL), arg_lit0("bB", "keyb", "use key B for access sectors (by default: key A)"), @@ -752,6 +753,7 @@ int CmdHFMFPNDEF(const char *cmd) { CLIExecWithReturn(cmd, argtable, true); bool verbose = arg_get_lit(1); + bool verbose2 = arg_get_lit(1) > 1; uint8_t aid[2] = {0}; int aidlen; CLIGetHexWithReturn(2, aid, &aidlen); @@ -827,9 +829,12 @@ int CmdHFMFPNDEF(const char *cmd) { return 11; } -// if (verbose) + if (verbose2) { PrintAndLogEx(NORMAL, "NDEF data:"); dump_buffer(data, datalen, stdout, 1); + } + + NDEFDecodeAndPrint(data, datalen, verbose); return 0; } diff --git a/client/mifare/ndef.c b/client/mifare/ndef.c new file mode 100644 index 000000000..22deb0809 --- /dev/null +++ b/client/mifare/ndef.c @@ -0,0 +1,16 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2019 Merlok +// +// 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. +//----------------------------------------------------------------------------- +// NFC Data Exchange Format (NDEF) functions +//----------------------------------------------------------------------------- + +#include "ndef.h" + +int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose) { + + return 0; +} diff --git a/client/mifare/ndef.h b/client/mifare/ndef.h new file mode 100644 index 000000000..6e79887ee --- /dev/null +++ b/client/mifare/ndef.h @@ -0,0 +1,19 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2019 Merlok +// +// 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. +//----------------------------------------------------------------------------- +// NFC Data Exchange Format (NDEF) functions +//----------------------------------------------------------------------------- + +#ifndef _NDEF_H_ +#define _NDEF_H_ + +#include +#include + +extern int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose); + +#endif // _NDEF_H_