add ndef.c/h

This commit is contained in:
merlokk 2019-03-05 00:11:31 +02:00
parent e191219d8a
commit cbe25f4832
4 changed files with 43 additions and 2 deletions

View file

@ -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 \

View file

@ -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;
}

16
client/mifare/ndef.c Normal file
View file

@ -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;
}

19
client/mifare/ndef.h Normal file
View file

@ -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 <stdint.h>
#include <stdbool.h>
extern int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose);
#endif // _NDEF_H_