当前位置: 首页>>代码示例>>Python>>正文


Python TypeConvertor.bool2str方法代码示例

本文整理汇总了Python中netzob.Common.Type.TypeConvertor.TypeConvertor.bool2str方法的典型用法代码示例。如果您正苦于以下问题:Python TypeConvertor.bool2str方法的具体用法?Python TypeConvertor.bool2str怎么用?Python TypeConvertor.bool2str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在netzob.Common.Type.TypeConvertor.TypeConvertor的用法示例。


在下文中一共展示了TypeConvertor.bool2str方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addPropertiesToElement

# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import bool2str [as 别名]
 def addPropertiesToElement(xmlMessage, message, namespace):
     # direction
     subDirection = etree.SubElement(xmlMessage, "{" + namespace + "}direction")
     subDirection.text = message.getDirection()
     # major
     subMajor = etree.SubElement(xmlMessage, "{" + namespace + "}major")
     subMajor.text = message.getMajor()
     # minor
     subMinor = etree.SubElement(xmlMessage, "{" + namespace + "}minor")
     subMinor.text = str(message.getMinor())
     # requestMode
     subRequestMode = etree.SubElement(xmlMessage, "{" + namespace + "}requestMode")
     subRequestMode.text = message.getRequestMode()
     # pid
     subPid = etree.SubElement(xmlMessage, "{" + namespace + "}pid")
     subPid.text = str(message.getPID())
     # status
     subStatus = etree.SubElement(xmlMessage, "{" + namespace + "}status")
     subStatus.text = str(message.getStatus())
     # information
     subInformation = etree.SubElement(xmlMessage, "{" + namespace + "}information")
     subInformation.text = str(message.getInformation())
     # cancel
     subCancel = etree.SubElement(xmlMessage, "{" + namespace + "}cancel")
     subCancel.text = TypeConvertor.bool2str(message.getCancel())
     # sizeIn
     subSizeIn = etree.SubElement(xmlMessage, "{" + namespace + "}sizeIn")
     subSizeIn.text = str(message.getSizeIn())
     # sizeOut
     subSizeOut = etree.SubElement(xmlMessage, "{" + namespace + "}sizeOut")
     subSizeOut.text = str(message.getSizeOut())
开发者ID:sangyf,项目名称:netzob,代码行数:33,代码来源:IRPMessageFactory.py

示例2: save

# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import bool2str [as 别名]
 def save(self, root, namespace):
     """Save in the XML tree the actor definition"""
     xmlActor = etree.SubElement(root, "{" + namespace + "}actor")
     xmlActor.set('id', str(self.getID()))
     xmlActor.set('name', str(self.getName()))
     xmlActor.set('initiator', TypeConvertor.bool2str(self.isInitiator()))
     self.abstractionLayer.save(xmlActor, namespace)
开发者ID:EnjoyHacking,项目名称:netzob,代码行数:9,代码来源:MMSTDVisitor.py

示例3: save

# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import bool2str [as 别名]
    def save(message, xmlMessages, namespace_project, namespace):
        root = etree.SubElement(xmlMessages, "{" + namespace + "}message")
        root.set("id", str(message.getID()))
        root.set("timestamp", str(message.getTimestamp()))
        root.set("{http://www.w3.org/2001/XMLSchema-instance}type", "netzob-common:IRPDeviceIoControlMessage")
        # data
        subData = etree.SubElement(root, "{" + namespace + "}data")
        subData.text = str(message.getData())
        # direction
        subDirection = etree.SubElement(root, "{" + namespace + "}direction")
        subDirection.text = message.getDirection()
        # major
        subMajor = etree.SubElement(root, "{" + namespace + "}major")
        subMajor.text = message.getMajor()
        # minor
        subMinor = etree.SubElement(root, "{" + namespace + "}minor")
        subMinor.text = str(message.getMinor())
        # requestMode
        subRequestMode = etree.SubElement(root, "{" + namespace + "}requestMode")
        subRequestMode.text = message.getRequestMode()
        # pid
        subPid = etree.SubElement(root, "{" + namespace + "}pid")
        subPid.text = str(message.getPID())
        # status
        subStatus = etree.SubElement(root, "{" + namespace + "}status")
        subStatus.text = str(message.getStatus())
        # information
        subInformation = etree.SubElement(root, "{" + namespace + "}information")
        subInformation.text = str(message.getInformation())
        # cancel
        subCancel = etree.SubElement(root, "{" + namespace + "}cancel")
        subCancel.text = TypeConvertor.bool2str(message.getCancel())
        # sizeIn
        subSizeIn = etree.SubElement(root, "{" + namespace + "}sizeIn")
        subSizeIn.text = str(message.getSizeIn())
        # sizeOut
        subSizeOut = etree.SubElement(root, "{" + namespace + "}sizeOut")
        subSizeOut.text = str(message.getSizeOut())
        # ioctl
        subIoctl = etree.SubElement(root, "{" + namespace + "}ioctl")
        subIoctl.text = str(message.getIOCTL())

        #pattern
        subPattern = etree.SubElement(root, "{" + namespace + "}pattern")
        subsubDirection = etree.SubElement(subPattern, "{" + namespace + "}direction")
        subsubDirection.text = str(message.getPattern()[0])
        for t in message.getPattern()[1]:
            subsubToken = etree.SubElement(subPattern, "{" + namespace + "}token")
            subsubToken.set("format", t.getFormat())
            subsubToken.set("length", str(t.getLength()))
            subsubToken.set("type", t.getType())
            subsubToken.set("value", t.getValue().encode("base-64"))

        return etree.tostring(root)
开发者ID:KurSh,项目名称:netzob,代码行数:56,代码来源:IRPDeviceIoControlMessageFactory.py


注:本文中的netzob.Common.Type.TypeConvertor.TypeConvertor.bool2str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。