Skip to content

Commit

Permalink
adding disassembly to yarascan output
Browse files Browse the repository at this point in the history
  • Loading branch information
gleeda committed Sep 28, 2018
1 parent 8a170a9 commit 258e658
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions volatility/memtriage.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,16 @@ def getinfos(data, items = []):
return datas

def parse_yarascan_data(data, out, output = "text"):
import volatility.plugins.malware.malfind as malfind
import volatility.utils as utils
datas = getinfos(data, plugin_cols["yarascan"]["cols"])
if output == "json":
out.write("{}\n\n".format(datas))
return
elif output == "text":
mode = "32bit"
if platform.machine() == "AMD64":
mode = "64bit"
for rule, owner, addr, content in datas:
out.write("Rule: {0}\n".format(rule))
if owner == None:
Expand All @@ -263,6 +267,11 @@ def parse_yarascan_data(data, out, output = "text"):
["{0:#010x} {1:<48} {2}\n".format(addr, h, ''.join(c))
for offset, h, c in utils.Hexdump(content.decode("hex"))
]))
out.write("\n\nDisassembly:\n")
out.write("\n".join(
["{0:#x} {1:<16} {2}".format(o, h, i)
for o, i, h in malfind.Disassemble(content.decode("hex"), int(addr), mode)
]))
else:
for rule, owner, addr, content in datas:
out.write("{0},{1},{2}\n".format(rule, owner, addr, content))
Expand Down

0 comments on commit 258e658

Please sign in to comment.