本文整理汇总了Python中scapy.config.conf.debug_dissector方法的典型用法代码示例。如果您正苦于以下问题:Python conf.debug_dissector方法的具体用法?Python conf.debug_dissector怎么用?Python conf.debug_dissector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scapy.config.conf
的用法示例。
在下文中一共展示了conf.debug_dissector方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: recv
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def recv(self, x):
pkt, sa_ll = self.ins.recvfrom(x)
if sa_ll[3] in conf.l2types :
cls = conf.l2types[sa_ll[3]]
elif sa_ll[1] in conf.l3types:
cls = conf.l3types[sa_ll[1]]
else:
cls = conf.default_l2
warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using %s" % (sa_ll[0],sa_ll[1],sa_ll[3],cls.name))
try:
pkt = cls(pkt)
except KeyboardInterrupt:
raise
except:
if conf.debug_dissector:
raise
pkt = conf.raw_layer(pkt)
pkt.time = get_last_packet_timestamp(self.ins)
return pkt
示例2: recv
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def recv(self,x=MTU):
ll = self.ins.datalink()
if ll in conf.l2types:
cls = conf.l2types[ll]
else:
cls = conf.default_l2
warning("Unable to guess datalink type (interface=%s linktype=%i). Using %s" % (self.iface, ll, cls.name))
pkt = self.ins.next()
if pkt is not None:
ts,pkt = pkt
if pkt is None:
return
try:
pkt = cls(pkt)
except KeyboardInterrupt:
raise
except:
if conf.debug_dissector:
raise
pkt = conf.raw_layer(pkt)
pkt.time = ts
return pkt.payload
示例3: recv
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def recv(self, x=MTU):
pkt, sa_ll = self.ins.recvfrom(x)
if sa_ll[3] in conf.l2types :
cls = conf.l2types[sa_ll[3]]
elif sa_ll[1] in conf.l3types:
cls = conf.l3types[sa_ll[1]]
else:
cls = conf.default_l2
warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using %s" % (sa_ll[0],sa_ll[1],sa_ll[3],cls.name))
try:
pkt = cls(pkt)
except KeyboardInterrupt:
raise
except:
if conf.debug_dissector:
raise
pkt = conf.raw_layer(pkt)
pkt.time = get_last_packet_timestamp(self.ins)
return pkt
示例4: read_packet
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def read_packet(self, size=MTU):
rp = super(PcapReader, self).read_packet(size=size)
if rp is None:
raise EOFError
s, pkt_info = rp
try:
p = self.LLcls(s)
except KeyboardInterrupt:
raise
except Exception:
if conf.debug_dissector:
from scapy.sendrecv import debug
debug.crashed_on = (self.LLcls, s)
raise
p = conf.raw_layer(s)
power = Decimal(10) ** Decimal(-9 if self.nano else -6)
p.time = EDecimal(pkt_info.sec + power * pkt_info.usec)
p.wirelen = pkt_info.wirelen
return p
示例5: recv
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def recv(self, x=MTU):
cls, val, ts = self.recv_raw(x)
if not val or not cls:
return
try:
pkt = cls(val)
except KeyboardInterrupt:
raise
except Exception:
if conf.debug_dissector:
from scapy.sendrecv import debug
debug.crashed_on = (cls, val)
raise
pkt = conf.raw_layer(val)
if ts:
pkt.time = ts
return pkt
示例6: do_dissect_payload
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def do_dissect_payload(self, s):
"""
Perform the dissection of the layer's payload
:param str s: the raw layer
"""
if s:
cls = self.guess_payload_class(s)
try:
p = cls(s, _internal=1, _underlayer=self)
except KeyboardInterrupt:
raise
except Exception:
if conf.debug_dissector:
if issubtype(cls, Packet):
log_runtime.error("%s dissector failed" % cls.__name__)
else:
log_runtime.error("%s.guess_payload_class() returned [%s]" % (self.__class__.__name__, repr(cls))) # noqa: E501
if cls is not None:
raise
p = conf.raw_layer(s, _internal=1, _underlayer=self)
self.add_payload(p)
示例7: getfield
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def getfield(self, pkt, s):
length = self.length_from(pkt)
i = None
if length > 0:
# RFC 1305
# The maximum number of data octets is 468.
#
# include/ntp_control.h
# u_char data[480 + MAX_MAC_LEN]; /* data + auth */
#
# Set the minimum length to 480 - 468
length = max(12, length)
if length % 4:
length += (4 - length % 4)
try:
i = self.m2i(pkt, s[:length])
except Exception:
if conf.debug_dissector:
raise
i = conf.raw_layer(load=s[:length])
return s[length:], i
示例8: recv
# 需要导入模块: from scapy.config import conf [as 别名]
# 或者: from scapy.config.conf import debug_dissector [as 别名]
def recv(self,x=MTU):
ll = self.ins.datalink()
if ll in conf.l2types:
cls = conf.l2types[ll]
else:
cls = conf.default_l2
warning("Unable to guess datalink type (interface=%s linktype=%i). Using %s" % (self.iface, ll, cls.name))
pkt = self.ins.next()
if pkt is not None:
ts,pkt = pkt
if pkt is None:
return
try:
pkt = cls(pkt)
except KeyboardInterrupt:
raise
except:
if conf.debug_dissector:
raise
pkt = conf.raw_layer(pkt)
pkt.time = ts
return pkt