diff options
author | bloodstalker <thabogre@gmail.com> | 2018-04-08 06:28:07 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-04-08 06:28:07 +0000 |
commit | adc7bcd0697131e1067763e9d1b96d6ece6f1e9f (patch) | |
tree | b065ea10ccd4dbe3c91454ed588a2d81953c0426 /bruiser/lua-scripts | |
parent | added some more features, a lil bit closer to getting the nested function cal... (diff) | |
download | mutator-adc7bcd0697131e1067763e9d1b96d6ece6f1e9f.tar.gz mutator-adc7bcd0697131e1067763e9d1b96d6ece6f1e9f.zip |
added some more cli options to load.py. added a new test file for bruiser to see how it fares against bigger files.
Diffstat (limited to '')
-rw-r--r-- | bruiser/lua-scripts/asmrw.lua | 2 | ||||
-rw-r--r-- | bruiser/lua-scripts/df-demo.lua | 46 |
2 files changed, 48 insertions, 0 deletions
diff --git a/bruiser/lua-scripts/asmrw.lua b/bruiser/lua-scripts/asmrw.lua index 2f68d2b..68603fa 100644 --- a/bruiser/lua-scripts/asmrw.lua +++ b/bruiser/lua-scripts/asmrw.lua @@ -19,6 +19,8 @@ --start of asmrewriter module local asmrw = {} xobj = require("lua-scripts.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) diff --git a/bruiser/lua-scripts/df-demo.lua b/bruiser/lua-scripts/df-demo.lua new file mode 100644 index 0000000..35a6b7a --- /dev/null +++ b/bruiser/lua-scripts/df-demo.lua @@ -0,0 +1,46 @@ + +xobj = require("lua-scripts.xobj") +asmrw = require("lua-scripts.asmrw") +colors = require("ansicolors") + +df_exe = "/home/bloodstalker/df/df_44_09_linux/df_linux/libs/Dwarf_Fortress" + +function main() + local text_section = xobj.getTextSection(df_exe) +end + +function pretty_dump() + count = 0 + local text_section = xobj.getTextSection(df_exe) + io.write(colors("%{blue}".." ".."\t".."00 ".."01 ".."02 ".."03 ".."04 ".."05 ".."06 ".."07 ".."08 ".."09 ".."0A ".."0B ".."0C ".."0D ".."0E ".."0F")) + for k,v in pairs(text_section) do + if count % 16 == 0 then + print() + io.write(colors("%{blue}".."0x"..string.format("%03x",count)), "\t") + end + io.write(colors("%{green}"..string.format("%02x", v)), " ") + count = count + 1 + end + count = 0 + print() +end + +function jmp_table_test() + local text_section = xobj.getTextSection(df_exe) + 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() + io.write("lua:calling getjmptable\n") + head = getjmptable(#text_section, text_section) + + while head:inext() ~= nil do + head:dump("entry") + io.write("type:", head:type(), "\tlocation:", "0x"..string.format("%x", head:location())) + print() + head = head:inext() + end +end + +--main() +--pretty_dump() +jmp_table_test() |