aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-06-24 06:16:22 +0000
committerbloodstalker <thabogre@gmail.com>2018-06-24 06:16:22 +0000
commit045e4e775c5d0ee2e7fd489cc3c236861fa5f004 (patch)
tree17a24b4f1d29e48f7c5b6db28927700d4e3bf186 /bruiser/lua-scripts
parentfixes #43. the auto-gen source files by luatablegen dont look like source fil... (diff)
downloadmutator-045e4e775c5d0ee2e7fd489cc3c236861fa5f004.tar.gz
mutator-045e4e775c5d0ee2e7fd489cc3c236861fa5f004.zip
fixes 42, fixes 44
Diffstat (limited to 'bruiser/lua-scripts')
-rw-r--r--bruiser/lua-scripts/demo1.lua30
-rw-r--r--bruiser/lua-scripts/demo3.lua13
-rw-r--r--bruiser/lua-scripts/regtest.lua12
-rw-r--r--bruiser/lua-scripts/wasm.lua1
-rw-r--r--bruiser/lua-scripts/xobj.lua34
5 files changed, 57 insertions, 33 deletions
diff --git a/bruiser/lua-scripts/demo1.lua b/bruiser/lua-scripts/demo1.lua
index c0ee9fd..c349c36 100644
--- a/bruiser/lua-scripts/demo1.lua
+++ b/bruiser/lua-scripts/demo1.lua
@@ -20,8 +20,8 @@ elf_file = "/home/bloodstalker/devi/hell2/bfd/test/test.so"
function Demo1.getGlobalTable()
local return_table = {}
- local names = objload("elf_get_obj_names", elf_file, "symbol_list")
- local sizes = objload("elf_get_obj_sizes", elf_file, "bytes")
+ local names = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
+ local sizes = objload("load", "elf_get_obj_sizes", elf_file, "bytes")
for i=1,#names,1 do
return_table[names[i]] = sizes[i]
end
@@ -29,28 +29,28 @@ function Demo1.getGlobalTable()
end
function Demo1.printObjNames()
- local c = objload("elf_get_obj_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function Demo1.printObjSizes()
- local c = objload("elf_get_obj_sizes", elf_file, "bytes")
+ local c = objload("load", "elf_get_obj_sizes", elf_file, "bytes")
for k,v in ipairs(c) do
print(k,v)
end
end
function Demo1.printFuncNames()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function Demo1.printFuncCode()
- local c = objload("elf_get_func_code", elf_file, "code_list")
+ local c = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(c) do
print(k,v)
if #v ~= 0 then
@@ -63,7 +63,7 @@ function Demo1.printFuncCode()
end
function Demo1.findMain()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
if v == "main" then
io.write("main index is".." "..k.."\n")
@@ -74,8 +74,8 @@ end
function Demo1.codeTables()
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for i=1,#func_name_table,1 do
return_table[func_name_table[i]] = code_table[i]
end
@@ -84,8 +84,8 @@ end
function Demo1.codeTableByName(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -99,8 +99,8 @@ end
function Demo1.codeTableByName_number(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -113,8 +113,8 @@ function Demo1.codeTableByName_number(name)
end
function Demo1.printFuncSizes()
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
local counter = 1
print("function sizes:")
for k, v in ipairs(code_table) do
diff --git a/bruiser/lua-scripts/demo3.lua b/bruiser/lua-scripts/demo3.lua
new file mode 100644
index 0000000..89dde81
--- /dev/null
+++ b/bruiser/lua-scripts/demo3.lua
@@ -0,0 +1,13 @@
+
+local demo3 = {}
+
+function demo3.init()
+ local wasm = require("wasm")
+ local wasm_file = "../wasm/test/injected.wasm"
+ local wasm_module = Wasm_Module()
+ local table_type = table_type_t()
+ local resizable_limit = resizable_limit_t()
+ table_type:set_resizable_limit(resizable_limit)
+end
+
+return demo3
diff --git a/bruiser/lua-scripts/regtest.lua b/bruiser/lua-scripts/regtest.lua
new file mode 100644
index 0000000..f7ec461
--- /dev/null
+++ b/bruiser/lua-scripts/regtest.lua
@@ -0,0 +1,12 @@
+
+-- luarocks install luaposix
+--local posix = require("posix")
+
+function reg_test()
+ local demo1 = require("demo1")
+ local demo2 = require("demo2")
+ local demo3 = require("asmtest")
+ print("yo")
+end
+
+reg_test()
diff --git a/bruiser/lua-scripts/wasm.lua b/bruiser/lua-scripts/wasm.lua
index 3c94960..88588a6 100644
--- a/bruiser/lua-scripts/wasm.lua
+++ b/bruiser/lua-scripts/wasm.lua
@@ -20,7 +20,6 @@ setmetatable(resizable_limit_t, {__call =
setmetatable(global_type_t, {__call =
function(self, arg0, arg1)
local t = self.new(arg0, arg1)
- print("created",t)
return t
end
}
diff --git a/bruiser/lua-scripts/xobj.lua b/bruiser/lua-scripts/xobj.lua
index 08a2945..a4f7a8d 100644
--- a/bruiser/lua-scripts/xobj.lua
+++ b/bruiser/lua-scripts/xobj.lua
@@ -26,8 +26,8 @@ end
function xobj.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 names = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
+ local sizes = objload("load", "elf_get_obj_sizes", elf_file, "symbol_list")
for i=1,#names,1 do
return_table[names[i]] = sizes[i]
end
@@ -35,28 +35,28 @@ function xobj.getGlobalTable()
end
function xobj.printObjNames()
- local c = objload("elf_get_obj_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function xobj.printObjSizes()
- local c = objload("elf_get_obj_sizes", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_obj_sizes", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function xobj.printFuncNames()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function xobj.printFuncCode()
- local c = objload("elf_get_func_code", elf_file, "code_list")
+ local c = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(c) do
print(k,v)
if #v ~= 0 then
@@ -69,7 +69,7 @@ function xobj.printFuncCode()
end
function xobj.findMain()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
if v == "'main'" then
io.write("main index is".." "..k.."\n")
@@ -80,8 +80,8 @@ end
function xobj.codeTables()
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for i=1,#func_name_table,1 do
return_table[func_name_table[i]] = code_table[i]
end
@@ -90,8 +90,8 @@ end
function xobj.codeTableByName(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -105,8 +105,8 @@ end
function xobj.codeTableByName_number(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -119,8 +119,8 @@ function xobj.codeTableByName_number(name)
end
function xobj.printFuncSizes()
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
local counter = 1
print("function sizes:")
for k, v in ipairs(code_table) do
@@ -130,11 +130,11 @@ function xobj.printFuncSizes()
end
function xobj.getTextSection(elf_exe)
- return objload("elf_get_text_section", elf_exe, "bytes")
+ return objload("load", "elf_get_text_section", elf_exe, "bytes")
end
function xobj.getRODataSection(elf_exe)
- return objload("elf_get_rodata_section", elf_exe, "bytes")
+ return objload("load", "elf_get_rodata_section", elf_exe, "bytes")
end
function xobj.CSDump(code)