mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
searchFile for cmdscripts
This commit is contained in:
parent
00ad68215b
commit
43055ae6a7
2 changed files with 12 additions and 5 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "cmdhw.h"
|
#include "cmdhw.h"
|
||||||
#include "whereami.h"
|
#include "whereami.h"
|
||||||
#include "comms.h"
|
#include "comms.h"
|
||||||
|
#include "fileutils.h"
|
||||||
//#include "usart.h"
|
//#include "usart.h"
|
||||||
|
|
||||||
static void showBanner(void) {
|
static void showBanner(void) {
|
||||||
|
@ -95,11 +96,16 @@ main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop) {
|
||||||
|
|
||||||
if (script_cmds_file) {
|
if (script_cmds_file) {
|
||||||
|
|
||||||
sf = fopen(script_cmds_file, "r");
|
char *path;
|
||||||
if (sf)
|
int res = searchFile(&path, CMD_SCRIPTS_SUBDIR, script_cmds_file, ".cmd", false);
|
||||||
PrintAndLogEx(SUCCESS, "executing commands from file: %s\n", script_cmds_file);
|
if (res == PM3_SUCCESS) {
|
||||||
else
|
sf = fopen(path, "r");
|
||||||
PrintAndLogEx(ERR, "could not open " _YELLOW_("%s") "...", script_cmds_file);
|
if (sf)
|
||||||
|
PrintAndLogEx(SUCCESS, "executing commands from file: %s\n", path);
|
||||||
|
else
|
||||||
|
PrintAndLogEx(ERR, "could not open " _YELLOW_("%s") "...", path);
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *my_history_path = NULL;
|
char *my_history_path = NULL;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#define PM3_USER_DIRECTORY PATHSEP ".proxmark3" PATHSEP
|
#define PM3_USER_DIRECTORY PATHSEP ".proxmark3" PATHSEP
|
||||||
|
|
||||||
// PM3 subdirectories:
|
// PM3 subdirectories:
|
||||||
|
#define CMD_SCRIPTS_SUBDIR "cmdscripts" PATHSEP
|
||||||
#define DICTIONARIES_SUBDIR "dictionaries" PATHSEP
|
#define DICTIONARIES_SUBDIR "dictionaries" PATHSEP
|
||||||
#define LUA_LIBRARIES_SUBDIR "lualibs" PATHSEP
|
#define LUA_LIBRARIES_SUBDIR "lualibs" PATHSEP
|
||||||
#define LUA_SCRIPTS_SUBDIR "luascripts" PATHSEP
|
#define LUA_SCRIPTS_SUBDIR "luascripts" PATHSEP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue