hf mf/mfu dbg => hw dbg

This commit is contained in:
Philippe Teuwen 2019-06-06 11:31:47 +02:00
commit 1a39ec3026
9 changed files with 37 additions and 37 deletions

View file

@ -1115,10 +1115,10 @@ static void PacketReceived(PacketCommandNG *packet) {
break;
}
// emulator
case CMD_MIFARE_SET_DBGMODE:
case CMD_SET_DBGMODE:
DBGLEVEL = packet->data.asBytes[0];
Dbprintf("Debug level: %d", DBGLEVEL);
reply_ng(CMD_MIFARE_SET_DBGMODE, PM3_SUCCESS, NULL, 0);
reply_ng(CMD_SET_DBGMODE, PM3_SUCCESS, NULL, 0);
break;
case CMD_MIFARE_EML_MEMCLR:
MifareEMemClr();

View file

@ -85,21 +85,6 @@ static int usage_hf14_mfsim(void) {
PrintAndLogEx(NORMAL, " hf mf sim u 11223344 i x");
return 0;
}
static int usage_hf14_dbg(void) {
PrintAndLogEx(NORMAL, "Usage: hf mf dbg [h] <debug level>");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h this help");
PrintAndLogEx(NORMAL, " <debug level> (Optional) see list for valid levels");
PrintAndLogEx(NORMAL, " 0 - no debug messages");
PrintAndLogEx(NORMAL, " 1 - error messages");
PrintAndLogEx(NORMAL, " 2 - plus information messages");
PrintAndLogEx(NORMAL, " 3 - plus debug messages");
PrintAndLogEx(NORMAL, " 4 - print even debug messages in timing critical functions");
PrintAndLogEx(NORMAL, " Note: this option therefore may cause malfunction itself");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " hf mf dbg 3");
return 0;
}
/*
* static int usage_hf14_sniff(void) {
PrintAndLogEx(NORMAL, "It continuously gets data from the field and saves it to: log, emulator, emulator file.");
@ -2475,18 +2460,6 @@ static int CmdHF14AMfSniff(const char *Cmd) {
return PM3_SUCCESS;
}
*/
int CmdHF14AMfDbg(const char *Cmd) {
char ctmp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) < 1 || ctmp == 'h') return usage_hf14_dbg();
uint8_t dbgMode = param_get8ex(Cmd, 0, 0, 10);
if (dbgMode > 4) return usage_hf14_dbg();
SendCommandNG(CMD_MIFARE_SET_DBGMODE, &dbgMode, 1);
return PM3_SUCCESS;
}
static int CmdHF14AMfKeyBrute(const char *Cmd) {
uint8_t blockNo = 0, keytype = 0;
@ -3640,7 +3613,6 @@ static command_t CommandTable[] = {
{"fchk", CmdHF14AMfChk_fast, IfPm3Iso14443a, "Check keys fast, targets all keys on card"},
{"decrypt", CmdHf14AMfDecryptBytes, AlwaysAvailable, "[nt] [ar_enc] [at_enc] [data] - to decrypt sniff or trace"},
{"-----------", CmdHelp, IfPm3Iso14443a, ""},
{"dbg", CmdHF14AMfDbg, IfPm3Iso14443a, "Set default debug mode"},
{"rdbl", CmdHF14AMfRdBl, IfPm3Iso14443a, "Read MIFARE classic block"},
{"rdsc", CmdHF14AMfRdSc, IfPm3Iso14443a, "Read MIFARE classic sector"},
{"dump", CmdHF14AMfDump, IfPm3Iso14443a, "Dump MIFARE classic tag to binary file"},

View file

@ -2706,7 +2706,6 @@ static int CmdHF14AMfUPwdGen(const char *Cmd) {
//------------------------------------
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"dbg", CmdHF14AMfDbg, IfPm3Iso14443a, "Set default debug mode"},
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump Ultralight / Ultralight-C / NTAG tag to binary file"},
{"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"},

View file

@ -22,6 +22,22 @@
static int CmdHelp(const char *Cmd);
static int usage_dbg(void) {
PrintAndLogEx(NORMAL, "Usage: hw dbg [h] <debug level>");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h this help");
PrintAndLogEx(NORMAL, " <debug level> (Optional) see list for valid levels");
PrintAndLogEx(NORMAL, " 0 - no debug messages");
PrintAndLogEx(NORMAL, " 1 - error messages");
PrintAndLogEx(NORMAL, " 2 - plus information messages");
PrintAndLogEx(NORMAL, " 3 - plus debug messages");
PrintAndLogEx(NORMAL, " 4 - print even debug messages in timing critical functions");
PrintAndLogEx(NORMAL, " Note: this option therefore may cause malfunction itself");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " hw dbg 3");
return 0;
}
static int usage_hw_detectreader(void) {
PrintAndLogEx(NORMAL, "Start to detect presences of reader field");
PrintAndLogEx(NORMAL, "press pm3 button to change modes and finally exit");
@ -349,6 +365,18 @@ static void lookupChipID(uint32_t iChipID, uint32_t mem_used) {
PrintAndLogEx(NORMAL, " --= Nonvolatile Program Memory Type: %s", asBuff);
}
int CmdDbg(const char *Cmd) {
char ctmp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) < 1 || ctmp == 'h') return usage_dbg();
uint8_t dbgMode = param_get8ex(Cmd, 0, 0, 10);
if (dbgMode > 4) return usage_dbg();
SendCommandNG(CMD_SET_DBGMODE, &dbgMode, 1);
return PM3_SUCCESS;
}
static int CmdDetectReader(const char *Cmd) {
uint8_t arg = 0;
char c = toupper(Cmd[0]);
@ -552,6 +580,7 @@ static int CmdConnect(const char *Cmd) {
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"dbg", CmdDbg, IfPm3Present, "Set Proxmark3 debug level"},
{"connect", CmdConnect, AlwaysAvailable, "connect Proxmark3 to serial port"},
{"detectreader", CmdDetectReader, IfPm3Present, "['l'|'h'] -- Detect external reader field (option 'l' or 'h' to limit to LF or HF)"},
{"fpgaoff", CmdFPGAOff, IfPm3Present, "Set FPGA off"},

View file

@ -551,7 +551,7 @@ local function selftest()
print ('VALID KEY :: 29564af75805')
end
local function setdevicedebug( status )
local c = 'hf mf dbg '
local c = 'hw dbg '
if status then
c = c..'1'
else

View file

@ -185,7 +185,7 @@ end
local function write_tag(uid, t)
print('Writing to tag')
core.console('hf mf dbg 0')
core.console('hw dbg 0')
utils.Sleep(0.5)
local cmd = ''
@ -203,7 +203,7 @@ local function write_tag(uid, t)
--dynamic
core.console(('hf mfu wrbl b 40 d %s k %08X'):format(t[40], pwd))
core.console('hf mf dbg 1')
core.console('hw dbg 1')
utils.Sleep(0.5)
print('Done')
end

View file

@ -128,7 +128,7 @@ local function main(args)
end
-- Turn off Debug
local cmdSetDbgOff = "hf mf dbg 0"
local cmdSetDbgOff = "hw dbg 0"
core.console( cmdSetDbgOff)
utils.Sleep(0.5)

View file

@ -368,7 +368,7 @@ local function main(args)
end
-- Turn off Debug
local cmdSetDbgOff = 'hf mf dbg 0'
local cmdSetDbgOff = 'hw dbg 0'
core.console( cmdSetDbgOff)
utils.Sleep(0.5)

View file

@ -234,6 +234,7 @@ typedef struct {
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
#define CMD_CAPABILITIES 0x0112
#define CMD_QUIT_SESSION 0x0113
#define CMD_SET_DBGMODE 0x0114
// RDV40, Flash memory operations
#define CMD_FLASHMEM_READ 0x0120
@ -378,7 +379,6 @@ typedef struct {
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500
// For mifare commands
#define CMD_MIFARE_SET_DBGMODE 0x0600
#define CMD_MIFARE_EML_MEMCLR 0x0601
#define CMD_MIFARE_EML_MEMSET 0x0602
#define CMD_MIFARE_EML_MEMGET 0x0603