]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/scripting.c
FIX: lf hitag : Mea culpa, simulation should not have reader_field on. thanks to...
[proxmark3-svn] / client / scripting.c
index 752edba6d0f9309b5d66724986ccf4f608924abf..d04c88eab5fc5b967ac1e6191fe28b9c07b7eca8 100644 (file)
@@ -145,7 +145,7 @@ static int l_nonce2key(lua_State *L){
     uint8_t dest_key[8];
     num_to_bytes(key,sizeof(dest_key),dest_key);
 
-    //printf("Pushing to lua stack: %012"llx"\n",key);
+    //printf("Pushing to lua stack: %012" PRIx64 "\n",key);
     lua_pushlstring(L,(const char *) dest_key,sizeof(dest_key));
 
     return 2; //Two return values
@@ -221,10 +221,10 @@ static int l_iso14443b_crc(lua_State *L)
                      unsigned char *TransmitFirst,
                      unsigned char *TransmitSecond)
        */
+       unsigned char buf[USB_CMD_DATA_SIZE] = {0x00};
     size_t size = 0;   
     const char *data = luaL_checklstring(L, 1, &size);
 
-       unsigned char buf[USB_CMD_DATA_SIZE] = {0x00};
        
        for (int i = 0; i < size; i += 2)
                sscanf(&data[i], "%02x", (unsigned int *)&buf[i / 2]);  
@@ -531,7 +531,7 @@ static int l_hardnested(lua_State *L){
     uint8_t dest_key[6];
     num_to_bytes(foundkey, sizeof(dest_key), dest_key);
 
-    //printf("Pushing to lua stack: %012"llx"\n",key);
+    //printf("Pushing to lua stack: %012" PRIx64 "\n",key);
     lua_pushlstring(L, (const char *) dest_key, sizeof(dest_key));
     return 2; //Two return values
 }
@@ -605,7 +605,11 @@ int set_pm3_libraries(lua_State *L)
 
     //-- Last but not least, add to the LUA_PATH (package.path in lua)
     // so we can load libraries from the ./lualib/ - directory
-    setLuaPath(L,"./lualibs/?.lua");
+       char libraries_path[strlen(get_my_executable_directory()) + strlen(LUA_LIBRARIES_DIRECTORY) + strlen(LUA_LIBRARIES_WILDCARD) + 1];
+       strcpy(libraries_path, get_my_executable_directory());
+       strcat(libraries_path, LUA_LIBRARIES_DIRECTORY);
+       strcat(libraries_path, LUA_LIBRARIES_WILDCARD);
+       setLuaPath(L, libraries_path);
 
     return 1;
 }
Impressum, Datenschutz