oletools_extract.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:lama 作者: CSE-POST 项目源码 文件源码
def html_report(content):
        html = "<div>"

        html_type = {'important': "",
                     'warning': "",
                     'info': "",
                     'inverse': ""}
        for item in content:
            if item.name == "analysis":
                decoded_content = json.loads(item.content)
                score = item.score

                if score >= 5:
                    type_label = "important"
                elif score >= 2:
                    type_label = "warning"
                elif score > 0:
                    type_label = "info"
                else:
                    type_label = "inverse"

                html_type[type_label] += "<label class=\"label label-{}\">{}</label> -> <b>{}</b><pre>{}</pre>".format(
                    type_label,
                    escape(decoded_content["type"]),
                    escape(decoded_content["keyword"]),
                    escape(decoded_content["description"])
                )
            elif item.name == 'macros':
                decoded_content = json.loads(item.content)
                html += "<label class=\"label label-info\">Source</label> : <b>{}</b><pre>{}</pre>".format(escape(decoded_content['vba_filename']),
                                                                                                           escape(decoded_content['code']))
            else:
                html += "LAMA PARSE ERROR"

        html += html_type['important']
        html += html_type['warning']
        html += html_type['info']
        html += html_type['inverse']
        html += "</div>"
        return html
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号