if gg.isVisible(true) then
gg.setVisible(false)
end
::Mainmenu:: gg.clearResults()
menu = gg.choice({'Weak Encryption','High Encryption','Log Script Functions','Exit'},nil,'Menu')
if menu == 1 then point1(Chikri) end
if menu == 2 then point2(Chikri) end
if menu == 3 then point3(Chikri) end
if menu == 4 then exit(Chikri) end
if menu == nil then os.exit() end
function exit(Chikri)
os.exit()
end
function point1(Chikri)
local last = gg.getFile()
info = gg.prompt({'Select script file:'}, {last}, {'file'})
if info == nil then os.exit() end
last = info[1]
local test = loadfile(info[1])
if test == nil then
gg.alert('Failed load script: '..info[1])
else
local sel = gg.choice({'Weak Encryption', 'Strong Encryption', 'Dump source'})
if sel == nil then os.exit() end
if sel == 1 or sel == 2 then
local warn = gg.alert('Scripts in binary form may not work on other versions of GameGuardian', 'Agree', 'Disagree')
if warn ~= 1 then os.exit() end
local out = last..".bin.lua"
local file = io.open(out, "w")
file:write(string.dump(test, sel == 2))
file:close()
gg.alert('The binary script is saved to the file:\n'..out)
end
function point2(Chikri)
local last = gg.getFile()
info = gg.prompt({'Select Script To Encrypt:'}, {last}, {'file'})
if info == nil then os.exit() end
last = info[1]
local enc = gg.prompt({'Set Password'},{[1]=0},{[1]='number'})
function Ecrypt(Text)
return Text:gsub('.', function (c) return string.format ("%02X", (string.byte(c) + 13 + enc[1]) % 256) end):gsub(" ", "+")
end
local out = last..".chikrienc.ua"
local file = io.open(last, 'r');
assert(file);
local data = file:read('*a');
file:close(); gg.alert('The encrypted script is saved to the file:\n'..out)
c = Ecrypt(data)
d = [==[
--Encryptor Made By Chikri
print('Script Encryptor Made By Chikri')
function encodes(key,code)
return (code:gsub('..', function (h) return string.char((tonumber(h,16)+256-13 - key + 999999*256)%256) end))
end
local v_value=gg.prompt({'Enter password:'},{[1]=0},{[1]='number'}) gg.toast('Loading……')
pcall(encodes(v_value[1],'technano'))
local data = encodes(v_value[1],'technano')
local enc = load(data)
pcall(enc)
]==]
d = string.gsub(d,'technano',c)
file = io.open(out,'w')file:write(d)file:close()
end
function point3(Chikri)
local ggg = {}
for k, v in pairs(gg) do
ggg[k] = v
end
local sel = select
local typ = type
local str = tostring
local echo = print
local io_open = io.open
local tr = {}
local msg = ''
if true then
local load_cnt = 0
local fname = g.last..'.load_'
for i, v in pairs({load=1, loadfile=0, dofile=0}) do
local orig = _G
local hook = 1
local type = v
hook = function (...)
local arg = {...}
local content = arg[1]
if type == 0 then
content = nil
local f = io_open(arg[1], "rb")
if f ~= nil then
content = f:read("*a")
f:close()
end
end
if content ~= nil then
local ret = nil
local total = 0
local file = fname..load_cnt..'.lua'
local f = io_open(file, 'w')
if type == 1 and typ(content) == 'function' then
local func = function (...)
local ret = content(...)
if ret ~= nil then
f:write(ret)
total = total + #ret
else
f:close()
end
return ret
end
ret = orig(func, sel(2, ...))
else
f:write(content)
total = #content
f:close()
ret = orig(...)
end
echo('Hooked load '..load_cnt..' with size of '..total..' bytes saved into '..file)
load_cnt = load_cnt + 1
return ret
end
return orig(...)
end
tr[hook] = orig
_G = hook
end
msg = msg..'\n\nAll data from calls "load" will be dumped into files: '..g.last..'.load_*.lua'
end
if true then
local file = g.last..'.log'
local f = io_open(file, 'w')
f:write("-- Hook started\n")
f:close()
local names = {
setRanges = {'^REGION_'},
startFuzzy = {'^TYPE_', '0x%X', '0x%X'},
searchAddress = {nil, '0x%X', '^TYPE_', '^SIGN_[^F]', '0x%X', '0x%X'},
searchFuzzy = {nil, '^SIGN_FUZZY_', '^TYPE_', '0x%X', '0x%X'},
searchNumber = {nil, '^TYPE_', nil, '^SIGN_[^F]', '0x%X', '0x%X'},
loadList = {nil, '^LOAD_'},
saveList = {nil, '^SAVE_'},
editAll = {nil, '^TYPE_'},
copyMemory = {'0x%X', '0x%X'},
dumpMemory = {'0x%X', '0x%X'},
}
local rets = {
alert = 1,
prompt = 1,
choice = 1,
multiChoice = 1,
}
local toFlags = function (check, value)
local ret = ''
for k, v in pairs(ggg) do
if k:match(check) ~= nil and (value & v) == v then
if ret ~= '' then ret = ret..' | ' end
ret = ret..'gg.'..k
value = value & ~v
end
end
if ret == '' or value ~= 0 then
if ret ~= '' then ret = ret..' | ' end
ret = ret..value
end
return ret
end
for i, v in pairs(ggg) do
if typ(v) == 'function' and i ~= 'getFile' and i ~= 'getLine' and i ~= 'isVisible' then
local orig = v
local name = i
local hook = 1
hook = function (...)
local arg = {...}
local f = io_open(file, 'a')
f:write('gg.'..name..'(')
for j, a in ipairs(arg) do
if j ~= 1 then f:write(', ') end
if typ(a) == 'string' then f:write('"') end
local b = a
if typ(a) == 'number' and names[name] ~= nil and names[name][j] ~= nil then
local check = names[name][j]
if check:sub(1, 1) ~= '^' then
if a == 0 or a == -1 then
b = a
else
b = check:format(a)
end
else
b = toFlags(check, a)
end
end
b = str(b)
f:write(b)
if typ(a) == 'string' then f:write('"') end
end
f:write(")")
if rets[name] ~= nil then
local ret = orig(...)
f:write(" --[[ ")
f:write(str(ret))
f:write(" ]]\n")
f:close()
return ret
end
f:write("\n")
f:close()
return orig(...)
end
tr[hook] = orig gg = hook
end
end
msg = msg..'\n\nAll GG calls will be logged into file: '..g.last..'.log'
end
echo('Hook started.'..msg..'\n')
ggg.alert('Hook started. Run script, input passwords and so on.'..msg)
msg = nil
if true then
local orig = string.dump
local hook = 1
hook = function (...)
local arg = {...}
if tr[arg[1]] ~= nil then
--echo('string.dump:', tr[arg[1]], arg[1])
arg[1] = tr[arg[1]]
end
return orig(arg[1], sel(2, ...))
end
tr[hook] = orig
string.dump = hook
end
if true then
local orig = tostring
local hook = 1
hook = function (...)
local old = tostring
local arg = {...}
if tr[arg[1]] ~= nil then
--tostring = orig; echo('tostring:', tr[arg[1]], arg[1])
arg[1] = tr[arg[1]]
end
local ret = orig(arg[1], sel(2, ...))
tostring = old
return ret
end
tr[hook] = orig
tostring = hook
end
if true then
local orig = debug.getupvalue
local hook = 1
hook = function (...)
local arg = {...}
if tr[arg[1]] ~= nil then
--echo('debug.getupvalue:', tr[arg[1]], arg[1], arg[2])
arg[1] = tr[arg[1]]
end
return orig(arg[1], sel(2, ...))
end
tr[hook] = orig
debug.getupvalue = hook
end
if false then
local orig = os.remove
local hook = 1
hook = function (...)
local arg = {...}
echo('os.remove:', arg)
return true
end
tr[hook] = orig
os.remove = hook
end
if false then
local orig = assert
local hook = 1
hook = function (...)
local arg = {...}
echo('assert:', arg)
return orig(...)
end
tr[hook] = orig
assert = hook
end
if false then
local orig = io.open
local hook = 1
hook = function (...)
local arg = {...}
echo('io.open:', arg)
return orig(...)
end
tr[hook] = orig
io.open = hook
end
end
local test = g.test
g = nil
test()
end
end
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Question
NIKITAOFF
if gg.isVisible(true) then
gg.setVisible(false)
end
::Mainmenu::
gg.clearResults()
menu = gg.choice({'Weak Encryption','High Encryption','Log Script Functions','Exit'},nil,'Menu')
if menu == 1 then point1(Chikri) end
if menu == 2 then point2(Chikri) end
if menu == 3 then point3(Chikri) end
if menu == 4 then exit(Chikri) end
if menu == nil then os.exit() end
function exit(Chikri)
os.exit()
end
function point1(Chikri)
local last = gg.getFile()
info = gg.prompt({'Select script file:'}, {last}, {'file'})
if info == nil then os.exit() end
last = info[1]
local test = loadfile(info[1])
if test == nil then
gg.alert('Failed load script: '..info[1])
else
local sel = gg.choice({'Weak Encryption', 'Strong Encryption', 'Dump source'})
if sel == nil then os.exit() end
if sel == 1 or sel == 2 then
local warn = gg.alert('Scripts in binary form may not work on other versions of GameGuardian', 'Agree', 'Disagree')
if warn ~= 1 then os.exit() end
local out = last..".bin.lua"
local file = io.open(out, "w")
file:write(string.dump(test, sel == 2))
file:close()
gg.alert('The binary script is saved to the file:\n'..out)
end
function point2(Chikri)
local last = gg.getFile()
info = gg.prompt({'Select Script To Encrypt:'}, {last}, {'file'})
if info == nil then os.exit() end
last = info[1]
local enc = gg.prompt({'Set Password'},{[1]=0},{[1]='number'})
function Ecrypt(Text)
return Text:gsub('.', function (c) return string.format ("%02X", (string.byte(c) + 13 + enc[1]) % 256) end):gsub(" ", "+")
end
local out = last..".chikrienc.ua"
local file = io.open(last, 'r');
assert(file);
local data = file:read('*a');
file:close();
gg.alert('The encrypted script is saved to the file:\n'..out)
c = Ecrypt(data)
d = [==[
--Encryptor Made By Chikri
print('Script Encryptor Made By Chikri')
function encodes(key,code)
return (code:gsub('..', function (h) return string.char((tonumber(h,16)+256-13 - key + 999999*256)%256) end))
end
local v_value=gg.prompt({'Enter password:'},{[1]=0},{[1]='number'})
gg.toast('Loading……')
pcall(encodes(v_value[1],'technano'))
local data = encodes(v_value[1],'technano')
local enc = load(data)
pcall(enc)
]==]
d = string.gsub(d,'technano',c)
file = io.open(out,'w')file:write(d)file:close()
end
function point3(Chikri)
local ggg = {}
for k, v in pairs(gg) do
ggg[k] = v
end
local sel = select
local typ = type
local str = tostring
local echo = print
local io_open = io.open
local tr = {}
local msg = ''
if true then
local load_cnt = 0
local fname = g.last..'.load_'
for i, v in pairs({load=1, loadfile=0, dofile=0}) do
local orig = _G
local hook = 1
local type = v
hook = function (...)
local arg = {...}
local content = arg[1]
if type == 0 then
content = nil
local f = io_open(arg[1], "rb")
if f ~= nil then
content = f:read("*a")
f:close()
end
end
if content ~= nil then
local ret = nil
local total = 0
local file = fname..load_cnt..'.lua'
local f = io_open(file, 'w')
if type == 1 and typ(content) == 'function' then
local func = function (...)
local ret = content(...)
if ret ~= nil then
f:write(ret)
total = total + #ret
else
f:close()
end
return ret
end
ret = orig(func, sel(2, ...))
else
f:write(content)
total = #content
f:close()
ret = orig(...)
end
echo('Hooked load '..load_cnt..' with size of '..total..' bytes saved into '..file)
load_cnt = load_cnt + 1
return ret
end
return orig(...)
end
tr[hook] = orig
_G = hook
end
msg = msg..'\n\nAll data from calls "load" will be dumped into files: '..g.last..'.load_*.lua'
end
if true then
local file = g.last..'.log'
local f = io_open(file, 'w')
f:write("-- Hook started\n")
f:close()
local names = {
setRanges = {'^REGION_'},
startFuzzy = {'^TYPE_', '0x%X', '0x%X'},
searchAddress = {nil, '0x%X', '^TYPE_', '^SIGN_[^F]', '0x%X', '0x%X'},
searchFuzzy = {nil, '^SIGN_FUZZY_', '^TYPE_', '0x%X', '0x%X'},
searchNumber = {nil, '^TYPE_', nil, '^SIGN_[^F]', '0x%X', '0x%X'},
loadList = {nil, '^LOAD_'},
saveList = {nil, '^SAVE_'},
editAll = {nil, '^TYPE_'},
copyMemory = {'0x%X', '0x%X'},
dumpMemory = {'0x%X', '0x%X'},
}
local rets = {
alert = 1,
prompt = 1,
choice = 1,
multiChoice = 1,
}
local toFlags = function (check, value)
local ret = ''
for k, v in pairs(ggg) do
if k:match(check) ~= nil and (value & v) == v then
if ret ~= '' then ret = ret..' | ' end
ret = ret..'gg.'..k
value = value & ~v
end
end
if ret == '' or value ~= 0 then
if ret ~= '' then ret = ret..' | ' end
ret = ret..value
end
return ret
end
for i, v in pairs(ggg) do
if typ(v) == 'function' and i ~= 'getFile' and i ~= 'getLine' and i ~= 'isVisible' then
local orig = v
local name = i
local hook = 1
hook = function (...)
local arg = {...}
local f = io_open(file, 'a')
f:write('gg.'..name..'(')
for j, a in ipairs(arg) do
if j ~= 1 then f:write(', ') end
if typ(a) == 'string' then f:write('"') end
local b = a
if typ(a) == 'number' and names[name] ~= nil and names[name][j] ~= nil then
local check = names[name][j]
if check:sub(1, 1) ~= '^' then
if a == 0 or a == -1 then
b = a
else
b = check:format(a)
end
else
b = toFlags(check, a)
end
end
b = str(b)
f:write(b)
if typ(a) == 'string' then f:write('"') end
end
f:write(")")
if rets[name] ~= nil then
local ret = orig(...)
f:write(" --[[ ")
f:write(str(ret))
f:write(" ]]\n")
f:close()
return ret
end
f:write("\n")
f:close()
return orig(...)
end
tr[hook] = orig
gg = hook
end
end
msg = msg..'\n\nAll GG calls will be logged into file: '..g.last..'.log'
end
echo('Hook started.'..msg..'\n')
ggg.alert('Hook started. Run script, input passwords and so on.'..msg)
msg = nil
if true then
local orig = string.dump
local hook = 1
hook = function (...)
local arg = {...}
if tr[arg[1]] ~= nil then
--echo('string.dump:', tr[arg[1]], arg[1])
arg[1] = tr[arg[1]]
end
return orig(arg[1], sel(2, ...))
end
tr[hook] = orig
string.dump = hook
end
if true then
local orig = tostring
local hook = 1
hook = function (...)
local old = tostring
local arg = {...}
if tr[arg[1]] ~= nil then
--tostring = orig; echo('tostring:', tr[arg[1]], arg[1])
arg[1] = tr[arg[1]]
end
local ret = orig(arg[1], sel(2, ...))
tostring = old
return ret
end
tr[hook] = orig
tostring = hook
end
if true then
local orig = debug.getupvalue
local hook = 1
hook = function (...)
local arg = {...}
if tr[arg[1]] ~= nil then
--echo('debug.getupvalue:', tr[arg[1]], arg[1], arg[2])
arg[1] = tr[arg[1]]
end
return orig(arg[1], sel(2, ...))
end
tr[hook] = orig
debug.getupvalue = hook
end
if false then
local orig = os.remove
local hook = 1
hook = function (...)
local arg = {...}
echo('os.remove:', arg)
return true
end
tr[hook] = orig
os.remove = hook
end
if false then
local orig = assert
local hook = 1
hook = function (...)
local arg = {...}
echo('assert:', arg)
return orig(...)
end
tr[hook] = orig
assert = hook
end
if false then
local orig = io.open
local hook = 1
hook = function (...)
local arg = {...}
echo('io.open:', arg)
return orig(...)
end
tr[hook] = orig
io.open = hook
end
end
local test = g.test
g = nil
test()
end
end
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.