def create_diff_report(file1, file2, file_name, from_desc, to_desc, is_64_bit):
""" Create a report showing the differences between two files
Arguments :
file1 : path to a file to disassemble
file2 : path to a file to disassemble
report_name : The name to use for the report
from_desc : A description of the 'from' element
to_desc : A description of the 'to' element
"""
# Disassemble each file and split into lines
disassembled_1 = OPcacheDisassembler(is_64_bit).disassemble(file1).split("\n")
disassembled_2 = OPcacheDisassembler(is_64_bit).disassemble(file2).split("\n")
# Differ
html_differ = difflib.HtmlDiff()
# Generate the report and write into a file
file_name = file_name.replace("/", "%2f") + '.html'
hash_name = hashlib.sha1(file_name).hexdigest()
with open(hunt_report + "/" + hash_name + ".html", "w") as f:
content = html_differ.make_file(disassembled_1, disassembled_2, from_desc, to_desc)
f.write(content)
# Return the name of the report
return (file_name, hash_name + ".html")
opcache_malware_hunt.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录