repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
secdev/scapy | scapy/sendrecv.py | sr1 | def sr1(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs):
"""Send packets at layer 3 and return only the first answer"""
s = conf.L3socket(promisc=promisc, filter=filter,
nofilter=nofilter, iface=iface)
ans, _ = sndrcv(s, x, *args, **kargs)
s.close()
if len... | python | def sr1(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs):
"""Send packets at layer 3 and return only the first answer"""
s = conf.L3socket(promisc=promisc, filter=filter,
nofilter=nofilter, iface=iface)
ans, _ = sndrcv(s, x, *args, **kargs)
s.close()
if len... | [
"def",
"sr1",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"nofilter",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"s",
"=",
"conf",
".",
"L3socket",
"(",
"promisc",
"=",
... | Send packets at layer 3 and return only the first answer | [
"Send",
"packets",
"at",
"layer",
"3",
"and",
"return",
"only",
"the",
"first",
"answer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L476-L485 | train | Send packets at layer 3 and return only the first answer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | srp | def srp(x, promisc=None, iface=None, iface_hint=None, filter=None,
nofilter=0, type=ETH_P_ALL, *args, **kargs):
"""Send and receive packets at layer 2"""
if iface is None and iface_hint is not None:
iface = conf.route.route(iface_hint)[0]
s = conf.L2socket(promisc=promisc, iface=iface,
... | python | def srp(x, promisc=None, iface=None, iface_hint=None, filter=None,
nofilter=0, type=ETH_P_ALL, *args, **kargs):
"""Send and receive packets at layer 2"""
if iface is None and iface_hint is not None:
iface = conf.route.route(iface_hint)[0]
s = conf.L2socket(promisc=promisc, iface=iface,
... | [
"def",
"srp",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"iface_hint",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"nofilter",
"=",
"0",
",",
"type",
"=",
"ETH_P_ALL",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
... | Send and receive packets at layer 2 | [
"Send",
"and",
"receive",
"packets",
"at",
"layer",
"2"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L489-L498 | train | Send and receive packets at layer 2 | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | srp1 | def srp1(*args, **kargs):
"""Send and receive packets at layer 2 and return only the first answer"""
ans, _ = srp(*args, **kargs)
if len(ans) > 0:
return ans[0][1]
else:
return None | python | def srp1(*args, **kargs):
"""Send and receive packets at layer 2 and return only the first answer"""
ans, _ = srp(*args, **kargs)
if len(ans) > 0:
return ans[0][1]
else:
return None | [
"def",
"srp1",
"(",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"ans",
",",
"_",
"=",
"srp",
"(",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
"if",
"len",
"(",
"ans",
")",
">",
"0",
":",
"return",
"ans",
"[",
"0",
"]",
"[",
"1",
"]",
"... | Send and receive packets at layer 2 and return only the first answer | [
"Send",
"and",
"receive",
"packets",
"at",
"layer",
"2",
"and",
"return",
"only",
"the",
"first",
"answer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L502-L508 | train | Send and receive packets at layer 2 and return only the first answer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | srflood | def srflood(x, promisc=None, filter=None, iface=None, nofilter=None, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 3
prn: function applied to packets received
unique: only consider packets whose print
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF filter
iface: ... | python | def srflood(x, promisc=None, filter=None, iface=None, nofilter=None, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 3
prn: function applied to packets received
unique: only consider packets whose print
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF filter
iface: ... | [
"def",
"srflood",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"nofilter",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"s",
"=",
"conf",
".",
"L3socket",
"... | Flood and receive packets at layer 3
prn: function applied to packets received
unique: only consider packets whose print
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF filter
iface: listen answers only on the given interface | [
"Flood",
"and",
"receive",
"packets",
"at",
"layer",
"3",
"prn",
":",
"function",
"applied",
"to",
"packets",
"received",
"unique",
":",
"only",
"consider",
"packets",
"whose",
"print",
"nofilter",
":",
"put",
"1",
"to",
"avoid",
"use",
"of",
"BPF",
"filte... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L673-L683 | train | Flood and receive packets at layer 3
prn | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | sr1flood | def sr1flood(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 3 and return only the first answer
prn: function applied to packets received
verbose: set verbosity level
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF ... | python | def sr1flood(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 3 and return only the first answer
prn: function applied to packets received
verbose: set verbosity level
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF ... | [
"def",
"sr1flood",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"nofilter",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"s",
"=",
"conf",
".",
"L3socket",
"("... | Flood and receive packets at layer 3 and return only the first answer
prn: function applied to packets received
verbose: set verbosity level
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF filter
iface: listen answers only on the given interface | [
"Flood",
"and",
"receive",
"packets",
"at",
"layer",
"3",
"and",
"return",
"only",
"the",
"first",
"answer",
"prn",
":",
"function",
"applied",
"to",
"packets",
"received",
"verbose",
":",
"set",
"verbosity",
"level",
"nofilter",
":",
"put",
"1",
"to",
"av... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L687-L700 | train | Flood and receive packets at layer 3 and return only the first answer
prn : function applied to packets received
nverbose : put 1 to avoid use of BPF filter
iface : give a BPF interface | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | srpflood | def srpflood(x, promisc=None, filter=None, iface=None, iface_hint=None, nofilter=None, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 2
prn: function applied to packets received
unique: only consider packets whose print
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF... | python | def srpflood(x, promisc=None, filter=None, iface=None, iface_hint=None, nofilter=None, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 2
prn: function applied to packets received
unique: only consider packets whose print
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF... | [
"def",
"srpflood",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"iface_hint",
"=",
"None",
",",
"nofilter",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"if",... | Flood and receive packets at layer 2
prn: function applied to packets received
unique: only consider packets whose print
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF filter
iface: listen answers only on the given interface | [
"Flood",
"and",
"receive",
"packets",
"at",
"layer",
"2",
"prn",
":",
"function",
"applied",
"to",
"packets",
"received",
"unique",
":",
"only",
"consider",
"packets",
"whose",
"print",
"nofilter",
":",
"put",
"1",
"to",
"avoid",
"use",
"of",
"BPF",
"filte... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L704-L716 | train | Flood and receive packets at layer 2
prn | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | srp1flood | def srp1flood(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 2 and return only the first answer
prn: function applied to packets received
verbose: set verbosity level
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF... | python | def srp1flood(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs): # noqa: E501
"""Flood and receive packets at layer 2 and return only the first answer
prn: function applied to packets received
verbose: set verbosity level
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF... | [
"def",
"srp1flood",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"nofilter",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"s",
"=",
"conf",
".",
"L2socket",
"(... | Flood and receive packets at layer 2 and return only the first answer
prn: function applied to packets received
verbose: set verbosity level
nofilter: put 1 to avoid use of BPF filters
filter: provide a BPF filter
iface: listen answers only on the given interface | [
"Flood",
"and",
"receive",
"packets",
"at",
"layer",
"2",
"and",
"return",
"only",
"the",
"first",
"answer",
"prn",
":",
"function",
"applied",
"to",
"packets",
"received",
"verbose",
":",
"set",
"verbosity",
"level",
"nofilter",
":",
"put",
"1",
"to",
"av... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L720-L733 | train | Flood and receive packets at layer 2 and return only the first answer
prn : function applied to packets received
nverbose levelofilter nofilter iface provide a BPF filter iface provide a BPF filter iface provide a BPF filter iface provide a BPF iface | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | sniff | def sniff(count=0, store=True, offline=None, prn=None, lfilter=None,
L2socket=None, timeout=None, opened_socket=None,
stop_filter=None, iface=None, started_callback=None,
session=None, *arg, **karg):
"""Sniff packets and return a list of packets.
Args:
count: number of pac... | python | def sniff(count=0, store=True, offline=None, prn=None, lfilter=None,
L2socket=None, timeout=None, opened_socket=None,
stop_filter=None, iface=None, started_callback=None,
session=None, *arg, **karg):
"""Sniff packets and return a list of packets.
Args:
count: number of pac... | [
"def",
"sniff",
"(",
"count",
"=",
"0",
",",
"store",
"=",
"True",
",",
"offline",
"=",
"None",
",",
"prn",
"=",
"None",
",",
"lfilter",
"=",
"None",
",",
"L2socket",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"opened_socket",
"=",
"None",
",",... | Sniff packets and return a list of packets.
Args:
count: number of packets to capture. 0 means infinity.
store: whether to store sniffed packets or discard them
prn: function to apply to each packet. If something is returned, it
is displayed.
--Ex: prn = lambda x: ... | [
"Sniff",
"packets",
"and",
"return",
"a",
"list",
"of",
"packets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L739-L895 | train | Sniff packets and return a list of packets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | bridge_and_sniff | def bridge_and_sniff(if1, if2, xfrm12=None, xfrm21=None, prn=None, L2socket=None, # noqa: E501
*args, **kargs):
"""Forward traffic between interfaces if1 and if2, sniff and return
the exchanged packets.
Arguments:
if1, if2: the interfaces to use (interface names or opened sockets).
xfrm... | python | def bridge_and_sniff(if1, if2, xfrm12=None, xfrm21=None, prn=None, L2socket=None, # noqa: E501
*args, **kargs):
"""Forward traffic between interfaces if1 and if2, sniff and return
the exchanged packets.
Arguments:
if1, if2: the interfaces to use (interface names or opened sockets).
xfrm... | [
"def",
"bridge_and_sniff",
"(",
"if1",
",",
"if2",
",",
"xfrm12",
"=",
"None",
",",
"xfrm21",
"=",
"None",
",",
"prn",
"=",
"None",
",",
"L2socket",
"=",
"None",
",",
"# noqa: E501",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"for",
"arg",
"in"... | Forward traffic between interfaces if1 and if2, sniff and return
the exchanged packets.
Arguments:
if1, if2: the interfaces to use (interface names or opened sockets).
xfrm12: a function to call when forwarding a packet from if1 to
if2. If it returns True, the packet is forwarded as it. If it
returns... | [
"Forward",
"traffic",
"between",
"interfaces",
"if1",
"and",
"if2",
"sniff",
"and",
"return",
"the",
"exchanged",
"packets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L899-L978 | train | Bridge and sniff packets between interfaces if1 and if2. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/sendrecv.py | tshark | def tshark(*args, **kargs):
"""Sniff packets and print them calling pkt.summary(), a bit like text wireshark""" # noqa: E501
print("Capturing on '" + str(kargs.get('iface') if 'iface' in kargs else conf.iface) + "'") # noqa: E501
i = [0] # This should be a nonlocal variable, using a mutable object for Py... | python | def tshark(*args, **kargs):
"""Sniff packets and print them calling pkt.summary(), a bit like text wireshark""" # noqa: E501
print("Capturing on '" + str(kargs.get('iface') if 'iface' in kargs else conf.iface) + "'") # noqa: E501
i = [0] # This should be a nonlocal variable, using a mutable object for Py... | [
"def",
"tshark",
"(",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"print",
"(",
"\"Capturing on '\"",
"+",
"str",
"(",
"kargs",
".",
"get",
"(",
"'iface'",
")",
"if",
"'iface'",
"in",
"kargs",
"else",
"conf",
".",
"iface",
")",
"+"... | Sniff packets and print them calling pkt.summary(), a bit like text wireshark | [
"Sniff",
"packets",
"and",
"print",
"them",
"calling",
"pkt",
".",
"summary",
"()",
"a",
"bit",
"like",
"text",
"wireshark"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L982-L991 | train | Sniff packets and print them calling pkt. summary | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/ikev2.py | ikev2scan | def ikev2scan(ip, **kwargs):
"""Send a IKEv2 SA to an IP and wait for answers."""
return sr(IP(dst=ip) / UDP() / IKEv2(init_SPI=RandString(8),
exch_type=34) / IKEv2_payload_SA(prop=IKEv2_payload_Proposal()), **kwargs) | python | def ikev2scan(ip, **kwargs):
"""Send a IKEv2 SA to an IP and wait for answers."""
return sr(IP(dst=ip) / UDP() / IKEv2(init_SPI=RandString(8),
exch_type=34) / IKEv2_payload_SA(prop=IKEv2_payload_Proposal()), **kwargs) | [
"def",
"ikev2scan",
"(",
"ip",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"sr",
"(",
"IP",
"(",
"dst",
"=",
"ip",
")",
"/",
"UDP",
"(",
")",
"/",
"IKEv2",
"(",
"init_SPI",
"=",
"RandString",
"(",
"8",
")",
",",
"exch_type",
"=",
"34",
")",
... | Send a IKEv2 SA to an IP and wait for answers. | [
"Send",
"a",
"IKEv2",
"SA",
"to",
"an",
"IP",
"and",
"wait",
"for",
"answers",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ikev2.py#L799-L802 | train | Send a IKEv2 SA to an IP and wait for answers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/asn1/mib.py | _mib_register | def _mib_register(ident, value, the_mib, unresolved):
"""Internal function used to register an OID and its name in a MIBDict"""
if ident in the_mib or ident in unresolved:
return ident in the_mib
resval = []
not_resolved = 0
for v in value:
if _mib_re_integer.match(v):
re... | python | def _mib_register(ident, value, the_mib, unresolved):
"""Internal function used to register an OID and its name in a MIBDict"""
if ident in the_mib or ident in unresolved:
return ident in the_mib
resval = []
not_resolved = 0
for v in value:
if _mib_re_integer.match(v):
re... | [
"def",
"_mib_register",
"(",
"ident",
",",
"value",
",",
"the_mib",
",",
"unresolved",
")",
":",
"if",
"ident",
"in",
"the_mib",
"or",
"ident",
"in",
"unresolved",
":",
"return",
"ident",
"in",
"the_mib",
"resval",
"=",
"[",
"]",
"not_resolved",
"=",
"0"... | Internal function used to register an OID and its name in a MIBDict | [
"Internal",
"function",
"used",
"to",
"register",
"an",
"OID",
"and",
"its",
"name",
"in",
"a",
"MIBDict"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/asn1/mib.py#L91-L128 | train | Internal function used to register an OID and its name in a MIBDict | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/asn1/mib.py | load_mib | def load_mib(filenames):
"""Load the conf.mib dict from a list of filenames"""
the_mib = {'iso': ['1']}
unresolved = {}
for k in six.iterkeys(conf.mib):
_mib_register(conf.mib[k], k.split("."), the_mib, unresolved)
if isinstance(filenames, (str, bytes)):
filenames = [filenames]
... | python | def load_mib(filenames):
"""Load the conf.mib dict from a list of filenames"""
the_mib = {'iso': ['1']}
unresolved = {}
for k in six.iterkeys(conf.mib):
_mib_register(conf.mib[k], k.split("."), the_mib, unresolved)
if isinstance(filenames, (str, bytes)):
filenames = [filenames]
... | [
"def",
"load_mib",
"(",
"filenames",
")",
":",
"the_mib",
"=",
"{",
"'iso'",
":",
"[",
"'1'",
"]",
"}",
"unresolved",
"=",
"{",
"}",
"for",
"k",
"in",
"six",
".",
"iterkeys",
"(",
"conf",
".",
"mib",
")",
":",
"_mib_register",
"(",
"conf",
".",
"... | Load the conf.mib dict from a list of filenames | [
"Load",
"the",
"conf",
".",
"mib",
"dict",
"from",
"a",
"list",
"of",
"filenames"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/asn1/mib.py#L131-L162 | train | Load the conf. mib dict from a list of filenames | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/asn1/mib.py | MIBDict._findroot | def _findroot(self, x):
"""Internal MIBDict function used to find a partial OID"""
if x.startswith("."):
x = x[1:]
if not x.endswith("."):
x += "."
max = 0
root = "."
root_key = ""
for k in six.iterkeys(self):
if x.startswith(k ... | python | def _findroot(self, x):
"""Internal MIBDict function used to find a partial OID"""
if x.startswith("."):
x = x[1:]
if not x.endswith("."):
x += "."
max = 0
root = "."
root_key = ""
for k in six.iterkeys(self):
if x.startswith(k ... | [
"def",
"_findroot",
"(",
"self",
",",
"x",
")",
":",
"if",
"x",
".",
"startswith",
"(",
"\".\"",
")",
":",
"x",
"=",
"x",
"[",
"1",
":",
"]",
"if",
"not",
"x",
".",
"endswith",
"(",
"\".\"",
")",
":",
"x",
"+=",
"\".\"",
"max",
"=",
"0",
"r... | Internal MIBDict function used to find a partial OID | [
"Internal",
"MIBDict",
"function",
"used",
"to",
"find",
"a",
"partial",
"OID"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/asn1/mib.py#L36-L51 | train | Internal MIBDict function used to find a root OID | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/asn1/mib.py | MIBDict._oid | def _oid(self, x):
"""Parse the OID id/OID generator, and return real OID"""
xl = x.strip(".").split(".")
p = len(xl) - 1
while p >= 0 and _mib_re_integer.match(xl[p]):
p -= 1
if p != 0 or xl[p] not in six.itervalues(self.__dict__):
return x
xl[p] ... | python | def _oid(self, x):
"""Parse the OID id/OID generator, and return real OID"""
xl = x.strip(".").split(".")
p = len(xl) - 1
while p >= 0 and _mib_re_integer.match(xl[p]):
p -= 1
if p != 0 or xl[p] not in six.itervalues(self.__dict__):
return x
xl[p] ... | [
"def",
"_oid",
"(",
"self",
",",
"x",
")",
":",
"xl",
"=",
"x",
".",
"strip",
"(",
"\".\"",
")",
".",
"split",
"(",
"\".\"",
")",
"p",
"=",
"len",
"(",
"xl",
")",
"-",
"1",
"while",
"p",
">=",
"0",
"and",
"_mib_re_integer",
".",
"match",
"(",... | Parse the OID id/OID generator, and return real OID | [
"Parse",
"the",
"OID",
"id",
"/",
"OID",
"generator",
"and",
"return",
"real",
"OID"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/asn1/mib.py#L58-L67 | train | Parse the OID id or OID generator and return real OID | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/mac_control.py | MACControl._get_underlayers_size | def _get_underlayers_size(self):
"""
get the total size of all under layers
:return: number of bytes
"""
under_layer = self.underlayer
under_layers_size = 0
while under_layer and isinstance(under_layer, Dot1Q):
under_layers_size += 4
und... | python | def _get_underlayers_size(self):
"""
get the total size of all under layers
:return: number of bytes
"""
under_layer = self.underlayer
under_layers_size = 0
while under_layer and isinstance(under_layer, Dot1Q):
under_layers_size += 4
und... | [
"def",
"_get_underlayers_size",
"(",
"self",
")",
":",
"under_layer",
"=",
"self",
".",
"underlayer",
"under_layers_size",
"=",
"0",
"while",
"under_layer",
"and",
"isinstance",
"(",
"under_layer",
",",
"Dot1Q",
")",
":",
"under_layers_size",
"+=",
"4",
"under_l... | get the total size of all under layers
:return: number of bytes | [
"get",
"the",
"total",
"size",
"of",
"all",
"under",
"layers",
":",
"return",
":",
"number",
"of",
"bytes"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/mac_control.py#L103-L121 | train | get the total size of all under layers
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/mac_control.py | MACControl.post_build | def post_build(self, pkt, pay):
"""
add padding to the frame if required.
note that padding is only added if pay is None/empty. this allows us to add # noqa: E501
any payload after the MACControl* PDU if needed (piggybacking).
"""
if not pay:
under_layers_s... | python | def post_build(self, pkt, pay):
"""
add padding to the frame if required.
note that padding is only added if pay is None/empty. this allows us to add # noqa: E501
any payload after the MACControl* PDU if needed (piggybacking).
"""
if not pay:
under_layers_s... | [
"def",
"post_build",
"(",
"self",
",",
"pkt",
",",
"pay",
")",
":",
"if",
"not",
"pay",
":",
"under_layers_size",
"=",
"self",
".",
"_get_underlayers_size",
"(",
")",
"frame_size",
"=",
"(",
"len",
"(",
"pkt",
")",
"+",
"under_layers_size",
")",
"if",
... | add padding to the frame if required.
note that padding is only added if pay is None/empty. this allows us to add # noqa: E501
any payload after the MACControl* PDU if needed (piggybacking). | [
"add",
"padding",
"to",
"the",
"frame",
"if",
"required",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/mac_control.py#L123-L139 | train | add padding to the frame if required. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/mac_control.py | MACControlPause.get_pause_time | def get_pause_time(self, speed=ETHER_SPEED_MBIT_1000):
"""
get pause time for given link speed in seconds
:param speed: select link speed to get the pause time for, must be ETHER_SPEED_MBIT_[10,100,1000] # noqa: E501
:return: pause time in seconds
:raises MACControlInvalidSpeed... | python | def get_pause_time(self, speed=ETHER_SPEED_MBIT_1000):
"""
get pause time for given link speed in seconds
:param speed: select link speed to get the pause time for, must be ETHER_SPEED_MBIT_[10,100,1000] # noqa: E501
:return: pause time in seconds
:raises MACControlInvalidSpeed... | [
"def",
"get_pause_time",
"(",
"self",
",",
"speed",
"=",
"ETHER_SPEED_MBIT_1000",
")",
":",
"try",
":",
"return",
"self",
".",
"pause_time",
"*",
"{",
"ETHER_SPEED_MBIT_10",
":",
"(",
"0.0000001",
"*",
"512",
")",
",",
"ETHER_SPEED_MBIT_100",
":",
"(",
"0.00... | get pause time for given link speed in seconds
:param speed: select link speed to get the pause time for, must be ETHER_SPEED_MBIT_[10,100,1000] # noqa: E501
:return: pause time in seconds
:raises MACControlInvalidSpeedException: on invalid speed selector | [
"get",
"pause",
"time",
"for",
"given",
"link",
"speed",
"in",
"seconds"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/mac_control.py#L152-L169 | train | get pause time for given link speed in seconds | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/can.py | rdcandump | def rdcandump(filename, count=None,
is_not_log_file_format=False,
interface=None):
"""Read a candump log file and return a packet list
count: read only <count> packets
is_not_log_file_format: read input with candumps stdout format
interfaces: return only packets from a specified interfa... | python | def rdcandump(filename, count=None,
is_not_log_file_format=False,
interface=None):
"""Read a candump log file and return a packet list
count: read only <count> packets
is_not_log_file_format: read input with candumps stdout format
interfaces: return only packets from a specified interfa... | [
"def",
"rdcandump",
"(",
"filename",
",",
"count",
"=",
"None",
",",
"is_not_log_file_format",
"=",
"False",
",",
"interface",
"=",
"None",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"filename",
",",
"six",
".",
"string_types",
")",
":",
"file",
"=",... | Read a candump log file and return a packet list
count: read only <count> packets
is_not_log_file_format: read input with candumps stdout format
interfaces: return only packets from a specified interface | [
"Read",
"a",
"candump",
"log",
"file",
"and",
"return",
"a",
"packet",
"list"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/can.py#L87-L147 | train | Read a candump log file and return a list of CAN packets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/can.py | CAN.inv_endianness | def inv_endianness(pkt):
""" Invert the order of the first four bytes of a CAN packet
This method is meant to be used specifically to convert a CAN packet
between the pcap format and the socketCAN format
:param pkt: str of the CAN packet
:return: packet str with the first four ... | python | def inv_endianness(pkt):
""" Invert the order of the first four bytes of a CAN packet
This method is meant to be used specifically to convert a CAN packet
between the pcap format and the socketCAN format
:param pkt: str of the CAN packet
:return: packet str with the first four ... | [
"def",
"inv_endianness",
"(",
"pkt",
")",
":",
"len_partial",
"=",
"len",
"(",
"pkt",
")",
"-",
"4",
"# len of the packet, CAN ID excluded",
"return",
"struct",
".",
"pack",
"(",
"'<I{}s'",
".",
"format",
"(",
"len_partial",
")",
",",
"*",
"struct",
".",
"... | Invert the order of the first four bytes of a CAN packet
This method is meant to be used specifically to convert a CAN packet
between the pcap format and the socketCAN format
:param pkt: str of the CAN packet
:return: packet str with the first four bytes swapped | [
"Invert",
"the",
"order",
"of",
"the",
"first",
"four",
"bytes",
"of",
"a",
"CAN",
"packet"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/can.py#L45-L56 | train | Invert the order of the first four bytes of a CAN packet | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/can.py | CAN.post_build | def post_build(self, pkt, pay):
""" Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged
"""
if conf.contribs... | python | def post_build(self, pkt, pay):
""" Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged
"""
if conf.contribs... | [
"def",
"post_build",
"(",
"self",
",",
"pkt",
",",
"pay",
")",
":",
"if",
"conf",
".",
"contribs",
"[",
"'CAN'",
"]",
"[",
"'swap-bytes'",
"]",
":",
"return",
"CAN",
".",
"inv_endianness",
"(",
"pkt",
")",
"+",
"pay",
"return",
"pkt",
"+",
"pay"
] | Implements the swap-bytes functionality when building
this is based on a copy of the Packet.self_build default method.
The goal is to affect only the CAN layer data and keep
under layers (e.g LinuxCooked) unchanged | [
"Implements",
"the",
"swap",
"-",
"bytes",
"functionality",
"when",
"building"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/can.py#L68-L77 | train | This method is called when the packet is built and the payload is not yet processed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/modules/p0f.py | pkt2uptime | def pkt2uptime(pkt, HZ=100):
"""Calculate the date the machine which emitted the packet booted using TCP timestamp # noqa: E501
pkt2uptime(pkt, [HZ=100])"""
if not isinstance(pkt, Packet):
raise TypeError("Not a TCP packet")
if isinstance(pkt, NoPayload):
raise TypeError("Not a TCP packet")... | python | def pkt2uptime(pkt, HZ=100):
"""Calculate the date the machine which emitted the packet booted using TCP timestamp # noqa: E501
pkt2uptime(pkt, [HZ=100])"""
if not isinstance(pkt, Packet):
raise TypeError("Not a TCP packet")
if isinstance(pkt, NoPayload):
raise TypeError("Not a TCP packet")... | [
"def",
"pkt2uptime",
"(",
"pkt",
",",
"HZ",
"=",
"100",
")",
":",
"if",
"not",
"isinstance",
"(",
"pkt",
",",
"Packet",
")",
":",
"raise",
"TypeError",
"(",
"\"Not a TCP packet\"",
")",
"if",
"isinstance",
"(",
"pkt",
",",
"NoPayload",
")",
":",
"raise... | Calculate the date the machine which emitted the packet booted using TCP timestamp # noqa: E501
pkt2uptime(pkt, [HZ=100]) | [
"Calculate",
"the",
"date",
"the",
"machine",
"which",
"emitted",
"the",
"packet",
"booted",
"using",
"TCP",
"timestamp",
"#",
"noqa",
":",
"E501",
"pkt2uptime",
"(",
"pkt",
"[",
"HZ",
"=",
"100",
"]",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/p0f.py#L345-L360 | train | Calculate the date the machine which emitted the packet booted using TCP timestamp | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/modules/p0f.py | p0f_impersonate | def p0f_impersonate(pkt, osgenre=None, osdetails=None, signature=None,
extrahops=0, mtu=1500, uptime=None):
"""Modifies pkt so that p0f will think it has been sent by a
specific OS. If osdetails is None, then we randomly pick up a
personality matching osgenre. If osgenre and signature are also ... | python | def p0f_impersonate(pkt, osgenre=None, osdetails=None, signature=None,
extrahops=0, mtu=1500, uptime=None):
"""Modifies pkt so that p0f will think it has been sent by a
specific OS. If osdetails is None, then we randomly pick up a
personality matching osgenre. If osgenre and signature are also ... | [
"def",
"p0f_impersonate",
"(",
"pkt",
",",
"osgenre",
"=",
"None",
",",
"osdetails",
"=",
"None",
",",
"signature",
"=",
"None",
",",
"extrahops",
"=",
"0",
",",
"mtu",
"=",
"1500",
",",
"uptime",
"=",
"None",
")",
":",
"pkt",
"=",
"pkt",
".",
"cop... | Modifies pkt so that p0f will think it has been sent by a
specific OS. If osdetails is None, then we randomly pick up a
personality matching osgenre. If osgenre and signature are also None,
we use a local signature (using p0f_getlocalsigs). If signature is
specified (as a tuple), we use the signature.
For now, only T... | [
"Modifies",
"pkt",
"so",
"that",
"p0f",
"will",
"think",
"it",
"has",
"been",
"sent",
"by",
"a",
"specific",
"OS",
".",
"If",
"osdetails",
"is",
"None",
"then",
"we",
"randomly",
"pick",
"up",
"a",
"personality",
"matching",
"osgenre",
".",
"If",
"osgenr... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/p0f.py#L363-L566 | train | Modifies a packet so that it has been sent by a specific OS. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | IODControlReq.get_response | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IODControlRes()
for field in ["ARUUID", "SessionKey", "AlarmSequenceNumber"]:
res.setfieldval(field, self.getfieldval(f... | python | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IODControlRes()
for field in ["ARUUID", "SessionKey", "AlarmSequenceNumber"]:
res.setfieldval(field, self.getfieldval(f... | [
"def",
"get_response",
"(",
"self",
")",
":",
"res",
"=",
"IODControlRes",
"(",
")",
"for",
"field",
"in",
"[",
"\"ARUUID\"",
",",
"\"SessionKey\"",
",",
"\"AlarmSequenceNumber\"",
"]",
":",
"res",
".",
"setfieldval",
"(",
"field",
",",
"self",
".",
"getfi... | Generate the response block of this request.
Careful: it only sets the fields which can be set from the request | [
"Generate",
"the",
"response",
"block",
"of",
"this",
"request",
".",
"Careful",
":",
"it",
"only",
"sets",
"the",
"fields",
"which",
"can",
"be",
"set",
"from",
"the",
"request"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L385-L394 | train | Generate the response block of this request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | IODWriteReq.get_response | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IODWriteRes()
for field in ["seqNum", "ARUUID", "API", "slotNumber",
"subslotNumber", "index"]:
r... | python | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IODWriteRes()
for field in ["seqNum", "ARUUID", "API", "slotNumber",
"subslotNumber", "index"]:
r... | [
"def",
"get_response",
"(",
"self",
")",
":",
"res",
"=",
"IODWriteRes",
"(",
")",
"for",
"field",
"in",
"[",
"\"seqNum\"",
",",
"\"ARUUID\"",
",",
"\"API\"",
",",
"\"slotNumber\"",
",",
"\"subslotNumber\"",
",",
"\"index\"",
"]",
":",
"res",
".",
"setfiel... | Generate the response block of this request.
Careful: it only sets the fields which can be set from the request | [
"Generate",
"the",
"response",
"block",
"of",
"this",
"request",
".",
"Careful",
":",
"it",
"only",
"sets",
"the",
"fields",
"which",
"can",
"be",
"set",
"from",
"the",
"request"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L445-L453 | train | Generate the response block of this request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | PadFieldWithLen.i2len | def i2len(self, pkt, val):
"""get the length of the field, including the padding length"""
fld_len = self._fld.i2len(pkt, val)
return fld_len + self.padlen(fld_len) | python | def i2len(self, pkt, val):
"""get the length of the field, including the padding length"""
fld_len = self._fld.i2len(pkt, val)
return fld_len + self.padlen(fld_len) | [
"def",
"i2len",
"(",
"self",
",",
"pkt",
",",
"val",
")",
":",
"fld_len",
"=",
"self",
".",
"_fld",
".",
"i2len",
"(",
"pkt",
",",
"val",
")",
"return",
"fld_len",
"+",
"self",
".",
"padlen",
"(",
"fld_len",
")"
] | get the length of the field, including the padding length | [
"get",
"the",
"length",
"of",
"the",
"field",
"including",
"the",
"padding",
"length"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L529-L532 | train | get the length of the field including the padding length | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | IODWriteMultipleReq.get_response | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IODWriteMultipleRes()
for field in ["seqNum", "ARUUID", "API", "slotNumber",
"subslotNumber", "index"]:
... | python | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IODWriteMultipleRes()
for field in ["seqNum", "ARUUID", "API", "slotNumber",
"subslotNumber", "index"]:
... | [
"def",
"get_response",
"(",
"self",
")",
":",
"res",
"=",
"IODWriteMultipleRes",
"(",
")",
"for",
"field",
"in",
"[",
"\"seqNum\"",
",",
"\"ARUUID\"",
",",
"\"API\"",
",",
"\"slotNumber\"",
",",
"\"subslotNumber\"",
",",
"\"index\"",
"]",
":",
"res",
".",
... | Generate the response block of this request.
Careful: it only sets the fields which can be set from the request | [
"Generate",
"the",
"response",
"block",
"of",
"this",
"request",
".",
"Careful",
":",
"it",
"only",
"sets",
"the",
"fields",
"which",
"can",
"be",
"set",
"from",
"the",
"request"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L580-L594 | train | Generate the response block of this request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | ARBlockReq.get_response | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = ARBlockRes()
for field in ["ARType", "ARUUID", "SessionKey"]:
res.setfieldval(field, self.getfieldval(field))
r... | python | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = ARBlockRes()
for field in ["ARType", "ARUUID", "SessionKey"]:
res.setfieldval(field, self.getfieldval(field))
r... | [
"def",
"get_response",
"(",
"self",
")",
":",
"res",
"=",
"ARBlockRes",
"(",
")",
"for",
"field",
"in",
"[",
"\"ARType\"",
",",
"\"ARUUID\"",
",",
"\"SessionKey\"",
"]",
":",
"res",
".",
"setfieldval",
"(",
"field",
",",
"self",
".",
"getfieldval",
"(",
... | Generate the response block of this request.
Careful: it only sets the fields which can be set from the request | [
"Generate",
"the",
"response",
"block",
"of",
"this",
"request",
".",
"Careful",
":",
"it",
"only",
"sets",
"the",
"fields",
"which",
"can",
"be",
"set",
"from",
"the",
"request"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L665-L672 | train | Generate the response block of this request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | IOCRBlockReq.get_response | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IOCRBlockRes()
for field in ["IOCRType", "IOCRReference", "FrameID"]:
res.setfieldval(field, self.getfieldval(field))
... | python | def get_response(self):
"""Generate the response block of this request.
Careful: it only sets the fields which can be set from the request
"""
res = IOCRBlockRes()
for field in ["IOCRType", "IOCRReference", "FrameID"]:
res.setfieldval(field, self.getfieldval(field))
... | [
"def",
"get_response",
"(",
"self",
")",
":",
"res",
"=",
"IOCRBlockRes",
"(",
")",
"for",
"field",
"in",
"[",
"\"IOCRType\"",
",",
"\"IOCRReference\"",
",",
"\"FrameID\"",
"]",
":",
"res",
".",
"setfieldval",
"(",
"field",
",",
"self",
".",
"getfieldval",... | Generate the response block of this request.
Careful: it only sets the fields which can be set from the request | [
"Generate",
"the",
"response",
"block",
"of",
"this",
"request",
".",
"Careful",
":",
"it",
"only",
"sets",
"the",
"fields",
"which",
"can",
"be",
"set",
"from",
"the",
"request"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L757-L764 | train | Generate the response block of this request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/pnio_rpc.py | PNIOServiceReqPDU.can_handle | def can_handle(cls, pkt, rpc):
"""heuristical guess_payload_class"""
# type = 0 => request
if rpc.getfieldval("type") == 0 and \
str(rpc.object_uuid).startswith("dea00000-6c97-11d1-8271-"):
return True
return False | python | def can_handle(cls, pkt, rpc):
"""heuristical guess_payload_class"""
# type = 0 => request
if rpc.getfieldval("type") == 0 and \
str(rpc.object_uuid).startswith("dea00000-6c97-11d1-8271-"):
return True
return False | [
"def",
"can_handle",
"(",
"cls",
",",
"pkt",
",",
"rpc",
")",
":",
"# type = 0 => request",
"if",
"rpc",
".",
"getfieldval",
"(",
"\"type\"",
")",
"==",
"0",
"and",
"str",
"(",
"rpc",
".",
"object_uuid",
")",
".",
"startswith",
"(",
"\"dea00000-6c97-11d1-8... | heuristical guess_payload_class | [
"heuristical",
"guess_payload_class"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/pnio_rpc.py#L969-L975 | train | check if the class can handle this item | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/macsec.py | MACsecSA.make_iv | def make_iv(self, pkt):
"""generate an IV for the packet"""
if self.xpn_en:
tmp_pn = (self.pn & 0xFFFFFFFF00000000) | (pkt[MACsec].pn & 0xFFFFFFFF) # noqa: E501
tmp_iv = self.ssci + struct.pack('!Q', tmp_pn)
return bytes(bytearray([a ^ b for a, b in zip(bytearray(tmp... | python | def make_iv(self, pkt):
"""generate an IV for the packet"""
if self.xpn_en:
tmp_pn = (self.pn & 0xFFFFFFFF00000000) | (pkt[MACsec].pn & 0xFFFFFFFF) # noqa: E501
tmp_iv = self.ssci + struct.pack('!Q', tmp_pn)
return bytes(bytearray([a ^ b for a, b in zip(bytearray(tmp... | [
"def",
"make_iv",
"(",
"self",
",",
"pkt",
")",
":",
"if",
"self",
".",
"xpn_en",
":",
"tmp_pn",
"=",
"(",
"self",
".",
"pn",
"&",
"0xFFFFFFFF00000000",
")",
"|",
"(",
"pkt",
"[",
"MACsec",
"]",
".",
"pn",
"&",
"0xFFFFFFFF",
")",
"# noqa: E501",
"t... | generate an IV for the packet | [
"generate",
"an",
"IV",
"for",
"the",
"packet"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L82-L89 | train | generate an IV for the packet | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/macsec.py | MACsecSA.split_pkt | def split_pkt(pkt, assoclen, icvlen=0):
"""
split the packet into associated data, plaintext or ciphertext, and
optional ICV
"""
data = raw(pkt)
assoc = data[:assoclen]
if icvlen:
icv = data[-icvlen:]
enc = data[assoclen:-icvlen]
el... | python | def split_pkt(pkt, assoclen, icvlen=0):
"""
split the packet into associated data, plaintext or ciphertext, and
optional ICV
"""
data = raw(pkt)
assoc = data[:assoclen]
if icvlen:
icv = data[-icvlen:]
enc = data[assoclen:-icvlen]
el... | [
"def",
"split_pkt",
"(",
"pkt",
",",
"assoclen",
",",
"icvlen",
"=",
"0",
")",
":",
"data",
"=",
"raw",
"(",
"pkt",
")",
"assoc",
"=",
"data",
"[",
":",
"assoclen",
"]",
"if",
"icvlen",
":",
"icv",
"=",
"data",
"[",
"-",
"icvlen",
":",
"]",
"en... | split the packet into associated data, plaintext or ciphertext, and
optional ICV | [
"split",
"the",
"packet",
"into",
"associated",
"data",
"plaintext",
"or",
"ciphertext",
"and",
"optional",
"ICV"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L92-L105 | train | split the packet into associated data plaintext or ciphertext and ICV | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/macsec.py | MACsecSA.encap | def encap(self, pkt):
"""encapsulate a frame using this Secure Association"""
if pkt.name != Ether().name:
raise TypeError('cannot encapsulate packet in MACsec, must be Ethernet') # noqa: E501
hdr = copy.deepcopy(pkt)
payload = hdr.payload
del hdr.payload
tag... | python | def encap(self, pkt):
"""encapsulate a frame using this Secure Association"""
if pkt.name != Ether().name:
raise TypeError('cannot encapsulate packet in MACsec, must be Ethernet') # noqa: E501
hdr = copy.deepcopy(pkt)
payload = hdr.payload
del hdr.payload
tag... | [
"def",
"encap",
"(",
"self",
",",
"pkt",
")",
":",
"if",
"pkt",
".",
"name",
"!=",
"Ether",
"(",
")",
".",
"name",
":",
"raise",
"TypeError",
"(",
"'cannot encapsulate packet in MACsec, must be Ethernet'",
")",
"# noqa: E501",
"hdr",
"=",
"copy",
".",
"deepc... | encapsulate a frame using this Secure Association | [
"encapsulate",
"a",
"frame",
"using",
"this",
"Secure",
"Association"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L123-L136 | train | encapsulate a frame using this Secure Association | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/macsec.py | MACsecSA.decap | def decap(self, orig_pkt):
"""decapsulate a MACsec frame"""
if orig_pkt.name != Ether().name or orig_pkt.payload.name != MACsec().name: # noqa: E501
raise TypeError('cannot decapsulate MACsec packet, must be Ethernet/MACsec') # noqa: E501
packet = copy.deepcopy(orig_pkt)
pr... | python | def decap(self, orig_pkt):
"""decapsulate a MACsec frame"""
if orig_pkt.name != Ether().name or orig_pkt.payload.name != MACsec().name: # noqa: E501
raise TypeError('cannot decapsulate MACsec packet, must be Ethernet/MACsec') # noqa: E501
packet = copy.deepcopy(orig_pkt)
pr... | [
"def",
"decap",
"(",
"self",
",",
"orig_pkt",
")",
":",
"if",
"orig_pkt",
".",
"name",
"!=",
"Ether",
"(",
")",
".",
"name",
"or",
"orig_pkt",
".",
"payload",
".",
"name",
"!=",
"MACsec",
"(",
")",
".",
"name",
":",
"# noqa: E501",
"raise",
"TypeErro... | decapsulate a MACsec frame | [
"decapsulate",
"a",
"MACsec",
"frame"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L140-L151 | train | decapsulate a MACsec frame | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/macsec.py | MACsecSA.encrypt | def encrypt(self, orig_pkt, assoclen=None):
"""encrypt a MACsec frame for this Secure Association"""
hdr = copy.deepcopy(orig_pkt)
del hdr[MACsec].payload
del hdr[MACsec].type
pktlen = len(orig_pkt)
if self.send_sci:
hdrlen = NOSCI_LEN + SCI_LEN
else:
... | python | def encrypt(self, orig_pkt, assoclen=None):
"""encrypt a MACsec frame for this Secure Association"""
hdr = copy.deepcopy(orig_pkt)
del hdr[MACsec].payload
del hdr[MACsec].type
pktlen = len(orig_pkt)
if self.send_sci:
hdrlen = NOSCI_LEN + SCI_LEN
else:
... | [
"def",
"encrypt",
"(",
"self",
",",
"orig_pkt",
",",
"assoclen",
"=",
"None",
")",
":",
"hdr",
"=",
"copy",
".",
"deepcopy",
"(",
"orig_pkt",
")",
"del",
"hdr",
"[",
"MACsec",
"]",
".",
"payload",
"del",
"hdr",
"[",
"MACsec",
"]",
".",
"type",
"pkt... | encrypt a MACsec frame for this Secure Association | [
"encrypt",
"a",
"MACsec",
"frame",
"for",
"this",
"Secure",
"Association"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L153-L178 | train | encrypt a MACsec frame for this Secure Association | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/macsec.py | MACsecSA.decrypt | def decrypt(self, orig_pkt, assoclen=None):
"""decrypt a MACsec frame for this Secure Association"""
hdr = copy.deepcopy(orig_pkt)
del hdr[MACsec].payload
pktlen = len(orig_pkt)
if self.send_sci:
hdrlen = NOSCI_LEN + SCI_LEN
else:
hdrlen = NOSCI_LE... | python | def decrypt(self, orig_pkt, assoclen=None):
"""decrypt a MACsec frame for this Secure Association"""
hdr = copy.deepcopy(orig_pkt)
del hdr[MACsec].payload
pktlen = len(orig_pkt)
if self.send_sci:
hdrlen = NOSCI_LEN + SCI_LEN
else:
hdrlen = NOSCI_LE... | [
"def",
"decrypt",
"(",
"self",
",",
"orig_pkt",
",",
"assoclen",
"=",
"None",
")",
":",
"hdr",
"=",
"copy",
".",
"deepcopy",
"(",
"orig_pkt",
")",
"del",
"hdr",
"[",
"MACsec",
"]",
".",
"payload",
"pktlen",
"=",
"len",
"(",
"orig_pkt",
")",
"if",
"... | decrypt a MACsec frame for this Secure Association | [
"decrypt",
"a",
"MACsec",
"frame",
"for",
"this",
"Secure",
"Association"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/macsec.py#L180-L207 | train | decrypts a MACsec frame for this Secure Association | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/bluetooth.py | srbt | def srbt(bt_address, pkts, inter=0.1, *args, **kargs):
"""send and receive using a bluetooth socket"""
if "port" in kargs:
s = conf.BTsocket(bt_address=bt_address, port=kargs.pop("port"))
else:
s = conf.BTsocket(bt_address=bt_address)
a, b = sndrcv(s, pkts, inter=inter, *args, **kargs)
... | python | def srbt(bt_address, pkts, inter=0.1, *args, **kargs):
"""send and receive using a bluetooth socket"""
if "port" in kargs:
s = conf.BTsocket(bt_address=bt_address, port=kargs.pop("port"))
else:
s = conf.BTsocket(bt_address=bt_address)
a, b = sndrcv(s, pkts, inter=inter, *args, **kargs)
... | [
"def",
"srbt",
"(",
"bt_address",
",",
"pkts",
",",
"inter",
"=",
"0.1",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"\"port\"",
"in",
"kargs",
":",
"s",
"=",
"conf",
".",
"BTsocket",
"(",
"bt_address",
"=",
"bt_address",
",",
"port",... | send and receive using a bluetooth socket | [
"send",
"and",
"receive",
"using",
"a",
"bluetooth",
"socket"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/bluetooth.py#L1458-L1466 | train | send and receive using a bluetooth socket | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/bluetooth.py | srbt1 | def srbt1(bt_address, pkts, *args, **kargs):
"""send and receive 1 packet using a bluetooth socket"""
a, b = srbt(bt_address, pkts, *args, **kargs)
if len(a) > 0:
return a[0][1] | python | def srbt1(bt_address, pkts, *args, **kargs):
"""send and receive 1 packet using a bluetooth socket"""
a, b = srbt(bt_address, pkts, *args, **kargs)
if len(a) > 0:
return a[0][1] | [
"def",
"srbt1",
"(",
"bt_address",
",",
"pkts",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"a",
",",
"b",
"=",
"srbt",
"(",
"bt_address",
",",
"pkts",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
"if",
"len",
"(",
"a",
")",
">",
... | send and receive 1 packet using a bluetooth socket | [
"send",
"and",
"receive",
"1",
"packet",
"using",
"a",
"bluetooth",
"socket"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/bluetooth.py#L1470-L1474 | train | send and receive 1 packet using bluetooth socket | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/bluetooth.py | EIR_Manufacturer_Specific_Data.register_magic_payload | def register_magic_payload(cls, payload_cls, magic_check=None):
"""
Registers a payload type that uses magic data.
Traditional payloads require registration of a Bluetooth Company ID
(requires company membership of the Bluetooth SIG), or a Bluetooth
Short UUID (requires a once-o... | python | def register_magic_payload(cls, payload_cls, magic_check=None):
"""
Registers a payload type that uses magic data.
Traditional payloads require registration of a Bluetooth Company ID
(requires company membership of the Bluetooth SIG), or a Bluetooth
Short UUID (requires a once-o... | [
"def",
"register_magic_payload",
"(",
"cls",
",",
"payload_cls",
",",
"magic_check",
"=",
"None",
")",
":",
"if",
"magic_check",
"is",
"None",
":",
"if",
"hasattr",
"(",
"payload_cls",
",",
"\"magic_check\"",
")",
":",
"magic_check",
"=",
"payload_cls",
".",
... | Registers a payload type that uses magic data.
Traditional payloads require registration of a Bluetooth Company ID
(requires company membership of the Bluetooth SIG), or a Bluetooth
Short UUID (requires a once-off payment).
There are alternatives which don't require registration (such ... | [
"Registers",
"a",
"payload",
"type",
"that",
"uses",
"magic",
"data",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/bluetooth.py#L707-L744 | train | Registers a payload type that uses magic data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/automotive/someip.py | SOMEIP._is_tp | def _is_tp(pkt):
"""Returns true if pkt is using SOMEIP-TP, else returns false."""
tp = [SOMEIP.TYPE_TP_REQUEST, SOMEIP.TYPE_TP_REQUEST_NO_RET,
SOMEIP.TYPE_TP_NOTIFICATION, SOMEIP.TYPE_TP_RESPONSE,
SOMEIP.TYPE_TP_ERROR]
if isinstance(pkt, Packet):
return ... | python | def _is_tp(pkt):
"""Returns true if pkt is using SOMEIP-TP, else returns false."""
tp = [SOMEIP.TYPE_TP_REQUEST, SOMEIP.TYPE_TP_REQUEST_NO_RET,
SOMEIP.TYPE_TP_NOTIFICATION, SOMEIP.TYPE_TP_RESPONSE,
SOMEIP.TYPE_TP_ERROR]
if isinstance(pkt, Packet):
return ... | [
"def",
"_is_tp",
"(",
"pkt",
")",
":",
"tp",
"=",
"[",
"SOMEIP",
".",
"TYPE_TP_REQUEST",
",",
"SOMEIP",
".",
"TYPE_TP_REQUEST_NO_RET",
",",
"SOMEIP",
".",
"TYPE_TP_NOTIFICATION",
",",
"SOMEIP",
".",
"TYPE_TP_RESPONSE",
",",
"SOMEIP",
".",
"TYPE_TP_ERROR",
"]",... | Returns true if pkt is using SOMEIP-TP, else returns false. | [
"Returns",
"true",
"if",
"pkt",
"is",
"using",
"SOMEIP",
"-",
"TP",
"else",
"returns",
"false",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/automotive/someip.py#L179-L188 | train | Returns true if pkt is using SOMEIP - TP else returns false. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/automotive/someip.py | SOMEIP.fragment | def fragment(self, fragsize=1392):
"""Fragment SOME/IP-TP"""
fnb = 0
fl = self
lst = list()
while fl.underlayer is not None:
fnb += 1
fl = fl.underlayer
for p in fl:
s = raw(p[fnb].payload)
nb = (len(s) + fragsize) // frags... | python | def fragment(self, fragsize=1392):
"""Fragment SOME/IP-TP"""
fnb = 0
fl = self
lst = list()
while fl.underlayer is not None:
fnb += 1
fl = fl.underlayer
for p in fl:
s = raw(p[fnb].payload)
nb = (len(s) + fragsize) // frags... | [
"def",
"fragment",
"(",
"self",
",",
"fragsize",
"=",
"1392",
")",
":",
"fnb",
"=",
"0",
"fl",
"=",
"self",
"lst",
"=",
"list",
"(",
")",
"while",
"fl",
".",
"underlayer",
"is",
"not",
"None",
":",
"fnb",
"+=",
"1",
"fl",
"=",
"fl",
".",
"under... | Fragment SOME/IP-TP | [
"Fragment",
"SOME",
"/",
"IP",
"-",
"TP"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/automotive/someip.py#L190-L216 | train | Fragment SOME IP - TP | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dot11.py | _next_radiotap_extpm | def _next_radiotap_extpm(pkt, lst, cur, s):
"""Generates the next RadioTapExtendedPresenceMask"""
if cur is None or (cur.present and cur.present.Ext):
st = len(lst) + (cur is not None)
return lambda *args: RadioTapExtendedPresenceMask(*args, index=st)
return None | python | def _next_radiotap_extpm(pkt, lst, cur, s):
"""Generates the next RadioTapExtendedPresenceMask"""
if cur is None or (cur.present and cur.present.Ext):
st = len(lst) + (cur is not None)
return lambda *args: RadioTapExtendedPresenceMask(*args, index=st)
return None | [
"def",
"_next_radiotap_extpm",
"(",
"pkt",
",",
"lst",
",",
"cur",
",",
"s",
")",
":",
"if",
"cur",
"is",
"None",
"or",
"(",
"cur",
".",
"present",
"and",
"cur",
".",
"present",
".",
"Ext",
")",
":",
"st",
"=",
"len",
"(",
"lst",
")",
"+",
"(",... | Generates the next RadioTapExtendedPresenceMask | [
"Generates",
"the",
"next",
"RadioTapExtendedPresenceMask"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dot11.py#L140-L145 | train | Generates the next RadioTapExtendedPresenceMask | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dot11.py | _Dot11NetStats.network_stats | def network_stats(self):
"""Return a dictionary containing a summary of the Dot11
elements fields
"""
summary = {}
crypto = set()
akmsuite_types = {
0x00: "Reserved",
0x01: "802.1X",
0x02: "PSK"
}
p = self.payload
... | python | def network_stats(self):
"""Return a dictionary containing a summary of the Dot11
elements fields
"""
summary = {}
crypto = set()
akmsuite_types = {
0x00: "Reserved",
0x01: "802.1X",
0x02: "PSK"
}
p = self.payload
... | [
"def",
"network_stats",
"(",
"self",
")",
":",
"summary",
"=",
"{",
"}",
"crypto",
"=",
"set",
"(",
")",
"akmsuite_types",
"=",
"{",
"0x00",
":",
"\"Reserved\"",
",",
"0x01",
":",
"\"802.1X\"",
",",
"0x02",
":",
"\"PSK\"",
"}",
"p",
"=",
"self",
".",... | Return a dictionary containing a summary of the Dot11
elements fields | [
"Return",
"a",
"dictionary",
"containing",
"a",
"summary",
"of",
"the",
"Dot11",
"elements",
"fields"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dot11.py#L619-L670 | train | Return a dictionary containing a summary of the Dot11 - related elements fields containing the Dot11 - related information. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/linux.py | get_alias_address | def get_alias_address(iface_name, ip_mask, gw_str, metric):
"""
Get the correct source IP address of an interface alias
"""
# Detect the architecture
if scapy.consts.IS_64BITS:
offset, name_len = 16, 40
else:
offset, name_len = 32, 32
# Retrieve interfaces structures
sc... | python | def get_alias_address(iface_name, ip_mask, gw_str, metric):
"""
Get the correct source IP address of an interface alias
"""
# Detect the architecture
if scapy.consts.IS_64BITS:
offset, name_len = 16, 40
else:
offset, name_len = 32, 32
# Retrieve interfaces structures
sc... | [
"def",
"get_alias_address",
"(",
"iface_name",
",",
"ip_mask",
",",
"gw_str",
",",
"metric",
")",
":",
"# Detect the architecture",
"if",
"scapy",
".",
"consts",
".",
"IS_64BITS",
":",
"offset",
",",
"name_len",
"=",
"16",
",",
"40",
"else",
":",
"offset",
... | Get the correct source IP address of an interface alias | [
"Get",
"the",
"correct",
"source",
"IP",
"address",
"of",
"an",
"interface",
"alias"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/linux.py#L153-L201 | train | Get the correct source IP address of an interface alias | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/linux.py | in6_getifaddr | def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'ifcace'.
This is the list of all addresses of all interfaces available on
the system.
"""
ret = []
try:
fdesc = open... | python | def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'ifcace'.
This is the list of all addresses of all interfaces available on
the system.
"""
ret = []
try:
fdesc = open... | [
"def",
"in6_getifaddr",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"try",
":",
"fdesc",
"=",
"open",
"(",
"\"/proc/net/if_inet6\"",
",",
"\"rb\"",
")",
"except",
"IOError",
":",
"return",
"ret",
"for",
"line",
"in",
"fdesc",
":",
"# addr, index, plen, scope, flags... | Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'ifcace'.
This is the list of all addresses of all interfaces available on
the system. | [
"Returns",
"a",
"list",
"of",
"3",
"-",
"tuples",
"of",
"the",
"form",
"(",
"addr",
"scope",
"iface",
")",
"where",
"addr",
"is",
"the",
"address",
"of",
"scope",
"scope",
"associated",
"to",
"the",
"interface",
"ifcace",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/linux.py#L276-L301 | train | Returns a list of 3 - tuples of the form addr scope iface | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/linux.py | get_iface_mode | def get_iface_mode(iface):
"""Return the interface mode.
params:
- iface: the iwconfig interface
"""
p = subprocess.Popen(["iwconfig", iface], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
output, err = p.communicate()
match = re.search(br"mode:([a-zA-Z]*)", out... | python | def get_iface_mode(iface):
"""Return the interface mode.
params:
- iface: the iwconfig interface
"""
p = subprocess.Popen(["iwconfig", iface], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
output, err = p.communicate()
match = re.search(br"mode:([a-zA-Z]*)", out... | [
"def",
"get_iface_mode",
"(",
"iface",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"iwconfig\"",
",",
"iface",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT",
")",
"output",
",",
"err... | Return the interface mode.
params:
- iface: the iwconfig interface | [
"Return",
"the",
"interface",
"mode",
".",
"params",
":",
"-",
"iface",
":",
"the",
"iwconfig",
"interface"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/linux.py#L386-L397 | train | Get the interface mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/linux.py | set_iface_monitor | def set_iface_monitor(iface, monitor):
"""Sets the monitor mode (or remove it) from an interface.
params:
- iface: the iwconfig interface
- monitor: True if the interface should be set in monitor mode,
False if it should be in managed mode
"""
mode = get_iface_mode(iface)
i... | python | def set_iface_monitor(iface, monitor):
"""Sets the monitor mode (or remove it) from an interface.
params:
- iface: the iwconfig interface
- monitor: True if the interface should be set in monitor mode,
False if it should be in managed mode
"""
mode = get_iface_mode(iface)
i... | [
"def",
"set_iface_monitor",
"(",
"iface",
",",
"monitor",
")",
":",
"mode",
"=",
"get_iface_mode",
"(",
"iface",
")",
"if",
"mode",
"==",
"\"unknown\"",
":",
"warning",
"(",
"\"Could not parse iwconfig !\"",
")",
"current_monitor",
"=",
"mode",
"==",
"\"monitor\... | Sets the monitor mode (or remove it) from an interface.
params:
- iface: the iwconfig interface
- monitor: True if the interface should be set in monitor mode,
False if it should be in managed mode | [
"Sets",
"the",
"monitor",
"mode",
"(",
"or",
"remove",
"it",
")",
"from",
"an",
"interface",
".",
"params",
":",
"-",
"iface",
":",
"the",
"iwconfig",
"interface",
"-",
"monitor",
":",
"True",
"if",
"the",
"interface",
"should",
"be",
"set",
"in",
"mon... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/linux.py#L400-L431 | train | Sets the monitor mode of an interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/linux.py | L2Socket.recv_raw | def recv_raw(self, x=MTU):
"""Receives a packet, then returns a tuple containing (cls, pkt_data, time)""" # noqa: E501
pkt, sa_ll = self.ins.recvfrom(x)
if self.outs and sa_ll[2] == socket.PACKET_OUTGOING:
return None, None, None
ts = get_last_packet_timestamp(self.ins)
... | python | def recv_raw(self, x=MTU):
"""Receives a packet, then returns a tuple containing (cls, pkt_data, time)""" # noqa: E501
pkt, sa_ll = self.ins.recvfrom(x)
if self.outs and sa_ll[2] == socket.PACKET_OUTGOING:
return None, None, None
ts = get_last_packet_timestamp(self.ins)
... | [
"def",
"recv_raw",
"(",
"self",
",",
"x",
"=",
"MTU",
")",
":",
"# noqa: E501",
"pkt",
",",
"sa_ll",
"=",
"self",
".",
"ins",
".",
"recvfrom",
"(",
"x",
")",
"if",
"self",
".",
"outs",
"and",
"sa_ll",
"[",
"2",
"]",
"==",
"socket",
".",
"PACKET_O... | Receives a packet, then returns a tuple containing (cls, pkt_data, time) | [
"Receives",
"a",
"packet",
"then",
"returns",
"a",
"tuple",
"containing",
"(",
"cls",
"pkt_data",
"time",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/linux.py#L484-L490 | train | Receives a packet then returns a tuple containing the class and the packet data and the time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | isBPFSocket | def isBPFSocket(obj):
"""Return True is obj is a BPF Super Socket"""
return isinstance(obj, L2bpfListenSocket) or isinstance(obj, L2bpfListenSocket) or isinstance(obj, L3bpfSocket) | python | def isBPFSocket(obj):
"""Return True is obj is a BPF Super Socket"""
return isinstance(obj, L2bpfListenSocket) or isinstance(obj, L2bpfListenSocket) or isinstance(obj, L3bpfSocket) | [
"def",
"isBPFSocket",
"(",
"obj",
")",
":",
"return",
"isinstance",
"(",
"obj",
",",
"L2bpfListenSocket",
")",
"or",
"isinstance",
"(",
"obj",
",",
"L2bpfListenSocket",
")",
"or",
"isinstance",
"(",
"obj",
",",
"L3bpfSocket",
")"
] | Return True is obj is a BPF Super Socket | [
"Return",
"True",
"is",
"obj",
"is",
"a",
"BPF",
"Super",
"Socket"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L364-L366 | train | Return True is obj is a BPF Super Socket | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | bpf_select | def bpf_select(fds_list, timeout=None):
"""A call to recv() can return several frames. This functions hides the fact
that some frames are read from the internal buffer."""
# Check file descriptors types
bpf_scks_buffered = list()
select_fds = list()
for tmp_fd in fds_list:
# Specif... | python | def bpf_select(fds_list, timeout=None):
"""A call to recv() can return several frames. This functions hides the fact
that some frames are read from the internal buffer."""
# Check file descriptors types
bpf_scks_buffered = list()
select_fds = list()
for tmp_fd in fds_list:
# Specif... | [
"def",
"bpf_select",
"(",
"fds_list",
",",
"timeout",
"=",
"None",
")",
":",
"# Check file descriptors types",
"bpf_scks_buffered",
"=",
"list",
"(",
")",
"select_fds",
"=",
"list",
"(",
")",
"for",
"tmp_fd",
"in",
"fds_list",
":",
"# Specific BPF sockets: get buf... | A call to recv() can return several frames. This functions hides the fact
that some frames are read from the internal buffer. | [
"A",
"call",
"to",
"recv",
"()",
"can",
"return",
"several",
"frames",
".",
"This",
"functions",
"hides",
"the",
"fact",
"that",
"some",
"frames",
"are",
"read",
"from",
"the",
"internal",
"buffer",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L369-L394 | train | A call to recv can return several frames. This function returns several frames. This function returns several frames. This function returns several frames. This function returns several frames. This function returns several frames. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | _L2bpfSocket.set_promisc | def set_promisc(self, value):
"""Set the interface in promiscuous mode"""
try:
fcntl.ioctl(self.ins, BIOCPROMISC, struct.pack('i', value))
except IOError:
raise Scapy_Exception("Cannot set promiscuous mode on interface "
"(%s)!" % self.i... | python | def set_promisc(self, value):
"""Set the interface in promiscuous mode"""
try:
fcntl.ioctl(self.ins, BIOCPROMISC, struct.pack('i', value))
except IOError:
raise Scapy_Exception("Cannot set promiscuous mode on interface "
"(%s)!" % self.i... | [
"def",
"set_promisc",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"fcntl",
".",
"ioctl",
"(",
"self",
".",
"ins",
",",
"BIOCPROMISC",
",",
"struct",
".",
"pack",
"(",
"'i'",
",",
"value",
")",
")",
"except",
"IOError",
":",
"raise",
"Scapy_Excep... | Set the interface in promiscuous mode | [
"Set",
"the",
"interface",
"in",
"promiscuous",
"mode"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L118-L125 | train | Set the interface in promiscuous mode | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | _L2bpfSocket.guess_cls | def guess_cls(self):
"""Guess the packet class that must be used on the interface"""
# Get the data link type
try:
ret = fcntl.ioctl(self.ins, BIOCGDLT, struct.pack('I', 0))
ret = struct.unpack('I', ret)[0]
except IOError:
cls = conf.default_l2
... | python | def guess_cls(self):
"""Guess the packet class that must be used on the interface"""
# Get the data link type
try:
ret = fcntl.ioctl(self.ins, BIOCGDLT, struct.pack('I', 0))
ret = struct.unpack('I', ret)[0]
except IOError:
cls = conf.default_l2
... | [
"def",
"guess_cls",
"(",
"self",
")",
":",
"# Get the data link type",
"try",
":",
"ret",
"=",
"fcntl",
".",
"ioctl",
"(",
"self",
".",
"ins",
",",
"BIOCGDLT",
",",
"struct",
".",
"pack",
"(",
"'I'",
",",
"0",
")",
")",
"ret",
"=",
"struct",
".",
"... | Guess the packet class that must be used on the interface | [
"Guess",
"the",
"packet",
"class",
"that",
"must",
"be",
"used",
"on",
"the",
"interface"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L134-L152 | train | Guess the packet class that must be used on the interface | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | _L2bpfSocket.set_nonblock | def set_nonblock(self, set_flag=True):
"""Set the non blocking flag on the socket"""
# Get the current flags
if self.fd_flags is None:
try:
self.fd_flags = fcntl.fcntl(self.ins, fcntl.F_GETFL)
except IOError:
warning("Cannot get flags on t... | python | def set_nonblock(self, set_flag=True):
"""Set the non blocking flag on the socket"""
# Get the current flags
if self.fd_flags is None:
try:
self.fd_flags = fcntl.fcntl(self.ins, fcntl.F_GETFL)
except IOError:
warning("Cannot get flags on t... | [
"def",
"set_nonblock",
"(",
"self",
",",
"set_flag",
"=",
"True",
")",
":",
"# Get the current flags",
"if",
"self",
".",
"fd_flags",
"is",
"None",
":",
"try",
":",
"self",
".",
"fd_flags",
"=",
"fcntl",
".",
"fcntl",
"(",
"self",
".",
"ins",
",",
"fcn... | Set the non blocking flag on the socket | [
"Set",
"the",
"non",
"blocking",
"flag",
"on",
"the",
"socket"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L154-L175 | train | Set the non blocking flag on the socket | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | _L2bpfSocket.get_stats | def get_stats(self):
"""Get received / dropped statistics"""
try:
ret = fcntl.ioctl(self.ins, BIOCGSTATS, struct.pack("2I", 0, 0))
return struct.unpack("2I", ret)
except IOError:
warning("Unable to get stats from BPF !")
return (None, None) | python | def get_stats(self):
"""Get received / dropped statistics"""
try:
ret = fcntl.ioctl(self.ins, BIOCGSTATS, struct.pack("2I", 0, 0))
return struct.unpack("2I", ret)
except IOError:
warning("Unable to get stats from BPF !")
return (None, None) | [
"def",
"get_stats",
"(",
"self",
")",
":",
"try",
":",
"ret",
"=",
"fcntl",
".",
"ioctl",
"(",
"self",
".",
"ins",
",",
"BIOCGSTATS",
",",
"struct",
".",
"pack",
"(",
"\"2I\"",
",",
"0",
",",
"0",
")",
")",
"return",
"struct",
".",
"unpack",
"(",... | Get received / dropped statistics | [
"Get",
"received",
"/",
"dropped",
"statistics"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L177-L185 | train | Get received and dropped statistics from the BPF. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | _L2bpfSocket.get_blen | def get_blen(self):
"""Get the BPF buffer length"""
try:
ret = fcntl.ioctl(self.ins, BIOCGBLEN, struct.pack("I", 0))
return struct.unpack("I", ret)[0]
except IOError:
warning("Unable to get the BPF buffer length")
return | python | def get_blen(self):
"""Get the BPF buffer length"""
try:
ret = fcntl.ioctl(self.ins, BIOCGBLEN, struct.pack("I", 0))
return struct.unpack("I", ret)[0]
except IOError:
warning("Unable to get the BPF buffer length")
return | [
"def",
"get_blen",
"(",
"self",
")",
":",
"try",
":",
"ret",
"=",
"fcntl",
".",
"ioctl",
"(",
"self",
".",
"ins",
",",
"BIOCGBLEN",
",",
"struct",
".",
"pack",
"(",
"\"I\"",
",",
"0",
")",
")",
"return",
"struct",
".",
"unpack",
"(",
"\"I\"",
","... | Get the BPF buffer length | [
"Get",
"the",
"BPF",
"buffer",
"length"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L187-L195 | train | Get the length of the BPF buffer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | _L2bpfSocket.close | def close(self):
"""Close the Super Socket"""
if not self.closed and self.ins is not None:
os.close(self.ins)
self.closed = True
self.ins = None | python | def close(self):
"""Close the Super Socket"""
if not self.closed and self.ins is not None:
os.close(self.ins)
self.closed = True
self.ins = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"closed",
"and",
"self",
".",
"ins",
"is",
"not",
"None",
":",
"os",
".",
"close",
"(",
"self",
".",
"ins",
")",
"self",
".",
"closed",
"=",
"True",
"self",
".",
"ins",
"=",
"None... | Close the Super Socket | [
"Close",
"the",
"Super",
"Socket"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L201-L207 | train | Close the Super Socket | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | L2bpfListenSocket.extract_frames | def extract_frames(self, bpf_buffer):
"""Extract all frames from the buffer and stored them in the received list.""" # noqa: E501
# Ensure that the BPF buffer contains at least the header
len_bb = len(bpf_buffer)
if len_bb < 20: # Note: 20 == sizeof(struct bfp_hdr)
return
... | python | def extract_frames(self, bpf_buffer):
"""Extract all frames from the buffer and stored them in the received list.""" # noqa: E501
# Ensure that the BPF buffer contains at least the header
len_bb = len(bpf_buffer)
if len_bb < 20: # Note: 20 == sizeof(struct bfp_hdr)
return
... | [
"def",
"extract_frames",
"(",
"self",
",",
"bpf_buffer",
")",
":",
"# noqa: E501",
"# Ensure that the BPF buffer contains at least the header",
"len_bb",
"=",
"len",
"(",
"bpf_buffer",
")",
"if",
"len_bb",
"<",
"20",
":",
"# Note: 20 == sizeof(struct bfp_hdr)",
"return",
... | Extract all frames from the buffer and stored them in the received list. | [
"Extract",
"all",
"frames",
"from",
"the",
"buffer",
"and",
"stored",
"them",
"in",
"the",
"received",
"list",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L249-L287 | train | Extract all frames from the buffer and store them in the received_frames list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | L2bpfListenSocket.recv | def recv(self, x=BPF_BUFFER_LENGTH):
"""Receive a frame from the network"""
if self.buffered_frames():
# Get a frame from the buffer
return self.get_frame()
# Get data from BPF
try:
bpf_buffer = os.read(self.ins, x)
except EnvironmentError as... | python | def recv(self, x=BPF_BUFFER_LENGTH):
"""Receive a frame from the network"""
if self.buffered_frames():
# Get a frame from the buffer
return self.get_frame()
# Get data from BPF
try:
bpf_buffer = os.read(self.ins, x)
except EnvironmentError as... | [
"def",
"recv",
"(",
"self",
",",
"x",
"=",
"BPF_BUFFER_LENGTH",
")",
":",
"if",
"self",
".",
"buffered_frames",
"(",
")",
":",
"# Get a frame from the buffer",
"return",
"self",
".",
"get_frame",
"(",
")",
"# Get data from BPF",
"try",
":",
"bpf_buffer",
"=",
... | Receive a frame from the network | [
"Receive",
"a",
"frame",
"from",
"the",
"network"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L289-L306 | train | Receive a single frame from the network | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | L2bpfSocket.nonblock_recv | def nonblock_recv(self):
"""Non blocking receive"""
if self.buffered_frames():
# Get a frame from the buffer
return self.get_frame()
# Set the non blocking flag, read from the socket, and unset the flag
self.set_nonblock(True)
pkt = L2bpfListenSocket.rec... | python | def nonblock_recv(self):
"""Non blocking receive"""
if self.buffered_frames():
# Get a frame from the buffer
return self.get_frame()
# Set the non blocking flag, read from the socket, and unset the flag
self.set_nonblock(True)
pkt = L2bpfListenSocket.rec... | [
"def",
"nonblock_recv",
"(",
"self",
")",
":",
"if",
"self",
".",
"buffered_frames",
"(",
")",
":",
"# Get a frame from the buffer",
"return",
"self",
".",
"get_frame",
"(",
")",
"# Set the non blocking flag, read from the socket, and unset the flag",
"self",
".",
"set_... | Non blocking receive | [
"Non",
"blocking",
"receive"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L316-L327 | train | Non blocking receive | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | L3bpfSocket.get_frame | def get_frame(self):
"""Get a frame or packet from the received list"""
pkt = super(L3bpfSocket, self).get_frame()
if pkt is not None:
return pkt.payload | python | def get_frame(self):
"""Get a frame or packet from the received list"""
pkt = super(L3bpfSocket, self).get_frame()
if pkt is not None:
return pkt.payload | [
"def",
"get_frame",
"(",
"self",
")",
":",
"pkt",
"=",
"super",
"(",
"L3bpfSocket",
",",
"self",
")",
".",
"get_frame",
"(",
")",
"if",
"pkt",
"is",
"not",
"None",
":",
"return",
"pkt",
".",
"payload"
] | Get a frame or packet from the received list | [
"Get",
"a",
"frame",
"or",
"packet",
"from",
"the",
"received",
"list"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L332-L336 | train | Get a frame or packet from the received list | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/supersocket.py | L3bpfSocket.send | def send(self, pkt):
"""Send a packet"""
# Use the routing table to find the output interface
iff = pkt.route()[0]
if iff is None:
iff = conf.iface
# Assign the network interface to the BPF handle
if self.assigned_interface != iff:
try:
... | python | def send(self, pkt):
"""Send a packet"""
# Use the routing table to find the output interface
iff = pkt.route()[0]
if iff is None:
iff = conf.iface
# Assign the network interface to the BPF handle
if self.assigned_interface != iff:
try:
... | [
"def",
"send",
"(",
"self",
",",
"pkt",
")",
":",
"# Use the routing table to find the output interface",
"iff",
"=",
"pkt",
".",
"route",
"(",
")",
"[",
"0",
"]",
"if",
"iff",
"is",
"None",
":",
"iff",
"=",
"conf",
".",
"iface",
"# Assign the network interf... | Send a packet | [
"Send",
"a",
"packet"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/supersocket.py#L338-L359 | train | Send a packet to the BPF | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake_sslv2.py | _SSLv2Handshake.tls_session_update | def tls_session_update(self, msg_str):
"""
Covers both post_build- and post_dissection- context updates.
"""
self.tls_session.handshake_messages.append(msg_str)
self.tls_session.handshake_messages_parsed.append(self) | python | def tls_session_update(self, msg_str):
"""
Covers both post_build- and post_dissection- context updates.
"""
self.tls_session.handshake_messages.append(msg_str)
self.tls_session.handshake_messages_parsed.append(self) | [
"def",
"tls_session_update",
"(",
"self",
",",
"msg_str",
")",
":",
"self",
".",
"tls_session",
".",
"handshake_messages",
".",
"append",
"(",
"msg_str",
")",
"self",
".",
"tls_session",
".",
"handshake_messages_parsed",
".",
"append",
"(",
"self",
")"
] | Covers both post_build- and post_dissection- context updates. | [
"Covers",
"both",
"post_build",
"-",
"and",
"post_dissection",
"-",
"context",
"updates",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake_sslv2.py#L52-L57 | train | Add a message to the list of TLS session messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/handshake_sslv2.py | SSLv2ServerHello.tls_session_update | def tls_session_update(self, msg_str):
"""
XXX Something should be done about the session ID here.
"""
super(SSLv2ServerHello, self).tls_session_update(msg_str)
s = self.tls_session
client_cs = s.sslv2_common_cs
css = [cs for cs in client_cs if cs in self.ciphers... | python | def tls_session_update(self, msg_str):
"""
XXX Something should be done about the session ID here.
"""
super(SSLv2ServerHello, self).tls_session_update(msg_str)
s = self.tls_session
client_cs = s.sslv2_common_cs
css = [cs for cs in client_cs if cs in self.ciphers... | [
"def",
"tls_session_update",
"(",
"self",
",",
"msg_str",
")",
":",
"super",
"(",
"SSLv2ServerHello",
",",
"self",
")",
".",
"tls_session_update",
"(",
"msg_str",
")",
"s",
"=",
"self",
".",
"tls_session",
"client_cs",
"=",
"s",
".",
"sslv2_common_cs",
"css"... | XXX Something should be done about the session ID here. | [
"XXX",
"Something",
"should",
"be",
"done",
"about",
"the",
"session",
"ID",
"here",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/handshake_sslv2.py#L186-L199 | train | Update the TLS session with the new message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/base_classes.py | _get_values | def _get_values(value):
"""Generate a range object from (start, stop[, step]) tuples, or
return value.
"""
if (isinstance(value, tuple) and (2 <= len(value) <= 3) and
all(hasattr(i, "__int__") for i in value)):
# We use values[1] + 1 as stop value for (x)range to maintain
# ... | python | def _get_values(value):
"""Generate a range object from (start, stop[, step]) tuples, or
return value.
"""
if (isinstance(value, tuple) and (2 <= len(value) <= 3) and
all(hasattr(i, "__int__") for i in value)):
# We use values[1] + 1 as stop value for (x)range to maintain
# ... | [
"def",
"_get_values",
"(",
"value",
")",
":",
"if",
"(",
"isinstance",
"(",
"value",
",",
"tuple",
")",
"and",
"(",
"2",
"<=",
"len",
"(",
"value",
")",
"<=",
"3",
")",
"and",
"all",
"(",
"hasattr",
"(",
"i",
",",
"\"__int__\"",
")",
"for",
"i",
... | Generate a range object from (start, stop[, step]) tuples, or
return value. | [
"Generate",
"a",
"range",
"object",
"from",
"(",
"start",
"stop",
"[",
"step",
"]",
")",
"tuples",
"or",
"return",
"value",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/base_classes.py#L39-L50 | train | Generate a range object from start stop tuple and or
tuple. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/base_classes.py | _CanvasDumpExtended.psdump | def psdump(self, filename=None, **kargs):
"""
psdump(filename=None, layer_shift=0, rebuild=1)
Creates an EPS file describing a packet. If filename is not provided a
temporary file is created and gs is called.
:param filename: the file's filename
"""
from scapy.c... | python | def psdump(self, filename=None, **kargs):
"""
psdump(filename=None, layer_shift=0, rebuild=1)
Creates an EPS file describing a packet. If filename is not provided a
temporary file is created and gs is called.
:param filename: the file's filename
"""
from scapy.c... | [
"def",
"psdump",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"from",
"scapy",
".",
"config",
"import",
"conf",
"from",
"scapy",
".",
"utils",
"import",
"get_temp_file",
",",
"ContextManagerSubprocess",
"canvas",
"=",
"self"... | psdump(filename=None, layer_shift=0, rebuild=1)
Creates an EPS file describing a packet. If filename is not provided a
temporary file is created and gs is called.
:param filename: the file's filename | [
"psdump",
"(",
"filename",
"=",
"None",
"layer_shift",
"=",
"0",
"rebuild",
"=",
"1",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/base_classes.py#L305-L327 | train | Dump the current state of the current state of the EPS file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/base_classes.py | _CanvasDumpExtended.pdfdump | def pdfdump(self, filename=None, **kargs):
"""
pdfdump(filename=None, layer_shift=0, rebuild=1)
Creates a PDF file describing a packet. If filename is not provided a
temporary file is created and xpdf is called.
:param filename: the file's filename
"""
from scap... | python | def pdfdump(self, filename=None, **kargs):
"""
pdfdump(filename=None, layer_shift=0, rebuild=1)
Creates a PDF file describing a packet. If filename is not provided a
temporary file is created and xpdf is called.
:param filename: the file's filename
"""
from scap... | [
"def",
"pdfdump",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"from",
"scapy",
".",
"config",
"import",
"conf",
"from",
"scapy",
".",
"utils",
"import",
"get_temp_file",
",",
"ContextManagerSubprocess",
"canvas",
"=",
"self... | pdfdump(filename=None, layer_shift=0, rebuild=1)
Creates a PDF file describing a packet. If filename is not provided a
temporary file is created and xpdf is called.
:param filename: the file's filename | [
"pdfdump",
"(",
"filename",
"=",
"None",
"layer_shift",
"=",
"0",
"rebuild",
"=",
"1",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/base_classes.py#L329-L352 | train | Create a PDF file describing a packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/base_classes.py | _CanvasDumpExtended.svgdump | def svgdump(self, filename=None, **kargs):
"""
svgdump(filename=None, layer_shift=0, rebuild=1)
Creates an SVG file describing a packet. If filename is not provided a
temporary file is created and gs is called.
:param filename: the file's filename
"""
from scapy... | python | def svgdump(self, filename=None, **kargs):
"""
svgdump(filename=None, layer_shift=0, rebuild=1)
Creates an SVG file describing a packet. If filename is not provided a
temporary file is created and gs is called.
:param filename: the file's filename
"""
from scapy... | [
"def",
"svgdump",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"from",
"scapy",
".",
"config",
"import",
"conf",
"from",
"scapy",
".",
"utils",
"import",
"get_temp_file",
",",
"ContextManagerSubprocess",
"canvas",
"=",
"self... | svgdump(filename=None, layer_shift=0, rebuild=1)
Creates an SVG file describing a packet. If filename is not provided a
temporary file is created and gs is called.
:param filename: the file's filename | [
"svgdump",
"(",
"filename",
"=",
"None",
"layer_shift",
"=",
"0",
"rebuild",
"=",
"1",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/base_classes.py#L354-L377 | train | This function creates an SVG file describing a packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | setup.py | get_long_description | def get_long_description():
"""Extract description from README.md, for PyPI's usage"""
try:
fpath = os.path.join(os.path.dirname(__file__), "README.md")
with io.open(fpath, encoding="utf-8") as f:
readme = f.read()
desc = readme.partition("<!-- start_ppi_description -->")... | python | def get_long_description():
"""Extract description from README.md, for PyPI's usage"""
try:
fpath = os.path.join(os.path.dirname(__file__), "README.md")
with io.open(fpath, encoding="utf-8") as f:
readme = f.read()
desc = readme.partition("<!-- start_ppi_description -->")... | [
"def",
"get_long_description",
"(",
")",
":",
"try",
":",
"fpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"\"README.md\"",
")",
"with",
"io",
".",
"open",
"(",
"fpath",
",",
"encoding",... | Extract description from README.md, for PyPI's usage | [
"Extract",
"description",
"from",
"README",
".",
"md",
"for",
"PyPI",
"s",
"usage"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/setup.py#L15-L25 | train | Extract description from README. md for PyPI s usage | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/cdp.py | _CDPChecksum._check_len | def _check_len(self, pkt):
"""Check for odd packet length and pad according to Cisco spec.
This padding is only used for checksum computation. The original
packet should not be altered."""
if len(pkt) % 2:
last_chr = pkt[-1]
if last_chr <= b'\x80':
... | python | def _check_len(self, pkt):
"""Check for odd packet length and pad according to Cisco spec.
This padding is only used for checksum computation. The original
packet should not be altered."""
if len(pkt) % 2:
last_chr = pkt[-1]
if last_chr <= b'\x80':
... | [
"def",
"_check_len",
"(",
"self",
",",
"pkt",
")",
":",
"if",
"len",
"(",
"pkt",
")",
"%",
"2",
":",
"last_chr",
"=",
"pkt",
"[",
"-",
"1",
"]",
"if",
"last_chr",
"<=",
"b'\\x80'",
":",
"return",
"pkt",
"[",
":",
"-",
"1",
"]",
"+",
"b'\\x00'",... | Check for odd packet length and pad according to Cisco spec.
This padding is only used for checksum computation. The original
packet should not be altered. | [
"Check",
"for",
"odd",
"packet",
"length",
"and",
"pad",
"according",
"to",
"Cisco",
"spec",
".",
"This",
"padding",
"is",
"only",
"used",
"for",
"checksum",
"computation",
".",
"The",
"original",
"packet",
"should",
"not",
"be",
"altered",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/cdp.py#L355-L366 | train | Check for odd packet length and pad according to Cisco spec. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/crypto/pkcs1.py | _legacy_pkcs1_v1_5_encode_md5_sha1 | def _legacy_pkcs1_v1_5_encode_md5_sha1(M, emLen):
"""
Legacy method for PKCS1 v1.5 encoding with MD5-SHA1 hash.
"""
M = bytes_encode(M)
md5_hash = hashes.Hash(_get_hash("md5"), backend=default_backend())
md5_hash.update(M)
sha1_hash = hashes.Hash(_get_hash("sha1"), backend=default_backend())... | python | def _legacy_pkcs1_v1_5_encode_md5_sha1(M, emLen):
"""
Legacy method for PKCS1 v1.5 encoding with MD5-SHA1 hash.
"""
M = bytes_encode(M)
md5_hash = hashes.Hash(_get_hash("md5"), backend=default_backend())
md5_hash.update(M)
sha1_hash = hashes.Hash(_get_hash("sha1"), backend=default_backend())... | [
"def",
"_legacy_pkcs1_v1_5_encode_md5_sha1",
"(",
"M",
",",
"emLen",
")",
":",
"M",
"=",
"bytes_encode",
"(",
"M",
")",
"md5_hash",
"=",
"hashes",
".",
"Hash",
"(",
"_get_hash",
"(",
"\"md5\"",
")",
",",
"backend",
"=",
"default_backend",
"(",
")",
")",
... | Legacy method for PKCS1 v1.5 encoding with MD5-SHA1 hash. | [
"Legacy",
"method",
"for",
"PKCS1",
"v1",
".",
"5",
"encoding",
"with",
"MD5",
"-",
"SHA1",
"hash",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/pkcs1.py#L72-L87 | train | Legacy method for PKCS1 v1. 5 encoding with MD5 - SHA1 hash. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dhcp.py | dhcp_request | def dhcp_request(iface=None, **kargs):
"""Send a DHCP discover request and return the answer"""
if conf.checkIPaddr != 0:
warning("conf.checkIPaddr is not 0, I may not be able to match the answer") # noqa: E501
if iface is None:
iface = conf.iface
fam, hw = get_if_raw_hwaddr(iface)
... | python | def dhcp_request(iface=None, **kargs):
"""Send a DHCP discover request and return the answer"""
if conf.checkIPaddr != 0:
warning("conf.checkIPaddr is not 0, I may not be able to match the answer") # noqa: E501
if iface is None:
iface = conf.iface
fam, hw = get_if_raw_hwaddr(iface)
... | [
"def",
"dhcp_request",
"(",
"iface",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"conf",
".",
"checkIPaddr",
"!=",
"0",
":",
"warning",
"(",
"\"conf.checkIPaddr is not 0, I may not be able to match the answer\"",
")",
"# noqa: E501",
"if",
"iface",
"is",
... | Send a DHCP discover request and return the answer | [
"Send",
"a",
"DHCP",
"discover",
"request",
"and",
"return",
"the",
"answer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dhcp.py#L347-L355 | train | Send a DHCP discover request and return the answer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/themes.py | apply_ipython_style | def apply_ipython_style(shell):
"""Updates the specified IPython console shell with
the conf.color_theme scapy theme."""
try:
from IPython.terminal.prompts import Prompts, Token
except Exception:
from scapy.error import log_loading
log_loading.warning(
"IPython too ol... | python | def apply_ipython_style(shell):
"""Updates the specified IPython console shell with
the conf.color_theme scapy theme."""
try:
from IPython.terminal.prompts import Prompts, Token
except Exception:
from scapy.error import log_loading
log_loading.warning(
"IPython too ol... | [
"def",
"apply_ipython_style",
"(",
"shell",
")",
":",
"try",
":",
"from",
"IPython",
".",
"terminal",
".",
"prompts",
"import",
"Prompts",
",",
"Token",
"except",
"Exception",
":",
"from",
"scapy",
".",
"error",
"import",
"log_loading",
"log_loading",
".",
"... | Updates the specified IPython console shell with
the conf.color_theme scapy theme. | [
"Updates",
"the",
"specified",
"IPython",
"console",
"shell",
"with",
"the",
"conf",
".",
"color_theme",
"scapy",
"theme",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/themes.py#L328-L397 | train | Updates the specified IPython console shell with the specified conf. color_theme scapy theme. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableObject._wait_non_ressources | def _wait_non_ressources(self, callback):
"""This get started as a thread, and waits for the data lock to be freed then advertise itself to the SelectableSelector using the callback""" # noqa: E501
self.trigger = threading.Lock()
self.was_ended = False
self.trigger.acquire()
sel... | python | def _wait_non_ressources(self, callback):
"""This get started as a thread, and waits for the data lock to be freed then advertise itself to the SelectableSelector using the callback""" # noqa: E501
self.trigger = threading.Lock()
self.was_ended = False
self.trigger.acquire()
sel... | [
"def",
"_wait_non_ressources",
"(",
"self",
",",
"callback",
")",
":",
"# noqa: E501",
"self",
".",
"trigger",
"=",
"threading",
".",
"Lock",
"(",
")",
"self",
".",
"was_ended",
"=",
"False",
"self",
".",
"trigger",
".",
"acquire",
"(",
")",
"self",
".",... | This get started as a thread, and waits for the data lock to be freed then advertise itself to the SelectableSelector using the callback | [
"This",
"get",
"started",
"as",
"a",
"thread",
"and",
"waits",
"for",
"the",
"data",
"lock",
"to",
"be",
"freed",
"then",
"advertise",
"itself",
"to",
"the",
"SelectableSelector",
"using",
"the",
"callback"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L87-L94 | train | This method is used to wait for non -ressources to be released and advertise itself to the SelectableSelector using the callback | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableObject.wait_return | def wait_return(self, callback):
"""Entry point of SelectableObject: register the callback"""
if self.check_recv():
return callback(self)
_t = threading.Thread(target=self._wait_non_ressources, args=(callback,)) # noqa: E501
_t.setDaemon(True)
_t.start() | python | def wait_return(self, callback):
"""Entry point of SelectableObject: register the callback"""
if self.check_recv():
return callback(self)
_t = threading.Thread(target=self._wait_non_ressources, args=(callback,)) # noqa: E501
_t.setDaemon(True)
_t.start() | [
"def",
"wait_return",
"(",
"self",
",",
"callback",
")",
":",
"if",
"self",
".",
"check_recv",
"(",
")",
":",
"return",
"callback",
"(",
"self",
")",
"_t",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"_wait_non_ressources",
",",
"... | Entry point of SelectableObject: register the callback | [
"Entry",
"point",
"of",
"SelectableObject",
":",
"register",
"the",
"callback"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L96-L102 | train | Entry point of SelectableObject : register the callback | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableObject.call_release | def call_release(self, arborted=False):
"""DEV: Must be call when the object becomes ready to read.
Relesases the lock of _wait_non_ressources"""
self.was_ended = arborted
try:
self.trigger.release()
except (threading.ThreadError, AttributeError):
pass | python | def call_release(self, arborted=False):
"""DEV: Must be call when the object becomes ready to read.
Relesases the lock of _wait_non_ressources"""
self.was_ended = arborted
try:
self.trigger.release()
except (threading.ThreadError, AttributeError):
pass | [
"def",
"call_release",
"(",
"self",
",",
"arborted",
"=",
"False",
")",
":",
"self",
".",
"was_ended",
"=",
"arborted",
"try",
":",
"self",
".",
"trigger",
".",
"release",
"(",
")",
"except",
"(",
"threading",
".",
"ThreadError",
",",
"AttributeError",
"... | DEV: Must be call when the object becomes ready to read.
Relesases the lock of _wait_non_ressources | [
"DEV",
":",
"Must",
"be",
"call",
"when",
"the",
"object",
"becomes",
"ready",
"to",
"read",
".",
"Relesases",
"the",
"lock",
"of",
"_wait_non_ressources"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L104-L111 | train | Release the lock of the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableSelector._release_all | def _release_all(self):
"""Releases all locks to kill all threads"""
for i in self.inputs:
i.call_release(True)
self.available_lock.release() | python | def _release_all(self):
"""Releases all locks to kill all threads"""
for i in self.inputs:
i.call_release(True)
self.available_lock.release() | [
"def",
"_release_all",
"(",
"self",
")",
":",
"for",
"i",
"in",
"self",
".",
"inputs",
":",
"i",
".",
"call_release",
"(",
"True",
")",
"self",
".",
"available_lock",
".",
"release",
"(",
")"
] | Releases all locks to kill all threads | [
"Releases",
"all",
"locks",
"to",
"kill",
"all",
"threads"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L123-L127 | train | Releases all locks to kill all threads | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableSelector._timeout_thread | def _timeout_thread(self, remain):
"""Timeout before releasing every thing, if nothing was returned"""
time.sleep(remain)
if not self._ended:
self._ended = True
self._release_all() | python | def _timeout_thread(self, remain):
"""Timeout before releasing every thing, if nothing was returned"""
time.sleep(remain)
if not self._ended:
self._ended = True
self._release_all() | [
"def",
"_timeout_thread",
"(",
"self",
",",
"remain",
")",
":",
"time",
".",
"sleep",
"(",
"remain",
")",
"if",
"not",
"self",
".",
"_ended",
":",
"self",
".",
"_ended",
"=",
"True",
"self",
".",
"_release_all",
"(",
")"
] | Timeout before releasing every thing, if nothing was returned | [
"Timeout",
"before",
"releasing",
"every",
"thing",
"if",
"nothing",
"was",
"returned"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L129-L134 | train | Timeout before releasing every thing | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableSelector._exit_door | def _exit_door(self, _input):
"""This function is passed to each SelectableObject as a callback
The SelectableObjects have to call it once there are ready"""
self.results.append(_input)
if self._ended:
return
self._ended = True
self._release_all() | python | def _exit_door(self, _input):
"""This function is passed to each SelectableObject as a callback
The SelectableObjects have to call it once there are ready"""
self.results.append(_input)
if self._ended:
return
self._ended = True
self._release_all() | [
"def",
"_exit_door",
"(",
"self",
",",
"_input",
")",
":",
"self",
".",
"results",
".",
"append",
"(",
"_input",
")",
"if",
"self",
".",
"_ended",
":",
"return",
"self",
".",
"_ended",
"=",
"True",
"self",
".",
"_release_all",
"(",
")"
] | This function is passed to each SelectableObject as a callback
The SelectableObjects have to call it once there are ready | [
"This",
"function",
"is",
"passed",
"to",
"each",
"SelectableObject",
"as",
"a",
"callback",
"The",
"SelectableObjects",
"have",
"to",
"call",
"it",
"once",
"there",
"are",
"ready"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L136-L143 | train | This function is called when the SelectableObject is ready to be used to exit the door. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/automaton.py | SelectableSelector.process | def process(self):
"""Entry point of SelectableSelector"""
if WINDOWS:
select_inputs = []
for i in self.inputs:
if not isinstance(i, SelectableObject):
warning("Unknown ignored object type: %s", type(i))
elif i.__selectable_forc... | python | def process(self):
"""Entry point of SelectableSelector"""
if WINDOWS:
select_inputs = []
for i in self.inputs:
if not isinstance(i, SelectableObject):
warning("Unknown ignored object type: %s", type(i))
elif i.__selectable_forc... | [
"def",
"process",
"(",
"self",
")",
":",
"if",
"WINDOWS",
":",
"select_inputs",
"=",
"[",
"]",
"for",
"i",
"in",
"self",
".",
"inputs",
":",
"if",
"not",
"isinstance",
"(",
"i",
",",
"SelectableObject",
")",
":",
"warning",
"(",
"\"Unknown ignored object... | Entry point of SelectableSelector | [
"Entry",
"point",
"of",
"SelectableSelector"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/automaton.py#L153-L179 | train | Process the select command. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/config.py | _version_checker | def _version_checker(module, minver):
"""Checks that module has a higher version that minver.
params:
- module: a module to test
- minver: a tuple of versions
"""
# We could use LooseVersion, but distutils imports imp which is deprecated
version_regexp = r'[a-z]?((?:\d|\.)+\d+)(?:\.dev[0-... | python | def _version_checker(module, minver):
"""Checks that module has a higher version that minver.
params:
- module: a module to test
- minver: a tuple of versions
"""
# We could use LooseVersion, but distutils imports imp which is deprecated
version_regexp = r'[a-z]?((?:\d|\.)+\d+)(?:\.dev[0-... | [
"def",
"_version_checker",
"(",
"module",
",",
"minver",
")",
":",
"# We could use LooseVersion, but distutils imports imp which is deprecated",
"version_regexp",
"=",
"r'[a-z]?((?:\\d|\\.)+\\d+)(?:\\.dev[0-9]+)?'",
"version_tags",
"=",
"re",
".",
"match",
"(",
"version_regexp",
... | Checks that module has a higher version that minver.
params:
- module: a module to test
- minver: a tuple of versions | [
"Checks",
"that",
"module",
"has",
"a",
"higher",
"version",
"that",
"minver",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/config.py#L356-L370 | train | Checks that a module has a higher version that minver. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/config.py | isCryptographyAdvanced | def isCryptographyAdvanced():
"""
Check if the cryptography library is present, and if it supports X25519,
ChaCha20Poly1305 and such (v2.0 or later).
"""
try:
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey # noqa: E501
X25519PrivateKey.generate()
e... | python | def isCryptographyAdvanced():
"""
Check if the cryptography library is present, and if it supports X25519,
ChaCha20Poly1305 and such (v2.0 or later).
"""
try:
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey # noqa: E501
X25519PrivateKey.generate()
e... | [
"def",
"isCryptographyAdvanced",
"(",
")",
":",
"try",
":",
"from",
"cryptography",
".",
"hazmat",
".",
"primitives",
".",
"asymmetric",
".",
"x25519",
"import",
"X25519PrivateKey",
"# noqa: E501",
"X25519PrivateKey",
".",
"generate",
"(",
")",
"except",
"Exceptio... | Check if the cryptography library is present, and if it supports X25519,
ChaCha20Poly1305 and such (v2.0 or later). | [
"Check",
"if",
"the",
"cryptography",
"library",
"is",
"present",
"and",
"if",
"it",
"supports",
"X25519",
"ChaCha20Poly1305",
"and",
"such",
"(",
"v2",
".",
"0",
"or",
"later",
")",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/config.py#L396-L407 | train | Check if the cryptography library is present and supports X25519. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/config.py | _prompt_changer | def _prompt_changer(attr, val):
"""Change the current prompt theme"""
try:
sys.ps1 = conf.color_theme.prompt(conf.prompt)
except Exception:
pass
try:
apply_ipython_style(get_ipython())
except NameError:
pass | python | def _prompt_changer(attr, val):
"""Change the current prompt theme"""
try:
sys.ps1 = conf.color_theme.prompt(conf.prompt)
except Exception:
pass
try:
apply_ipython_style(get_ipython())
except NameError:
pass | [
"def",
"_prompt_changer",
"(",
"attr",
",",
"val",
")",
":",
"try",
":",
"sys",
".",
"ps1",
"=",
"conf",
".",
"color_theme",
".",
"prompt",
"(",
"conf",
".",
"prompt",
")",
"except",
"Exception",
":",
"pass",
"try",
":",
"apply_ipython_style",
"(",
"ge... | Change the current prompt theme | [
"Change",
"the",
"current",
"prompt",
"theme"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/config.py#L419-L428 | train | Change the current prompt theme | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/config.py | _set_conf_sockets | def _set_conf_sockets():
"""Populate the conf.L2Socket and conf.L3Socket
according to the various use_* parameters
"""
if conf.use_bpf and not BSD:
Interceptor.set_from_hook(conf, "use_bpf", False)
raise ScapyInvalidPlatformException("BSD-like (OSX, *BSD...) only !")
if conf.use_winp... | python | def _set_conf_sockets():
"""Populate the conf.L2Socket and conf.L3Socket
according to the various use_* parameters
"""
if conf.use_bpf and not BSD:
Interceptor.set_from_hook(conf, "use_bpf", False)
raise ScapyInvalidPlatformException("BSD-like (OSX, *BSD...) only !")
if conf.use_winp... | [
"def",
"_set_conf_sockets",
"(",
")",
":",
"if",
"conf",
".",
"use_bpf",
"and",
"not",
"BSD",
":",
"Interceptor",
".",
"set_from_hook",
"(",
"conf",
",",
"\"use_bpf\"",
",",
"False",
")",
"raise",
"ScapyInvalidPlatformException",
"(",
"\"BSD-like (OSX, *BSD...) on... | Populate the conf.L2Socket and conf.L3Socket
according to the various use_* parameters | [
"Populate",
"the",
"conf",
".",
"L2Socket",
"and",
"conf",
".",
"L3Socket",
"according",
"to",
"the",
"various",
"use_",
"*",
"parameters"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/config.py#L431-L482 | train | Populate the conf. L2Socket and conf. L3Socket according to the various use_* parameters
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/config.py | crypto_validator | def crypto_validator(func):
"""
This a decorator to be used for any method relying on the cryptography library. # noqa: E501
Its behaviour depends on the 'crypto_valid' attribute of the global 'conf'.
"""
def func_in(*args, **kwargs):
if not conf.crypto_valid:
raise ImportError(... | python | def crypto_validator(func):
"""
This a decorator to be used for any method relying on the cryptography library. # noqa: E501
Its behaviour depends on the 'crypto_valid' attribute of the global 'conf'.
"""
def func_in(*args, **kwargs):
if not conf.crypto_valid:
raise ImportError(... | [
"def",
"crypto_validator",
"(",
"func",
")",
":",
"def",
"func_in",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"conf",
".",
"crypto_valid",
":",
"raise",
"ImportError",
"(",
"\"Cannot execute crypto-related method! \"",
"\"Please install p... | This a decorator to be used for any method relying on the cryptography library. # noqa: E501
Its behaviour depends on the 'crypto_valid' attribute of the global 'conf'. | [
"This",
"a",
"decorator",
"to",
"be",
"used",
"for",
"any",
"method",
"relying",
"on",
"the",
"cryptography",
"library",
".",
"#",
"noqa",
":",
"E501",
"Its",
"behaviour",
"depends",
"on",
"the",
"crypto_valid",
"attribute",
"of",
"the",
"global",
"conf",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/config.py#L640-L650 | train | Decorator to be used for any method relying on the cryptography library. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.filter | def filter(self, func):
"""Returns a packet list filtered by a truth function. This truth
function has to take a packet as the only argument and return a boolean value.""" # noqa: E501
return self.__class__([x for x in self.res if func(x)],
name="filtered %s" % sel... | python | def filter(self, func):
"""Returns a packet list filtered by a truth function. This truth
function has to take a packet as the only argument and return a boolean value.""" # noqa: E501
return self.__class__([x for x in self.res if func(x)],
name="filtered %s" % sel... | [
"def",
"filter",
"(",
"self",
",",
"func",
")",
":",
"# noqa: E501",
"return",
"self",
".",
"__class__",
"(",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"res",
"if",
"func",
"(",
"x",
")",
"]",
",",
"name",
"=",
"\"filtered %s\"",
"%",
"self",
".",
... | Returns a packet list filtered by a truth function. This truth
function has to take a packet as the only argument and return a boolean value. | [
"Returns",
"a",
"packet",
"list",
"filtered",
"by",
"a",
"truth",
"function",
".",
"This",
"truth",
"function",
"has",
"to",
"take",
"a",
"packet",
"as",
"the",
"only",
"argument",
"and",
"return",
"a",
"boolean",
"value",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L163-L167 | train | Returns a new packet list filtered by a truth function. This truth
function has to take a packet as the only argument and return a boolean value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.plot | def plot(self, f, lfilter=None, plot_xy=False, **kargs):
"""Applies a function to each packet to get a value that will be plotted
with matplotlib. A list of matplotlib.lines.Line2D is returned.
lfilter: a truth function that decides whether a packet must be plotted
"""
# Python... | python | def plot(self, f, lfilter=None, plot_xy=False, **kargs):
"""Applies a function to each packet to get a value that will be plotted
with matplotlib. A list of matplotlib.lines.Line2D is returned.
lfilter: a truth function that decides whether a packet must be plotted
"""
# Python... | [
"def",
"plot",
"(",
"self",
",",
"f",
",",
"lfilter",
"=",
"None",
",",
"plot_xy",
"=",
"False",
",",
"*",
"*",
"kargs",
")",
":",
"# Python 2 backward compatibility",
"f",
"=",
"lambda_tuple_converter",
"(",
"f",
")",
"lfilter",
"=",
"lambda_tuple_converter... | Applies a function to each packet to get a value that will be plotted
with matplotlib. A list of matplotlib.lines.Line2D is returned.
lfilter: a truth function that decides whether a packet must be plotted | [
"Applies",
"a",
"function",
"to",
"each",
"packet",
"to",
"get",
"a",
"value",
"that",
"will",
"be",
"plotted",
"with",
"matplotlib",
".",
"A",
"list",
"of",
"matplotlib",
".",
"lines",
".",
"Line2D",
"is",
"returned",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L182-L211 | train | Applies a function to each packet to get a value that will be plotted
with matplotlib. A list of matplotlib. lines. Line2D is returned. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.diffplot | def diffplot(self, f, delay=1, lfilter=None, **kargs):
"""diffplot(f, delay=1, lfilter=None)
Applies a function to couples (l[i],l[i+delay])
A list of matplotlib.lines.Line2D is returned.
"""
# Get the list of packets
if lfilter is None:
lst_pkts = [f(self.r... | python | def diffplot(self, f, delay=1, lfilter=None, **kargs):
"""diffplot(f, delay=1, lfilter=None)
Applies a function to couples (l[i],l[i+delay])
A list of matplotlib.lines.Line2D is returned.
"""
# Get the list of packets
if lfilter is None:
lst_pkts = [f(self.r... | [
"def",
"diffplot",
"(",
"self",
",",
"f",
",",
"delay",
"=",
"1",
",",
"lfilter",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"# Get the list of packets",
"if",
"lfilter",
"is",
"None",
":",
"lst_pkts",
"=",
"[",
"f",
"(",
"self",
".",
"res",
"[... | diffplot(f, delay=1, lfilter=None)
Applies a function to couples (l[i],l[i+delay])
A list of matplotlib.lines.Line2D is returned. | [
"diffplot",
"(",
"f",
"delay",
"=",
"1",
"lfilter",
"=",
"None",
")",
"Applies",
"a",
"function",
"to",
"couples",
"(",
"l",
"[",
"i",
"]",
"l",
"[",
"i",
"+",
"delay",
"]",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L213-L238 | train | Function f applies a function to couples and returns a list of matplotlib. lines. Line2D is returned. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.multiplot | def multiplot(self, f, lfilter=None, plot_xy=False, **kargs):
"""Uses a function that returns a label and a value for this label, then
plots all the values label by label.
A list of matplotlib.lines.Line2D is returned.
"""
# Python 2 backward compatibility
f = lambda_tu... | python | def multiplot(self, f, lfilter=None, plot_xy=False, **kargs):
"""Uses a function that returns a label and a value for this label, then
plots all the values label by label.
A list of matplotlib.lines.Line2D is returned.
"""
# Python 2 backward compatibility
f = lambda_tu... | [
"def",
"multiplot",
"(",
"self",
",",
"f",
",",
"lfilter",
"=",
"None",
",",
"plot_xy",
"=",
"False",
",",
"*",
"*",
"kargs",
")",
":",
"# Python 2 backward compatibility",
"f",
"=",
"lambda_tuple_converter",
"(",
"f",
")",
"lfilter",
"=",
"lambda_tuple_conv... | Uses a function that returns a label and a value for this label, then
plots all the values label by label.
A list of matplotlib.lines.Line2D is returned. | [
"Uses",
"a",
"function",
"that",
"returns",
"a",
"label",
"and",
"a",
"value",
"for",
"this",
"label",
"then",
"plots",
"all",
"the",
"values",
"label",
"by",
"label",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L240-L278 | train | Uses a function that returns a label and a value for this label then a list of matplotlib. lines. Line2D is returned. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.hexraw | def hexraw(self, lfilter=None):
"""Same as nsummary(), except that if a packet has a Raw layer, it will be hexdumped # noqa: E501
lfilter: a truth function that decides whether a packet must be displayed""" # noqa: E501
for i, res in enumerate(self.res):
p = self._elt2pkt(res)
... | python | def hexraw(self, lfilter=None):
"""Same as nsummary(), except that if a packet has a Raw layer, it will be hexdumped # noqa: E501
lfilter: a truth function that decides whether a packet must be displayed""" # noqa: E501
for i, res in enumerate(self.res):
p = self._elt2pkt(res)
... | [
"def",
"hexraw",
"(",
"self",
",",
"lfilter",
"=",
"None",
")",
":",
"# noqa: E501",
"for",
"i",
",",
"res",
"in",
"enumerate",
"(",
"self",
".",
"res",
")",
":",
"p",
"=",
"self",
".",
"_elt2pkt",
"(",
"res",
")",
"if",
"lfilter",
"is",
"not",
"... | Same as nsummary(), except that if a packet has a Raw layer, it will be hexdumped # noqa: E501
lfilter: a truth function that decides whether a packet must be displayed | [
"Same",
"as",
"nsummary",
"()",
"except",
"that",
"if",
"a",
"packet",
"has",
"a",
"Raw",
"layer",
"it",
"will",
"be",
"hexdumped",
"#",
"noqa",
":",
"E501",
"lfilter",
":",
"a",
"truth",
"function",
"that",
"decides",
"whether",
"a",
"packet",
"must",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L285-L296 | train | Print the hexdump of all the related objects in the packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.hexdump | def hexdump(self, lfilter=None):
"""Same as nsummary(), except that packets are also hexdumped
lfilter: a truth function that decides whether a packet must be displayed""" # noqa: E501
for i, res in enumerate(self.res):
p = self._elt2pkt(res)
if lfilter is not None and n... | python | def hexdump(self, lfilter=None):
"""Same as nsummary(), except that packets are also hexdumped
lfilter: a truth function that decides whether a packet must be displayed""" # noqa: E501
for i, res in enumerate(self.res):
p = self._elt2pkt(res)
if lfilter is not None and n... | [
"def",
"hexdump",
"(",
"self",
",",
"lfilter",
"=",
"None",
")",
":",
"# noqa: E501",
"for",
"i",
",",
"res",
"in",
"enumerate",
"(",
"self",
".",
"res",
")",
":",
"p",
"=",
"self",
".",
"_elt2pkt",
"(",
"res",
")",
"if",
"lfilter",
"is",
"not",
... | Same as nsummary(), except that packets are also hexdumped
lfilter: a truth function that decides whether a packet must be displayed | [
"Same",
"as",
"nsummary",
"()",
"except",
"that",
"packets",
"are",
"also",
"hexdumped",
"lfilter",
":",
"a",
"truth",
"function",
"that",
"decides",
"whether",
"a",
"packet",
"must",
"be",
"displayed"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L298-L308 | train | Print the hexdump of the contents of the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.conversations | def conversations(self, getsrcdst=None, **kargs):
"""Graphes a conversations between sources and destinations and display it
(using graphviz and imagemagick)
getsrcdst: a function that takes an element of the list and
returns the source, the destination and optionally
... | python | def conversations(self, getsrcdst=None, **kargs):
"""Graphes a conversations between sources and destinations and display it
(using graphviz and imagemagick)
getsrcdst: a function that takes an element of the list and
returns the source, the destination and optionally
... | [
"def",
"conversations",
"(",
"self",
",",
"getsrcdst",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"getsrcdst",
"is",
"None",
":",
"def",
"getsrcdst",
"(",
"pkt",
")",
":",
"\"\"\"Extract src and dst addresses\"\"\"",
"if",
"'IP'",
"in",
"pkt",
":... | Graphes a conversations between sources and destinations and display it
(using graphviz and imagemagick)
getsrcdst: a function that takes an element of the list and
returns the source, the destination and optionally
a label. By default, returns the IP source and
... | [
"Graphes",
"a",
"conversations",
"between",
"sources",
"and",
"destinations",
"and",
"display",
"it",
"(",
"using",
"graphviz",
"and",
"imagemagick",
")",
"getsrcdst",
":",
"a",
"function",
"that",
"takes",
"an",
"element",
"of",
"the",
"list",
"and",
"returns... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L335-L377 | train | Graphs a conversations between source and destination IP and ARP layers and displays them as a graphviz graph. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.afterglow | def afterglow(self, src=None, event=None, dst=None, **kargs):
"""Experimental clone attempt of http://sourceforge.net/projects/afterglow
each datum is reduced as src -> event -> dst and the data are graphed.
by default we have IP.src -> IP.dport -> IP.dst"""
if src is None:
s... | python | def afterglow(self, src=None, event=None, dst=None, **kargs):
"""Experimental clone attempt of http://sourceforge.net/projects/afterglow
each datum is reduced as src -> event -> dst and the data are graphed.
by default we have IP.src -> IP.dport -> IP.dst"""
if src is None:
s... | [
"def",
"afterglow",
"(",
"self",
",",
"src",
"=",
"None",
",",
"event",
"=",
"None",
",",
"dst",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"src",
"is",
"None",
":",
"src",
"=",
"lambda",
"x",
":",
"x",
"[",
"'IP'",
"]",
".",
"src",... | Experimental clone attempt of http://sourceforge.net/projects/afterglow
each datum is reduced as src -> event -> dst and the data are graphed.
by default we have IP.src -> IP.dport -> IP.dst | [
"Experimental",
"clone",
"attempt",
"of",
"http",
":",
"//",
"sourceforge",
".",
"net",
"/",
"projects",
"/",
"afterglow",
"each",
"datum",
"is",
"reduced",
"as",
"src",
"-",
">",
"event",
"-",
">",
"dst",
"and",
"the",
"data",
"are",
"graphed",
".",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L379-L461 | train | Experimental clone attempt of http://sourceforge. net / projects / afterglow. net. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.sr | def sr(self, multi=0):
"""sr([multi=1]) -> (SndRcvList, PacketList)
Matches packets in the list and return ( (matched couples), (unmatched packets) )""" # noqa: E501
remain = self.res[:]
sr = []
i = 0
while i < len(remain):
s = remain[i]
j = i
... | python | def sr(self, multi=0):
"""sr([multi=1]) -> (SndRcvList, PacketList)
Matches packets in the list and return ( (matched couples), (unmatched packets) )""" # noqa: E501
remain = self.res[:]
sr = []
i = 0
while i < len(remain):
s = remain[i]
j = i
... | [
"def",
"sr",
"(",
"self",
",",
"multi",
"=",
"0",
")",
":",
"# noqa: E501",
"remain",
"=",
"self",
".",
"res",
"[",
":",
"]",
"sr",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"remain",
")",
":",
"s",
"=",
"remain",
"[",
"i... | sr([multi=1]) -> (SndRcvList, PacketList)
Matches packets in the list and return ( (matched couples), (unmatched packets) ) | [
"sr",
"(",
"[",
"multi",
"=",
"1",
"]",
")",
"-",
">",
"(",
"SndRcvList",
"PacketList",
")",
"Matches",
"packets",
"in",
"the",
"list",
"and",
"return",
"(",
"(",
"matched",
"couples",
")",
"(",
"unmatched",
"packets",
")",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L478-L503 | train | sr - Matches packets in the list and return a tuple of the matched couples and packets. multi - 1 - Matches packets in the list and return a tuple of the matched couples and unmatched packets. multi - 0 - Matches packets in the list and return a tuple of the matched couples and unmatched packets | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/plist.py | PacketList.replace | def replace(self, *args, **kargs):
"""
lst.replace(<field>,[<oldvalue>,]<newvalue>)
lst.replace( (fld,[ov],nv),(fld,[ov,]nv),...)
if ov is None, all values are replaced
ex:
lst.replace( IP.src, "192.168.1.1", "10.0.0.1" )
lst.replace( IP.ttl, 64 )
... | python | def replace(self, *args, **kargs):
"""
lst.replace(<field>,[<oldvalue>,]<newvalue>)
lst.replace( (fld,[ov],nv),(fld,[ov,]nv),...)
if ov is None, all values are replaced
ex:
lst.replace( IP.src, "192.168.1.1", "10.0.0.1" )
lst.replace( IP.ttl, 64 )
... | [
"def",
"replace",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"delete_checksums",
"=",
"kargs",
".",
"get",
"(",
"\"delete_checksums\"",
",",
"False",
")",
"x",
"=",
"PacketList",
"(",
"name",
"=",
"\"Replaced %s\"",
"%",
"self",
"... | lst.replace(<field>,[<oldvalue>,]<newvalue>)
lst.replace( (fld,[ov],nv),(fld,[ov,]nv),...)
if ov is None, all values are replaced
ex:
lst.replace( IP.src, "192.168.1.1", "10.0.0.1" )
lst.replace( IP.ttl, 64 )
lst.replace( (IP.ttl, 64), (TCP.sport, 666, 777), ) | [
"lst",
".",
"replace",
"(",
"<field",
">",
"[",
"<oldvalue",
">",
"]",
"<newvalue",
">",
")",
"lst",
".",
"replace",
"(",
"(",
"fld",
"[",
"ov",
"]",
"nv",
")",
"(",
"fld",
"[",
"ov",
"]",
"nv",
")",
"...",
")",
"if",
"ov",
"is",
"None",
"all... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/plist.py#L540-L571 | train | Replace the entries in the list with the ones in args. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/common.py | _check_tcpdump | def _check_tcpdump():
"""
Return True if the tcpdump command can be started
"""
with open(os.devnull, 'wb') as devnull:
try:
proc = subprocess.Popen([conf.prog.tcpdump, "--version"],
stdout=devnull, stderr=subprocess.STDOUT)
except OSError:... | python | def _check_tcpdump():
"""
Return True if the tcpdump command can be started
"""
with open(os.devnull, 'wb') as devnull:
try:
proc = subprocess.Popen([conf.prog.tcpdump, "--version"],
stdout=devnull, stderr=subprocess.STDOUT)
except OSError:... | [
"def",
"_check_tcpdump",
"(",
")",
":",
"with",
"open",
"(",
"os",
".",
"devnull",
",",
"'wb'",
")",
"as",
"devnull",
":",
"try",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"conf",
".",
"prog",
".",
"tcpdump",
",",
"\"--version\"",
"]",
... | Return True if the tcpdump command can be started | [
"Return",
"True",
"if",
"the",
"tcpdump",
"command",
"can",
"be",
"started"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/common.py#L31-L46 | train | Check if tcpdump command can be started | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/common.py | get_if | def get_if(iff, cmd):
"""Ease SIOCGIF* ioctl calls"""
sck = socket.socket()
ifreq = ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
sck.close()
return ifreq | python | def get_if(iff, cmd):
"""Ease SIOCGIF* ioctl calls"""
sck = socket.socket()
ifreq = ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
sck.close()
return ifreq | [
"def",
"get_if",
"(",
"iff",
",",
"cmd",
")",
":",
"sck",
"=",
"socket",
".",
"socket",
"(",
")",
"ifreq",
"=",
"ioctl",
"(",
"sck",
",",
"cmd",
",",
"struct",
".",
"pack",
"(",
"\"16s16x\"",
",",
"iff",
".",
"encode",
"(",
"\"utf8\"",
")",
")",
... | Ease SIOCGIF* ioctl calls | [
"Ease",
"SIOCGIF",
"*",
"ioctl",
"calls"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/common.py#L55-L61 | train | Ease SIOCGIF * ioctl calls | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/common.py | _select_nonblock | def _select_nonblock(sockets, remain=None):
"""This function is called during sendrecv() routine to select
the available sockets.
"""
# pcap sockets aren't selectable, so we return all of them
# and ask the selecting functions to use nonblock_recv instead of recv
def _sleep_nonblock_recv(self):
... | python | def _select_nonblock(sockets, remain=None):
"""This function is called during sendrecv() routine to select
the available sockets.
"""
# pcap sockets aren't selectable, so we return all of them
# and ask the selecting functions to use nonblock_recv instead of recv
def _sleep_nonblock_recv(self):
... | [
"def",
"_select_nonblock",
"(",
"sockets",
",",
"remain",
"=",
"None",
")",
":",
"# pcap sockets aren't selectable, so we return all of them",
"# and ask the selecting functions to use nonblock_recv instead of recv",
"def",
"_sleep_nonblock_recv",
"(",
"self",
")",
":",
"try",
... | This function is called during sendrecv() routine to select
the available sockets. | [
"This",
"function",
"is",
"called",
"during",
"sendrecv",
"()",
"routine",
"to",
"select",
"the",
"available",
"sockets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/common.py#L70-L84 | train | This function is called during sendrecv and recvonewait routines to select the available sockets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/common.py | _legacy_bpf_pointer | def _legacy_bpf_pointer(tcpdump_lines):
"""Get old-format BPF Pointer. Deprecated"""
X86_64 = os.uname()[4] in ['x86_64', 'aarch64']
size = int(tcpdump_lines[0])
bpf = b""
for l in tcpdump_lines[1:]:
if six.PY2:
int_type = long # noqa: F821
else:
int_type = i... | python | def _legacy_bpf_pointer(tcpdump_lines):
"""Get old-format BPF Pointer. Deprecated"""
X86_64 = os.uname()[4] in ['x86_64', 'aarch64']
size = int(tcpdump_lines[0])
bpf = b""
for l in tcpdump_lines[1:]:
if six.PY2:
int_type = long # noqa: F821
else:
int_type = i... | [
"def",
"_legacy_bpf_pointer",
"(",
"tcpdump_lines",
")",
":",
"X86_64",
"=",
"os",
".",
"uname",
"(",
")",
"[",
"4",
"]",
"in",
"[",
"'x86_64'",
",",
"'aarch64'",
"]",
"size",
"=",
"int",
"(",
"tcpdump_lines",
"[",
"0",
"]",
")",
"bpf",
"=",
"b\"\"",... | Get old-format BPF Pointer. Deprecated | [
"Get",
"old",
"-",
"format",
"BPF",
"Pointer",
".",
"Deprecated"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/common.py#L103-L125 | train | Get old - format BPF Pointer. Deprecated. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/common.py | get_bpf_pointer | def get_bpf_pointer(tcpdump_lines):
"""Create a BPF Pointer for TCPDump filter"""
if conf.use_pypy:
return _legacy_bpf_pointer(tcpdump_lines)
# Allocate BPF instructions
size = int(tcpdump_lines[0])
bpf_insn_a = bpf_insn * size
bip = bpf_insn_a()
# Fill the BPF instruction structur... | python | def get_bpf_pointer(tcpdump_lines):
"""Create a BPF Pointer for TCPDump filter"""
if conf.use_pypy:
return _legacy_bpf_pointer(tcpdump_lines)
# Allocate BPF instructions
size = int(tcpdump_lines[0])
bpf_insn_a = bpf_insn * size
bip = bpf_insn_a()
# Fill the BPF instruction structur... | [
"def",
"get_bpf_pointer",
"(",
"tcpdump_lines",
")",
":",
"if",
"conf",
".",
"use_pypy",
":",
"return",
"_legacy_bpf_pointer",
"(",
"tcpdump_lines",
")",
"# Allocate BPF instructions",
"size",
"=",
"int",
"(",
"tcpdump_lines",
"[",
"0",
"]",
")",
"bpf_insn_a",
"... | Create a BPF Pointer for TCPDump filter | [
"Create",
"a",
"BPF",
"Pointer",
"for",
"TCPDump",
"filter"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/common.py#L128-L150 | train | Create a BPF Pointer for TCPDump filter | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/common.py | compile_filter | def compile_filter(bpf_filter, iface=None):
"""Asks Tcpdump to parse the filter, then build the matching
BPF bytecode using get_bpf_pointer.
"""
if not TCPDUMP:
raise Scapy_Exception("tcpdump is not available. Cannot use filter !")
try:
process = subprocess.Popen([
conf.p... | python | def compile_filter(bpf_filter, iface=None):
"""Asks Tcpdump to parse the filter, then build the matching
BPF bytecode using get_bpf_pointer.
"""
if not TCPDUMP:
raise Scapy_Exception("tcpdump is not available. Cannot use filter !")
try:
process = subprocess.Popen([
conf.p... | [
"def",
"compile_filter",
"(",
"bpf_filter",
",",
"iface",
"=",
"None",
")",
":",
"if",
"not",
"TCPDUMP",
":",
"raise",
"Scapy_Exception",
"(",
"\"tcpdump is not available. Cannot use filter !\"",
")",
"try",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
... | Asks Tcpdump to parse the filter, then build the matching
BPF bytecode using get_bpf_pointer. | [
"Asks",
"Tcpdump",
"to",
"parse",
"the",
"filter",
"then",
"build",
"the",
"matching",
"BPF",
"bytecode",
"using",
"get_bpf_pointer",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/common.py#L153-L179 | train | Asks Tcpdump to parse the filter then build the matching BPF bytecode using get_bpf_pointer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.