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


Python Packet.guess_payload_class方法代码示例

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


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

示例1: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
    def guess_payload_class(self, payload):

        try:
            dlpdu_type = payload[0]
            return EtherCat.ETHERCAT_TYPE12_DLPDU_TYPES[dlpdu_type]

        except KeyError:
            log_runtime.error(
                '{}.guess_payload_class() - unknown or invalid '
                'DLPDU type'.format(self.__class__.__name__))
            return Packet.guess_payload_class(self, payload)

        return Packet.guess_payload_class(self, payload)
开发者ID:plorinquer,项目名称:scapy,代码行数:15,代码来源:ethercat.py

示例2: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.type == 0x02 and (0x08 <= self.subtype <= 0xF and self.subtype != 0xD):  # noqa: E501
         return Dot11QoS
     elif self.FCfield & 0x40:
         return Dot11WEP
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:netkey,项目名称:scapy,代码行数:9,代码来源:dot11.py

示例3: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.flags & 0x02:
         return ZigbeeSecurityHeader
     elif self.frametype == 0:
         return ZigbeeAppDataPayload
     elif self.frametype == 1:
         return ZigbeeNWKCommandPayload
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:lopessec,项目名称:SecBee,代码行数:11,代码来源:zigbee.py

示例4: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.frame_control & 0x02: # we have a security header
         return ZigbeeSecurityHeader
     elif self.aps_frametype == 0: # data
         return ZigbeeClusterLibrary # TODO might also be another frame
     elif self.aps_frametype == 1: # command
         return ZigbeeAppCommandPayload
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:BastilleResearch,项目名称:scapy-radio,代码行数:11,代码来源:zigbee.py

示例5: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
    def guess_payload_class(self, payload):

        start_line = payload.splitlines(True)[0]

        if self.re_request_line.match(start_line) is not None:
            return SIPRequest
        elif self.re_status_line.match(start_line) is not None:
            return SIPResponse

        return Packet.guess_payload_class(self, payload)
开发者ID:dynamicdeploy,项目名称:sirano,代码行数:12,代码来源:sip.py

示例6: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
    def guess_payload_class(self, payload):
        if len(payload) < self._min_ieo_len:
            return Packet.guess_payload_class(self, payload)

        # Look at fields of the generic ICMPExtensionObject to determine which
        # bound extension type to use.
        ieo = ICMPExtensionObject(payload)
        if ieo.len < self._min_ieo_len:
            return Packet.guess_payload_class(self, payload)

        for fval, cls in self.payload_guess:
            ok = 1
            for k, v in fval.iteritems():
                if not hasattr(ieo, k) or v != ieo.getfieldval(k):
                    ok = 0
                    break
            if ok:
                return cls
        return ICMPExtensionObject
开发者ID:Osso,项目名称:scapy,代码行数:21,代码来源:icmp_extensions.py

示例7: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.fcf_frametype == 0x00:
         return Dot15d4Beacon
     elif self.fcf_frametype == 0x01:
         return Dot15d4Data
     elif self.fcf_frametype == 0x02:
         return Dot15d4Ack
     elif self.fcf_frametype == 0x03:
         return Dot15d4Cmd
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:commial,项目名称:scapy,代码行数:13,代码来源:dot15d4.py

示例8: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     # Profile-wide commands
     if self.zcl_frametype == 0x00 and self.command_identifier == 0x00:
         return ZCLGeneralReadAttributes
     elif self.zcl_frametype == 0x00 and self.command_identifier == 0x01:
         return ZCLGeneralReadAttributesResponse
     # Cluster-specific commands
     elif self.zcl_frametype == 0x01 and self.command_identifier == 0x00 and self.direction == 0 and self.underlayer.cluster == 0x0700:  # "price"  # noqa: E501
         return ZCLPriceGetCurrentPrice
     elif self.zcl_frametype == 0x01 and self.command_identifier == 0x01 and self.direction == 0 and self.underlayer.cluster == 0x0700:  # "price"  # noqa: E501
         return ZCLPriceGetScheduledPrices
     elif self.zcl_frametype == 0x01 and self.command_identifier == 0x00 and self.direction == 1 and self.underlayer.cluster == 0x0700:  # "price"  # noqa: E501
         return ZCLPricePublishPrice
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:commial,项目名称:scapy,代码行数:17,代码来源:zigbee.py

示例9: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     """ Decides if the payload is an HTTP Request or Response, or
         something else """
     try:
         prog = re.compile(r"^(?:OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT) " r"(?:.+?) " r"HTTP/\d\.\d$")
         req = payload[: payload.index("\r\n")]
         result = prog.match(req)
         if result:
             return HTTPRequest
         else:
             prog = re.compile(r"^HTTP/\d\.\d \d\d\d .*$")
             result = prog.match(req)
             if result:
                 return HTTPResponse
     except:
         pass
     return Packet.guess_payload_class(self, payload)
开发者ID:jphgxq,项目名称:scapy-http,代码行数:19,代码来源:http.py

示例10: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     return conf.l2types.get(self.dlt, Packet.guess_payload_class(self, payload))  # noqa: E501
开发者ID:segment-routing,项目名称:scapy,代码行数:4,代码来源:ppi.py

示例11: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.flags > 31:
         return TLSv1RecordLayer
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:Jadkadan,项目名称:scapy,代码行数:7,代码来源:peap.py

示例12: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.options[:len(dhcpmagic)] == dhcpmagic:
         return DHCP
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:commial,项目名称:scapy,代码行数:7,代码来源:dhcp.py

示例13: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.flags >> 2 in [1, 3, 7]:	# if start bit is set
         return Packet.guess_payload_class(self, payload)
     else:
         return TLSv1RecordLayer
开发者ID:xiaobitao,项目名称:scapy,代码行数:7,代码来源:ttls.py

示例14: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.underlayer.len > 28:
         return HSRPmd5
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:commial,项目名称:scapy,代码行数:7,代码来源:hsrp.py

示例15: guess_payload_class

# 需要导入模块: from scapy.packet import Packet [as 别名]
# 或者: from scapy.packet.Packet import guess_payload_class [as 别名]
 def guess_payload_class(self, payload):
     if self.byteCount > 0:
         return ModbusReadFileSubRequest
     else:
         return Packet.guess_payload_class(self, payload)
开发者ID:commial,项目名称:scapy,代码行数:7,代码来源:modbus.py


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