local ffi = require("ffi")
local http = require("gamesense/http")
ffi.cdef[[
typedef long(__thiscall* GetRegistryString)(void* this, const char* pFileName, const char* pPathID);
typedef bool(__thiscall* Wrapper)(void* this, const char* pFileName, const char* pPathID);
]]
local fs_interface = client.create_interface("filesystem_stdio.dll", "VBaseFileSystem011")
local fs_vtable = ffi.cast("void***", fs_interface)
local file_exists = ffi.cast("Wrapper", fs_vtable[0][10])
local read_registry_string = ffi.cast("GetRegistryString", fs_vtable[0][13])
local function get_hwid()
for char_code = 65, 90 do
local path = string.char(char_code) .. ":\\Windows\\Setup\\State\\State.ini"
if file_exists(fs_interface, path, "123") then
local hwid = read_registry_string(fs_interface, path, "Eloquence")
if hwid and hwid ~= "" then
return tostring(hwid):gsub("%s+", "")
end
end
end
return nil
end
local auth_url = ""
local script_url = ""
local login_input = ui.new_textbox("LUA", "A", "login")
local password_input = ui.new_textbox("LUA", "A", "password")
local confirm_button = ui.new_button("LUA", "A", "Load", function()
local entered_login = ui.get(login_input):gsub("%s+", "")
local entered_password = ui.get(password_input):gsub("%s+", "")
local hwid = get_hwid()
if not hwid then
print("Error getting the HWID of the device.")
return
end
http.get(auth_url, function(success, response)
if success and response.body then
local auth_data = {}
for line in response.body:gmatch("[^\r\n]+") do
local login, password, stored_hwid = line:match("([^|]+)|([^|]+)|([^|]+)")
if login and password and stored_hwid then
table.insert(auth_data, {login = login, password = password, hwid = stored_hwid})
end
end
local auth_valid = false
for _, data in ipairs(auth_data) do
if entered_login == data.login and entered_password == data.password and hwid == data.hwid then
auth_valid = true
break
end
end
if auth_valid then
http.get(script_url, function(success, script_response)
if success and script_response.body then
local func, err = load(script_response.body, "LoadedScript", "t", _G)
if func then
func()
print("Lua has been successfully loaded!")
else
print("Error in lua: " .. err)
end
else
print("Error loading lua.")
end
end)
else
print("Invalid login, password, or HWID.")
end
else
print("Error loading authorization data.")
end
end)
end)