python类escape()的实例源码

docker_module_example.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def html_report(content):
        html = "<div>"
        for item in content:
            if item.name == "key1":
                html += "Key1 : {}".format(escape(item.content))
            else:
                # Error
                pass
        html += "</div>"
        return html
module_example.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def html_report(content):
        html = "<div>"
        for item in content:
            if item.name == "name1":
                html += "Name1 : {}".format(escape(item.content))
            else:
                # Error
                pass
        html += "</div>"
        return html
html_reporter.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _make_menu_malware(m, level=0, actif=""):
        html = ""
        tab = ""
        if level:
            tab = level * 4 * "&nbsp;" + level * "-" + "&nbsp;"

        html += "<li id=\"menu_malware_{}\" class=\"menu_malware {}\"><a href=\"#\" onclick=\"show_malware({})\">{}{}</a></li>".format(str(m.uid), actif, str(m.uid), tab, escape(m.name))
        if len(m.extract_malware):
            html += "<ul class=\"nav nav-list\">"
            for m_e in m.extract_malware:
                html += HtmlReporter._make_menu_malware(m_e, level+1)
            html += "</ul>"
        return html
        html += "{}".format([me.name for me in m.extract_malware])
html_reporter.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _make_module_menu(malware):
        html = ""
        html += "<div>"
        html += "<ul class=\"nav nav-pills modules-pills\">"
        for i, m in enumerate(malware.module_status):
            module_class = Module.get_module_by_name(m.module_cls_name)
            module_name = module_class.module_name()
            active = ""
            if i is 0:
                active = "active"
            html += "<li id=\"menu_module_malware_{}_{}\" class=\"menu_module_malware menu_module_malware_{} {}\"><a href=\"#\" onclick=\"show_module_malware({},{})\">{}</a></li>".format(str(malware.uid),str(m.id),str(malware.uid),active,str(malware.uid),str(m.id),escape(module_name))
        html += "</ul>"
        html += "</div>"
        return html
html_reporter.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _make_indicator_report(module_cls_name, indicators):
        module_class = Module.get_module_by_name(module_cls_name)
        html_report_fct = getattr(module_class, "html_report", None)
        html = ""
        if callable(html_report_fct):
            html += html_report_fct(indicators)
        else:
            for indic in indicators:
                html += "<div><b>{} ({}): </b>{}<br/></div>".format(escape(indic.name),
                                                                    indic.score,
                                                                    escape(indic.content))
        return html
jsbeautifier_docker.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def html_report(content):
        html = "<div>"
        for item in content:
            if item.name == "code":
                html += "<label class=\"label label-info\">Code</label> <pre>{}</pre>".format(escape(base64.b64decode(item.content).decode('utf-8')))
            elif item.name == "error":
                html += "<label class=\"label label-inverse\">Error</label> <pre>{}</pre>".format(escape(base64.b64decode(item.content).decode('utf-8')))
            else:
                html += "LAMA PARSE ERROR"
        html += "</div>"
        return html
cuckoo_html.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _category_make_html(content):
        """
        Create part with categorie
        """
        html = "<div>"
        html += "<b>Category : </b>{}".format(escape(content))
        html += "</div>"
        return html
cuckoo_html.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _buff_yara_make_html(content):
        """
        Create part with YARA results
        """
        decode_content = json.loads(content)
        html = "<div>"
        for cont in decode_content:
            html += (
                    "<label class=\"label label-info\">{}</label> : strings {}"
                    ).format(escape(cont['name']),
                             escape(", ".join(cont['strings'])))
            html += "<br/>{}".format(cont['meta']['description'])
        html += "</div>"
        return html
oletools_extract.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
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
unpack.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def html_report(content):
        html = "<div>"
        for item in content:
            if item.name == "error":
                html += "<b>Error : </b>{}".format(escape(item.content))
            else:
                html += "LAMA PARSE ERROR"
        html += "</div>"
        return html
oletools_mraptor.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def html_report(content):
        html = "<div>"

        for item in content:
            if item.name == "out":
                out = base64.b64decode(item.content)
                html += "<label class=\"label label-info\">out</label><pre>{}</pre>".format(escape(out.decode("utf-8")))

            if item.name == "returncode":
                html += "<label class=\"label label-info\">Return code : {}</label><br/>".format(escape(item.content))

        html += "</div>"
        return html
ffdec.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def html_report(content):
        html = ""
        html_tar = ""
        html_err = ""
        for item in content:
            if item.name == "script":
                json_decode = json.loads(item.content)
                html += "<label class=\"label\">Script</label> {} <pre>{}</pre>".format(escape(json_decode['filename']), escape(base64.b64decode(json_decode['code']).decode('utf-8')))
            elif item.name == "tar":
                archive_name = os.path.basename(item.content)
                html_tar += "<label class=\"label\">Exctact files : </label> <a href=\"/file?path={}\">{}</a><br />".format(item.content, archive_name)
            else:
                html_err += "LAMA PARSE ERROR"
        html = "<div>{}{}{}</div>".format(html_tar, html, html_err)
        return html
cuckoo_html.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _category_make_html(content):
        """
        Create part with categorie
        """
        html = "<div>"
        html += "<b>Category : </b>{}".format(escape(content))
        html += "</div>"
        return html
cuckoo_html.py 文件源码 项目:lama 作者: CSE-POST 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _buff_yara_make_html(content):
        """
        Create part with YARA results
        """
        decode_content = json.loads(content)
        html = "<div>"
        for cont in decode_content:
            html += (
                    "<label class=\"label label-info\">{}</label> : strings {}"
                    ).format(escape(cont['name']),
                             escape(", ".join(cont['strings'])))
            html += "<br/>{}".format(cont['meta']['description'])
        html += "</div>"
        return html
html_renderer.py 文件源码 项目:mistletoe 作者: miyuchina 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def render_raw_text(token):
        return html.escape(token.content)
util.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def htmlUnknown(x):
    return '<code>'+html.escape(saferepr(x))+'</code>'
util.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def htmlInst(i):
    if hasattr(i, "__html__"):
        s = i.__html__()
    else:
        s = html.escape(saferepr(i))
    return '''<div class="instance"><span class="instanceName">%s instance @ %s</span>
              <span class="instanceRepr">%s</span></div>
              ''' % (i.__class__, hex(id(i)), s)
util.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def htmlString(s):
    return html.escape(saferepr(s))
util.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def htmlFunc(f):
    return ('<div class="function">' +
            html.escape("function %s in file %s at line %s" %
                        (f.__name__, f.func_code.co_filename,
                         f.func_code.co_firstlineno))+
            '</div>')
util.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def htmlIndent(snippetLine):
    ret = string.replace(string.replace(html.escape(string.rstrip(snippetLine)),
                                  '  ', '&nbsp;'),
                   '\t', '&nbsp; &nbsp; &nbsp; &nbsp; ')
    return ret


问题


面经


文章

微信
公众号

扫码关注公众号