本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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)
示例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)
示例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)
示例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
示例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)
示例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)
示例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
示例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)
示例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)