mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
add set isodepstate in lua
This commit is contained in:
parent
d0cb240c64
commit
5a483df74d
1 changed files with 32 additions and 4 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include "cmdlfem4x05.h" // read 4305
|
#include "cmdlfem4x05.h" // read 4305
|
||||||
#include "cmdlfem4x50.h" // read 4350
|
#include "cmdlfem4x50.h" // read 4350
|
||||||
#include "em4x50.h" // 4x50 structs
|
#include "em4x50.h" // 4x50 structs
|
||||||
|
#include "iso7816/iso7816core.h" // ISODEPSTATE
|
||||||
|
|
||||||
static int returnToLuaWithError(lua_State *L, const char *fmt, ...) {
|
static int returnToLuaWithError(lua_State *L, const char *fmt, ...) {
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
@ -1188,15 +1189,12 @@ static int l_em4x50_read(lua_State *L) {
|
||||||
words[etd.addresses & 0xFF].byte[3]
|
words[etd.addresses & 0xFF].byte[3]
|
||||||
);
|
);
|
||||||
lua_pushinteger(L, word);
|
lua_pushinteger(L, word);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
static int l_ndefparse(lua_State *L) {
|
static int l_ndefparse(lua_State *L) {
|
||||||
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
//Check number of arguments
|
//Check number of arguments
|
||||||
int n = lua_gettop(L);
|
int n = lua_gettop(L);
|
||||||
if (n != 3) {
|
if (n != 3) {
|
||||||
|
@ -1212,6 +1210,7 @@ static int l_ndefparse(lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
size_t size;
|
||||||
const char *p_data = luaL_checklstring(L, 3, &size);
|
const char *p_data = luaL_checklstring(L, 3, &size);
|
||||||
if (size) {
|
if (size) {
|
||||||
if (size > (datalen << 1))
|
if (size > (datalen << 1))
|
||||||
|
@ -1256,6 +1255,34 @@ static int l_remark(lua_State *L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_set_iso_dep_state(lua_State *L) {
|
||||||
|
|
||||||
|
//Check number of arguments
|
||||||
|
int n = lua_gettop(L);
|
||||||
|
if (n != 1) {
|
||||||
|
return returnToLuaWithError(L, "Only one value allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t state = luaL_checknumber(L, 1);
|
||||||
|
switch (state) {
|
||||||
|
case 0:
|
||||||
|
SetISODEPState(ISODEP_INACTIVE);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
SetISODEPState(ISODEP_NFCA);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
SetISODEPState(ISODEP_NFCB);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
SetISODEPState(ISODEP_NFCV);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return returnToLuaWithError(L, "Wrong ISODEP STATE value");
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// 1. filename
|
// 1. filename
|
||||||
// 2. extension
|
// 2. extension
|
||||||
// output: full search path to file
|
// output: full search path to file
|
||||||
|
@ -1402,6 +1429,7 @@ int set_pm3_libraries(lua_State *L) {
|
||||||
{"em4x05_read", l_em4x05_read},
|
{"em4x05_read", l_em4x05_read},
|
||||||
{"em4x50_read", l_em4x50_read},
|
{"em4x50_read", l_em4x50_read},
|
||||||
{"ul_read_uid", l_ul_read_uid},
|
{"ul_read_uid", l_ul_read_uid},
|
||||||
|
{"set_isodepstate", l_set_iso_dep_state},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue