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/layers/sixlowpan.py | sixlowpan_fragment | def sixlowpan_fragment(packet, datagram_tag=1):
"""Split a packet into different links to transmit as 6lowpan packets.
Usage example:
>>> ipv6 = ..... (very big packet)
>>> pkts = sixlowpan_fragment(ipv6, datagram_tag=0x17)
>>> send = [Dot15d4()/Dot15d4Data()/x for x in pkts]
... | python | def sixlowpan_fragment(packet, datagram_tag=1):
"""Split a packet into different links to transmit as 6lowpan packets.
Usage example:
>>> ipv6 = ..... (very big packet)
>>> pkts = sixlowpan_fragment(ipv6, datagram_tag=0x17)
>>> send = [Dot15d4()/Dot15d4Data()/x for x in pkts]
... | [
"def",
"sixlowpan_fragment",
"(",
"packet",
",",
"datagram_tag",
"=",
"1",
")",
":",
"if",
"not",
"packet",
".",
"haslayer",
"(",
"IPv6",
")",
":",
"raise",
"Exception",
"(",
"\"SixLoWPAN only fragments IPv6 packets !\"",
")",
"str_packet",
"=",
"raw",
"(",
"p... | Split a packet into different links to transmit as 6lowpan packets.
Usage example:
>>> ipv6 = ..... (very big packet)
>>> pkts = sixlowpan_fragment(ipv6, datagram_tag=0x17)
>>> send = [Dot15d4()/Dot15d4Data()/x for x in pkts]
>>> wireshark(send) | [
"Split",
"a",
"packet",
"into",
"different",
"links",
"to",
"transmit",
"as",
"6lowpan",
"packets",
".",
"Usage",
"example",
":",
">>>",
"ipv6",
"=",
".....",
"(",
"very",
"big",
"packet",
")",
">>>",
"pkts",
"=",
"sixlowpan_fragment",
"(",
"ipv6",
"datagr... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/sixlowpan.py#L751-L778 | train | Split a packet into different links to transmit as 6lowpan 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/sixlowpan.py | IP6FieldLenField.addfield | def addfield(self, pkt, s, val):
"""Add an internal value to a string"""
tmp_len = self.length_of(pkt)
if tmp_len == 0:
return s
internal = self.i2m(pkt, val)[-tmp_len:]
return s + struct.pack("!%ds" % tmp_len, internal) | python | def addfield(self, pkt, s, val):
"""Add an internal value to a string"""
tmp_len = self.length_of(pkt)
if tmp_len == 0:
return s
internal = self.i2m(pkt, val)[-tmp_len:]
return s + struct.pack("!%ds" % tmp_len, internal) | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"val",
")",
":",
"tmp_len",
"=",
"self",
".",
"length_of",
"(",
"pkt",
")",
"if",
"tmp_len",
"==",
"0",
":",
"return",
"s",
"internal",
"=",
"self",
".",
"i2m",
"(",
"pkt",
",",
"val",
... | Add an internal value to a string | [
"Add",
"an",
"internal",
"value",
"to",
"a",
"string"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/sixlowpan.py#L80-L86 | train | Add an internal value to a string | 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/sixlowpan.py | SixLoWPANAddrField.addfield | def addfield(self, pkt, s, val):
"""Add an internal value to a string"""
if self.length_of(pkt) == 8:
return s + struct.pack(self.fmt[0] + "B", val)
if self.length_of(pkt) == 16:
return s + struct.pack(self.fmt[0] + "H", val)
if self.length_of(pkt) == 32:
... | python | def addfield(self, pkt, s, val):
"""Add an internal value to a string"""
if self.length_of(pkt) == 8:
return s + struct.pack(self.fmt[0] + "B", val)
if self.length_of(pkt) == 16:
return s + struct.pack(self.fmt[0] + "H", val)
if self.length_of(pkt) == 32:
... | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"val",
")",
":",
"if",
"self",
".",
"length_of",
"(",
"pkt",
")",
"==",
"8",
":",
"return",
"s",
"+",
"struct",
".",
"pack",
"(",
"self",
".",
"fmt",
"[",
"0",
"]",
"+",
"\"B\"",
",",... | Add an internal value to a string | [
"Add",
"an",
"internal",
"value",
"to",
"a",
"string"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/sixlowpan.py#L124-L140 | train | Add an internal value to a string | 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/sixlowpan.py | LoWPAN_IPHC.post_dissect | def post_dissect(self, data):
"""dissect the IPv6 package compressed into this IPHC packet.
The packet payload needs to be decompressed and depending on the
arguments, several conversions should be done.
"""
# uncompress payload
packet = IPv6()
packet.version = ... | python | def post_dissect(self, data):
"""dissect the IPv6 package compressed into this IPHC packet.
The packet payload needs to be decompressed and depending on the
arguments, several conversions should be done.
"""
# uncompress payload
packet = IPv6()
packet.version = ... | [
"def",
"post_dissect",
"(",
"self",
",",
"data",
")",
":",
"# uncompress payload",
"packet",
"=",
"IPv6",
"(",
")",
"packet",
".",
"version",
"=",
"IPHC_DEFAULT_VERSION",
"packet",
".",
"tc",
",",
"packet",
".",
"fl",
"=",
"self",
".",
"_getTrafficClassAndFl... | dissect the IPv6 package compressed into this IPHC packet.
The packet payload needs to be decompressed and depending on the
arguments, several conversions should be done. | [
"dissect",
"the",
"IPv6",
"package",
"compressed",
"into",
"this",
"IPHC",
"packet",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/sixlowpan.py#L452-L515 | train | This function is called by IPHC to dissect the IPv6 packet. It is called after the packet is decompressed and the payload needs to be decompressed and depending on the arguments. | 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/sixlowpan.py | LoWPAN_IPHC._getTrafficClassAndFlowLabel | def _getTrafficClassAndFlowLabel(self):
"""Page 6, draft feb 2011 """
if self.tf == 0x0:
return (self.tc_ecn << 6) + self.tc_dscp, self.flowlabel
elif self.tf == 0x1:
return (self.tc_ecn << 6), self.flowlabel
elif self.tf == 0x2:
return (self.tc_ecn <<... | python | def _getTrafficClassAndFlowLabel(self):
"""Page 6, draft feb 2011 """
if self.tf == 0x0:
return (self.tc_ecn << 6) + self.tc_dscp, self.flowlabel
elif self.tf == 0x1:
return (self.tc_ecn << 6), self.flowlabel
elif self.tf == 0x2:
return (self.tc_ecn <<... | [
"def",
"_getTrafficClassAndFlowLabel",
"(",
"self",
")",
":",
"if",
"self",
".",
"tf",
"==",
"0x0",
":",
"return",
"(",
"self",
".",
"tc_ecn",
"<<",
"6",
")",
"+",
"self",
".",
"tc_dscp",
",",
"self",
".",
"flowlabel",
"elif",
"self",
".",
"tf",
"=="... | Page 6, draft feb 2011 | [
"Page",
"6",
"draft",
"feb",
"2011"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/sixlowpan.py#L707-L716 | train | Page 6 draft feb 2011 | 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/sixlowpan.py | SixLoWPAN.dispatch_hook | def dispatch_hook(cls, _pkt=b"", *args, **kargs):
"""Depending on the payload content, the frame type we should interpretate""" # noqa: E501
if _pkt and len(_pkt) >= 1:
if orb(_pkt[0]) == 0x41:
return LoWPANUncompressedIPv6
if orb(_pkt[0]) == 0x42:
... | python | def dispatch_hook(cls, _pkt=b"", *args, **kargs):
"""Depending on the payload content, the frame type we should interpretate""" # noqa: E501
if _pkt and len(_pkt) >= 1:
if orb(_pkt[0]) == 0x41:
return LoWPANUncompressedIPv6
if orb(_pkt[0]) == 0x42:
... | [
"def",
"dispatch_hook",
"(",
"cls",
",",
"_pkt",
"=",
"b\"\"",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"if",
"_pkt",
"and",
"len",
"(",
"_pkt",
")",
">=",
"1",
":",
"if",
"orb",
"(",
"_pkt",
"[",
"0",
"]",
")",
"==",... | Depending on the payload content, the frame type we should interpretate | [
"Depending",
"on",
"the",
"payload",
"content",
"the",
"frame",
"type",
"we",
"should",
"interpretate"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/sixlowpan.py#L729-L744 | train | This method is used to dispatch the packet content to the appropriate class. | 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/x509.py | X509_TBSCertificate.get_issuer_str | def get_issuer_str(self):
"""
Returns a one-line string containing every type/value
in a rather specific order. sorted() built-in ensures unicity.
"""
name_str = ""
attrsDict = self.get_issuer()
for attrType, attrSymbol in _attrName_mapping:
if attrTyp... | python | def get_issuer_str(self):
"""
Returns a one-line string containing every type/value
in a rather specific order. sorted() built-in ensures unicity.
"""
name_str = ""
attrsDict = self.get_issuer()
for attrType, attrSymbol in _attrName_mapping:
if attrTyp... | [
"def",
"get_issuer_str",
"(",
"self",
")",
":",
"name_str",
"=",
"\"\"",
"attrsDict",
"=",
"self",
".",
"get_issuer",
"(",
")",
"for",
"attrType",
",",
"attrSymbol",
"in",
"_attrName_mapping",
":",
"if",
"attrType",
"in",
"attrsDict",
":",
"name_str",
"+=",
... | Returns a one-line string containing every type/value
in a rather specific order. sorted() built-in ensures unicity. | [
"Returns",
"a",
"one",
"-",
"line",
"string",
"containing",
"every",
"type",
"/",
"value",
"in",
"a",
"rather",
"specific",
"order",
".",
"sorted",
"()",
"built",
"-",
"in",
"ensures",
"unicity",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/x509.py#L966-L981 | train | Returns a one - line string containing every type and value of the user s issuer. | 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/sessions.py | DefaultSession.on_packet_received | def on_packet_received(self, pkt):
"""DEV: entry point. Will be called by sniff() for each
received packet (that passes the filters).
"""
if not pkt:
return
if self.store:
self.lst.append(pkt)
if self.prn:
result = self.prn(pkt)
... | python | def on_packet_received(self, pkt):
"""DEV: entry point. Will be called by sniff() for each
received packet (that passes the filters).
"""
if not pkt:
return
if self.store:
self.lst.append(pkt)
if self.prn:
result = self.prn(pkt)
... | [
"def",
"on_packet_received",
"(",
"self",
",",
"pkt",
")",
":",
"if",
"not",
"pkt",
":",
"return",
"if",
"self",
".",
"store",
":",
"self",
".",
"lst",
".",
"append",
"(",
"pkt",
")",
"if",
"self",
".",
"prn",
":",
"result",
"=",
"self",
".",
"pr... | DEV: entry point. Will be called by sniff() for each
received packet (that passes the filters). | [
"DEV",
":",
"entry",
"point",
".",
"Will",
"be",
"called",
"by",
"sniff",
"()",
"for",
"each",
"received",
"packet",
"(",
"that",
"passes",
"the",
"filters",
")",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sessions.py#L26-L37 | train | Called by the filter handler when a packet is received. | 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/packet.py | bind_bottom_up | def bind_bottom_up(lower, upper, __fval=None, **fval):
"""Bind 2 layers for dissection.
The upper layer will be chosen for dissection on top of the lower layer, if
ALL the passed arguments are validated. If multiple calls are made with the same # noqa: E501
layers, the last one will be used as default.... | python | def bind_bottom_up(lower, upper, __fval=None, **fval):
"""Bind 2 layers for dissection.
The upper layer will be chosen for dissection on top of the lower layer, if
ALL the passed arguments are validated. If multiple calls are made with the same # noqa: E501
layers, the last one will be used as default.... | [
"def",
"bind_bottom_up",
"(",
"lower",
",",
"upper",
",",
"__fval",
"=",
"None",
",",
"*",
"*",
"fval",
")",
":",
"if",
"__fval",
"is",
"not",
"None",
":",
"fval",
".",
"update",
"(",
"__fval",
")",
"lower",
".",
"payload_guess",
"=",
"lower",
".",
... | Bind 2 layers for dissection.
The upper layer will be chosen for dissection on top of the lower layer, if
ALL the passed arguments are validated. If multiple calls are made with the same # noqa: E501
layers, the last one will be used as default.
ex:
>>> bind_bottom_up(Ether, SNAP, type=0x1234)... | [
"Bind",
"2",
"layers",
"for",
"dissection",
".",
"The",
"upper",
"layer",
"will",
"be",
"chosen",
"for",
"dissection",
"on",
"top",
"of",
"the",
"lower",
"layer",
"if",
"ALL",
"the",
"passed",
"arguments",
"are",
"validated",
".",
"If",
"multiple",
"calls"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1539-L1553 | train | Bind 2 layers for dissection. | 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/packet.py | bind_top_down | def bind_top_down(lower, upper, __fval=None, **fval):
"""Bind 2 layers for building.
When the upper layer is added as a payload of the lower layer, all the arguments # noqa: E501
will be applied to them.
ex:
>>> bind_top_down(Ether, SNAP, type=0x1234)
>>> Ether()/SNAP()
<Ether ... | python | def bind_top_down(lower, upper, __fval=None, **fval):
"""Bind 2 layers for building.
When the upper layer is added as a payload of the lower layer, all the arguments # noqa: E501
will be applied to them.
ex:
>>> bind_top_down(Ether, SNAP, type=0x1234)
>>> Ether()/SNAP()
<Ether ... | [
"def",
"bind_top_down",
"(",
"lower",
",",
"upper",
",",
"__fval",
"=",
"None",
",",
"*",
"*",
"fval",
")",
":",
"if",
"__fval",
"is",
"not",
"None",
":",
"fval",
".",
"update",
"(",
"__fval",
")",
"upper",
".",
"_overload_fields",
"=",
"upper",
".",... | Bind 2 layers for building.
When the upper layer is added as a payload of the lower layer, all the arguments # noqa: E501
will be applied to them.
ex:
>>> bind_top_down(Ether, SNAP, type=0x1234)
>>> Ether()/SNAP()
<Ether type=0x1234 |<SNAP |>> | [
"Bind",
"2",
"layers",
"for",
"building",
".",
"When",
"the",
"upper",
"layer",
"is",
"added",
"as",
"a",
"payload",
"of",
"the",
"lower",
"layer",
"all",
"the",
"arguments",
"#",
"noqa",
":",
"E501",
"will",
"be",
"applied",
"to",
"them",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1556-L1569 | train | Bind 2 layers for building. | 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/packet.py | bind_layers | def bind_layers(lower, upper, __fval=None, **fval):
"""Bind 2 layers on some specific fields' values. It makes the packet being built # noqa: E501
and dissected when the arguments are present.
This functions calls both bind_bottom_up and bind_top_down, with all passed arguments. # noqa: E501
Please h... | python | def bind_layers(lower, upper, __fval=None, **fval):
"""Bind 2 layers on some specific fields' values. It makes the packet being built # noqa: E501
and dissected when the arguments are present.
This functions calls both bind_bottom_up and bind_top_down, with all passed arguments. # noqa: E501
Please h... | [
"def",
"bind_layers",
"(",
"lower",
",",
"upper",
",",
"__fval",
"=",
"None",
",",
"*",
"*",
"fval",
")",
":",
"if",
"__fval",
"is",
"not",
"None",
":",
"fval",
".",
"update",
"(",
"__fval",
")",
"bind_top_down",
"(",
"lower",
",",
"upper",
",",
"*... | Bind 2 layers on some specific fields' values. It makes the packet being built # noqa: E501
and dissected when the arguments are present.
This functions calls both bind_bottom_up and bind_top_down, with all passed arguments. # noqa: E501
Please have a look at their docs:
- help(bind_bottom_up)
... | [
"Bind",
"2",
"layers",
"on",
"some",
"specific",
"fields",
"values",
".",
"It",
"makes",
"the",
"packet",
"being",
"built",
"#",
"noqa",
":",
"E501",
"and",
"dissected",
"when",
"the",
"arguments",
"are",
"present",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1573-L1585 | train | Bind 2 layers on some specific fields values. It makes the packet being built when the arguments are present. | 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/packet.py | split_bottom_up | def split_bottom_up(lower, upper, __fval=None, **fval):
"""This call un-links an association that was made using bind_bottom_up.
Have a look at help(bind_bottom_up)
"""
if __fval is not None:
fval.update(__fval)
def do_filter(params, cls):
params_is_invalid = any(
k not ... | python | def split_bottom_up(lower, upper, __fval=None, **fval):
"""This call un-links an association that was made using bind_bottom_up.
Have a look at help(bind_bottom_up)
"""
if __fval is not None:
fval.update(__fval)
def do_filter(params, cls):
params_is_invalid = any(
k not ... | [
"def",
"split_bottom_up",
"(",
"lower",
",",
"upper",
",",
"__fval",
"=",
"None",
",",
"*",
"*",
"fval",
")",
":",
"if",
"__fval",
"is",
"not",
"None",
":",
"fval",
".",
"update",
"(",
"__fval",
")",
"def",
"do_filter",
"(",
"params",
",",
"cls",
"... | This call un-links an association that was made using bind_bottom_up.
Have a look at help(bind_bottom_up) | [
"This",
"call",
"un",
"-",
"links",
"an",
"association",
"that",
"was",
"made",
"using",
"bind_bottom_up",
".",
"Have",
"a",
"look",
"at",
"help",
"(",
"bind_bottom_up",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1588-L1600 | train | This function splits the payload_guess of the current node into two nodes. | 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/packet.py | split_top_down | def split_top_down(lower, upper, __fval=None, **fval):
"""This call un-links an association that was made using bind_top_down.
Have a look at help(bind_top_down)
"""
if __fval is not None:
fval.update(__fval)
if lower in upper._overload_fields:
ofval = upper._overload_fields[lower]
... | python | def split_top_down(lower, upper, __fval=None, **fval):
"""This call un-links an association that was made using bind_top_down.
Have a look at help(bind_top_down)
"""
if __fval is not None:
fval.update(__fval)
if lower in upper._overload_fields:
ofval = upper._overload_fields[lower]
... | [
"def",
"split_top_down",
"(",
"lower",
",",
"upper",
",",
"__fval",
"=",
"None",
",",
"*",
"*",
"fval",
")",
":",
"if",
"__fval",
"is",
"not",
"None",
":",
"fval",
".",
"update",
"(",
"__fval",
")",
"if",
"lower",
"in",
"upper",
".",
"_overload_field... | This call un-links an association that was made using bind_top_down.
Have a look at help(bind_top_down) | [
"This",
"call",
"un",
"-",
"links",
"an",
"association",
"that",
"was",
"made",
"using",
"bind_top_down",
".",
"Have",
"a",
"look",
"at",
"help",
"(",
"bind_top_down",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1603-L1614 | train | This function splits an association into two sets of items. | 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/packet.py | split_layers | def split_layers(lower, upper, __fval=None, **fval):
"""Split 2 layers previously bound.
This call un-links calls bind_top_down and bind_bottom_up. It is the opposite of # noqa: E501
bind_layers.
Please have a look at their docs:
- help(split_bottom_up)
- help(split_top_down)
"""
if ... | python | def split_layers(lower, upper, __fval=None, **fval):
"""Split 2 layers previously bound.
This call un-links calls bind_top_down and bind_bottom_up. It is the opposite of # noqa: E501
bind_layers.
Please have a look at their docs:
- help(split_bottom_up)
- help(split_top_down)
"""
if ... | [
"def",
"split_layers",
"(",
"lower",
",",
"upper",
",",
"__fval",
"=",
"None",
",",
"*",
"*",
"fval",
")",
":",
"if",
"__fval",
"is",
"not",
"None",
":",
"fval",
".",
"update",
"(",
"__fval",
")",
"split_bottom_up",
"(",
"lower",
",",
"upper",
",",
... | Split 2 layers previously bound.
This call un-links calls bind_top_down and bind_bottom_up. It is the opposite of # noqa: E501
bind_layers.
Please have a look at their docs:
- help(split_bottom_up)
- help(split_top_down) | [
"Split",
"2",
"layers",
"previously",
"bound",
".",
"This",
"call",
"un",
"-",
"links",
"calls",
"bind_top_down",
"and",
"bind_bottom_up",
".",
"It",
"is",
"the",
"opposite",
"of",
"#",
"noqa",
":",
"E501",
"bind_layers",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1618-L1630 | train | Split 2 layers previously bound. | 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/packet.py | explore | def explore(layer=None):
"""Function used to discover the Scapy layers and protocols.
It helps to see which packets exists in contrib or layer files.
params:
- layer: If specified, the function will explore the layer. If not,
the GUI mode will be activated, to browse the available layers... | python | def explore(layer=None):
"""Function used to discover the Scapy layers and protocols.
It helps to see which packets exists in contrib or layer files.
params:
- layer: If specified, the function will explore the layer. If not,
the GUI mode will be activated, to browse the available layers... | [
"def",
"explore",
"(",
"layer",
"=",
"None",
")",
":",
"if",
"layer",
"is",
"None",
":",
"# GUI MODE",
"if",
"not",
"conf",
".",
"interactive",
":",
"raise",
"Scapy_Exception",
"(",
"\"explore() GUI-mode cannot be run in \"",
"\"interactive mode. Please provide a \"",... | Function used to discover the Scapy layers and protocols.
It helps to see which packets exists in contrib or layer files.
params:
- layer: If specified, the function will explore the layer. If not,
the GUI mode will be activated, to browse the available layers
examples:
>>> explor... | [
"Function",
"used",
"to",
"discover",
"the",
"Scapy",
"layers",
"and",
"protocols",
".",
"It",
"helps",
"to",
"see",
"which",
"packets",
"exists",
"in",
"contrib",
"or",
"layer",
"files",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1634-L1757 | train | Function used to explore the Scapy layers and protocols. | 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/packet.py | ls | def ls(obj=None, case_sensitive=False, verbose=False):
"""List available layers, or infos on a given layer class or name.
params:
- obj: Packet / packet name to use
- case_sensitive: if obj is a string, is it case sensitive?
- verbose
"""
is_string = isinstance(obj, six.string_types)
... | python | def ls(obj=None, case_sensitive=False, verbose=False):
"""List available layers, or infos on a given layer class or name.
params:
- obj: Packet / packet name to use
- case_sensitive: if obj is a string, is it case sensitive?
- verbose
"""
is_string = isinstance(obj, six.string_types)
... | [
"def",
"ls",
"(",
"obj",
"=",
"None",
",",
"case_sensitive",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"is_string",
"=",
"isinstance",
"(",
"obj",
",",
"six",
".",
"string_types",
")",
"if",
"obj",
"is",
"None",
"or",
"is_string",
":",
"t... | List available layers, or infos on a given layer class or name.
params:
- obj: Packet / packet name to use
- case_sensitive: if obj is a string, is it case sensitive?
- verbose | [
"List",
"available",
"layers",
"or",
"infos",
"on",
"a",
"given",
"layer",
"class",
"or",
"name",
".",
"params",
":",
"-",
"obj",
":",
"Packet",
"/",
"packet",
"name",
"to",
"use",
"-",
"case_sensitive",
":",
"if",
"obj",
"is",
"a",
"string",
"is",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1761-L1849 | train | List available layers or infos on a given Packet or name. | 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/packet.py | fuzz | def fuzz(p, _inplace=0):
"""Transform a layer into a fuzzy layer by replacing some default values by random objects""" # noqa: E501
if not _inplace:
p = p.copy()
q = p
while not isinstance(q, NoPayload):
for f in q.fields_desc:
if isinstance(f, PacketListField):
... | python | def fuzz(p, _inplace=0):
"""Transform a layer into a fuzzy layer by replacing some default values by random objects""" # noqa: E501
if not _inplace:
p = p.copy()
q = p
while not isinstance(q, NoPayload):
for f in q.fields_desc:
if isinstance(f, PacketListField):
... | [
"def",
"fuzz",
"(",
"p",
",",
"_inplace",
"=",
"0",
")",
":",
"# noqa: E501",
"if",
"not",
"_inplace",
":",
"p",
"=",
"p",
".",
"copy",
"(",
")",
"q",
"=",
"p",
"while",
"not",
"isinstance",
"(",
"q",
",",
"NoPayload",
")",
":",
"for",
"f",
"in... | Transform a layer into a fuzzy layer by replacing some default values by random objects | [
"Transform",
"a",
"layer",
"into",
"a",
"fuzzy",
"layer",
"by",
"replacing",
"some",
"default",
"values",
"by",
"random",
"objects"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1857-L1874 | train | Transform a layer into a fuzzy layer by replacing some default values by random objects | 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/packet.py | Packet.init_fields | def init_fields(self):
"""
Initialize each fields of the fields_desc dict
"""
if self.class_dont_cache.get(self.__class__, False):
self.do_init_fields(self.fields_desc)
else:
self.do_init_cached_fields() | python | def init_fields(self):
"""
Initialize each fields of the fields_desc dict
"""
if self.class_dont_cache.get(self.__class__, False):
self.do_init_fields(self.fields_desc)
else:
self.do_init_cached_fields() | [
"def",
"init_fields",
"(",
"self",
")",
":",
"if",
"self",
".",
"class_dont_cache",
".",
"get",
"(",
"self",
".",
"__class__",
",",
"False",
")",
":",
"self",
".",
"do_init_fields",
"(",
"self",
".",
"fields_desc",
")",
"else",
":",
"self",
".",
"do_in... | Initialize each fields of the fields_desc dict | [
"Initialize",
"each",
"fields",
"of",
"the",
"fields_desc",
"dict"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L167-L175 | train | Initialize each field of the fields_desc dict. | 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/packet.py | Packet.do_init_fields | def do_init_fields(self, flist):
"""
Initialize each fields of the fields_desc dict
"""
for f in flist:
self.default_fields[f.name] = copy.deepcopy(f.default)
self.fieldtype[f.name] = f
if f.holds_packets:
self.packetfields.append(f) | python | def do_init_fields(self, flist):
"""
Initialize each fields of the fields_desc dict
"""
for f in flist:
self.default_fields[f.name] = copy.deepcopy(f.default)
self.fieldtype[f.name] = f
if f.holds_packets:
self.packetfields.append(f) | [
"def",
"do_init_fields",
"(",
"self",
",",
"flist",
")",
":",
"for",
"f",
"in",
"flist",
":",
"self",
".",
"default_fields",
"[",
"f",
".",
"name",
"]",
"=",
"copy",
".",
"deepcopy",
"(",
"f",
".",
"default",
")",
"self",
".",
"fieldtype",
"[",
"f"... | Initialize each fields of the fields_desc dict | [
"Initialize",
"each",
"fields",
"of",
"the",
"fields_desc",
"dict"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L177-L185 | train | Initialize each field of the fields_desc dict | 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/packet.py | Packet.do_init_cached_fields | def do_init_cached_fields(self):
"""
Initialize each fields of the fields_desc dict, or use the cached
fields information
"""
cls_name = self.__class__
# Build the fields information
if Packet.class_default_fields.get(cls_name, None) is None:
self.pr... | python | def do_init_cached_fields(self):
"""
Initialize each fields of the fields_desc dict, or use the cached
fields information
"""
cls_name = self.__class__
# Build the fields information
if Packet.class_default_fields.get(cls_name, None) is None:
self.pr... | [
"def",
"do_init_cached_fields",
"(",
"self",
")",
":",
"cls_name",
"=",
"self",
".",
"__class__",
"# Build the fields information",
"if",
"Packet",
".",
"class_default_fields",
".",
"get",
"(",
"cls_name",
",",
"None",
")",
"is",
"None",
":",
"self",
".",
"pre... | Initialize each fields of the fields_desc dict, or use the cached
fields information | [
"Initialize",
"each",
"fields",
"of",
"the",
"fields_desc",
"dict",
"or",
"use",
"the",
"cached",
"fields",
"information"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L187-L208 | train | Initialize each fields of the fields_desc dict or use the cached
fields 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/packet.py | Packet.prepare_cached_fields | def prepare_cached_fields(self, flist):
"""
Prepare the cached fields of the fields_desc dict
"""
cls_name = self.__class__
# Fields cache initialization
if flist:
Packet.class_default_fields[cls_name] = dict()
Packet.class_default_fields_ref[cls... | python | def prepare_cached_fields(self, flist):
"""
Prepare the cached fields of the fields_desc dict
"""
cls_name = self.__class__
# Fields cache initialization
if flist:
Packet.class_default_fields[cls_name] = dict()
Packet.class_default_fields_ref[cls... | [
"def",
"prepare_cached_fields",
"(",
"self",
",",
"flist",
")",
":",
"cls_name",
"=",
"self",
".",
"__class__",
"# Fields cache initialization",
"if",
"flist",
":",
"Packet",
".",
"class_default_fields",
"[",
"cls_name",
"]",
"=",
"dict",
"(",
")",
"Packet",
"... | Prepare the cached fields of the fields_desc dict | [
"Prepare",
"the",
"cached",
"fields",
"of",
"the",
"fields_desc",
"dict"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L210-L243 | train | Prepare the cached fields of the fields_desc 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/packet.py | Packet.dissection_done | def dissection_done(self, pkt):
"""DEV: will be called after a dissection is completed"""
self.post_dissection(pkt)
self.payload.dissection_done(pkt) | python | def dissection_done(self, pkt):
"""DEV: will be called after a dissection is completed"""
self.post_dissection(pkt)
self.payload.dissection_done(pkt) | [
"def",
"dissection_done",
"(",
"self",
",",
"pkt",
")",
":",
"self",
".",
"post_dissection",
"(",
"pkt",
")",
"self",
".",
"payload",
".",
"dissection_done",
"(",
"pkt",
")"
] | DEV: will be called after a dissection is completed | [
"DEV",
":",
"will",
"be",
"called",
"after",
"a",
"dissection",
"is",
"completed"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L245-L248 | train | Called when a dissection is complete. | 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/packet.py | Packet.copy | def copy(self):
"""Returns a deep copy of the instance."""
clone = self.__class__()
clone.fields = self.copy_fields_dict(self.fields)
clone.default_fields = self.copy_fields_dict(self.default_fields)
clone.overloaded_fields = self.overloaded_fields.copy()
clone.underlayer... | python | def copy(self):
"""Returns a deep copy of the instance."""
clone = self.__class__()
clone.fields = self.copy_fields_dict(self.fields)
clone.default_fields = self.copy_fields_dict(self.default_fields)
clone.overloaded_fields = self.overloaded_fields.copy()
clone.underlayer... | [
"def",
"copy",
"(",
"self",
")",
":",
"clone",
"=",
"self",
".",
"__class__",
"(",
")",
"clone",
".",
"fields",
"=",
"self",
".",
"copy_fields_dict",
"(",
"self",
".",
"fields",
")",
"clone",
".",
"default_fields",
"=",
"self",
".",
"copy_fields_dict",
... | Returns a deep copy of the instance. | [
"Returns",
"a",
"deep",
"copy",
"of",
"the",
"instance",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L287-L304 | train | Returns a deep copy of the instance. | 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/packet.py | Packet._superdir | def _superdir(self):
"""
Return a list of slots and methods, including those from subclasses.
"""
attrs = set()
cls = self.__class__
if hasattr(cls, '__all_slots__'):
attrs.update(cls.__all_slots__)
for bcls in cls.__mro__:
if hasattr(bcls,... | python | def _superdir(self):
"""
Return a list of slots and methods, including those from subclasses.
"""
attrs = set()
cls = self.__class__
if hasattr(cls, '__all_slots__'):
attrs.update(cls.__all_slots__)
for bcls in cls.__mro__:
if hasattr(bcls,... | [
"def",
"_superdir",
"(",
"self",
")",
":",
"attrs",
"=",
"set",
"(",
")",
"cls",
"=",
"self",
".",
"__class__",
"if",
"hasattr",
"(",
"cls",
",",
"'__all_slots__'",
")",
":",
"attrs",
".",
"update",
"(",
"cls",
".",
"__all_slots__",
")",
"for",
"bcls... | Return a list of slots and methods, including those from subclasses. | [
"Return",
"a",
"list",
"of",
"slots",
"and",
"methods",
"including",
"those",
"from",
"subclasses",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L384-L395 | train | Return a list of slots and methods including those from subclasses. | 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/packet.py | Packet.clear_cache | def clear_cache(self):
"""Clear the raw packet cache for the field and all its subfields"""
self.raw_packet_cache = None
for _, fval in six.iteritems(self.fields):
if isinstance(fval, Packet):
fval.clear_cache()
self.payload.clear_cache() | python | def clear_cache(self):
"""Clear the raw packet cache for the field and all its subfields"""
self.raw_packet_cache = None
for _, fval in six.iteritems(self.fields):
if isinstance(fval, Packet):
fval.clear_cache()
self.payload.clear_cache() | [
"def",
"clear_cache",
"(",
"self",
")",
":",
"self",
".",
"raw_packet_cache",
"=",
"None",
"for",
"_",
",",
"fval",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fval",
",",
"Packet",
")",
":",
"fval",... | Clear the raw packet cache for the field and all its subfields | [
"Clear",
"the",
"raw",
"packet",
"cache",
"for",
"the",
"field",
"and",
"all",
"its",
"subfields"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L488-L494 | train | Clear the raw packet cache for the field and all its subfields | 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/packet.py | Packet.self_build | def self_build(self, field_pos_list=None):
"""
Create the default layer regarding fields_desc dict
:param field_pos_list:
"""
if self.raw_packet_cache is not None:
for fname, fval in six.iteritems(self.raw_packet_cache_fields):
if self.getfieldval(fna... | python | def self_build(self, field_pos_list=None):
"""
Create the default layer regarding fields_desc dict
:param field_pos_list:
"""
if self.raw_packet_cache is not None:
for fname, fval in six.iteritems(self.raw_packet_cache_fields):
if self.getfieldval(fna... | [
"def",
"self_build",
"(",
"self",
",",
"field_pos_list",
"=",
"None",
")",
":",
"if",
"self",
".",
"raw_packet_cache",
"is",
"not",
"None",
":",
"for",
"fname",
",",
"fval",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"raw_packet_cache_fields",
")",
... | Create the default layer regarding fields_desc dict
:param field_pos_list: | [
"Create",
"the",
"default",
"layer",
"regarding",
"fields_desc",
"dict"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L496-L521 | train | Create the default layer regarding fields_desc dict
| 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/packet.py | Packet.do_build | def do_build(self):
"""
Create the default version of the layer
:return: a string of the packet with the payload
"""
if not self.explicit:
self = next(iter(self))
pkt = self.self_build()
for t in self.post_transforms:
pkt = t(pkt)
... | python | def do_build(self):
"""
Create the default version of the layer
:return: a string of the packet with the payload
"""
if not self.explicit:
self = next(iter(self))
pkt = self.self_build()
for t in self.post_transforms:
pkt = t(pkt)
... | [
"def",
"do_build",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"explicit",
":",
"self",
"=",
"next",
"(",
"iter",
"(",
"self",
")",
")",
"pkt",
"=",
"self",
".",
"self_build",
"(",
")",
"for",
"t",
"in",
"self",
".",
"post_transforms",
":",
... | Create the default version of the layer
:return: a string of the packet with the payload | [
"Create",
"the",
"default",
"version",
"of",
"the",
"layer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L531-L546 | train | Create the default version of the layer and return the payload | 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/packet.py | Packet.build | def build(self):
"""
Create the current layer
:return: string of the packet with the payload
"""
p = self.do_build()
p += self.build_padding()
p = self.build_done(p)
return p | python | def build(self):
"""
Create the current layer
:return: string of the packet with the payload
"""
p = self.do_build()
p += self.build_padding()
p = self.build_done(p)
return p | [
"def",
"build",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"do_build",
"(",
")",
"p",
"+=",
"self",
".",
"build_padding",
"(",
")",
"p",
"=",
"self",
".",
"build_done",
"(",
"p",
")",
"return",
"p"
] | Create the current layer
:return: string of the packet with the payload | [
"Create",
"the",
"current",
"layer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L551-L560 | train | Create the current layer and return the string with the payload | 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/packet.py | Packet.do_dissect_payload | def do_dissect_payload(self, s):
"""
Perform the dissection of the layer's payload
:param str s: the raw layer
"""
if s:
cls = self.guess_payload_class(s)
try:
p = cls(s, _internal=1, _underlayer=self)
except KeyboardInterrupt:... | python | def do_dissect_payload(self, s):
"""
Perform the dissection of the layer's payload
:param str s: the raw layer
"""
if s:
cls = self.guess_payload_class(s)
try:
p = cls(s, _internal=1, _underlayer=self)
except KeyboardInterrupt:... | [
"def",
"do_dissect_payload",
"(",
"self",
",",
"s",
")",
":",
"if",
"s",
":",
"cls",
"=",
"self",
".",
"guess_payload_class",
"(",
"s",
")",
"try",
":",
"p",
"=",
"cls",
"(",
"s",
",",
"_internal",
"=",
"1",
",",
"_underlayer",
"=",
"self",
")",
... | Perform the dissection of the layer's payload
:param str s: the raw layer | [
"Perform",
"the",
"dissection",
"of",
"the",
"layer",
"s",
"payload"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L796-L817 | train | Perform the dissection of the payload of the layer. | 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/packet.py | Packet.guess_payload_class | def guess_payload_class(self, payload):
"""
DEV: Guesses the next payload class from layer bonds.
Can be overloaded to use a different mechanism.
:param str payload: the layer's payload
:return: the payload class
"""
for t in self.aliastypes:
for fval... | python | def guess_payload_class(self, payload):
"""
DEV: Guesses the next payload class from layer bonds.
Can be overloaded to use a different mechanism.
:param str payload: the layer's payload
:return: the payload class
"""
for t in self.aliastypes:
for fval... | [
"def",
"guess_payload_class",
"(",
"self",
",",
"payload",
")",
":",
"for",
"t",
"in",
"self",
".",
"aliastypes",
":",
"for",
"fval",
",",
"cls",
"in",
"t",
".",
"payload_guess",
":",
"if",
"all",
"(",
"hasattr",
"(",
"self",
",",
"k",
")",
"and",
... | DEV: Guesses the next payload class from layer bonds.
Can be overloaded to use a different mechanism.
:param str payload: the layer's payload
:return: the payload class | [
"DEV",
":",
"Guesses",
"the",
"next",
"payload",
"class",
"from",
"layer",
"bonds",
".",
"Can",
"be",
"overloaded",
"to",
"use",
"a",
"different",
"mechanism",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L831-L844 | train | Guesses the next payload class from the layer bonds. | 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/packet.py | Packet.hide_defaults | def hide_defaults(self):
"""Removes fields' values that are the same as default values."""
# use list(): self.fields is modified in the loop
for k, v in list(six.iteritems(self.fields)):
v = self.fields[k]
if k in self.default_fields:
if self.default_field... | python | def hide_defaults(self):
"""Removes fields' values that are the same as default values."""
# use list(): self.fields is modified in the loop
for k, v in list(six.iteritems(self.fields)):
v = self.fields[k]
if k in self.default_fields:
if self.default_field... | [
"def",
"hide_defaults",
"(",
"self",
")",
":",
"# use list(): self.fields is modified in the loop",
"for",
"k",
",",
"v",
"in",
"list",
"(",
"six",
".",
"iteritems",
"(",
"self",
".",
"fields",
")",
")",
":",
"v",
"=",
"self",
".",
"fields",
"[",
"k",
"]... | Removes fields' values that are the same as default values. | [
"Removes",
"fields",
"values",
"that",
"are",
"the",
"same",
"as",
"default",
"values",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L856-L864 | train | Removes fields values that are the same as default values. | 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/packet.py | Packet.layers | def layers(self):
"""returns a list of layer classes (including subclasses) in this packet""" # noqa: E501
layers = []
lyr = self
while lyr:
layers.append(lyr.__class__)
lyr = lyr.payload.getlayer(0, _subclass=True)
return layers | python | def layers(self):
"""returns a list of layer classes (including subclasses) in this packet""" # noqa: E501
layers = []
lyr = self
while lyr:
layers.append(lyr.__class__)
lyr = lyr.payload.getlayer(0, _subclass=True)
return layers | [
"def",
"layers",
"(",
"self",
")",
":",
"# noqa: E501",
"layers",
"=",
"[",
"]",
"lyr",
"=",
"self",
"while",
"lyr",
":",
"layers",
".",
"append",
"(",
"lyr",
".",
"__class__",
")",
"lyr",
"=",
"lyr",
".",
"payload",
".",
"getlayer",
"(",
"0",
",",... | returns a list of layer classes (including subclasses) in this packet | [
"returns",
"a",
"list",
"of",
"layer",
"classes",
"(",
"including",
"subclasses",
")",
"in",
"this",
"packet"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L990-L997 | train | returns a list of layer classes including subclasses in this 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/packet.py | Packet.getlayer | def getlayer(self, cls, nb=1, _track=None, _subclass=None, **flt):
"""Return the nb^th layer that is an instance of cls, matching flt
values.
"""
if _subclass is None:
_subclass = self.match_subclass or None
if _subclass:
match = lambda cls1, cls2: issubclass(cls1... | python | def getlayer(self, cls, nb=1, _track=None, _subclass=None, **flt):
"""Return the nb^th layer that is an instance of cls, matching flt
values.
"""
if _subclass is None:
_subclass = self.match_subclass or None
if _subclass:
match = lambda cls1, cls2: issubclass(cls1... | [
"def",
"getlayer",
"(",
"self",
",",
"cls",
",",
"nb",
"=",
"1",
",",
"_track",
"=",
"None",
",",
"_subclass",
"=",
"None",
",",
"*",
"*",
"flt",
")",
":",
"if",
"_subclass",
"is",
"None",
":",
"_subclass",
"=",
"self",
".",
"match_subclass",
"or",... | Return the nb^th layer that is an instance of cls, matching flt
values. | [
"Return",
"the",
"nb^th",
"layer",
"that",
"is",
"an",
"instance",
"of",
"cls",
"matching",
"flt",
"values",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1017-L1060 | train | Return the nb^th layer that is an instance of cls matching flt
values. | 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/packet.py | Packet._show_or_dump | def _show_or_dump(self, dump=False, indent=3, lvl="", label_lvl="", first_call=True): # noqa: E501
"""
Internal method that shows or dumps a hierarchical view of a packet.
Called by show.
:param dump: determine if it prints or returns the string value
:param int indent: the siz... | python | def _show_or_dump(self, dump=False, indent=3, lvl="", label_lvl="", first_call=True): # noqa: E501
"""
Internal method that shows or dumps a hierarchical view of a packet.
Called by show.
:param dump: determine if it prints or returns the string value
:param int indent: the siz... | [
"def",
"_show_or_dump",
"(",
"self",
",",
"dump",
"=",
"False",
",",
"indent",
"=",
"3",
",",
"lvl",
"=",
"\"\"",
",",
"label_lvl",
"=",
"\"\"",
",",
"first_call",
"=",
"True",
")",
":",
"# noqa: E501",
"if",
"dump",
":",
"from",
"scapy",
".",
"theme... | Internal method that shows or dumps a hierarchical view of a packet.
Called by show.
:param dump: determine if it prints or returns the string value
:param int indent: the size of indentation for each layer
:param str lvl: additional information about the layer lvl
:param str la... | [
"Internal",
"method",
"that",
"shows",
"or",
"dumps",
"a",
"hierarchical",
"view",
"of",
"a",
"packet",
".",
"Called",
"by",
"show",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1106-L1160 | train | Internal method that shows or dumps a hierarchical view of 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/packet.py | Packet.show | def show(self, dump=False, indent=3, lvl="", label_lvl=""):
"""
Prints or returns (when "dump" is true) a hierarchical view of the
packet.
:param dump: determine if it prints or returns the string value
:param int indent: the size of indentation for each layer
:param str... | python | def show(self, dump=False, indent=3, lvl="", label_lvl=""):
"""
Prints or returns (when "dump" is true) a hierarchical view of the
packet.
:param dump: determine if it prints or returns the string value
:param int indent: the size of indentation for each layer
:param str... | [
"def",
"show",
"(",
"self",
",",
"dump",
"=",
"False",
",",
"indent",
"=",
"3",
",",
"lvl",
"=",
"\"\"",
",",
"label_lvl",
"=",
"\"\"",
")",
":",
"return",
"self",
".",
"_show_or_dump",
"(",
"dump",
",",
"indent",
",",
"lvl",
",",
"label_lvl",
")"
... | Prints or returns (when "dump" is true) a hierarchical view of the
packet.
:param dump: determine if it prints or returns the string value
:param int indent: the size of indentation for each layer
:param str lvl: additional information about the layer lvl
:param str label_lvl: a... | [
"Prints",
"or",
"returns",
"(",
"when",
"dump",
"is",
"true",
")",
"a",
"hierarchical",
"view",
"of",
"the",
"packet",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1162-L1173 | train | Print the value of the key - value layer. | 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/packet.py | Packet.show2 | def show2(self, dump=False, indent=3, lvl="", label_lvl=""):
"""
Prints or returns (when "dump" is true) a hierarchical view of an
assembled version of the packet, so that automatic fields are
calculated (checksums, etc.)
:param dump: determine if it prints or returns the string... | python | def show2(self, dump=False, indent=3, lvl="", label_lvl=""):
"""
Prints or returns (when "dump" is true) a hierarchical view of an
assembled version of the packet, so that automatic fields are
calculated (checksums, etc.)
:param dump: determine if it prints or returns the string... | [
"def",
"show2",
"(",
"self",
",",
"dump",
"=",
"False",
",",
"indent",
"=",
"3",
",",
"lvl",
"=",
"\"\"",
",",
"label_lvl",
"=",
"\"\"",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"raw",
"(",
"self",
")",
")",
".",
"show",
"(",
"dump",
... | Prints or returns (when "dump" is true) a hierarchical view of an
assembled version of the packet, so that automatic fields are
calculated (checksums, etc.)
:param dump: determine if it prints or returns the string value
:param int indent: the size of indentation for each layer
... | [
"Prints",
"or",
"returns",
"(",
"when",
"dump",
"is",
"true",
")",
"a",
"hierarchical",
"view",
"of",
"an",
"assembled",
"version",
"of",
"the",
"packet",
"so",
"that",
"automatic",
"fields",
"are",
"calculated",
"(",
"checksums",
"etc",
".",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1175-L1187 | train | Print the packet as a hierarchical view of 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/packet.py | Packet.sprintf | def sprintf(self, fmt, relax=1):
"""sprintf(format, [relax=1]) -> str
where format is a string that can include directives. A directive begins and
ends by % and has the following format %[fmt[r],][cls[:nb].]field%.
fmt is a classic printf directive, "r" can be appended for raw substitution
(ex: IP.flags=0x18 i... | python | def sprintf(self, fmt, relax=1):
"""sprintf(format, [relax=1]) -> str
where format is a string that can include directives. A directive begins and
ends by % and has the following format %[fmt[r],][cls[:nb].]field%.
fmt is a classic printf directive, "r" can be appended for raw substitution
(ex: IP.flags=0x18 i... | [
"def",
"sprintf",
"(",
"self",
",",
"fmt",
",",
"relax",
"=",
"1",
")",
":",
"escape",
"=",
"{",
"\"%\"",
":",
"\"%\"",
",",
"\"(\"",
":",
"\"{\"",
",",
"\")\"",
":",
"\"}\"",
"}",
"# Evaluate conditions",
"while",
"\"{\"",
"in",
"fmt",
":",
"i",
"... | sprintf(format, [relax=1]) -> str
where format is a string that can include directives. A directive begins and
ends by % and has the following format %[fmt[r],][cls[:nb].]field%.
fmt is a classic printf directive, "r" can be appended for raw substitution
(ex: IP.flags=0x18 instead of SA), nb is the number of the layer... | [
"sprintf",
"(",
"format",
"[",
"relax",
"=",
"1",
"]",
")",
"-",
">",
"str",
"where",
"format",
"is",
"a",
"string",
"that",
"can",
"include",
"directives",
".",
"A",
"directive",
"begins",
"and",
"ends",
"by",
"%",
"and",
"has",
"the",
"following",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1189-L1291 | train | Return a string that can be used as a sprintf statement in a log 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/packet.py | Packet.command | def command(self):
"""
Returns a string representing the command you have to type to
obtain the same packet
"""
f = []
for fn, fv in six.iteritems(self.fields):
fld = self.get_field(fn)
if isinstance(fv, (list, dict, set)) and len(fv) == 0:
... | python | def command(self):
"""
Returns a string representing the command you have to type to
obtain the same packet
"""
f = []
for fn, fv in six.iteritems(self.fields):
fld = self.get_field(fn)
if isinstance(fv, (list, dict, set)) and len(fv) == 0:
... | [
"def",
"command",
"(",
"self",
")",
":",
"f",
"=",
"[",
"]",
"for",
"fn",
",",
"fv",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"fields",
")",
":",
"fld",
"=",
"self",
".",
"get_field",
"(",
"fn",
")",
"if",
"isinstance",
"(",
"fv",
",",
... | Returns a string representing the command you have to type to
obtain the same packet | [
"Returns",
"a",
"string",
"representing",
"the",
"command",
"you",
"have",
"to",
"type",
"to",
"obtain",
"the",
"same",
"packet"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/packet.py#L1341-L1364 | train | Returns a string representing the command you have to type to
obtain the same 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/tls/automaton_srv.py | TLSServerAutomaton.INIT_TLS_SESSION | def INIT_TLS_SESSION(self):
"""
XXX We should offer the right key according to the client's suites. For
now server_rsa_key is only used for RSAkx, but we should try to replace
every server_key with both server_rsa_key and server_ecdsa_key.
"""
self.cur_session = tlsSessio... | python | def INIT_TLS_SESSION(self):
"""
XXX We should offer the right key according to the client's suites. For
now server_rsa_key is only used for RSAkx, but we should try to replace
every server_key with both server_rsa_key and server_ecdsa_key.
"""
self.cur_session = tlsSessio... | [
"def",
"INIT_TLS_SESSION",
"(",
"self",
")",
":",
"self",
".",
"cur_session",
"=",
"tlsSession",
"(",
"connection_end",
"=",
"\"server\"",
")",
"self",
".",
"cur_session",
".",
"server_certs",
"=",
"[",
"self",
".",
"mycert",
"]",
"self",
".",
"cur_session",... | XXX We should offer the right key according to the client's suites. For
now server_rsa_key is only used for RSAkx, but we should try to replace
every server_key with both server_rsa_key and server_ecdsa_key. | [
"XXX",
"We",
"should",
"offer",
"the",
"right",
"key",
"according",
"to",
"the",
"client",
"s",
"suites",
".",
"For",
"now",
"server_rsa_key",
"is",
"only",
"used",
"for",
"RSAkx",
"but",
"we",
"should",
"try",
"to",
"replace",
"every",
"server_key",
"with... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton_srv.py#L176-L189 | train | Initialize the TLS session. | 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/automaton_srv.py | TLSServerAutomaton.should_check_ciphersuites | def should_check_ciphersuites(self):
"""
We extract cipher suites candidates from the client's proposition.
"""
if isinstance(self.mykey, PrivKeyRSA):
kx = "RSA"
elif isinstance(self.mykey, PrivKeyECDSA):
kx = "ECDSA"
if get_usable_ciphersuites(sel... | python | def should_check_ciphersuites(self):
"""
We extract cipher suites candidates from the client's proposition.
"""
if isinstance(self.mykey, PrivKeyRSA):
kx = "RSA"
elif isinstance(self.mykey, PrivKeyECDSA):
kx = "ECDSA"
if get_usable_ciphersuites(sel... | [
"def",
"should_check_ciphersuites",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"mykey",
",",
"PrivKeyRSA",
")",
":",
"kx",
"=",
"\"RSA\"",
"elif",
"isinstance",
"(",
"self",
".",
"mykey",
",",
"PrivKeyECDSA",
")",
":",
"kx",
"=",
"\"ECD... | We extract cipher suites candidates from the client's proposition. | [
"We",
"extract",
"cipher",
"suites",
"candidates",
"from",
"the",
"client",
"s",
"proposition",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton_srv.py#L212-L222 | train | Check if cipher suites are usable. | 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/automaton_srv.py | TLSServerAutomaton.should_add_ServerHello | def should_add_ServerHello(self):
"""
Selecting a cipher suite should be no trouble as we already caught
the None case previously.
Also, we do not manage extensions at all.
"""
if isinstance(self.mykey, PrivKeyRSA):
kx = "RSA"
elif isinstance(self.myk... | python | def should_add_ServerHello(self):
"""
Selecting a cipher suite should be no trouble as we already caught
the None case previously.
Also, we do not manage extensions at all.
"""
if isinstance(self.mykey, PrivKeyRSA):
kx = "RSA"
elif isinstance(self.myk... | [
"def",
"should_add_ServerHello",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"mykey",
",",
"PrivKeyRSA",
")",
":",
"kx",
"=",
"\"RSA\"",
"elif",
"isinstance",
"(",
"self",
".",
"mykey",
",",
"PrivKeyECDSA",
")",
":",
"kx",
"=",
"\"ECDSA\... | Selecting a cipher suite should be no trouble as we already caught
the None case previously.
Also, we do not manage extensions at all. | [
"Selecting",
"a",
"cipher",
"suite",
"should",
"be",
"no",
"trouble",
"as",
"we",
"already",
"caught",
"the",
"None",
"case",
"previously",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton_srv.py#L243-L259 | train | Add a server hello message to the message queue. | 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/krack/automaton.py | KrackAP.parse_args | def parse_args(self, ap_mac, ssid, passphrase,
channel=None,
# KRACK attack options
double_3handshake=True,
encrypt_3handshake=True,
wait_3handshake=0,
double_gtk_refresh=True,
arp_target... | python | def parse_args(self, ap_mac, ssid, passphrase,
channel=None,
# KRACK attack options
double_3handshake=True,
encrypt_3handshake=True,
wait_3handshake=0,
double_gtk_refresh=True,
arp_target... | [
"def",
"parse_args",
"(",
"self",
",",
"ap_mac",
",",
"ssid",
",",
"passphrase",
",",
"channel",
"=",
"None",
",",
"# KRACK attack options",
"double_3handshake",
"=",
"True",
",",
"encrypt_3handshake",
"=",
"True",
",",
"wait_3handshake",
"=",
"0",
",",
"doubl... | Mandatory arguments:
@iface: interface to use (must be in monitor mode)
@ap_mac: AP's MAC
@ssid: AP's SSID
@passphrase: AP's Passphrase (min 8 char.)
Optional arguments:
@channel: used by the interface. Default 6, autodetected on windows
Krack attacks options:
... | [
"Mandatory",
"arguments",
":",
"@iface",
":",
"interface",
"to",
"use",
"(",
"must",
"be",
"in",
"monitor",
"mode",
")",
"@ap_mac",
":",
"AP",
"s",
"MAC",
"@ssid",
":",
"AP",
"s",
"SSID",
"@passphrase",
":",
"AP",
"s",
"Passphrase",
"(",
"min",
"8",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L72-L155 | train | Parse the arguments for the KrackAP 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/modules/krack/automaton.py | KrackAP.install_PMK | def install_PMK(self):
"""Compute and install the PMK"""
self.pmk = PBKDF2HMAC(
algorithm=hashes.SHA1(),
length=32,
salt=self.ssid.encode(),
iterations=4096,
backend=default_backend(),
).derive(self.passphrase.encode()) | python | def install_PMK(self):
"""Compute and install the PMK"""
self.pmk = PBKDF2HMAC(
algorithm=hashes.SHA1(),
length=32,
salt=self.ssid.encode(),
iterations=4096,
backend=default_backend(),
).derive(self.passphrase.encode()) | [
"def",
"install_PMK",
"(",
"self",
")",
":",
"self",
".",
"pmk",
"=",
"PBKDF2HMAC",
"(",
"algorithm",
"=",
"hashes",
".",
"SHA1",
"(",
")",
",",
"length",
"=",
"32",
",",
"salt",
"=",
"self",
".",
"ssid",
".",
"encode",
"(",
")",
",",
"iterations",... | Compute and install the PMK | [
"Compute",
"and",
"install",
"the",
"PMK"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L169-L177 | train | Compute and install the PMK | 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/krack/automaton.py | KrackAP.install_unicast_keys | def install_unicast_keys(self, client_nonce):
"""Use the client nonce @client_nonce to compute and install
PTK, KCK, KEK, TK, MIC (AP -> STA), MIC (STA -> AP)
"""
pmk = self.pmk
anonce = self.anonce
snonce = client_nonce
amac = mac2str(self.mac)
smac = mac... | python | def install_unicast_keys(self, client_nonce):
"""Use the client nonce @client_nonce to compute and install
PTK, KCK, KEK, TK, MIC (AP -> STA), MIC (STA -> AP)
"""
pmk = self.pmk
anonce = self.anonce
snonce = client_nonce
amac = mac2str(self.mac)
smac = mac... | [
"def",
"install_unicast_keys",
"(",
"self",
",",
"client_nonce",
")",
":",
"pmk",
"=",
"self",
".",
"pmk",
"anonce",
"=",
"self",
".",
"anonce",
"snonce",
"=",
"client_nonce",
"amac",
"=",
"mac2str",
"(",
"self",
".",
"mac",
")",
"smac",
"=",
"mac2str",
... | Use the client nonce @client_nonce to compute and install
PTK, KCK, KEK, TK, MIC (AP -> STA), MIC (STA -> AP) | [
"Use",
"the",
"client",
"nonce"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L179-L200 | train | Use the client nonce to compute and install the unicast keys for the current client. | 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/krack/automaton.py | KrackAP.install_GTK | def install_GTK(self):
"""Compute a new GTK and install it alongs
MIC (AP -> Group = broadcast + multicast)
"""
# Compute GTK
self.gtk_full = self.gen_nonce(32)
self.gtk = self.gtk_full[:16]
# Extract derivated keys
self.mic_ap_to_group = self.gtk_full[1... | python | def install_GTK(self):
"""Compute a new GTK and install it alongs
MIC (AP -> Group = broadcast + multicast)
"""
# Compute GTK
self.gtk_full = self.gen_nonce(32)
self.gtk = self.gtk_full[:16]
# Extract derivated keys
self.mic_ap_to_group = self.gtk_full[1... | [
"def",
"install_GTK",
"(",
"self",
")",
":",
"# Compute GTK",
"self",
".",
"gtk_full",
"=",
"self",
".",
"gen_nonce",
"(",
"32",
")",
"self",
".",
"gtk",
"=",
"self",
".",
"gtk_full",
"[",
":",
"16",
"]",
"# Extract derivated keys",
"self",
".",
"mic_ap_... | Compute a new GTK and install it alongs
MIC (AP -> Group = broadcast + multicast) | [
"Compute",
"a",
"new",
"GTK",
"and",
"install",
"it",
"alongs",
"MIC",
"(",
"AP",
"-",
">",
"Group",
"=",
"broadcast",
"+",
"multicast",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L202-L215 | train | Compute a new GTK and install it alongs
MIC | 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/krack/automaton.py | KrackAP.build_ap_info_pkt | def build_ap_info_pkt(self, layer_cls, dest):
"""Build a packet with info describing the current AP
For beacon / proberesp use
"""
return RadioTap() \
/ Dot11(addr1=dest, addr2=self.mac, addr3=self.mac) \
/ layer_cls(timestamp=0, beacon_interval=100,
... | python | def build_ap_info_pkt(self, layer_cls, dest):
"""Build a packet with info describing the current AP
For beacon / proberesp use
"""
return RadioTap() \
/ Dot11(addr1=dest, addr2=self.mac, addr3=self.mac) \
/ layer_cls(timestamp=0, beacon_interval=100,
... | [
"def",
"build_ap_info_pkt",
"(",
"self",
",",
"layer_cls",
",",
"dest",
")",
":",
"return",
"RadioTap",
"(",
")",
"/",
"Dot11",
"(",
"addr1",
"=",
"dest",
",",
"addr2",
"=",
"self",
".",
"mac",
",",
"addr3",
"=",
"self",
".",
"mac",
")",
"/",
"laye... | Build a packet with info describing the current AP
For beacon / proberesp use | [
"Build",
"a",
"packet",
"with",
"info",
"describing",
"the",
"current",
"AP",
"For",
"beacon",
"/",
"proberesp",
"use"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L219-L232 | train | Build a packet with info describing the current AP. | 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/krack/automaton.py | KrackAP.build_GTK_KDE | def build_GTK_KDE(self):
"""Build the Key Data Encapsulation for GTK
KeyID: 0
Ref: 802.11i p81
"""
return b''.join([
b'\xdd', # Type KDE
chb(len(self.gtk_full) + 6),
b'\x00\x0f\xac', # OUI
b'\x01', # GTK KDE
b'\x00\x0... | python | def build_GTK_KDE(self):
"""Build the Key Data Encapsulation for GTK
KeyID: 0
Ref: 802.11i p81
"""
return b''.join([
b'\xdd', # Type KDE
chb(len(self.gtk_full) + 6),
b'\x00\x0f\xac', # OUI
b'\x01', # GTK KDE
b'\x00\x0... | [
"def",
"build_GTK_KDE",
"(",
"self",
")",
":",
"return",
"b''",
".",
"join",
"(",
"[",
"b'\\xdd'",
",",
"# Type KDE",
"chb",
"(",
"len",
"(",
"self",
".",
"gtk_full",
")",
"+",
"6",
")",
",",
"b'\\x00\\x0f\\xac'",
",",
"# OUI",
"b'\\x01'",
",",
"# GTK ... | Build the Key Data Encapsulation for GTK
KeyID: 0
Ref: 802.11i p81 | [
"Build",
"the",
"Key",
"Data",
"Encapsulation",
"for",
"GTK",
"KeyID",
":",
"0",
"Ref",
":",
"802",
".",
"11i",
"p81"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L301-L313 | train | Builds the Key Data Encapsulation for GTK. | 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/krack/automaton.py | KrackAP.send_wpa_enc | def send_wpa_enc(self, data, iv, seqnum, dest, mic_key,
key_idx=0, additionnal_flag=["from-DS"],
encrypt_key=None):
"""Send an encrypted packet with content @data, using IV @iv,
sequence number @seqnum, MIC key @mic_key
"""
if encrypt_key is Non... | python | def send_wpa_enc(self, data, iv, seqnum, dest, mic_key,
key_idx=0, additionnal_flag=["from-DS"],
encrypt_key=None):
"""Send an encrypted packet with content @data, using IV @iv,
sequence number @seqnum, MIC key @mic_key
"""
if encrypt_key is Non... | [
"def",
"send_wpa_enc",
"(",
"self",
",",
"data",
",",
"iv",
",",
"seqnum",
",",
"dest",
",",
"mic_key",
",",
"key_idx",
"=",
"0",
",",
"additionnal_flag",
"=",
"[",
"\"from-DS\"",
"]",
",",
"encrypt_key",
"=",
"None",
")",
":",
"if",
"encrypt_key",
"is... | Send an encrypted packet with content @data, using IV @iv,
sequence number @seqnum, MIC key @mic_key | [
"Send",
"an",
"encrypted",
"packet",
"with",
"content"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L315-L345 | train | Send an encrypted packet with content data using IV seqnum MIC key mic_key and key_idx. | 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/krack/automaton.py | KrackAP.send_ether_over_wpa | def send_ether_over_wpa(self, pkt, **kwargs):
"""Send an Ethernet packet using the WPA channel
Extra arguments will be ignored, and are just left for compatibility
"""
payload = LLC() / SNAP() / pkt[Ether].payload
dest = pkt.dst
if dest == "ff:ff:ff:ff:ff:ff":
... | python | def send_ether_over_wpa(self, pkt, **kwargs):
"""Send an Ethernet packet using the WPA channel
Extra arguments will be ignored, and are just left for compatibility
"""
payload = LLC() / SNAP() / pkt[Ether].payload
dest = pkt.dst
if dest == "ff:ff:ff:ff:ff:ff":
... | [
"def",
"send_ether_over_wpa",
"(",
"self",
",",
"pkt",
",",
"*",
"*",
"kwargs",
")",
":",
"payload",
"=",
"LLC",
"(",
")",
"/",
"SNAP",
"(",
")",
"/",
"pkt",
"[",
"Ether",
"]",
".",
"payload",
"dest",
"=",
"pkt",
".",
"dst",
"if",
"dest",
"==",
... | Send an Ethernet packet using the WPA channel
Extra arguments will be ignored, and are just left for compatibility | [
"Send",
"an",
"Ethernet",
"packet",
"using",
"the",
"WPA",
"channel",
"Extra",
"arguments",
"will",
"be",
"ignored",
"and",
"are",
"just",
"left",
"for",
"compatibility"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/krack/automaton.py#L359-L370 | train | Send an Ethernet packet over the WPA channel. | 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/automaton.py | _TLSAutomaton.get_next_msg | def get_next_msg(self, socket_timeout=2, retry=2):
"""
The purpose of the function is to make next message(s) available in
self.buffer_in. If the list is not empty, nothing is done. If not, in
order to fill it, the function uses the data already available in
self.remain_in from a... | python | def get_next_msg(self, socket_timeout=2, retry=2):
"""
The purpose of the function is to make next message(s) available in
self.buffer_in. If the list is not empty, nothing is done. If not, in
order to fill it, the function uses the data already available in
self.remain_in from a... | [
"def",
"get_next_msg",
"(",
"self",
",",
"socket_timeout",
"=",
"2",
",",
"retry",
"=",
"2",
")",
":",
"if",
"self",
".",
"buffer_in",
":",
"# A message is already available.",
"return",
"self",
".",
"socket",
".",
"settimeout",
"(",
"socket_timeout",
")",
"... | The purpose of the function is to make next message(s) available in
self.buffer_in. If the list is not empty, nothing is done. If not, in
order to fill it, the function uses the data already available in
self.remain_in from a previous call and waits till there are enough to
dissect a TLS... | [
"The",
"purpose",
"of",
"the",
"function",
"is",
"to",
"make",
"next",
"message",
"(",
"s",
")",
"available",
"in",
"self",
".",
"buffer_in",
".",
"If",
"the",
"list",
"is",
"not",
"empty",
"nothing",
"is",
"done",
".",
"If",
"not",
"in",
"order",
"t... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton.py#L78-L166 | train | This function returns the next available message from the buffer_in list. If the buffer_in is not empty it is filled with the remaining bytes and the function returns the message. If the buffer_in is not empty it is set to socket_timeout and retry is set to True. | 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/automaton.py | _TLSAutomaton.raise_on_packet | def raise_on_packet(self, pkt_cls, state, get_next_msg=True):
"""
If the next message to be processed has type 'pkt_cls', raise 'state'.
If there is no message waiting to be processed, we try to get one with
the default 'get_next_msg' parameters.
"""
# Maybe we already pa... | python | def raise_on_packet(self, pkt_cls, state, get_next_msg=True):
"""
If the next message to be processed has type 'pkt_cls', raise 'state'.
If there is no message waiting to be processed, we try to get one with
the default 'get_next_msg' parameters.
"""
# Maybe we already pa... | [
"def",
"raise_on_packet",
"(",
"self",
",",
"pkt_cls",
",",
"state",
",",
"get_next_msg",
"=",
"True",
")",
":",
"# Maybe we already parsed the expected packet, maybe not.",
"if",
"get_next_msg",
":",
"self",
".",
"get_next_msg",
"(",
")",
"if",
"(",
"not",
"self"... | If the next message to be processed has type 'pkt_cls', raise 'state'.
If there is no message waiting to be processed, we try to get one with
the default 'get_next_msg' parameters. | [
"If",
"the",
"next",
"message",
"to",
"be",
"processed",
"has",
"type",
"pkt_cls",
"raise",
"state",
".",
"If",
"there",
"is",
"no",
"message",
"waiting",
"to",
"be",
"processed",
"we",
"try",
"to",
"get",
"one",
"with",
"the",
"default",
"get_next_msg",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton.py#L168-L182 | train | Raise state on the next 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/tls/automaton.py | _TLSAutomaton.add_record | def add_record(self, is_sslv2=None, is_tls13=None):
"""
Add a new TLS or SSLv2 or TLS 1.3 record to the packets buffered out.
"""
if is_sslv2 is None and is_tls13 is None:
v = (self.cur_session.tls_version or
self.cur_session.advertised_tls_version)
... | python | def add_record(self, is_sslv2=None, is_tls13=None):
"""
Add a new TLS or SSLv2 or TLS 1.3 record to the packets buffered out.
"""
if is_sslv2 is None and is_tls13 is None:
v = (self.cur_session.tls_version or
self.cur_session.advertised_tls_version)
... | [
"def",
"add_record",
"(",
"self",
",",
"is_sslv2",
"=",
"None",
",",
"is_tls13",
"=",
"None",
")",
":",
"if",
"is_sslv2",
"is",
"None",
"and",
"is_tls13",
"is",
"None",
":",
"v",
"=",
"(",
"self",
".",
"cur_session",
".",
"tls_version",
"or",
"self",
... | Add a new TLS or SSLv2 or TLS 1.3 record to the packets buffered out. | [
"Add",
"a",
"new",
"TLS",
"or",
"SSLv2",
"or",
"TLS",
"1",
".",
"3",
"record",
"to",
"the",
"packets",
"buffered",
"out",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton.py#L184-L200 | train | Add a new TLS or SSLv2 or TLS 1. 3 record to the packets buffered out. | 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/automaton.py | _TLSAutomaton.add_msg | def add_msg(self, pkt):
"""
Add a TLS message (e.g. TLSClientHello or TLSApplicationData)
inside the latest record to be sent through the socket.
We believe a good automaton should not use the first test.
"""
if not self.buffer_out:
self.add_record()
r... | python | def add_msg(self, pkt):
"""
Add a TLS message (e.g. TLSClientHello or TLSApplicationData)
inside the latest record to be sent through the socket.
We believe a good automaton should not use the first test.
"""
if not self.buffer_out:
self.add_record()
r... | [
"def",
"add_msg",
"(",
"self",
",",
"pkt",
")",
":",
"if",
"not",
"self",
".",
"buffer_out",
":",
"self",
".",
"add_record",
"(",
")",
"r",
"=",
"self",
".",
"buffer_out",
"[",
"-",
"1",
"]",
"if",
"isinstance",
"(",
"r",
",",
"TLS13",
")",
":",
... | Add a TLS message (e.g. TLSClientHello or TLSApplicationData)
inside the latest record to be sent through the socket.
We believe a good automaton should not use the first test. | [
"Add",
"a",
"TLS",
"message",
"(",
"e",
".",
"g",
".",
"TLSClientHello",
"or",
"TLSApplicationData",
")",
"inside",
"the",
"latest",
"record",
"to",
"be",
"sent",
"through",
"the",
"socket",
".",
"We",
"believe",
"a",
"good",
"automaton",
"should",
"not",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton.py#L202-L214 | train | Add a TLS message to the message 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/layers/tls/automaton.py | _TLSAutomaton.flush_records | def flush_records(self):
"""
Send all buffered records and update the session accordingly.
"""
s = b"".join(p.raw_stateful() for p in self.buffer_out)
self.socket.send(s)
self.buffer_out = [] | python | def flush_records(self):
"""
Send all buffered records and update the session accordingly.
"""
s = b"".join(p.raw_stateful() for p in self.buffer_out)
self.socket.send(s)
self.buffer_out = [] | [
"def",
"flush_records",
"(",
"self",
")",
":",
"s",
"=",
"b\"\"",
".",
"join",
"(",
"p",
".",
"raw_stateful",
"(",
")",
"for",
"p",
"in",
"self",
".",
"buffer_out",
")",
"self",
".",
"socket",
".",
"send",
"(",
"s",
")",
"self",
".",
"buffer_out",
... | Send all buffered records and update the session accordingly. | [
"Send",
"all",
"buffered",
"records",
"and",
"update",
"the",
"session",
"accordingly",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/automaton.py#L216-L222 | train | Send all buffered records and update the session accordingly. | 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/dot15d4.py | util_srcpanid_present | def util_srcpanid_present(pkt):
'''A source PAN ID is included if and only if both src addr mode != 0 and PAN ID Compression in FCF == 0''' # noqa: E501
if (pkt.underlayer.getfieldval("fcf_srcaddrmode") != 0) and (pkt.underlayer.getfieldval("fcf_panidcompress") == 0): # noqa: E501
return True
else... | python | def util_srcpanid_present(pkt):
'''A source PAN ID is included if and only if both src addr mode != 0 and PAN ID Compression in FCF == 0''' # noqa: E501
if (pkt.underlayer.getfieldval("fcf_srcaddrmode") != 0) and (pkt.underlayer.getfieldval("fcf_panidcompress") == 0): # noqa: E501
return True
else... | [
"def",
"util_srcpanid_present",
"(",
"pkt",
")",
":",
"# noqa: E501",
"if",
"(",
"pkt",
".",
"underlayer",
".",
"getfieldval",
"(",
"\"fcf_srcaddrmode\"",
")",
"!=",
"0",
")",
"and",
"(",
"pkt",
".",
"underlayer",
".",
"getfieldval",
"(",
"\"fcf_panidcompress\... | A source PAN ID is included if and only if both src addr mode != 0 and PAN ID Compression in FCF == 0 | [
"A",
"source",
"PAN",
"ID",
"is",
"included",
"if",
"and",
"only",
"if",
"both",
"src",
"addr",
"mode",
"!",
"=",
"0",
"and",
"PAN",
"ID",
"Compression",
"in",
"FCF",
"==",
"0"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dot15d4.py#L362-L367 | train | A source PAN ID is included if and only if both src addr mode and PAN ID Compression in FCF == 0 | 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/dot15d4.py | dot15d4AddressField.i2repr | def i2repr(self, pkt, x):
"""Convert internal value to a nice representation"""
if len(hex(self.i2m(pkt, x))) < 7: # short address
return hex(self.i2m(pkt, x))
else: # long address
x = "%016x" % self.i2m(pkt, x)
return ":".join(["%s%s" % (x[i], x[i + 1]) for... | python | def i2repr(self, pkt, x):
"""Convert internal value to a nice representation"""
if len(hex(self.i2m(pkt, x))) < 7: # short address
return hex(self.i2m(pkt, x))
else: # long address
x = "%016x" % self.i2m(pkt, x)
return ":".join(["%s%s" % (x[i], x[i + 1]) for... | [
"def",
"i2repr",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"if",
"len",
"(",
"hex",
"(",
"self",
".",
"i2m",
"(",
"pkt",
",",
"x",
")",
")",
")",
"<",
"7",
":",
"# short address",
"return",
"hex",
"(",
"self",
".",
"i2m",
"(",
"pkt",
",",
... | Convert internal value to a nice representation | [
"Convert",
"internal",
"value",
"to",
"a",
"nice",
"representation"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dot15d4.py#L40-L46 | train | Convert internal value to a nice representation | 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/dot15d4.py | dot15d4AddressField.addfield | def addfield(self, pkt, s, val):
"""Add an internal value to a string"""
if self.adjust(pkt, self.length_of) == 2:
return s + struct.pack(self.fmt[0] + "H", val)
elif self.adjust(pkt, self.length_of) == 8:
return s + struct.pack(self.fmt[0] + "Q", val)
else:
... | python | def addfield(self, pkt, s, val):
"""Add an internal value to a string"""
if self.adjust(pkt, self.length_of) == 2:
return s + struct.pack(self.fmt[0] + "H", val)
elif self.adjust(pkt, self.length_of) == 8:
return s + struct.pack(self.fmt[0] + "Q", val)
else:
... | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"val",
")",
":",
"if",
"self",
".",
"adjust",
"(",
"pkt",
",",
"self",
".",
"length_of",
")",
"==",
"2",
":",
"return",
"s",
"+",
"struct",
".",
"pack",
"(",
"self",
".",
"fmt",
"[",
... | Add an internal value to a string | [
"Add",
"an",
"internal",
"value",
"to",
"a",
"string"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dot15d4.py#L48-L55 | train | Add an internal value to a string | 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/prf.py | _tls_P_hash | def _tls_P_hash(secret, seed, req_len, hm):
"""
Provides the implementation of P_hash function defined in
section 5 of RFC 4346 (and section 5 of RFC 5246). Two
parameters have been added (hm and req_len):
- secret : the key to be used. If RFC 4868 is to be believed,
the length must ... | python | def _tls_P_hash(secret, seed, req_len, hm):
"""
Provides the implementation of P_hash function defined in
section 5 of RFC 4346 (and section 5 of RFC 5246). Two
parameters have been added (hm and req_len):
- secret : the key to be used. If RFC 4868 is to be believed,
the length must ... | [
"def",
"_tls_P_hash",
"(",
"secret",
",",
"seed",
",",
"req_len",
",",
"hm",
")",
":",
"hash_len",
"=",
"hm",
".",
"hash_alg",
".",
"hash_len",
"n",
"=",
"(",
"req_len",
"+",
"hash_len",
"-",
"1",
")",
"//",
"hash_len",
"seed",
"=",
"bytes_encode",
"... | Provides the implementation of P_hash function defined in
section 5 of RFC 4346 (and section 5 of RFC 5246). Two
parameters have been added (hm and req_len):
- secret : the key to be used. If RFC 4868 is to be believed,
the length must match hm.key_len. Actually,
python hmac t... | [
"Provides",
"the",
"implementation",
"of",
"P_hash",
"function",
"defined",
"in",
"section",
"5",
"of",
"RFC",
"4346",
"(",
"and",
"section",
"5",
"of",
"RFC",
"5246",
")",
".",
"Two",
"parameters",
"have",
"been",
"added",
"(",
"hm",
"and",
"req_len",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L22-L51 | train | This function generates the P_hash function for the TLS version of the given key. | 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/prf.py | _ssl_PRF | def _ssl_PRF(secret, seed, req_len):
"""
Provides the implementation of SSLv3 PRF function:
SSLv3-PRF(secret, seed) =
MD5(secret || SHA-1("A" || secret || seed)) ||
MD5(secret || SHA-1("BB" || secret || seed)) ||
MD5(secret || SHA-1("CCC" || secret || seed)) || ...
req_len sho... | python | def _ssl_PRF(secret, seed, req_len):
"""
Provides the implementation of SSLv3 PRF function:
SSLv3-PRF(secret, seed) =
MD5(secret || SHA-1("A" || secret || seed)) ||
MD5(secret || SHA-1("BB" || secret || seed)) ||
MD5(secret || SHA-1("CCC" || secret || seed)) || ...
req_len sho... | [
"def",
"_ssl_PRF",
"(",
"secret",
",",
"seed",
",",
"req_len",
")",
":",
"if",
"req_len",
">",
"416",
":",
"warning",
"(",
"\"_ssl_PRF() is not expected to provide more than 416 bytes\"",
")",
"return",
"\"\"",
"d",
"=",
"[",
"b\"A\"",
",",
"b\"B\"",
",",
"b\"... | Provides the implementation of SSLv3 PRF function:
SSLv3-PRF(secret, seed) =
MD5(secret || SHA-1("A" || secret || seed)) ||
MD5(secret || SHA-1("BB" || secret || seed)) ||
MD5(secret || SHA-1("CCC" || secret || seed)) || ...
req_len should not be more than 26 x 16 = 416. | [
"Provides",
"the",
"implementation",
"of",
"SSLv3",
"PRF",
"function",
":"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L93-L121 | train | Returns the SSLv3 PRF function for the given secret and seed. | 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/prf.py | _tls_PRF | def _tls_PRF(secret, label, seed, req_len):
"""
Provides the implementation of TLS PRF function as defined in
section 5 of RFC 4346:
PRF(secret, label, seed) = P_MD5(S1, label + seed) XOR
P_SHA-1(S2, label + seed)
Parameters are:
- secret: the secret used by the... | python | def _tls_PRF(secret, label, seed, req_len):
"""
Provides the implementation of TLS PRF function as defined in
section 5 of RFC 4346:
PRF(secret, label, seed) = P_MD5(S1, label + seed) XOR
P_SHA-1(S2, label + seed)
Parameters are:
- secret: the secret used by the... | [
"def",
"_tls_PRF",
"(",
"secret",
",",
"label",
",",
"seed",
",",
"req_len",
")",
":",
"tmp_len",
"=",
"(",
"len",
"(",
"secret",
")",
"+",
"1",
")",
"//",
"2",
"S1",
"=",
"secret",
"[",
":",
"tmp_len",
"]",
"S2",
"=",
"secret",
"[",
"-",
"tmp_... | Provides the implementation of TLS PRF function as defined in
section 5 of RFC 4346:
PRF(secret, label, seed) = P_MD5(S1, label + seed) XOR
P_SHA-1(S2, label + seed)
Parameters are:
- secret: the secret used by the HMAC in the 2 expansion
functions (S1 and... | [
"Provides",
"the",
"implementation",
"of",
"TLS",
"PRF",
"function",
"as",
"defined",
"in",
"section",
"5",
"of",
"RFC",
"4346",
":"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L124-L148 | train | Returns the PRF function for the given secret label and seed. | 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/prf.py | _tls12_SHA256PRF | def _tls12_SHA256PRF(secret, label, seed, req_len):
"""
Provides the implementation of TLS 1.2 PRF function as
defined in section 5 of RFC 5246:
PRF(secret, label, seed) = P_SHA256(secret, label + seed)
Parameters are:
- secret: the secret used by the HMAC in the 2 expansion
fun... | python | def _tls12_SHA256PRF(secret, label, seed, req_len):
"""
Provides the implementation of TLS 1.2 PRF function as
defined in section 5 of RFC 5246:
PRF(secret, label, seed) = P_SHA256(secret, label + seed)
Parameters are:
- secret: the secret used by the HMAC in the 2 expansion
fun... | [
"def",
"_tls12_SHA256PRF",
"(",
"secret",
",",
"label",
",",
"seed",
",",
"req_len",
")",
":",
"return",
"_tls_P_SHA256",
"(",
"secret",
",",
"label",
"+",
"seed",
",",
"req_len",
")"
] | Provides the implementation of TLS 1.2 PRF function as
defined in section 5 of RFC 5246:
PRF(secret, label, seed) = P_SHA256(secret, label + seed)
Parameters are:
- secret: the secret used by the HMAC in the 2 expansion
functions (S1 and S2 are the halves of this secret).
- label: s... | [
"Provides",
"the",
"implementation",
"of",
"TLS",
"1",
".",
"2",
"PRF",
"function",
"as",
"defined",
"in",
"section",
"5",
"of",
"RFC",
"5246",
":"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L151-L167 | train | Returns the implementation of TLS 1. 2 PRF function as
| 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/prf.py | PRF.compute_master_secret | def compute_master_secret(self, pre_master_secret,
client_random, server_random):
"""
Return the 48-byte master_secret, computed from pre_master_secret,
client_random and server_random. See RFC 5246, section 6.3.
"""
seed = client_random + server_ran... | python | def compute_master_secret(self, pre_master_secret,
client_random, server_random):
"""
Return the 48-byte master_secret, computed from pre_master_secret,
client_random and server_random. See RFC 5246, section 6.3.
"""
seed = client_random + server_ran... | [
"def",
"compute_master_secret",
"(",
"self",
",",
"pre_master_secret",
",",
"client_random",
",",
"server_random",
")",
":",
"seed",
"=",
"client_random",
"+",
"server_random",
"if",
"self",
".",
"tls_version",
"<",
"0x0300",
":",
"return",
"None",
"elif",
"self... | Return the 48-byte master_secret, computed from pre_master_secret,
client_random and server_random. See RFC 5246, section 6.3. | [
"Return",
"the",
"48",
"-",
"byte",
"master_secret",
"computed",
"from",
"pre_master_secret",
"client_random",
"and",
"server_random",
".",
"See",
"RFC",
"5246",
"section",
"6",
".",
"3",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L210-L222 | train | Computes the master secret from the pre_master_secret client_random and server_random. | 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/prf.py | PRF.derive_key_block | def derive_key_block(self, master_secret, server_random,
client_random, req_len):
"""
Perform the derivation of master_secret into a key_block of req_len
requested length. See RFC 5246, section 6.3.
"""
seed = server_random + client_random
if self... | python | def derive_key_block(self, master_secret, server_random,
client_random, req_len):
"""
Perform the derivation of master_secret into a key_block of req_len
requested length. See RFC 5246, section 6.3.
"""
seed = server_random + client_random
if self... | [
"def",
"derive_key_block",
"(",
"self",
",",
"master_secret",
",",
"server_random",
",",
"client_random",
",",
"req_len",
")",
":",
"seed",
"=",
"server_random",
"+",
"client_random",
"if",
"self",
".",
"tls_version",
"<=",
"0x0300",
":",
"return",
"self",
"."... | Perform the derivation of master_secret into a key_block of req_len
requested length. See RFC 5246, section 6.3. | [
"Perform",
"the",
"derivation",
"of",
"master_secret",
"into",
"a",
"key_block",
"of",
"req_len",
"requested",
"length",
".",
"See",
"RFC",
"5246",
"section",
"6",
".",
"3",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L224-L234 | train | Derive a key_block from a master_secret. | 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/prf.py | PRF.compute_verify_data | def compute_verify_data(self, con_end, read_or_write,
handshake_msg, master_secret):
"""
Return verify_data based on handshake messages, connection end,
master secret, and read_or_write position. See RFC 5246, section 7.4.9.
Every TLS 1.2 cipher suite has a v... | python | def compute_verify_data(self, con_end, read_or_write,
handshake_msg, master_secret):
"""
Return verify_data based on handshake messages, connection end,
master secret, and read_or_write position. See RFC 5246, section 7.4.9.
Every TLS 1.2 cipher suite has a v... | [
"def",
"compute_verify_data",
"(",
"self",
",",
"con_end",
",",
"read_or_write",
",",
"handshake_msg",
",",
"master_secret",
")",
":",
"if",
"self",
".",
"tls_version",
"<",
"0x0300",
":",
"return",
"None",
"elif",
"self",
".",
"tls_version",
"==",
"0x0300",
... | Return verify_data based on handshake messages, connection end,
master secret, and read_or_write position. See RFC 5246, section 7.4.9.
Every TLS 1.2 cipher suite has a verify_data of length 12. Note also:
"This PRF with the SHA-256 hash function is used for all cipher
suites defined i... | [
"Return",
"verify_data",
"based",
"on",
"handshake",
"messages",
"connection",
"end",
"master",
"secret",
"and",
"read_or_write",
"position",
".",
"See",
"RFC",
"5246",
"section",
"7",
".",
"4",
".",
"9",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L236-L294 | train | Compute verify_data based on handshake messages master_secret and read_or_write. | 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/prf.py | PRF.postprocess_key_for_export | def postprocess_key_for_export(self, key, client_random, server_random,
con_end, read_or_write, req_len):
"""
Postprocess cipher key for EXPORT ciphersuite, i.e. weakens it.
An export key generation example is given in section 6.3.1 of RFC 2246.
See als... | python | def postprocess_key_for_export(self, key, client_random, server_random,
con_end, read_or_write, req_len):
"""
Postprocess cipher key for EXPORT ciphersuite, i.e. weakens it.
An export key generation example is given in section 6.3.1 of RFC 2246.
See als... | [
"def",
"postprocess_key_for_export",
"(",
"self",
",",
"key",
",",
"client_random",
",",
"server_random",
",",
"con_end",
",",
"read_or_write",
",",
"req_len",
")",
":",
"s",
"=",
"con_end",
"+",
"read_or_write",
"s",
"=",
"(",
"s",
"==",
"\"clientwrite\"",
... | Postprocess cipher key for EXPORT ciphersuite, i.e. weakens it.
An export key generation example is given in section 6.3.1 of RFC 2246.
See also page 86 of EKR's book. | [
"Postprocess",
"cipher",
"key",
"for",
"EXPORT",
"ciphersuite",
"i",
".",
"e",
".",
"weakens",
"it",
".",
"An",
"export",
"key",
"generation",
"example",
"is",
"given",
"in",
"section",
"6",
".",
"3",
".",
"1",
"of",
"RFC",
"2246",
".",
"See",
"also",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L296-L323 | train | Postprocess cipher key for EXPORT cipher suite. | 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/prf.py | PRF.generate_iv_for_export | def generate_iv_for_export(self, client_random, server_random,
con_end, read_or_write, req_len):
"""
Generate IV for EXPORT ciphersuite, i.e. weakens it.
An export IV generation example is given in section 6.3.1 of RFC 2246.
See also page 86 of EKR's book.
... | python | def generate_iv_for_export(self, client_random, server_random,
con_end, read_or_write, req_len):
"""
Generate IV for EXPORT ciphersuite, i.e. weakens it.
An export IV generation example is given in section 6.3.1 of RFC 2246.
See also page 86 of EKR's book.
... | [
"def",
"generate_iv_for_export",
"(",
"self",
",",
"client_random",
",",
"server_random",
",",
"con_end",
",",
"read_or_write",
",",
"req_len",
")",
":",
"s",
"=",
"con_end",
"+",
"read_or_write",
"s",
"=",
"(",
"s",
"==",
"\"clientwrite\"",
"or",
"s",
"==",... | Generate IV for EXPORT ciphersuite, i.e. weakens it.
An export IV generation example is given in section 6.3.1 of RFC 2246.
See also page 86 of EKR's book. | [
"Generate",
"IV",
"for",
"EXPORT",
"ciphersuite",
"i",
".",
"e",
".",
"weakens",
"it",
".",
"An",
"export",
"IV",
"generation",
"example",
"is",
"given",
"in",
"section",
"6",
".",
"3",
".",
"1",
"of",
"RFC",
"2246",
".",
"See",
"also",
"page",
"86",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/prf.py#L325-L352 | train | Generate an export IV for the specified ciphersuite. | 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/data.py | load_protocols | def load_protocols(filename, _integer_base=10):
""""Parse /etc/protocols and return values as a dictionary."""
spaces = re.compile(b"[ \t]+|\n")
dct = DADict(_name=filename)
try:
with open(filename, "rb") as fdesc:
for line in fdesc:
try:
shrp = li... | python | def load_protocols(filename, _integer_base=10):
""""Parse /etc/protocols and return values as a dictionary."""
spaces = re.compile(b"[ \t]+|\n")
dct = DADict(_name=filename)
try:
with open(filename, "rb") as fdesc:
for line in fdesc:
try:
shrp = li... | [
"def",
"load_protocols",
"(",
"filename",
",",
"_integer_base",
"=",
"10",
")",
":",
"spaces",
"=",
"re",
".",
"compile",
"(",
"b\"[ \\t]+|\\n\"",
")",
"dct",
"=",
"DADict",
"(",
"_name",
"=",
"filename",
")",
"try",
":",
"with",
"open",
"(",
"filename",... | Parse /etc/protocols and return values as a dictionary. | [
"Parse",
"/",
"etc",
"/",
"protocols",
"and",
"return",
"values",
"as",
"a",
"dictionary",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/data.py#L157-L184 | train | Parse / etc / protocols and return values as a dictionary. | 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/data.py | load_manuf | def load_manuf(filename):
"""Load manuf file from Wireshark.
param:
- filename: the file to load the manuf file from"""
manufdb = ManufDA(_name=filename)
with open(filename, "rb") as fdesc:
for line in fdesc:
try:
line = line.strip()
if not line o... | python | def load_manuf(filename):
"""Load manuf file from Wireshark.
param:
- filename: the file to load the manuf file from"""
manufdb = ManufDA(_name=filename)
with open(filename, "rb") as fdesc:
for line in fdesc:
try:
line = line.strip()
if not line o... | [
"def",
"load_manuf",
"(",
"filename",
")",
":",
"manufdb",
"=",
"ManufDA",
"(",
"_name",
"=",
"filename",
")",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"fdesc",
":",
"for",
"line",
"in",
"fdesc",
":",
"try",
":",
"line",
"=",
"line"... | Load manuf file from Wireshark.
param:
- filename: the file to load the manuf file from | [
"Load",
"manuf",
"file",
"from",
"Wireshark",
".",
"param",
":",
"-",
"filename",
":",
"the",
"file",
"to",
"load",
"the",
"manuf",
"file",
"from"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/data.py#L269-L288 | train | Load the manuf file from Wireshark. | 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/data.py | ManufDA.lookup | def lookup(self, mac):
"""Find OUI name matching to a MAC"""
oui = ":".join(mac.split(":")[:3]).upper()
return self[oui] | python | def lookup(self, mac):
"""Find OUI name matching to a MAC"""
oui = ":".join(mac.split(":")[:3]).upper()
return self[oui] | [
"def",
"lookup",
"(",
"self",
",",
"mac",
")",
":",
"oui",
"=",
"\":\"",
".",
"join",
"(",
"mac",
".",
"split",
"(",
"\":\"",
")",
"[",
":",
"3",
"]",
")",
".",
"upper",
"(",
")",
"return",
"self",
"[",
"oui",
"]"
] | Find OUI name matching to a MAC | [
"Find",
"OUI",
"name",
"matching",
"to",
"a",
"MAC"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/data.py#L248-L251 | train | Find the OUI name matching to a MAC | 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/data.py | ManufDA.reverse_lookup | def reverse_lookup(self, name, case_sensitive=False):
"""Find all MACs registered to a OUI
params:
- name: the OUI name
- case_sensitive: default to False
returns: a dict of mac:tuples (Name, Extended Name)
"""
if case_sensitive:
filtr = lambda x, l:... | python | def reverse_lookup(self, name, case_sensitive=False):
"""Find all MACs registered to a OUI
params:
- name: the OUI name
- case_sensitive: default to False
returns: a dict of mac:tuples (Name, Extended Name)
"""
if case_sensitive:
filtr = lambda x, l:... | [
"def",
"reverse_lookup",
"(",
"self",
",",
"name",
",",
"case_sensitive",
"=",
"False",
")",
":",
"if",
"case_sensitive",
":",
"filtr",
"=",
"lambda",
"x",
",",
"l",
":",
"any",
"(",
"x",
"==",
"z",
"for",
"z",
"in",
"l",
")",
"else",
":",
"name",
... | Find all MACs registered to a OUI
params:
- name: the OUI name
- case_sensitive: default to False
returns: a dict of mac:tuples (Name, Extended Name) | [
"Find",
"all",
"MACs",
"registered",
"to",
"a",
"OUI",
"params",
":",
"-",
"name",
":",
"the",
"OUI",
"name",
"-",
"case_sensitive",
":",
"default",
"to",
"False",
"returns",
":",
"a",
"dict",
"of",
"mac",
":",
"tuples",
"(",
"Name",
"Extended",
"Name"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/data.py#L253-L266 | train | Returns a dict of all MACs registered to a OUI. | 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/ccp.py | DTO.answers | def answers(self, other):
"""In CCP, the payload of a DTO packet is dependent on the cmd field
of a corresponding CRO packet. Two packets correspond, if there
ctr field is equal. If answers detect the corresponding CRO, it will
interpret the payload of a DTO with the correct class. In CC... | python | def answers(self, other):
"""In CCP, the payload of a DTO packet is dependent on the cmd field
of a corresponding CRO packet. Two packets correspond, if there
ctr field is equal. If answers detect the corresponding CRO, it will
interpret the payload of a DTO with the correct class. In CC... | [
"def",
"answers",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"hasattr",
"(",
"other",
",",
"\"ctr\"",
")",
":",
"return",
"0",
"if",
"self",
".",
"ctr",
"!=",
"other",
".",
"ctr",
":",
"return",
"0",
"if",
"not",
"hasattr",
"(",
"other",
"... | In CCP, the payload of a DTO packet is dependent on the cmd field
of a corresponding CRO packet. Two packets correspond, if there
ctr field is equal. If answers detect the corresponding CRO, it will
interpret the payload of a DTO with the correct class. In CCP, there is
no other way, to ... | [
"In",
"CCP",
"the",
"payload",
"of",
"a",
"DTO",
"packet",
"is",
"dependent",
"on",
"the",
"cmd",
"field",
"of",
"a",
"corresponding",
"CRO",
"packet",
".",
"Two",
"packets",
"correspond",
"if",
"there",
"ctr",
"field",
"is",
"equal",
".",
"If",
"answers... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/automotive/ccp.py#L562-L584 | train | This function is used to determine the class of the payload of another DTO 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/__init__.py | _version_from_git_describe | def _version_from_git_describe():
"""
Read the version from ``git describe``. It returns the latest tag with an
optional suffix if the current directory is not exactly on the tag.
Example::
$ git describe --always
v2.3.2-346-g164a52c075c8
The tag prefix (``v``) and the git commit ... | python | def _version_from_git_describe():
"""
Read the version from ``git describe``. It returns the latest tag with an
optional suffix if the current directory is not exactly on the tag.
Example::
$ git describe --always
v2.3.2-346-g164a52c075c8
The tag prefix (``v``) and the git commit ... | [
"def",
"_version_from_git_describe",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"_SCAPY_PKG_DIR",
")",
",",
"'.git'",
")",
")",
":",
"# noqa: E501",
"... | Read the version from ``git describe``. It returns the latest tag with an
optional suffix if the current directory is not exactly on the tag.
Example::
$ git describe --always
v2.3.2-346-g164a52c075c8
The tag prefix (``v``) and the git commit sha1 (``-g164a52c075c8``) are
removed if p... | [
"Read",
"the",
"version",
"from",
"git",
"describe",
".",
"It",
"returns",
"the",
"latest",
"tag",
"with",
"an",
"optional",
"suffix",
"if",
"the",
"current",
"directory",
"is",
"not",
"exactly",
"on",
"the",
"tag",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/__init__.py#L21-L61 | train | Read the version from git describe. | 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/extensions.py | _TLS_Ext_CertTypeDispatcher | def _TLS_Ext_CertTypeDispatcher(m, *args, **kargs):
"""
We need to select the correct one on dissection. We use the length for
that, as 1 for client version would emply an empty list.
"""
tmp_len = struct.unpack("!H", m[2:4])[0]
if tmp_len == 1:
cls = TLS_Ext_ServerCertType
else:
... | python | def _TLS_Ext_CertTypeDispatcher(m, *args, **kargs):
"""
We need to select the correct one on dissection. We use the length for
that, as 1 for client version would emply an empty list.
"""
tmp_len = struct.unpack("!H", m[2:4])[0]
if tmp_len == 1:
cls = TLS_Ext_ServerCertType
else:
... | [
"def",
"_TLS_Ext_CertTypeDispatcher",
"(",
"m",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"tmp_len",
"=",
"struct",
".",
"unpack",
"(",
"\"!H\"",
",",
"m",
"[",
"2",
":",
"4",
"]",
")",
"[",
"0",
"]",
"if",
"tmp_len",
"==",
"1",
":",
... | We need to select the correct one on dissection. We use the length for
that, as 1 for client version would emply an empty list. | [
"We",
"need",
"to",
"select",
"the",
"correct",
"one",
"on",
"dissection",
".",
"We",
"use",
"the",
"length",
"for",
"that",
"as",
"1",
"for",
"client",
"version",
"would",
"emply",
"an",
"empty",
"list",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/extensions.py#L372-L382 | train | This function is used to create a new instance of the TLS_Ext_CertTypeDispatcher class. | 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/extensions.py | TLS_Ext_PrettyPacketList._show_or_dump | def _show_or_dump(self, dump=False, indent=3,
lvl="", label_lvl="", first_call=True):
""" Reproduced from packet.py """
ct = AnsiColorTheme() if dump else conf.color_theme
s = "%s%s %s %s \n" % (label_lvl, ct.punct("###["),
ct.layer_name(self.... | python | def _show_or_dump(self, dump=False, indent=3,
lvl="", label_lvl="", first_call=True):
""" Reproduced from packet.py """
ct = AnsiColorTheme() if dump else conf.color_theme
s = "%s%s %s %s \n" % (label_lvl, ct.punct("###["),
ct.layer_name(self.... | [
"def",
"_show_or_dump",
"(",
"self",
",",
"dump",
"=",
"False",
",",
"indent",
"=",
"3",
",",
"lvl",
"=",
"\"\"",
",",
"label_lvl",
"=",
"\"\"",
",",
"first_call",
"=",
"True",
")",
":",
"ct",
"=",
"AnsiColorTheme",
"(",
")",
"if",
"dump",
"else",
... | Reproduced from packet.py | [
"Reproduced",
"from",
"packet",
".",
"py"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/extensions.py#L96-L135 | train | Return a string representation 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/layers/tls/extensions.py | _ExtensionsLenField.getfield | def getfield(self, pkt, s):
"""
We try to compute a length, usually from a msglen parsed earlier.
If this length is 0, we consider 'selection_present' (from RFC 5246)
to be False. This means that there should not be any length field.
However, with TLS 1.3, zero lengths are always... | python | def getfield(self, pkt, s):
"""
We try to compute a length, usually from a msglen parsed earlier.
If this length is 0, we consider 'selection_present' (from RFC 5246)
to be False. This means that there should not be any length field.
However, with TLS 1.3, zero lengths are always... | [
"def",
"getfield",
"(",
"self",
",",
"pkt",
",",
"s",
")",
":",
"ext",
"=",
"pkt",
".",
"get_field",
"(",
"self",
".",
"length_of",
")",
"tmp_len",
"=",
"ext",
".",
"length_from",
"(",
"pkt",
")",
"if",
"tmp_len",
"is",
"None",
"or",
"tmp_len",
"<=... | We try to compute a length, usually from a msglen parsed earlier.
If this length is 0, we consider 'selection_present' (from RFC 5246)
to be False. This means that there should not be any length field.
However, with TLS 1.3, zero lengths are always explicit. | [
"We",
"try",
"to",
"compute",
"a",
"length",
"usually",
"from",
"a",
"msglen",
"parsed",
"earlier",
".",
"If",
"this",
"length",
"is",
"0",
"we",
"consider",
"selection_present",
"(",
"from",
"RFC",
"5246",
")",
"to",
"be",
"False",
".",
"This",
"means",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/extensions.py#L615-L628 | train | Return the length of the record from the extension field. | 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/extensions.py | _ExtensionsLenField.addfield | def addfield(self, pkt, s, i):
"""
There is a hack with the _ExtensionsField.i2len. It works only because
we expect _ExtensionsField.i2m to return a string of the same size (if
not of the same value) upon successive calls (e.g. through i2len here,
then i2m when directly building ... | python | def addfield(self, pkt, s, i):
"""
There is a hack with the _ExtensionsField.i2len. It works only because
we expect _ExtensionsField.i2m to return a string of the same size (if
not of the same value) upon successive calls (e.g. through i2len here,
then i2m when directly building ... | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"i",
")",
":",
"if",
"i",
"is",
"None",
":",
"if",
"self",
".",
"length_of",
"is",
"not",
"None",
":",
"fld",
",",
"fval",
"=",
"pkt",
".",
"getfield_and_val",
"(",
"self",
".",
"length_o... | There is a hack with the _ExtensionsField.i2len. It works only because
we expect _ExtensionsField.i2m to return a string of the same size (if
not of the same value) upon successive calls (e.g. through i2len here,
then i2m when directly building the _ExtensionsField).
XXX A proper way to... | [
"There",
"is",
"a",
"hack",
"with",
"the",
"_ExtensionsField",
".",
"i2len",
".",
"It",
"works",
"only",
"because",
"we",
"expect",
"_ExtensionsField",
".",
"i2m",
"to",
"return",
"a",
"string",
"of",
"the",
"same",
"size",
"(",
"if",
"not",
"of",
"the",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/extensions.py#L630-L652 | train | Add a field to the internal 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/layers/netflow.py | _GenNetflowRecordV9 | def _GenNetflowRecordV9(cls, lengths_list):
"""Internal function used to generate the Records from
their template.
"""
_fields_desc = []
for j, k in lengths_list:
_f_data = NetflowV9TemplateFieldDecoders.get(k, None)
_f_type, _f_args = (
_f_data if isinstance(_f_data, tup... | python | def _GenNetflowRecordV9(cls, lengths_list):
"""Internal function used to generate the Records from
their template.
"""
_fields_desc = []
for j, k in lengths_list:
_f_data = NetflowV9TemplateFieldDecoders.get(k, None)
_f_type, _f_args = (
_f_data if isinstance(_f_data, tup... | [
"def",
"_GenNetflowRecordV9",
"(",
"cls",
",",
"lengths_list",
")",
":",
"_fields_desc",
"=",
"[",
"]",
"for",
"j",
",",
"k",
"in",
"lengths_list",
":",
"_f_data",
"=",
"NetflowV9TemplateFieldDecoders",
".",
"get",
"(",
"k",
",",
"None",
")",
"_f_type",
",... | Internal function used to generate the Records from
their template. | [
"Internal",
"function",
"used",
"to",
"generate",
"the",
"Records",
"from",
"their",
"template",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/netflow.py#L1284-L1318 | train | Internal function used to generate the Records from the given class and the given list of lengths. | 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/netflow.py | _netflowv9_defragment_packet | def _netflowv9_defragment_packet(pkt, definitions, definitions_opts, ignored):
"""Used internally to process a single packet during defragmenting"""
# Dataflowset definitions
if NetflowFlowsetV9 in pkt:
current = pkt
while NetflowFlowsetV9 in current:
current = current[NetflowFlo... | python | def _netflowv9_defragment_packet(pkt, definitions, definitions_opts, ignored):
"""Used internally to process a single packet during defragmenting"""
# Dataflowset definitions
if NetflowFlowsetV9 in pkt:
current = pkt
while NetflowFlowsetV9 in current:
current = current[NetflowFlo... | [
"def",
"_netflowv9_defragment_packet",
"(",
"pkt",
",",
"definitions",
",",
"definitions_opts",
",",
"ignored",
")",
":",
"# Dataflowset definitions",
"if",
"NetflowFlowsetV9",
"in",
"pkt",
":",
"current",
"=",
"pkt",
"while",
"NetflowFlowsetV9",
"in",
"current",
":... | Used internally to process a single packet during defragmenting | [
"Used",
"internally",
"to",
"process",
"a",
"single",
"packet",
"during",
"defragmenting"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/netflow.py#L1358-L1453 | train | Used internally to process a single packet during defragmenting. | 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/netflow.py | netflowv9_defragment | def netflowv9_defragment(plist, verb=1):
"""Process all NetflowV9/10 Packets to match IDs of the DataFlowsets
with the Headers
params:
- plist: the list of mixed NetflowV9/10 packets.
- verb: verbose print (0/1)
"""
if not isinstance(plist, (PacketList, list)):
plist = [plist]
... | python | def netflowv9_defragment(plist, verb=1):
"""Process all NetflowV9/10 Packets to match IDs of the DataFlowsets
with the Headers
params:
- plist: the list of mixed NetflowV9/10 packets.
- verb: verbose print (0/1)
"""
if not isinstance(plist, (PacketList, list)):
plist = [plist]
... | [
"def",
"netflowv9_defragment",
"(",
"plist",
",",
"verb",
"=",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"plist",
",",
"(",
"PacketList",
",",
"list",
")",
")",
":",
"plist",
"=",
"[",
"plist",
"]",
"# We need the whole packet to be dissected to access fi... | Process all NetflowV9/10 Packets to match IDs of the DataFlowsets
with the Headers
params:
- plist: the list of mixed NetflowV9/10 packets.
- verb: verbose print (0/1) | [
"Process",
"all",
"NetflowV9",
"/",
"10",
"Packets",
"to",
"match",
"IDs",
"of",
"the",
"DataFlowsets",
"with",
"the",
"Headers"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/netflow.py#L1456-L1479 | train | Process all NetflowV9 and NetflowOptionsFlowsetV9 packets to match IDs of the Headers of the DataFlowsets
with the Headers of the DataFlowsets
. | 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/cert.py | der2pem | def der2pem(der_string, obj="UNKNOWN"):
"""Convert DER octet string to PEM format (with optional header)"""
# Encode a byte string in PEM format. Header advertizes <obj> type.
pem_string = ("-----BEGIN %s-----\n" % obj).encode()
base64_string = base64.b64encode(der_string)
chunks = [base64_string[i:... | python | def der2pem(der_string, obj="UNKNOWN"):
"""Convert DER octet string to PEM format (with optional header)"""
# Encode a byte string in PEM format. Header advertizes <obj> type.
pem_string = ("-----BEGIN %s-----\n" % obj).encode()
base64_string = base64.b64encode(der_string)
chunks = [base64_string[i:... | [
"def",
"der2pem",
"(",
"der_string",
",",
"obj",
"=",
"\"UNKNOWN\"",
")",
":",
"# Encode a byte string in PEM format. Header advertizes <obj> type.",
"pem_string",
"=",
"(",
"\"-----BEGIN %s-----\\n\"",
"%",
"obj",
")",
".",
"encode",
"(",
")",
"base64_string",
"=",
"... | Convert DER octet string to PEM format (with optional header) | [
"Convert",
"DER",
"octet",
"string",
"to",
"PEM",
"format",
"(",
"with",
"optional",
"header",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L68-L76 | train | Convert a DER octet string to PEM format. | 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/cert.py | pem2der | def pem2der(pem_string):
"""Convert PEM string to DER format"""
# Encode all lines between the first '-----\n' and the 2nd-to-last '-----'.
pem_string = pem_string.replace(b"\r", b"")
first_idx = pem_string.find(b"-----\n") + 6
if pem_string.find(b"-----BEGIN", first_idx) != -1:
raise Except... | python | def pem2der(pem_string):
"""Convert PEM string to DER format"""
# Encode all lines between the first '-----\n' and the 2nd-to-last '-----'.
pem_string = pem_string.replace(b"\r", b"")
first_idx = pem_string.find(b"-----\n") + 6
if pem_string.find(b"-----BEGIN", first_idx) != -1:
raise Except... | [
"def",
"pem2der",
"(",
"pem_string",
")",
":",
"# Encode all lines between the first '-----\\n' and the 2nd-to-last '-----'.",
"pem_string",
"=",
"pem_string",
".",
"replace",
"(",
"b\"\\r\"",
",",
"b\"\"",
")",
"first_idx",
"=",
"pem_string",
".",
"find",
"(",
"b\"----... | Convert PEM string to DER format | [
"Convert",
"PEM",
"string",
"to",
"DER",
"format"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L80-L91 | train | Convert PEM string to DER format | 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/cert.py | split_pem | def split_pem(s):
"""
Split PEM objects. Useful to process concatenated certificates.
"""
pem_strings = []
while s != b"":
start_idx = s.find(b"-----BEGIN")
if start_idx == -1:
break
end_idx = s.find(b"-----END")
end_idx = s.find(b"\n", end_idx) + 1
... | python | def split_pem(s):
"""
Split PEM objects. Useful to process concatenated certificates.
"""
pem_strings = []
while s != b"":
start_idx = s.find(b"-----BEGIN")
if start_idx == -1:
break
end_idx = s.find(b"-----END")
end_idx = s.find(b"\n", end_idx) + 1
... | [
"def",
"split_pem",
"(",
"s",
")",
":",
"pem_strings",
"=",
"[",
"]",
"while",
"s",
"!=",
"b\"\"",
":",
"start_idx",
"=",
"s",
".",
"find",
"(",
"b\"-----BEGIN\"",
")",
"if",
"start_idx",
"==",
"-",
"1",
":",
"break",
"end_idx",
"=",
"s",
".",
"fin... | Split PEM objects. Useful to process concatenated certificates. | [
"Split",
"PEM",
"objects",
".",
"Useful",
"to",
"process",
"concatenated",
"certificates",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L94-L107 | train | Split PEM objects. Useful to process concatenated certificates. | 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/cert.py | _create_ca_file | def _create_ca_file(anchor_list, filename):
"""
Concatenate all the certificates (PEM format for the export) in
'anchor_list' and write the result to file 'filename'. On success
'filename' is returned, None otherwise.
If you are used to OpenSSL tools, this function builds a CAfile
that can be u... | python | def _create_ca_file(anchor_list, filename):
"""
Concatenate all the certificates (PEM format for the export) in
'anchor_list' and write the result to file 'filename'. On success
'filename' is returned, None otherwise.
If you are used to OpenSSL tools, this function builds a CAfile
that can be u... | [
"def",
"_create_ca_file",
"(",
"anchor_list",
",",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"for",
"a",
"in",
"anchor_list",
":",
"s",
"=",
"a",
".",
"output",
"(",
"fmt",
"=",
"\"PEM\"",
... | Concatenate all the certificates (PEM format for the export) in
'anchor_list' and write the result to file 'filename'. On success
'filename' is returned, None otherwise.
If you are used to OpenSSL tools, this function builds a CAfile
that can be used for certificate and CRL check. | [
"Concatenate",
"all",
"the",
"certificates",
"(",
"PEM",
"format",
"for",
"the",
"export",
")",
"in",
"anchor_list",
"and",
"write",
"the",
"result",
"to",
"file",
"filename",
".",
"On",
"success",
"filename",
"is",
"returned",
"None",
"otherwise",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L1010-L1026 | train | Create a CAfile from the list of anchor_list and write the result to filename. | 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/cert.py | PubKey.verifyCert | def verifyCert(self, cert):
""" Verifies either a Cert or an X509_Cert. """
tbsCert = cert.tbsCertificate
sigAlg = tbsCert.signature
h = hash_by_oid[sigAlg.algorithm.val]
sigVal = raw(cert.signatureValue)
return self.verify(raw(tbsCert), sigVal, h=h, t='pkcs') | python | def verifyCert(self, cert):
""" Verifies either a Cert or an X509_Cert. """
tbsCert = cert.tbsCertificate
sigAlg = tbsCert.signature
h = hash_by_oid[sigAlg.algorithm.val]
sigVal = raw(cert.signatureValue)
return self.verify(raw(tbsCert), sigVal, h=h, t='pkcs') | [
"def",
"verifyCert",
"(",
"self",
",",
"cert",
")",
":",
"tbsCert",
"=",
"cert",
".",
"tbsCertificate",
"sigAlg",
"=",
"tbsCert",
".",
"signature",
"h",
"=",
"hash_by_oid",
"[",
"sigAlg",
".",
"algorithm",
".",
"val",
"]",
"sigVal",
"=",
"raw",
"(",
"c... | Verifies either a Cert or an X509_Cert. | [
"Verifies",
"either",
"a",
"Cert",
"or",
"an",
"X509_Cert",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L245-L251 | train | Verifies either a Cert or X509_Cert. | 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/cert.py | PrivKey.signTBSCert | def signTBSCert(self, tbsCert, h="sha256"):
"""
Note that this will always copy the signature field from the
tbsCertificate into the signatureAlgorithm field of the result,
regardless of the coherence between its contents (which might
indicate ecdsa-with-SHA512) and the result (e... | python | def signTBSCert(self, tbsCert, h="sha256"):
"""
Note that this will always copy the signature field from the
tbsCertificate into the signatureAlgorithm field of the result,
regardless of the coherence between its contents (which might
indicate ecdsa-with-SHA512) and the result (e... | [
"def",
"signTBSCert",
"(",
"self",
",",
"tbsCert",
",",
"h",
"=",
"\"sha256\"",
")",
":",
"sigAlg",
"=",
"tbsCert",
".",
"signature",
"h",
"=",
"h",
"or",
"hash_by_oid",
"[",
"sigAlg",
".",
"algorithm",
".",
"val",
"]",
"sigVal",
"=",
"self",
".",
"s... | Note that this will always copy the signature field from the
tbsCertificate into the signatureAlgorithm field of the result,
regardless of the coherence between its contents (which might
indicate ecdsa-with-SHA512) and the result (e.g. RSA signing MD2).
There is a small inheritance tric... | [
"Note",
"that",
"this",
"will",
"always",
"copy",
"the",
"signature",
"field",
"from",
"the",
"tbsCertificate",
"into",
"the",
"signatureAlgorithm",
"field",
"of",
"the",
"result",
"regardless",
"of",
"the",
"coherence",
"between",
"its",
"contents",
"(",
"which... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L423-L444 | train | Signs a TBSCert and returns a X509_Cert object with the signature field set to the signatureValue of the TBSCert. | 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/cert.py | Cert.isSelfSigned | def isSelfSigned(self):
"""
Return True if the certificate is self-signed:
- issuer and subject are the same
- the signature of the certificate is valid.
"""
if self.issuer_hash == self.subject_hash:
return self.isIssuerCert(self)
return False | python | def isSelfSigned(self):
"""
Return True if the certificate is self-signed:
- issuer and subject are the same
- the signature of the certificate is valid.
"""
if self.issuer_hash == self.subject_hash:
return self.isIssuerCert(self)
return False | [
"def",
"isSelfSigned",
"(",
"self",
")",
":",
"if",
"self",
".",
"issuer_hash",
"==",
"self",
".",
"subject_hash",
":",
"return",
"self",
".",
"isIssuerCert",
"(",
"self",
")",
"return",
"False"
] | Return True if the certificate is self-signed:
- issuer and subject are the same
- the signature of the certificate is valid. | [
"Return",
"True",
"if",
"the",
"certificate",
"is",
"self",
"-",
"signed",
":",
"-",
"issuer",
"and",
"subject",
"are",
"the",
"same",
"-",
"the",
"signature",
"of",
"the",
"certificate",
"is",
"valid",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L659-L667 | train | Return True if the certificate is self - signed. | 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/cert.py | Cert.isRevoked | def isRevoked(self, crl_list):
"""
Given a list of trusted CRL (their signature has already been
verified with trusted anchors), this function returns True if
the certificate is marked as revoked by one of those CRL.
Note that if the Certificate was on hold in a previous CRL and... | python | def isRevoked(self, crl_list):
"""
Given a list of trusted CRL (their signature has already been
verified with trusted anchors), this function returns True if
the certificate is marked as revoked by one of those CRL.
Note that if the Certificate was on hold in a previous CRL and... | [
"def",
"isRevoked",
"(",
"self",
",",
"crl_list",
")",
":",
"for",
"c",
"in",
"crl_list",
":",
"if",
"(",
"self",
".",
"authorityKeyID",
"is",
"not",
"None",
"and",
"c",
".",
"authorityKeyID",
"is",
"not",
"None",
"and",
"self",
".",
"authorityKeyID",
... | Given a list of trusted CRL (their signature has already been
verified with trusted anchors), this function returns True if
the certificate is marked as revoked by one of those CRL.
Note that if the Certificate was on hold in a previous CRL and
is now valid again in a new CRL and bot ar... | [
"Given",
"a",
"list",
"of",
"trusted",
"CRL",
"(",
"their",
"signature",
"has",
"already",
"been",
"verified",
"with",
"trusted",
"anchors",
")",
"this",
"function",
"returns",
"True",
"if",
"the",
"certificate",
"is",
"marked",
"as",
"revoked",
"by",
"one",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L713-L736 | train | This function returns True if the certificate is marked as revoked by one of the trusted CRLs in crl_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/layers/tls/cert.py | Cert.export | def export(self, filename, fmt="DER"):
"""
Export certificate in 'fmt' format (DER or PEM) to file 'filename'
"""
f = open(filename, "wb")
if fmt == "DER":
f.write(self.der)
elif fmt == "PEM":
f.write(self.pem)
f.close() | python | def export(self, filename, fmt="DER"):
"""
Export certificate in 'fmt' format (DER or PEM) to file 'filename'
"""
f = open(filename, "wb")
if fmt == "DER":
f.write(self.der)
elif fmt == "PEM":
f.write(self.pem)
f.close() | [
"def",
"export",
"(",
"self",
",",
"filename",
",",
"fmt",
"=",
"\"DER\"",
")",
":",
"f",
"=",
"open",
"(",
"filename",
",",
"\"wb\"",
")",
"if",
"fmt",
"==",
"\"DER\"",
":",
"f",
".",
"write",
"(",
"self",
".",
"der",
")",
"elif",
"fmt",
"==",
... | Export certificate in 'fmt' format (DER or PEM) to file 'filename' | [
"Export",
"certificate",
"in",
"fmt",
"format",
"(",
"DER",
"or",
"PEM",
")",
"to",
"file",
"filename"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L738-L747 | train | Export certificate in fmt format to file filename | 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/cert.py | Chain.verifyChain | def verifyChain(self, anchors, untrusted=None):
"""
Perform verification of certificate chains for that certificate.
A list of anchors is required. The certificates in the optional
untrusted list may be used as additional elements to the final chain.
On par with chain instantiati... | python | def verifyChain(self, anchors, untrusted=None):
"""
Perform verification of certificate chains for that certificate.
A list of anchors is required. The certificates in the optional
untrusted list may be used as additional elements to the final chain.
On par with chain instantiati... | [
"def",
"verifyChain",
"(",
"self",
",",
"anchors",
",",
"untrusted",
"=",
"None",
")",
":",
"untrusted",
"=",
"untrusted",
"or",
"[",
"]",
"for",
"a",
"in",
"anchors",
":",
"chain",
"=",
"Chain",
"(",
"self",
"+",
"untrusted",
",",
"a",
")",
"if",
... | Perform verification of certificate chains for that certificate.
A list of anchors is required. The certificates in the optional
untrusted list may be used as additional elements to the final chain.
On par with chain instantiation, only one chain constructed with the
untrusted candidates... | [
"Perform",
"verification",
"of",
"certificate",
"chains",
"for",
"that",
"certificate",
".",
"A",
"list",
"of",
"anchors",
"is",
"required",
".",
"The",
"certificates",
"in",
"the",
"optional",
"untrusted",
"list",
"may",
"be",
"used",
"as",
"additional",
"ele... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L910-L930 | train | Verify the chain for this certificate. | 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/cert.py | Chain.verifyChainFromCAFile | def verifyChainFromCAFile(self, cafile, untrusted_file=None):
"""
Does the same job as .verifyChain() but using the list of anchors
from the cafile. As for .verifyChain(), a list of untrusted
certificates can be passed (as a file, this time).
"""
try:
f = open... | python | def verifyChainFromCAFile(self, cafile, untrusted_file=None):
"""
Does the same job as .verifyChain() but using the list of anchors
from the cafile. As for .verifyChain(), a list of untrusted
certificates can be passed (as a file, this time).
"""
try:
f = open... | [
"def",
"verifyChainFromCAFile",
"(",
"self",
",",
"cafile",
",",
"untrusted_file",
"=",
"None",
")",
":",
"try",
":",
"f",
"=",
"open",
"(",
"cafile",
",",
"\"rb\"",
")",
"ca_certs",
"=",
"f",
".",
"read",
"(",
")",
"f",
".",
"close",
"(",
")",
"ex... | Does the same job as .verifyChain() but using the list of anchors
from the cafile. As for .verifyChain(), a list of untrusted
certificates can be passed (as a file, this time). | [
"Does",
"the",
"same",
"job",
"as",
".",
"verifyChain",
"()",
"but",
"using",
"the",
"list",
"of",
"anchors",
"from",
"the",
"cafile",
".",
"As",
"for",
".",
"verifyChain",
"()",
"a",
"list",
"of",
"untrusted",
"certificates",
"can",
"be",
"passed",
"(",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L932-L957 | train | Verify the certificates in the cafile and return a list of anchors and untrusted certificates. | 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/cert.py | Chain.verifyChainFromCAPath | def verifyChainFromCAPath(self, capath, untrusted_file=None):
"""
Does the same job as .verifyChainFromCAFile() but using the list
of anchors in capath directory. The directory should (only) contain
certificates files in PEM format. As for .verifyChainFromCAFile(),
a list of untr... | python | def verifyChainFromCAPath(self, capath, untrusted_file=None):
"""
Does the same job as .verifyChainFromCAFile() but using the list
of anchors in capath directory. The directory should (only) contain
certificates files in PEM format. As for .verifyChainFromCAFile(),
a list of untr... | [
"def",
"verifyChainFromCAPath",
"(",
"self",
",",
"capath",
",",
"untrusted_file",
"=",
"None",
")",
":",
"try",
":",
"anchors",
"=",
"[",
"]",
"for",
"cafile",
"in",
"os",
".",
"listdir",
"(",
"capath",
")",
":",
"anchors",
".",
"append",
"(",
"Cert",... | Does the same job as .verifyChainFromCAFile() but using the list
of anchors in capath directory. The directory should (only) contain
certificates files in PEM format. As for .verifyChainFromCAFile(),
a list of untrusted certificates can be passed as a file
(concatenation of the certifica... | [
"Does",
"the",
"same",
"job",
"as",
".",
"verifyChainFromCAFile",
"()",
"but",
"using",
"the",
"list",
"of",
"anchors",
"in",
"capath",
"directory",
".",
"The",
"directory",
"should",
"(",
"only",
")",
"contain",
"certificates",
"files",
"in",
"PEM",
"format... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L959-L984 | train | Verify the chain of certificates in a directory. | 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/obd/obd.py | OBD.answers | def answers(self, other):
"""DEV: true if self is an answer from other"""
if other.__class__ == self.__class__:
return (other.service + 0x40) == self.service or \
(self.service == 0x7f and
self.request_service_id == other.service)
return False | python | def answers(self, other):
"""DEV: true if self is an answer from other"""
if other.__class__ == self.__class__:
return (other.service + 0x40) == self.service or \
(self.service == 0x7f and
self.request_service_id == other.service)
return False | [
"def",
"answers",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
".",
"__class__",
"==",
"self",
".",
"__class__",
":",
"return",
"(",
"other",
".",
"service",
"+",
"0x40",
")",
"==",
"self",
".",
"service",
"or",
"(",
"self",
".",
"service",
... | DEV: true if self is an answer from other | [
"DEV",
":",
"true",
"if",
"self",
"is",
"an",
"answer",
"from",
"other"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/automotive/obd/obd.py#L58-L64 | train | Returns True if self is an answer from other. | 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 | _sndrcv_snd | def _sndrcv_snd(pks, timeout, inter, verbose, tobesent, hsent, timessent, stopevent): # noqa: E501
"""Function used in the sending thread of sndrcv()"""
try:
i = 0
rec_time = timessent is not None
if verbose:
print("Begin emission:")
for p in tobesent:
# ... | python | def _sndrcv_snd(pks, timeout, inter, verbose, tobesent, hsent, timessent, stopevent): # noqa: E501
"""Function used in the sending thread of sndrcv()"""
try:
i = 0
rec_time = timessent is not None
if verbose:
print("Begin emission:")
for p in tobesent:
# ... | [
"def",
"_sndrcv_snd",
"(",
"pks",
",",
"timeout",
",",
"inter",
",",
"verbose",
",",
"tobesent",
",",
"hsent",
",",
"timessent",
",",
"stopevent",
")",
":",
"# noqa: E501",
"try",
":",
"i",
"=",
"0",
"rec_time",
"=",
"timessent",
"is",
"not",
"None",
"... | Function used in the sending thread of sndrcv() | [
"Function",
"used",
"in",
"the",
"sending",
"thread",
"of",
"sndrcv",
"()"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L55-L90 | train | Function used in the sending thread of sndrcv | 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 | _sndrcv_rcv | def _sndrcv_rcv(pks, hsent, stopevent, nbrecv, notans, verbose, chainCC,
multi, _storage_policy=None):
"""Function used to receive packets and check their hashret"""
if not _storage_policy:
_storage_policy = lambda x, y: (x, y)
ans = []
def _get_pkt():
# SuperSocket.sele... | python | def _sndrcv_rcv(pks, hsent, stopevent, nbrecv, notans, verbose, chainCC,
multi, _storage_policy=None):
"""Function used to receive packets and check their hashret"""
if not _storage_policy:
_storage_policy = lambda x, y: (x, y)
ans = []
def _get_pkt():
# SuperSocket.sele... | [
"def",
"_sndrcv_rcv",
"(",
"pks",
",",
"hsent",
",",
"stopevent",
",",
"nbrecv",
",",
"notans",
",",
"verbose",
",",
"chainCC",
",",
"multi",
",",
"_storage_policy",
"=",
"None",
")",
":",
"if",
"not",
"_storage_policy",
":",
"_storage_policy",
"=",
"lambd... | Function used to receive packets and check their hashret | [
"Function",
"used",
"to",
"receive",
"packets",
"and",
"check",
"their",
"hashret"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L93-L149 | train | Function used to receive packets and check their hashret | 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 | sndrcv | def sndrcv(pks, pkt, timeout=None, inter=0, verbose=None, chainCC=False,
retry=0, multi=False, rcv_pks=None, store_unanswered=True,
process=None, prebuild=False):
"""Scapy raw function to send a packet and receive its answer.
WARNING: This is an internal function. Using sr/srp/sr1/srp is
... | python | def sndrcv(pks, pkt, timeout=None, inter=0, verbose=None, chainCC=False,
retry=0, multi=False, rcv_pks=None, store_unanswered=True,
process=None, prebuild=False):
"""Scapy raw function to send a packet and receive its answer.
WARNING: This is an internal function. Using sr/srp/sr1/srp is
... | [
"def",
"sndrcv",
"(",
"pks",
",",
"pkt",
",",
"timeout",
"=",
"None",
",",
"inter",
"=",
"0",
",",
"verbose",
"=",
"None",
",",
"chainCC",
"=",
"False",
",",
"retry",
"=",
"0",
",",
"multi",
"=",
"False",
",",
"rcv_pks",
"=",
"None",
",",
"store_... | Scapy raw function to send a packet and receive its answer.
WARNING: This is an internal function. Using sr/srp/sr1/srp is
more appropriate in many cases. | [
"Scapy",
"raw",
"function",
"to",
"send",
"a",
"packet",
"and",
"receive",
"its",
"answer",
".",
"WARNING",
":",
"This",
"is",
"an",
"internal",
"function",
".",
"Using",
"sr",
"/",
"srp",
"/",
"sr1",
"/",
"srp",
"is",
"more",
"appropriate",
"in",
"man... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L178-L269 | train | Scapy raw function to send a packet and receive an 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 | send | def send(x, inter=0, loop=0, count=None,
verbose=None, realtime=None,
return_packets=False, socket=None, *args, **kargs):
"""Send packets at layer 3
send(packets, [inter=0], [loop=0], [count=None], [verbose=conf.verb], [realtime=None], [return_packets=False], # noqa: E501
[socket=None]) -> N... | python | def send(x, inter=0, loop=0, count=None,
verbose=None, realtime=None,
return_packets=False, socket=None, *args, **kargs):
"""Send packets at layer 3
send(packets, [inter=0], [loop=0], [count=None], [verbose=conf.verb], [realtime=None], [return_packets=False], # noqa: E501
[socket=None]) -> N... | [
"def",
"send",
"(",
"x",
",",
"inter",
"=",
"0",
",",
"loop",
"=",
"0",
",",
"count",
"=",
"None",
",",
"verbose",
"=",
"None",
",",
"realtime",
"=",
"None",
",",
"return_packets",
"=",
"False",
",",
"socket",
"=",
"None",
",",
"*",
"args",
",",
... | Send packets at layer 3
send(packets, [inter=0], [loop=0], [count=None], [verbose=conf.verb], [realtime=None], [return_packets=False], # noqa: E501
[socket=None]) -> None | [
"Send",
"packets",
"at",
"layer",
"3",
"send",
"(",
"packets",
"[",
"inter",
"=",
"0",
"]",
"[",
"loop",
"=",
"0",
"]",
"[",
"count",
"=",
"None",
"]",
"[",
"verbose",
"=",
"conf",
".",
"verb",
"]",
"[",
"realtime",
"=",
"None",
"]",
"[",
"retu... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L316-L329 | train | Send a packet at layer 3. | 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 | sendp | def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None,
verbose=None, realtime=None,
return_packets=False, socket=None, *args, **kargs):
"""Send packets at layer 2
sendp(packets, [inter=0], [loop=0], [iface=None], [iface_hint=None], [count=None], [verbose=conf.verb], # noqa: E501... | python | def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None,
verbose=None, realtime=None,
return_packets=False, socket=None, *args, **kargs):
"""Send packets at layer 2
sendp(packets, [inter=0], [loop=0], [iface=None], [iface_hint=None], [count=None], [verbose=conf.verb], # noqa: E501... | [
"def",
"sendp",
"(",
"x",
",",
"inter",
"=",
"0",
",",
"loop",
"=",
"0",
",",
"iface",
"=",
"None",
",",
"iface_hint",
"=",
"None",
",",
"count",
"=",
"None",
",",
"verbose",
"=",
"None",
",",
"realtime",
"=",
"None",
",",
"return_packets",
"=",
... | Send packets at layer 2
sendp(packets, [inter=0], [loop=0], [iface=None], [iface_hint=None], [count=None], [verbose=conf.verb], # noqa: E501
[realtime=None], [return_packets=False], [socket=None]) -> None | [
"Send",
"packets",
"at",
"layer",
"2",
"sendp",
"(",
"packets",
"[",
"inter",
"=",
"0",
"]",
"[",
"loop",
"=",
"0",
"]",
"[",
"iface",
"=",
"None",
"]",
"[",
"iface_hint",
"=",
"None",
"]",
"[",
"count",
"=",
"None",
"]",
"[",
"verbose",
"=",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L333-L348 | train | Send 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 | sendpfast | def sendpfast(x, pps=None, mbps=None, realtime=None, loop=0, file_cache=False, iface=None, replay_args=None, # noqa: E501
parse_results=False):
"""Send packets at layer 2 using tcpreplay for performance
pps: packets per second
mpbs: MBits per second
realtime: use packet's timestamp, bend... | python | def sendpfast(x, pps=None, mbps=None, realtime=None, loop=0, file_cache=False, iface=None, replay_args=None, # noqa: E501
parse_results=False):
"""Send packets at layer 2 using tcpreplay for performance
pps: packets per second
mpbs: MBits per second
realtime: use packet's timestamp, bend... | [
"def",
"sendpfast",
"(",
"x",
",",
"pps",
"=",
"None",
",",
"mbps",
"=",
"None",
",",
"realtime",
"=",
"None",
",",
"loop",
"=",
"0",
",",
"file_cache",
"=",
"False",
",",
"iface",
"=",
"None",
",",
"replay_args",
"=",
"None",
",",
"# noqa: E501",
... | Send packets at layer 2 using tcpreplay for performance
pps: packets per second
mpbs: MBits per second
realtime: use packet's timestamp, bending time with real-time value
loop: number of times to process the packet list
file_cache: cache packets in RAM instead of reading from disk at each iteration... | [
"Send",
"packets",
"at",
"layer",
"2",
"using",
"tcpreplay",
"for",
"performance",
"pps",
":",
"packets",
"per",
"second",
"mpbs",
":",
"MBits",
"per",
"second",
"realtime",
":",
"use",
"packet",
"s",
"timestamp",
"bending",
"time",
"with",
"real",
"-",
"t... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L352-L407 | train | Send packets at layer 2 using tcpreplay for performance | 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 | _parse_tcpreplay_result | def _parse_tcpreplay_result(stdout, stderr, argv):
"""
Parse the output of tcpreplay and modify the results_dict to populate output information. # noqa: E501
Tested with tcpreplay v3.4.4
Tested with tcpreplay v4.1.2
:param stdout: stdout of tcpreplay subprocess call
:param stderr: stderr of tcp... | python | def _parse_tcpreplay_result(stdout, stderr, argv):
"""
Parse the output of tcpreplay and modify the results_dict to populate output information. # noqa: E501
Tested with tcpreplay v3.4.4
Tested with tcpreplay v4.1.2
:param stdout: stdout of tcpreplay subprocess call
:param stderr: stderr of tcp... | [
"def",
"_parse_tcpreplay_result",
"(",
"stdout",
",",
"stderr",
",",
"argv",
")",
":",
"try",
":",
"results",
"=",
"{",
"}",
"stdout",
"=",
"plain_str",
"(",
"stdout",
")",
".",
"lower",
"(",
")",
"stderr",
"=",
"plain_str",
"(",
"stderr",
")",
".",
... | Parse the output of tcpreplay and modify the results_dict to populate output information. # noqa: E501
Tested with tcpreplay v3.4.4
Tested with tcpreplay v4.1.2
:param stdout: stdout of tcpreplay subprocess call
:param stderr: stderr of tcpreplay subprocess call
:param argv: the command used in the... | [
"Parse",
"the",
"output",
"of",
"tcpreplay",
"and",
"modify",
"the",
"results_dict",
"to",
"populate",
"output",
"information",
".",
"#",
"noqa",
":",
"E501",
"Tested",
"with",
"tcpreplay",
"v3",
".",
"4",
".",
"4",
"Tested",
"with",
"tcpreplay",
"v4",
"."... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L410-L462 | train | Parse the output of tcpreplay and modify the results_dict to populate the output 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/sendrecv.py | sr | def sr(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs):
"""Send and receive packets at layer 3"""
s = conf.L3socket(promisc=promisc, filter=filter,
iface=iface, nofilter=nofilter)
result = sndrcv(s, x, *args, **kargs)
s.close()
return result | python | def sr(x, promisc=None, filter=None, iface=None, nofilter=0, *args, **kargs):
"""Send and receive packets at layer 3"""
s = conf.L3socket(promisc=promisc, filter=filter,
iface=iface, nofilter=nofilter)
result = sndrcv(s, x, *args, **kargs)
s.close()
return result | [
"def",
"sr",
"(",
"x",
",",
"promisc",
"=",
"None",
",",
"filter",
"=",
"None",
",",
"iface",
"=",
"None",
",",
"nofilter",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"s",
"=",
"conf",
".",
"L3socket",
"(",
"promisc",
"=",
... | Send and receive packets at layer 3 | [
"Send",
"and",
"receive",
"packets",
"at",
"layer",
"3"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/sendrecv.py#L466-L472 | train | Send and receive packets at layer 3 | 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.