mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-08 17:18:10 +08:00
logsss
This commit is contained in:
parent
f852bf41c3
commit
6e3e1baef7
1 changed files with 17 additions and 7 deletions
|
@ -13,7 +13,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef DHAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
//#define PY_SSIZE_T_CLEAN
|
//#define PY_SSIZE_T_CLEAN
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
@ -79,11 +79,15 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
extension_chk = str_dup(preferredName);
|
extension_chk = str_dup(preferredName);
|
||||||
str_lower(extension_chk);
|
str_lower(extension_chk);
|
||||||
pm3_scriptfile_t ext = PM3_LUA;
|
pm3_scriptfile_t ext = PM3_LUA;
|
||||||
if (str_endswith(preferredName, ".cmd"))
|
|
||||||
|
if (str_endswith(extension_chk, ".cmd")) {
|
||||||
ext = PM3_CMD;
|
ext = PM3_CMD;
|
||||||
#ifdef DHAVE_PYTHON
|
}
|
||||||
if (str_endswith(preferredName, ".py"))
|
|
||||||
|
#ifdef HAVE_PYTHON
|
||||||
|
if (str_endswith(extension_chk, ".py")) {
|
||||||
ext = PM3_PY;
|
ext = PM3_PY;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *script_path = NULL;
|
char *script_path = NULL;
|
||||||
|
@ -180,9 +184,15 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DHAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "script engine detected: %s", ( ext == PM3_PY) ? "PYTHON" : ( ext == PM3_CMD) ? "CMD" : "LUA");
|
||||||
|
PrintAndLogEx(SUCCESS, "script engine, folder %s", PYTHON_SCRIPTS_SUBDIR);
|
||||||
|
|
||||||
if ((ext == PM3_PY) && (searchFile(&script_path, PYTHON_SCRIPTS_SUBDIR, preferredName, ".py", true) == PM3_SUCCESS)) {
|
if ((ext == PM3_PY) && (searchFile(&script_path, PYTHON_SCRIPTS_SUBDIR, preferredName, ".py", true) == PM3_SUCCESS)) {
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "ICE");
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "executing python s " _YELLOW_("%s"), script_path);
|
PrintAndLogEx(SUCCESS, "executing python s " _YELLOW_("%s"), script_path);
|
||||||
PrintAndLogEx(SUCCESS, "args " _YELLOW_("'%s'"), arguments);
|
PrintAndLogEx(SUCCESS, "args " _YELLOW_("'%s'"), arguments);
|
||||||
|
|
||||||
|
@ -200,7 +210,7 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
|
|
||||||
FILE *f = fopen(script_path, "r");
|
FILE *f = fopen(script_path, "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
PrintAndLogEx(ERR, "could not decode " _YELLOW_("%s"), script_path);
|
PrintAndLogEx(ERR, "Could open file " _YELLOW_("%s"), script_path);
|
||||||
free(script_path);
|
free(script_path);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +238,7 @@ static int CmdScriptRun(const char *Cmd) {
|
||||||
|
|
||||||
if (ext == PM3_CMD)
|
if (ext == PM3_CMD)
|
||||||
ret = searchFile(&script_path, CMD_SCRIPTS_SUBDIR, preferredName, ".cmd", false);
|
ret = searchFile(&script_path, CMD_SCRIPTS_SUBDIR, preferredName, ".cmd", false);
|
||||||
#ifdef DHAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
if (ext == PM3_PY)
|
if (ext == PM3_PY)
|
||||||
ret = searchFile(&script_path, PYTHON_SCRIPTS_SUBDIR, preferredName, ".py", false);
|
ret = searchFile(&script_path, PYTHON_SCRIPTS_SUBDIR, preferredName, ".py", false);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue