aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts/demo1.lua
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-05-18 23:35:03 +0000
committerbloodstalker <thabogre@gmail.com>2018-05-18 23:35:03 +0000
commit5de630461628e95a7460f16574242f897f874a94 (patch)
treee259b4ea6d6b0421fe605ffece4d98aa5baa8ccb /bruiser/lua-scripts/demo1.lua
parentcontribution guidelines (diff)
downloadmutator-5de630461628e95a7460f16574242f897f874a94.tar.gz
mutator-5de630461628e95a7460f16574242f897f874a94.zip
fixes #33. fixed #34. python interpreter should clean up after itself properly so maybe #32 is also sovled but i need more time to know. the stack usage for lua has been reduced so larger number of xobjs are fine now. general cleanup for executioner and bruiser. added a note regarding running obfuscators test. lua no longer needs libreadline to build. bfds test no longer needs libbfd to build.
Diffstat (limited to 'bruiser/lua-scripts/demo1.lua')
-rw-r--r--bruiser/lua-scripts/demo1.lua28
1 files changed, 21 insertions, 7 deletions
diff --git a/bruiser/lua-scripts/demo1.lua b/bruiser/lua-scripts/demo1.lua
index efbc7c5..6f02860 100644
--- a/bruiser/lua-scripts/demo1.lua
+++ b/bruiser/lua-scripts/demo1.lua
@@ -12,14 +12,14 @@
-- objload("elf_get_func_code", "../bfd/test/test.so", "code_list")
--
--------------------------------------------------------------------------------------------------------------
-elf_file = "../bfd/test/test.so"
+elf_file = "/home/bloodstalker/devi/hell2/bfd/test/test.so"
--elf_file = "/home/bloodstalker/devi/hell2/bfd/test/test.so"
--elf_file = "../bfd/test/test"
function getGlobalTable()
local return_table = {}
local names = objload("elf_get_obj_names", elf_file, "symbol_list")
- local sizes = objload("elf_get_obj_sizes", elf_file, "symbol_list")
+ local sizes = objload("elf_get_obj_sizes", elf_file, "bytes")
for i=1,#names,1 do
return_table[names[i]] = sizes[i]
end
@@ -34,7 +34,7 @@ function printObjNames()
end
function printObjSizes()
- local c = objload("elf_get_obj_sizes", elf_file, "symbol_list")
+ local c = objload("elf_get_obj_sizes", elf_file, "bytes")
for k,v in ipairs(c) do
print(k,v)
end
@@ -63,7 +63,7 @@ end
function findMain()
local c = objload("elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
- if v == "'main'" then
+ if v == "main" then
io.write("main index is".." "..k.."\n")
return k
end
@@ -135,8 +135,7 @@ function main()
io.write(string.format('%02x', v), " ")
end
io.write("\n")
-
- local C_main_code = codeTableByName("'main'")
+local C_main_code = codeTableByName("'main'")
for k, v in ipairs(C_main_code) do
io.write(v, " ")
end
@@ -152,6 +151,14 @@ function main()
printFuncSizes()
+ print("passthrough_code: ")
+ for k,v in pairs(passthrough_code) do
+ io.write(v," ")
+ end
+ io.write("\n")
+
+
+ print("xsize = "..xsize())
xobjregister(add2_code, "add2")
xobjregister(sub2_code, "sub2")
xobjregister(adddouble_code, "adddouble")
@@ -159,6 +166,12 @@ function main()
xobjregister(triple_code, "triple")
xobjregister(quad_code, "quad")
xobjregister(passthrough_code, "passthrough")
+ print("xsize = "..xsize())
+
+ local x_list = xobjlist()
+ for k,v in pairs(x_list) do
+ print(k,v)
+ end
a=xcall(2,{"uint32","uint32"},"uint32",0, {30,20})
print("call add result", a)
@@ -167,7 +180,7 @@ function main()
arg1 = 100
arg2 = 200
- a=xcall(2,{"sint32", "sint32"},"sint32",1, {arg1,arg2})
+ a=xcall(2,{"sint32", "sint32"},"sint32","sub2", {arg1,arg2})
print("xcall returned:",a)
if a ~= -100 then print("test failed") end
@@ -188,6 +201,7 @@ function main()
print("xcall returned:",a)
if (a ~= "i live!") then print("test failed"); os.exit(1) end
+ -- nested call
--a=xcall(4,{"sint32", "sint32", "sint32", "sint32"},"sint32",5, {10,20,30,40})
--print("xcall returned:",a)
--if a ~= 100 then print("test failed") end