diff options
Diffstat (limited to '')
-rw-r--r-- | bruiser/lua-scripts/demo2.lua | 30 | ||||
-rw-r--r-- | bruiser/lua-scripts/xobj.lua | 8 |
2 files changed, 36 insertions, 2 deletions
diff --git a/bruiser/lua-scripts/demo2.lua b/bruiser/lua-scripts/demo2.lua index 3b6007a..c8de8aa 100644 --- a/bruiser/lua-scripts/demo2.lua +++ b/bruiser/lua-scripts/demo2.lua @@ -25,11 +25,37 @@ function main() xobjregister(passthrough_code, "passthrough") end +function pretty_dump() + count = 0 + local text_section = xobj.getTextSection() + 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 test() + local text_section = xobj.getTextSection() + dummy = xobj.CSDump(text_section) + print(dummy) +end + function asm_rewriter() local text_section = xobj.getTextSection() - for k,v in pairs(text_section) do io.write(colors("%{blue}"..string.format("%02x",k)),":",colors("%{green}"..string.format("%02x",v)),"\t") end - io.write("\n") + local head = getjmptable(#text_section, text_section) + print("head value is",head) + dumpjmptable(head) + freejmptable(haed) end --main() +--pretty_dump() +--test() asm_rewriter() diff --git a/bruiser/lua-scripts/xobj.lua b/bruiser/lua-scripts/xobj.lua index 880730a..81d0bc0 100644 --- a/bruiser/lua-scripts/xobj.lua +++ b/bruiser/lua-scripts/xobj.lua @@ -133,6 +133,14 @@ function xobj.getTextSection() return objload("elf_get_text_section", elf_exe, "bytes") end +function xobj.CSDump(code) + ret = "" + for k,v in pairs(code) do + ret = ret.."\\x"..string.format("%02x",v) + end + return ret +end + --end of xobj module return xobj -------------------------------------------------------------------------------------------------------------- |