本文整理匯總了Python中scapy.config.conf.padding_layer方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.padding_layer方法的具體用法?Python conf.padding_layer怎麽用?Python conf.padding_layer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scapy.config.conf
的用法示例。
在下文中一共展示了conf.padding_layer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: etherleak
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def etherleak(target, **kargs):
"""Exploit Etherleak flaw"""
return srpflood(Ether()/ARP(pdst=target),
prn=lambda (s,r): conf.padding_layer in r and hexstr(r[conf.padding_layer].load),
filter="arp", **kargs)
示例2: incoming_data_received
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def incoming_data_received(self, pkt):
if not isinstance(pkt[TCP].payload, NoPayload) and not isinstance(pkt[TCP].payload, conf.padding_layer):
raise self.ESTABLISHED().action_parameters(pkt)
示例3: fragleak2
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def fragleak2(target, timeout=0.4, onlyasc=0):
found={}
try:
while 1:
p = sr1(IP(dst=target, options="\x00"*40, proto=200)/"XXXXYYYYYYYYYYYY",timeout=timeout,verbose=0)
if not p:
continue
if conf.padding_layer in p:
leak = p[conf.padding_layer].load
if leak not in found:
found[leak]=None
linehexdump(leak,onlyasc=onlyasc)
except:
pass
示例4: padding
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def padding(self, lfilter=None):
# type: (Optional[Callable]) -> None
"""Same as hexraw(), for Padding layer"""
for i, res in enumerate(self.res):
p = self._elt2pkt(res)
if p.haslayer(conf.padding_layer):
if lfilter is None or lfilter(p):
print("%s %s %s" % (conf.color_theme.id(i, fmt="%04i"),
p.sprintf("%.time%"),
self._elt2sum(res)))
hexdump(p.getlayer(conf.padding_layer).load)
示例5: nzpadding
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def nzpadding(self, lfilter=None):
# type: (Optional[Callable]) -> None
"""Same as padding() but only non null padding"""
for i, res in enumerate(self.res):
p = self._elt2pkt(res)
if p.haslayer(conf.padding_layer):
pad = p.getlayer(conf.padding_layer).load
if pad == pad[0] * len(pad):
continue
if lfilter is None or lfilter(p):
print("%s %s %s" % (conf.color_theme.id(i, fmt="%04i"),
p.sprintf("%.time%"),
self._elt2sum(res)))
hexdump(p.getlayer(conf.padding_layer).load)
示例6: getfield
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def getfield(self, pkt, s):
i = self.m2i(pkt, s)
remain = b""
if conf.padding_layer in i:
r = i[conf.padding_layer]
del(r.underlayer.payload)
remain = r.load
return remain, i
示例7: recv
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def recv(self, x=MTU):
pkt = self.ins.recv(x, socket.MSG_PEEK)
x = len(pkt)
if x == 0:
return None
pkt = self.basecls(pkt)
pad = pkt.getlayer(conf.padding_layer)
if pad is not None and pad.underlayer is not None:
del(pad.underlayer.payload)
from scapy.packet import NoPayload
while pad is not None and not isinstance(pad, NoPayload):
x -= len(pad.load)
pad = pad.payload
self.ins.recv(x)
return pkt
示例8: build_ps
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def build_ps(self, internal=0):
p, lst = self.do_build_ps()
# if not internal:
# pkt = self
# while pkt.haslayer(conf.padding_layer):
# pkt = pkt.getlayer(conf.padding_layer)
# lst.append( (pkt, [ ("loakjkjd", pkt.load, pkt.load) ] ) )
# p += pkt.load
# pkt = pkt.payload
return p, lst
示例9: dissect
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def dissect(self, s):
s = self.pre_dissect(s)
s = self.do_dissect(s)
s = self.post_dissect(s)
payl, pad = self.extract_padding(s)
self.do_dissect_payload(payl)
if pad and conf.padding:
self.add_payload(conf.padding_layer(pad))
示例10: answers
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def answers(self, other):
return isinstance(other, NoPayload) or isinstance(other, conf.padding_layer) # noqa: E501
示例11: default_payload_class
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def default_payload_class(self, p):
if len(p) < 4:
return conf.padding_layer
else:
t = orb(p[0])
return globals().get(sctpchunktypescls.get(t, "Raw"), conf.raw_layer) # noqa: E501
示例12: getfield
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def getfield(self, pkt, s):
i = self.m2i(pkt, s)
if i is None:
return s, None
remain = b""
if conf.padding_layer in i:
r = i[conf.padding_layer]
del r.underlayer.payload
remain = r.load
return remain, i
示例13: etherleak
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def etherleak(target, **kargs):
"""Exploit Etherleak flaw"""
return srp(Ether() / ARP(pdst=target),
prn=lambda s_r: conf.padding_layer in s_r[1] and hexstr(s_r[1][conf.padding_layer].load), # noqa: E501
filter="arp", **kargs)
示例14: guess_payload_class
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def guess_payload_class(self, pay):
return conf.padding_layer
# RadioTap constants
示例15: _defrag_list
# 需要導入模塊: from scapy.config import conf [as 別名]
# 或者: from scapy.config.conf import padding_layer [as 別名]
def _defrag_list(lst, defrag, missfrag):
"""Internal usage only. Part of the _defrag_logic"""
p = lst[0]
lastp = lst[-1]
if p.frag > 0 or lastp.flags.MF: # first or last fragment missing
missfrag.extend(lst)
return
p = p.copy()
if conf.padding_layer in p:
del(p[conf.padding_layer].underlayer.payload)
ip = p[IP]
if ip.len is None or ip.ihl is None:
clen = len(ip.payload)
else:
clen = ip.len - (ip.ihl << 2)
txt = conf.raw_layer()
for q in lst[1:]:
if clen != q.frag << 3: # Wrong fragmentation offset
if clen > q.frag << 3:
warning("Fragment overlap (%i > %i) %r || %r || %r" % (clen, q.frag << 3, p, txt, q)) # noqa: E501
missfrag.extend(lst)
break
if q[IP].len is None or q[IP].ihl is None:
clen += len(q[IP].payload)
else:
clen += q[IP].len - (q[IP].ihl << 2)
if conf.padding_layer in q:
del(q[conf.padding_layer].underlayer.payload)
txt.add_payload(q[IP].payload.copy())
if q.time > p.time:
p.time = q.time
else:
ip.flags.MF = False
del(ip.chksum)
del(ip.len)
p = p / txt
p._defrag_pos = max(x._defrag_pos for x in lst)
defrag.append(p)