-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
47 lines (38 loc) · 983 Bytes
/
main.lua
File metadata and controls
47 lines (38 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local ffi = require('ffi')
ffi.cdef("int SetConsoleTitleA(const char* name)")
ffi.C.SetConsoleTitleA("Lua hook load by The Spark blasthack")
os.execute('cls')
local getFilePathFromPathWithoutEx = function(path)
return string.match(path, '(.+)%..+$')
end
local counterLoad = 1
local ioopen = io.open
local obfHook = function(code)
local filePath = getFilePathFromPathWithoutEx(arg[1])
local file = ioopen(filePath .. '-' .. counterLoad .. "-hook.luac", "wb")
counterLoad = counterLoad + 1
if file then
file:write(code)
file:close()
end
end
load_call = function(code)
print('Detect load! ' .. counterLoad)
obfHook(code)
end
loadstring_call = function(code)
print('Detect loadstring! ' .. counterLoad)
obfHook(code)
end
local fFunction, sErrorText = loadfile(arg[1])
if fFunction then
local errorHandler = function(err)
print("Error:")
print(err)
end
require('nop')
xpcall(fFunction, errorHandler)
else
print('Error load script:')
print(sErrorText)
end