aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'bruiser/lua-scripts')
-rw-r--r--bruiser/lua-scripts/asmrw.lua21
-rw-r--r--bruiser/lua-scripts/demo2.lua2
-rw-r--r--bruiser/lua-scripts/df-demo.lua45
-rw-r--r--bruiser/lua-scripts/xobj.lua2
4 files changed, 25 insertions, 45 deletions
diff --git a/bruiser/lua-scripts/asmrw.lua b/bruiser/lua-scripts/asmrw.lua
index 68603fa..b8de4c5 100644
--- a/bruiser/lua-scripts/asmrw.lua
+++ b/bruiser/lua-scripts/asmrw.lua
@@ -4,7 +4,7 @@
--This program is free software; you can redistribute it and/or
--modify it under the terms of the GNU General Public License
---as published by the Free Software Foundation; either version 2
+--as published by the Free Software Foundation; either version 3
--of the License, or (at your option) any later version.
--This program is distributed in the hope that it will be useful,
@@ -18,7 +18,7 @@
--------------------------------------------------------------------------------------------------------------
--start of asmrewriter module
local asmrw = {}
-xobj = require("lua-scripts.xobj")
+xobj = require("xobj")
-- this will hold a copy of the original text section
local text_buffer = {}
@@ -31,6 +31,23 @@ setmetatable(jmp_s_t, {__call =
}
)
+function asmrw.strings(exe)
+ io.write(colors("%{cyan}".."lua:getting text section...\n"))
+ local text_section = xobj.getTextSection(exe)
+ local rodata = xobj.getRODataSection(exe)
+ for k,v in pairs(rodata) do
+ if v > 33 and v < 127 then
+ io.write(string.format("%c",v))
+ else
+ io.write(" ")
+ end
+ end
+ io.write("\0\n")
+end
+
+function asmrw.strings_deep(exe)
+end
+
function jmp_s_t:dump(msg)
print(msg, self:custom())
return self
diff --git a/bruiser/lua-scripts/demo2.lua b/bruiser/lua-scripts/demo2.lua
index bd2eb91..a5cf1af 100644
--- a/bruiser/lua-scripts/demo2.lua
+++ b/bruiser/lua-scripts/demo2.lua
@@ -1,5 +1,5 @@
-xobj = require("lua-scripts.xobj")
+xobj = require("xobj")
colors = require("ansicolors")
elf_file = "../bfd/test/test.so"
elf_exe = "../bfd/test/test"
diff --git a/bruiser/lua-scripts/df-demo.lua b/bruiser/lua-scripts/df-demo.lua
index 7db2f85..916db00 100644
--- a/bruiser/lua-scripts/df-demo.lua
+++ b/bruiser/lua-scripts/df-demo.lua
@@ -1,59 +1,22 @@
-xobj = require("lua-scripts.xobj")
-asmrw = require("lua-scripts.asmrw")
+xobj = require("xobj")
+asmrw = require("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()
io.write(colors("%{cyan}".."lua:getting text section...\n"))
local text_section = xobj.getTextSection(df_exe)
local rodata = xobj.getRODataSection(df_exe)
for k,v in pairs(rodata) do
- if v > 32 and v < 127 then
+ if v > 33 and v < 127 then
io.write(string.format("%c",v))
else
io.write(" ")
end
end
io.write("\0\n")
- io.write(colors("%{green}".."lua:got text section.\n"))
- 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(colors("%{cyan}".."lua:calling getjmptable\n"))
- --head = getjmptable(#text_section, text_section)
-
- --if false then
- --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
end
---main()
---pretty_dump()
-jmp_table_test()
+asmrw.strings(df_exe)
diff --git a/bruiser/lua-scripts/xobj.lua b/bruiser/lua-scripts/xobj.lua
index 1d1f748..08a2945 100644
--- a/bruiser/lua-scripts/xobj.lua
+++ b/bruiser/lua-scripts/xobj.lua
@@ -4,7 +4,7 @@
--This program is free software; you can redistribute it and/or
--modify it under the terms of the GNU General Public License
---as published by the Free Software Foundation; either version 2
+--as published by the Free Software Foundation; either version 3
--of the License, or (at your option) any later version.
--This program is distributed in the hope that it will be useful,