mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
Replace WITH_FLASH by dynamic detection in client
This commit is contained in:
parent
c93eee5c72
commit
cad676a23c
6 changed files with 39 additions and 67 deletions
|
@ -7,8 +7,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Proxmark3 RDV40 Flash memory commands
|
// Proxmark3 RDV40 Flash memory commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifdef WITH_FLASH
|
|
||||||
|
|
||||||
#include "cmdflashmem.h"
|
#include "cmdflashmem.h"
|
||||||
|
|
||||||
#include "mbedtls/rsa.h"
|
#include "mbedtls/rsa.h"
|
||||||
|
@ -618,12 +616,12 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"spibaud", CmdFlashmemSpiBaudrate, AlwaysAvailable, "Set Flash memory Spi baudrate [rdv40]"},
|
{"spibaud", CmdFlashmemSpiBaudrate, IfPm3Flash, "Set Flash memory Spi baudrate [rdv40]"},
|
||||||
{"read", CmdFlashMemRead, AlwaysAvailable, "Read Flash memory [rdv40]"},
|
{"read", CmdFlashMemRead, IfPm3Flash, "Read Flash memory [rdv40]"},
|
||||||
{"info", CmdFlashMemInfo, AlwaysAvailable, "Flash memory information [rdv40]"},
|
{"info", CmdFlashMemInfo, IfPm3Flash, "Flash memory information [rdv40]"},
|
||||||
{"load", CmdFlashMemLoad, AlwaysAvailable, "Load data into flash memory [rdv40]"},
|
{"load", CmdFlashMemLoad, IfPm3Flash, "Load data into flash memory [rdv40]"},
|
||||||
{"save", CmdFlashMemSave, AlwaysAvailable, "Save data from flash memory [rdv40]"},
|
{"save", CmdFlashMemSave, IfPm3Flash, "Save data from flash memory [rdv40]"},
|
||||||
{"wipe", CmdFlashMemWipe, AlwaysAvailable, "Wipe data from flash memory [rdv40]"},
|
{"wipe", CmdFlashMemWipe, IfPm3Flash, "Wipe data from flash memory [rdv40]"},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -637,5 +635,3 @@ int CmdFlashMem(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
return CmdsParse(CommandTable, Cmd);
|
return CmdsParse(CommandTable, Cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
// Proxmark3 RDV40 Flash memory commands
|
// Proxmark3 RDV40 Flash memory commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef WITH_FLASH
|
|
||||||
|
|
||||||
#ifndef CMDFLASHMEM_H__
|
#ifndef CMDFLASHMEM_H__
|
||||||
#define CMDFLASHMEM_H__
|
#define CMDFLASHMEM_H__
|
||||||
|
|
||||||
|
@ -36,5 +34,3 @@ typedef enum {
|
||||||
int CmdFlashMem(const char *Cmd);
|
int CmdFlashMem(const char *Cmd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -202,9 +202,8 @@ static int usage_hf14_chk_fast(void) {
|
||||||
PrintAndLogEx(NORMAL, " hf mf fchk 1 1234567890ab keys.dic -- target 1K using key 1234567890ab, using dictionary file");
|
PrintAndLogEx(NORMAL, " hf mf fchk 1 1234567890ab keys.dic -- target 1K using key 1234567890ab, using dictionary file");
|
||||||
PrintAndLogEx(NORMAL, " hf mf fchk 1 t -- target 1K, write to emulator memory");
|
PrintAndLogEx(NORMAL, " hf mf fchk 1 t -- target 1K, write to emulator memory");
|
||||||
PrintAndLogEx(NORMAL, " hf mf fchk 1 d -- target 1K, write to file");
|
PrintAndLogEx(NORMAL, " hf mf fchk 1 d -- target 1K, write to file");
|
||||||
#ifdef WITH_FLASH
|
if (IfPm3Flash())
|
||||||
PrintAndLogEx(NORMAL, " hf mf fchk 1 m -- target 1K, use dictionary from flashmemory");
|
PrintAndLogEx(NORMAL, " hf mf fchk 1 m -- target 1K, use dictionary from flashmemory");
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int usage_hf14_keybrute(void) {
|
static int usage_hf14_keybrute(void) {
|
||||||
|
@ -1593,9 +1592,7 @@ static int CmdHF14AMfChk_fast(const char *Cmd) {
|
||||||
} else if (clen == 1) {
|
} else if (clen == 1) {
|
||||||
if (ctmp == 't') { transferToEml = 1; continue; }
|
if (ctmp == 't') { transferToEml = 1; continue; }
|
||||||
if (ctmp == 'd') { createDumpFile = 1; continue; }
|
if (ctmp == 'd') { createDumpFile = 1; continue; }
|
||||||
#ifdef WITH_FLASH
|
if ((ctmp == 'm') && (IfPm3Flash())){ use_flashmemory = true; continue; }
|
||||||
if (ctmp == 'm') { use_flashmemory = true; continue; }
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
// May be a dic file
|
// May be a dic file
|
||||||
if (param_getstr(Cmd, i, filename, FILE_PATH_SIZE) >= FILE_PATH_SIZE) {
|
if (param_getstr(Cmd, i, filename, FILE_PATH_SIZE) >= FILE_PATH_SIZE) {
|
||||||
|
|
|
@ -500,25 +500,12 @@ void pm3_version(bool verbose) {
|
||||||
SendCommandOLD(CMD_VERSION, 0, 0, 0, NULL, 0);
|
SendCommandOLD(CMD_VERSION, 0, 0, 0, NULL, 0);
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
||||||
PrintAndLogEx(NORMAL, "\n" _BLUE_(" [ Proxmark3 RFID instrument ]") "\n");
|
PrintAndLogEx(NORMAL, "\n" _BLUE_(" [ Proxmark3 RFID instrument ]") "\n");
|
||||||
char s[60] = {0};
|
|
||||||
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD) || defined(WITH_FPC)
|
|
||||||
strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1);
|
|
||||||
#endif
|
|
||||||
#ifdef WITH_FLASH
|
|
||||||
strncat(s, "flashmem; ", sizeof(s) - strlen(s) - 1);
|
|
||||||
#endif
|
|
||||||
#ifdef WITH_SMARTCARD
|
|
||||||
strncat(s, "smartcard; ", sizeof(s) - strlen(s) - 1);
|
|
||||||
#endif
|
|
||||||
#ifdef WITH_FPC
|
|
||||||
#ifdef WITH_FPC_HOST
|
|
||||||
strncat(s, "fpc-host; ", sizeof(s) - strlen(s) - 1);
|
|
||||||
#else
|
|
||||||
strncat(s, "fpc; ", sizeof(s) - strlen(s) - 1);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
PrintAndLogEx(NORMAL, "\n [ CLIENT ]");
|
PrintAndLogEx(NORMAL, "\n [ CLIENT ]");
|
||||||
PrintAndLogEx(NORMAL, " client: iceman %s \n", s);
|
PrintAndLogEx(NORMAL, " client: RRG/Iceman"); // TODO version info?
|
||||||
|
PrintAndLogEx(NORMAL, "\n [ PROXMARK ]");
|
||||||
|
PrintAndLogEx(NORMAL, " external flash: %s", IfPm3Flash() ? _GREEN_("present") : _YELLOW_("absent"));
|
||||||
|
PrintAndLogEx(NORMAL, " smartcard reader: %s", IfPm3Smartcard() ? _GREEN_("present") : _YELLOW_("absent"));
|
||||||
|
PrintAndLogEx(NORMAL, " USART for addon support: %s\n", IfPm3FpcHost() ? _GREEN_("present") : _YELLOW_("absent"));
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, (char *)resp.data.asBytes);
|
PrintAndLogEx(NORMAL, (char *)resp.data.asBytes);
|
||||||
lookupChipID(resp.oldarg[0], resp.oldarg[1]);
|
lookupChipID(resp.oldarg[0], resp.oldarg[1]);
|
||||||
|
|
|
@ -53,12 +53,8 @@ static command_t CommandTable[] = {
|
||||||
{"reveng", CmdRev, AlwaysAvailable, "{ Crc calculations from the RevEng software... }"},
|
{"reveng", CmdRev, AlwaysAvailable, "{ Crc calculations from the RevEng software... }"},
|
||||||
{"script", CmdScript, AlwaysAvailable, "{ Scripting commands }"},
|
{"script", CmdScript, AlwaysAvailable, "{ Scripting commands }"},
|
||||||
{"trace", CmdTrace, AlwaysAvailable, "{ Trace manipulation... }"},
|
{"trace", CmdTrace, AlwaysAvailable, "{ Trace manipulation... }"},
|
||||||
#ifdef WITH_FLASH
|
{"mem", CmdFlashMem, IfPm3Flash, "{ Flash Memory manipulation... }"},
|
||||||
{"mem", CmdFlashMem, AlwaysAvailable, "{ Flash Memory manipulation... }"},
|
{"sc", CmdSmartcard, IfPm3Smartcard, "{ Smart card ISO7816 commands... }"},
|
||||||
#endif
|
|
||||||
#ifdef WITH_SMARTCARD
|
|
||||||
{"sc", CmdSmartcard, AlwaysAvailable, "{ Smart card ISO7816 commands... }"},
|
|
||||||
#endif
|
|
||||||
{"quit", CmdQuit, AlwaysAvailable, ""},
|
{"quit", CmdQuit, AlwaysAvailable, ""},
|
||||||
{"exit", CmdQuit, AlwaysAvailable, "Exit program"},
|
{"exit", CmdQuit, AlwaysAvailable, "Exit program"},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
|
|
|
@ -264,9 +264,7 @@ static int l_GetFromBigBuf(lua_State *L) {
|
||||||
*/
|
*/
|
||||||
static int l_GetFromFlashMem(lua_State *L) {
|
static int l_GetFromFlashMem(lua_State *L) {
|
||||||
|
|
||||||
#ifndef WITH_FLASH
|
if (IfPm3Flash()) {
|
||||||
return returnToLuaWithError(L, "Not compiled with FLASH MEM support");
|
|
||||||
#else
|
|
||||||
int len = 0, startindex = 0;
|
int len = 0, startindex = 0;
|
||||||
|
|
||||||
int n = lua_gettop(L);
|
int n = lua_gettop(L);
|
||||||
|
@ -293,7 +291,9 @@ static int l_GetFromFlashMem(lua_State *L) {
|
||||||
lua_pushlstring(L, (const char *)data, len);
|
lua_pushlstring(L, (const char *)data, len);
|
||||||
free(data);
|
free(data);
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
} else {
|
||||||
|
return returnToLuaWithError(L, "No FLASH MEM support");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue