From 2cd674dac75855c35373d3e6b89359f3e89b1178 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Sun, 9 Sep 2018 03:14:20 +0430 Subject: jmp_t_s now uses the new way of registering tables, the 5.3 way. bruiser is supposed to be luarocks-friendly so i wont remove the compatibility build. --- bruiser/lua-scripts/asmrw.lua | 24 ++++++++++++------------ bruiser/lua-scripts/asmtest.lua | 6 +++--- bruiser/lua-scripts/demo2.lua | 4 ++++ 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'bruiser/lua-scripts') diff --git a/bruiser/lua-scripts/asmrw.lua b/bruiser/lua-scripts/asmrw.lua index b8de4c5..07844ca 100644 --- a/bruiser/lua-scripts/asmrw.lua +++ b/bruiser/lua-scripts/asmrw.lua @@ -22,14 +22,14 @@ xobj = require("xobj") -- this will hold a copy of the original text section local text_buffer = {} -setmetatable(jmp_s_t, {__call = - function(self, arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) - local t = self.new(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) - print("created", t) - return t - end - } -) +--setmetatable(jmp_s_t, {__call = + --function(self, arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) + --local t = self.new(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) + --print("created", t) + --return t + --end + --} +--) function asmrw.strings(exe) io.write(colors("%{cyan}".."lua:getting text section...\n")) @@ -48,10 +48,10 @@ end function asmrw.strings_deep(exe) end -function jmp_s_t:dump(msg) - print(msg, self:custom()) - return self -end +--function jmp_s_t:dump(msg) + --print(msg, self:custom()) + --return self +--end function asmrw.get_head(elf_exe) local text_section = xobj.getTextSection(elf_exe) diff --git a/bruiser/lua-scripts/asmtest.lua b/bruiser/lua-scripts/asmtest.lua index d7c0583..f5809d8 100644 --- a/bruiser/lua-scripts/asmtest.lua +++ b/bruiser/lua-scripts/asmtest.lua @@ -5,13 +5,13 @@ asmrw = require("asmrw") function test() local elf_exe = "../bfd/test/test" local text_section = xobj.getTextSection(elf_exe) - local head = jmp_s_t() + -- local head = jmp_s_t() -- messes up the stack. I could fix it but not sure why i would want to keep this in --local head2 = jmp_s_t:new() - head = getjmptable(#text_section, text_section) + local head = getjmptable(#text_section, text_section) while head:inext() ~= nil do - head:dump("entry") + --head:dump("entry") io.write("type:", head:type(), "\tlocation:", "0x"..string.format("%x", head:location())) print() head = head:inext() diff --git a/bruiser/lua-scripts/demo2.lua b/bruiser/lua-scripts/demo2.lua index 73a177c..4a1730e 100644 --- a/bruiser/lua-scripts/demo2.lua +++ b/bruiser/lua-scripts/demo2.lua @@ -52,16 +52,20 @@ function test() print(dummy) end +--[[ setmetatable(jmp_s_t, {__call = function(self, arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) local t = self.new(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) print("created", t) return t end}) +]]-- +--[[ function jmp_s_t:show(msg) print(msg, self, self:custom()) return self end +]]-- function jmp_t_test() local t = jmp_s_t.new(1,2,3,nil,nil,nil,7,8,9,0,0,1) -- cgit v1.2.3