mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
hf mf/mfu dbg => hw dbg
This commit is contained in:
parent
4761ea13f7
commit
1a39ec3026
9 changed files with 37 additions and 37 deletions
|
@ -1115,10 +1115,10 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// emulator
|
// emulator
|
||||||
case CMD_MIFARE_SET_DBGMODE:
|
case CMD_SET_DBGMODE:
|
||||||
DBGLEVEL = packet->data.asBytes[0];
|
DBGLEVEL = packet->data.asBytes[0];
|
||||||
Dbprintf("Debug level: %d", DBGLEVEL);
|
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;
|
break;
|
||||||
case CMD_MIFARE_EML_MEMCLR:
|
case CMD_MIFARE_EML_MEMCLR:
|
||||||
MifareEMemClr();
|
MifareEMemClr();
|
||||||
|
|
|
@ -85,21 +85,6 @@ static int usage_hf14_mfsim(void) {
|
||||||
PrintAndLogEx(NORMAL, " hf mf sim u 11223344 i x");
|
PrintAndLogEx(NORMAL, " hf mf sim u 11223344 i x");
|
||||||
return 0;
|
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) {
|
* static int usage_hf14_sniff(void) {
|
||||||
PrintAndLogEx(NORMAL, "It continuously gets data from the field and saves it to: log, emulator, emulator file.");
|
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;
|
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) {
|
static int CmdHF14AMfKeyBrute(const char *Cmd) {
|
||||||
|
|
||||||
uint8_t blockNo = 0, keytype = 0;
|
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"},
|
{"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"},
|
{"decrypt", CmdHf14AMfDecryptBytes, AlwaysAvailable, "[nt] [ar_enc] [at_enc] [data] - to decrypt sniff or trace"},
|
||||||
{"-----------", CmdHelp, IfPm3Iso14443a, ""},
|
{"-----------", CmdHelp, IfPm3Iso14443a, ""},
|
||||||
{"dbg", CmdHF14AMfDbg, IfPm3Iso14443a, "Set default debug mode"},
|
|
||||||
{"rdbl", CmdHF14AMfRdBl, IfPm3Iso14443a, "Read MIFARE classic block"},
|
{"rdbl", CmdHF14AMfRdBl, IfPm3Iso14443a, "Read MIFARE classic block"},
|
||||||
{"rdsc", CmdHF14AMfRdSc, IfPm3Iso14443a, "Read MIFARE classic sector"},
|
{"rdsc", CmdHF14AMfRdSc, IfPm3Iso14443a, "Read MIFARE classic sector"},
|
||||||
{"dump", CmdHF14AMfDump, IfPm3Iso14443a, "Dump MIFARE classic tag to binary file"},
|
{"dump", CmdHF14AMfDump, IfPm3Iso14443a, "Dump MIFARE classic tag to binary file"},
|
||||||
|
|
|
@ -2706,7 +2706,6 @@ static int CmdHF14AMfUPwdGen(const char *Cmd) {
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"dbg", CmdHF14AMfDbg, IfPm3Iso14443a, "Set default debug mode"},
|
|
||||||
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
|
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
|
||||||
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump Ultralight / Ultralight-C / NTAG tag to binary file"},
|
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump Ultralight / Ultralight-C / NTAG tag to binary file"},
|
||||||
{"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"},
|
{"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"},
|
||||||
|
|
|
@ -22,6 +22,22 @@
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
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) {
|
static int usage_hw_detectreader(void) {
|
||||||
PrintAndLogEx(NORMAL, "Start to detect presences of reader field");
|
PrintAndLogEx(NORMAL, "Start to detect presences of reader field");
|
||||||
PrintAndLogEx(NORMAL, "press pm3 button to change modes and finally exit");
|
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);
|
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) {
|
static int CmdDetectReader(const char *Cmd) {
|
||||||
uint8_t arg = 0;
|
uint8_t arg = 0;
|
||||||
char c = toupper(Cmd[0]);
|
char c = toupper(Cmd[0]);
|
||||||
|
@ -552,6 +580,7 @@ static int CmdConnect(const char *Cmd) {
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
|
{"dbg", CmdDbg, IfPm3Present, "Set Proxmark3 debug level"},
|
||||||
{"connect", CmdConnect, AlwaysAvailable, "connect Proxmark3 to serial port"},
|
{"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)"},
|
{"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"},
|
{"fpgaoff", CmdFPGAOff, IfPm3Present, "Set FPGA off"},
|
||||||
|
|
|
@ -551,7 +551,7 @@ local function selftest()
|
||||||
print ('VALID KEY :: 29564af75805')
|
print ('VALID KEY :: 29564af75805')
|
||||||
end
|
end
|
||||||
local function setdevicedebug( status )
|
local function setdevicedebug( status )
|
||||||
local c = 'hf mf dbg '
|
local c = 'hw dbg '
|
||||||
if status then
|
if status then
|
||||||
c = c..'1'
|
c = c..'1'
|
||||||
else
|
else
|
||||||
|
|
|
@ -185,7 +185,7 @@ end
|
||||||
local function write_tag(uid, t)
|
local function write_tag(uid, t)
|
||||||
|
|
||||||
print('Writing to tag')
|
print('Writing to tag')
|
||||||
core.console('hf mf dbg 0')
|
core.console('hw dbg 0')
|
||||||
utils.Sleep(0.5)
|
utils.Sleep(0.5)
|
||||||
|
|
||||||
local cmd = ''
|
local cmd = ''
|
||||||
|
@ -203,7 +203,7 @@ local function write_tag(uid, t)
|
||||||
--dynamic
|
--dynamic
|
||||||
core.console(('hf mfu wrbl b 40 d %s k %08X'):format(t[40], pwd))
|
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)
|
utils.Sleep(0.5)
|
||||||
print('Done')
|
print('Done')
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,7 @@ local function main(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Turn off Debug
|
-- Turn off Debug
|
||||||
local cmdSetDbgOff = "hf mf dbg 0"
|
local cmdSetDbgOff = "hw dbg 0"
|
||||||
core.console( cmdSetDbgOff)
|
core.console( cmdSetDbgOff)
|
||||||
utils.Sleep(0.5)
|
utils.Sleep(0.5)
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ local function main(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Turn off Debug
|
-- Turn off Debug
|
||||||
local cmdSetDbgOff = 'hf mf dbg 0'
|
local cmdSetDbgOff = 'hw dbg 0'
|
||||||
core.console( cmdSetDbgOff)
|
core.console( cmdSetDbgOff)
|
||||||
utils.Sleep(0.5)
|
utils.Sleep(0.5)
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,7 @@ typedef struct {
|
||||||
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
|
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
|
||||||
#define CMD_CAPABILITIES 0x0112
|
#define CMD_CAPABILITIES 0x0112
|
||||||
#define CMD_QUIT_SESSION 0x0113
|
#define CMD_QUIT_SESSION 0x0113
|
||||||
|
#define CMD_SET_DBGMODE 0x0114
|
||||||
|
|
||||||
// RDV40, Flash memory operations
|
// RDV40, Flash memory operations
|
||||||
#define CMD_FLASHMEM_READ 0x0120
|
#define CMD_FLASHMEM_READ 0x0120
|
||||||
|
@ -378,7 +379,6 @@ typedef struct {
|
||||||
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500
|
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500
|
||||||
|
|
||||||
// For mifare commands
|
// For mifare commands
|
||||||
#define CMD_MIFARE_SET_DBGMODE 0x0600
|
|
||||||
#define CMD_MIFARE_EML_MEMCLR 0x0601
|
#define CMD_MIFARE_EML_MEMCLR 0x0601
|
||||||
#define CMD_MIFARE_EML_MEMSET 0x0602
|
#define CMD_MIFARE_EML_MEMSET 0x0602
|
||||||
#define CMD_MIFARE_EML_MEMGET 0x0603
|
#define CMD_MIFARE_EML_MEMGET 0x0603
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue