mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
revert
This commit is contained in:
parent
7a730ec57b
commit
776eac5e5a
1 changed files with 19 additions and 15 deletions
|
@ -344,12 +344,14 @@ static int l_WaitForResponseTimeout(lua_State *L) {
|
||||||
return returnToLuaWithError(L, "You need to supply at least command to wait for");
|
return returnToLuaWithError(L, "You need to supply at least command to wait for");
|
||||||
|
|
||||||
// extract first param. cmd byte to look for
|
// extract first param. cmd byte to look for
|
||||||
if (n >= 1)
|
if (n >= 1) {
|
||||||
cmd = luaL_checkunsigned(L, 1);
|
cmd = (uint32_t)luaL_checkinteger(L, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// extract second param. timeout value
|
// extract second param. timeout value
|
||||||
if (n >= 2)
|
if (n >= 2) {
|
||||||
ms_timeout = luaL_checkunsigned(L, 2);
|
ms_timeout = (size_t)luaL_checkinteger(L, 2);
|
||||||
|
}
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(cmd, &resp, ms_timeout) == false) {
|
if (WaitForResponseTimeout(cmd, &resp, ms_timeout) == false) {
|
||||||
|
@ -647,7 +649,7 @@ static int l_crc8legic(lua_State *L) {
|
||||||
size_t size;
|
size_t size;
|
||||||
const char *p_hexstr = luaL_checklstring(L, 1, &size);
|
const char *p_hexstr = luaL_checklstring(L, 1, &size);
|
||||||
uint16_t retval = CRC8Legic((uint8_t *)p_hexstr, size);
|
uint16_t retval = CRC8Legic((uint8_t *)p_hexstr, size);
|
||||||
lua_pushunsigned(L, retval);
|
lua_pushinteger(L, retval);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,7 +665,7 @@ static int l_crc16legic(lua_State *L) {
|
||||||
|
|
||||||
init_table(CRC_LEGIC_16);
|
init_table(CRC_LEGIC_16);
|
||||||
uint16_t retval = crc16_legic((uint8_t *)p_hexstr, hexsize, uidcrc);
|
uint16_t retval = crc16_legic((uint8_t *)p_hexstr, hexsize, uidcrc);
|
||||||
lua_pushunsigned(L, retval);
|
lua_pushinteger(L, retval);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,7 +675,7 @@ static int l_crc16(lua_State *L) {
|
||||||
const char *p_str = luaL_checklstring(L, 1, &size);
|
const char *p_str = luaL_checklstring(L, 1, &size);
|
||||||
|
|
||||||
uint16_t checksum = Crc16ex(CRC_CCITT, (uint8_t *) p_str, size);
|
uint16_t checksum = Crc16ex(CRC_CCITT, (uint8_t *) p_str, size);
|
||||||
lua_pushunsigned(L, checksum);
|
lua_pushinteger(L, checksum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,9 +741,10 @@ static int l_reveng_models(lua_State *L) {
|
||||||
#define NMODELS 106
|
#define NMODELS 106
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
uint8_t in_width = luaL_checkunsigned(L, 1);
|
uint8_t in_width = (uint8_t)luaL_checkinteger(L, 1);
|
||||||
if (in_width > 89)
|
if (in_width > 89) {
|
||||||
return returnToLuaWithError(L, "Width cannot exceed 89, got %d", in_width);
|
return returnToLuaWithError(L, "Width cannot exceed 89, got %d", in_width);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t width[NMODELS];
|
uint8_t width[NMODELS];
|
||||||
memset(width, 0, sizeof(width));
|
memset(width, 0, sizeof(width));
|
||||||
|
@ -749,8 +752,9 @@ static int l_reveng_models(lua_State *L) {
|
||||||
|
|
||||||
width[0] = in_width;
|
width[0] = in_width;
|
||||||
|
|
||||||
if (!GetModels(models, &count, width))
|
if (!GetModels(models, &count, width)) {
|
||||||
return returnToLuaWithError(L, "didn't find any models");
|
return returnToLuaWithError(L, "didn't find any models");
|
||||||
|
}
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
@ -920,8 +924,8 @@ static int l_keygen_algoB(lua_State *L) {
|
||||||
uint32_t pwd = ul_ev1_pwdgenB(uid);
|
uint32_t pwd = ul_ev1_pwdgenB(uid);
|
||||||
uint16_t pack = ul_ev1_packgenB(uid);
|
uint16_t pack = ul_ev1_packgenB(uid);
|
||||||
|
|
||||||
lua_pushunsigned(L, pwd);
|
lua_pushinteger(L, pwd);
|
||||||
lua_pushunsigned(L, pack);
|
lua_pushinteger(L, pack);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,8 +957,8 @@ static int l_keygen_algoD(lua_State *L) {
|
||||||
uint32_t pwd = ul_ev1_pwdgenD(uid);
|
uint32_t pwd = ul_ev1_pwdgenD(uid);
|
||||||
uint16_t pack = ul_ev1_packgenD(uid);
|
uint16_t pack = ul_ev1_packgenD(uid);
|
||||||
|
|
||||||
lua_pushunsigned(L, pwd);
|
lua_pushinteger(L, pwd);
|
||||||
lua_pushunsigned(L, pack);
|
lua_pushinteger(L, pack);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,7 +1045,7 @@ static int l_T55xx_readblock(lua_State *L) {
|
||||||
return returnToLuaWithError(L, "Failed to get actual data");
|
return returnToLuaWithError(L, "Failed to get actual data");
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pushunsigned(L, blockData);
|
lua_pushinteger(L, blockData);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue