peba.py 文件源码

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

项目:PEBA 作者: dtag-dev-sec 项目源码 文件源码
def formatAlertsCount(numberofalerts, outformat):
    """ Create XML / Json Structure with number of Alerts in requested timespan """

    if outformat == "xml":
        ewssimpleinfo = ET.Element('EWSSimpleIPInfo')
        alertCount = ET.SubElement(ewssimpleinfo, 'AlertCount')
        if numberofalerts:
            alertCount.text = str(numberofalerts)
        else:
            alertCount.text = str(0)
        prettify(ewssimpleinfo)
        alertcountxml = '<?xml version="1.0" encoding="UTF-8"?>'
        alertcountxml += (ET.tostring(ewssimpleinfo, encoding="utf-8", method="xml")).decode('utf-8')
        return alertcountxml
    else:
        return ({'AlertCount': numberofalerts})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号