aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts/demo2.lua
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-03-04 14:33:19 +0000
committerbloodstalker <thabogre@gmail.com>2018-03-04 14:33:19 +0000
commitb85751a9544860eb711e722ca2f07efc034369e1 (patch)
tree6d64b2c55f40923655e87c36726e1602a82fb522 /bruiser/lua-scripts/demo2.lua
parentthe skeletion code for the jump table struct is now working (diff)
downloadmutator-b85751a9544860eb711e722ca2f07efc034369e1.tar.gz
mutator-b85751a9544860eb711e722ca2f07efc034369e1.zip
wip-the lua syntax is not what i want to be yet and im having trouble with the JMP_S_T pointers
Diffstat (limited to '')
-rw-r--r--bruiser/lua-scripts/demo2.lua42
1 files changed, 39 insertions, 3 deletions
diff --git a/bruiser/lua-scripts/demo2.lua b/bruiser/lua-scripts/demo2.lua
index 03d6089..fc50cc1 100644
--- a/bruiser/lua-scripts/demo2.lua
+++ b/bruiser/lua-scripts/demo2.lua
@@ -55,13 +55,49 @@ function asm_rewriter()
freejmptable(haed)
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()
- for k,v in pairs(jmp_s_t) do print(k,v) end
- local t = jmp_s_t.new()
+ local t = jmp_s_t.new(1,2,3,nil,nil,nil,7,8,9,0,0,1)
+ t:show("t is")
+ local t_next = jmp_s_t.new()
+ local t_next_y = jmp_s_t.new()
+ local t_next_n = jmp_s_t.new()
+ t:set_next(t_next)
+ t:set_next_y(t_next_y)
+ t:set_next_n(t_next_n)
+ t:show("t is")
+ tt = jmp_s_t()
+ tt:show("tt is")
+ --collectgarbage()
+ --t:show("t is")
+end
+
+function integ_test()
+ local text_section = xobj.getTextSection()
+ local head = jmp_s_t.new()
+ head = getjmptable(#text_section, text_section)
+ head:show("XXXXXhead is")
+ print(head:location())
+ --while head:next() ~= nil do
+ for i=1,11,1 do
+ head = head:next()
+ head:show("next is")
+ end
end
--main()
--pretty_dump()
--test()
--asm_rewriter()
-jmp_t_test()
+--jmp_t_test()
+integ_test()