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/contrib/lldp.py | _ldp_id_adjustlen | def _ldp_id_adjustlen(pkt, x):
"""Return the length of the `id` field,
according to its real encoded type"""
f, v = pkt.getfield_and_val('id')
return len(_LLDPidField.i2m(f, pkt, v)) + 1 | python | def _ldp_id_adjustlen(pkt, x):
"""Return the length of the `id` field,
according to its real encoded type"""
f, v = pkt.getfield_and_val('id')
return len(_LLDPidField.i2m(f, pkt, v)) + 1 | [
"def",
"_ldp_id_adjustlen",
"(",
"pkt",
",",
"x",
")",
":",
"f",
",",
"v",
"=",
"pkt",
".",
"getfield_and_val",
"(",
"'id'",
")",
"return",
"len",
"(",
"_LLDPidField",
".",
"i2m",
"(",
"f",
",",
"pkt",
",",
"v",
")",
")",
"+",
"1"
] | Return the length of the `id` field,
according to its real encoded type | [
"Return",
"the",
"length",
"of",
"the",
"id",
"field",
"according",
"to",
"its",
"real",
"encoded",
"type"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/lldp.py#L326-L330 | train | Return the length of the id field according to its real encoded type | 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/lldp.py | LLDPDU._dot1q_headers_size | def _dot1q_headers_size(layer):
"""
calculate size of lower dot1q layers (if present)
:param layer: the layer to start at
:return: size of vlan headers, layer below lowest vlan header
"""
vlan_headers_size = 0
under_layer = layer
while under_layer and is... | python | def _dot1q_headers_size(layer):
"""
calculate size of lower dot1q layers (if present)
:param layer: the layer to start at
:return: size of vlan headers, layer below lowest vlan header
"""
vlan_headers_size = 0
under_layer = layer
while under_layer and is... | [
"def",
"_dot1q_headers_size",
"(",
"layer",
")",
":",
"vlan_headers_size",
"=",
"0",
"under_layer",
"=",
"layer",
"while",
"under_layer",
"and",
"isinstance",
"(",
"under_layer",
",",
"Dot1Q",
")",
":",
"vlan_headers_size",
"+=",
"LLDPDU",
".",
"DOT1Q_HEADER_LEN",... | calculate size of lower dot1q layers (if present)
:param layer: the layer to start at
:return: size of vlan headers, layer below lowest vlan header | [
"calculate",
"size",
"of",
"lower",
"dot1q",
"layers",
"(",
"if",
"present",
")",
":",
"param",
"layer",
":",
"the",
"layer",
"to",
"start",
"at",
":",
"return",
":",
"size",
"of",
"vlan",
"headers",
"layer",
"below",
"lowest",
"vlan",
"header"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/lldp.py#L135-L149 | train | calculate size of lower dot1q headers in a 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/contrib/lldp.py | LLDPDU._frame_structure_check | def _frame_structure_check(structure_description):
"""
check if the structure of the frame is conform to the basic
frame structure defined by the standard
:param structure_description: string-list reflecting LLDP-msg structure
"""
standard_frame_structure = [LLDPDUChassi... | python | def _frame_structure_check(structure_description):
"""
check if the structure of the frame is conform to the basic
frame structure defined by the standard
:param structure_description: string-list reflecting LLDP-msg structure
"""
standard_frame_structure = [LLDPDUChassi... | [
"def",
"_frame_structure_check",
"(",
"structure_description",
")",
":",
"standard_frame_structure",
"=",
"[",
"LLDPDUChassisID",
".",
"__name__",
",",
"LLDPDUPortID",
".",
"__name__",
",",
"LLDPDUTimeToLive",
".",
"__name__",
",",
"'<...>'",
",",
"LLDPDUEndOfLLDPDU",
... | check if the structure of the frame is conform to the basic
frame structure defined by the standard
:param structure_description: string-list reflecting LLDP-msg structure | [
"check",
"if",
"the",
"structure",
"of",
"the",
"frame",
"is",
"conform",
"to",
"the",
"basic",
"frame",
"structure",
"defined",
"by",
"the",
"standard",
":",
"param",
"structure_description",
":",
"string",
"-",
"list",
"reflecting",
"LLDP",
"-",
"msg",
"st... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/lldp.py#L188-L221 | train | check if the structure of the frame is conform to the basic LLDP - msg structure | 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/lldp.py | LLDPDU._tlv_multiplicities_check | def _tlv_multiplicities_check(tlv_type_count):
"""
check if multiplicity of present TLVs conforms to the standard
:param tlv_type_count: dict containing counte-per-TLV
"""
# * : 0..n, 1 : one and only one.
standard_multiplicities = {
LLDPDUEndOfLLDPDU.__name_... | python | def _tlv_multiplicities_check(tlv_type_count):
"""
check if multiplicity of present TLVs conforms to the standard
:param tlv_type_count: dict containing counte-per-TLV
"""
# * : 0..n, 1 : one and only one.
standard_multiplicities = {
LLDPDUEndOfLLDPDU.__name_... | [
"def",
"_tlv_multiplicities_check",
"(",
"tlv_type_count",
")",
":",
"# * : 0..n, 1 : one and only one.",
"standard_multiplicities",
"=",
"{",
"LLDPDUEndOfLLDPDU",
".",
"__name__",
":",
"1",
",",
"LLDPDUChassisID",
".",
"__name__",
":",
"1",
",",
"LLDPDUPortID",
".",
... | check if multiplicity of present TLVs conforms to the standard
:param tlv_type_count: dict containing counte-per-TLV | [
"check",
"if",
"multiplicity",
"of",
"present",
"TLVs",
"conforms",
"to",
"the",
"standard",
":",
"param",
"tlv_type_count",
":",
"dict",
"containing",
"counte",
"-",
"per",
"-",
"TLV"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/lldp.py#L224-L261 | train | Check if multiplicity of present TLVs conforms to the standard. | 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/lldp.py | LLDPDUTimeToLive._check | def _check(self):
"""
run layer specific checks
"""
if conf.contribs['LLDP'].strict_mode() and self._length != 2:
raise LLDPInvalidLengthField('length must be 2 - got '
'{}'.format(self._length)) | python | def _check(self):
"""
run layer specific checks
"""
if conf.contribs['LLDP'].strict_mode() and self._length != 2:
raise LLDPInvalidLengthField('length must be 2 - got '
'{}'.format(self._length)) | [
"def",
"_check",
"(",
"self",
")",
":",
"if",
"conf",
".",
"contribs",
"[",
"'LLDP'",
"]",
".",
"strict_mode",
"(",
")",
"and",
"self",
".",
"_length",
"!=",
"2",
":",
"raise",
"LLDPInvalidLengthField",
"(",
"'length must be 2 - got '",
"'{}'",
".",
"forma... | run layer specific checks | [
"run",
"layer",
"specific",
"checks"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/lldp.py#L435-L441 | train | run layer specific checks
xn | 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/lldp.py | LLDPDUManagementAddress._check | def _check(self):
"""
run layer specific checks
"""
if conf.contribs['LLDP'].strict_mode():
management_address_len = len(self.management_address)
if management_address_len == 0 or management_address_len > 31:
raise LLDPInvalidLengthField(
... | python | def _check(self):
"""
run layer specific checks
"""
if conf.contribs['LLDP'].strict_mode():
management_address_len = len(self.management_address)
if management_address_len == 0 or management_address_len > 31:
raise LLDPInvalidLengthField(
... | [
"def",
"_check",
"(",
"self",
")",
":",
"if",
"conf",
".",
"contribs",
"[",
"'LLDP'",
"]",
".",
"strict_mode",
"(",
")",
":",
"management_address_len",
"=",
"len",
"(",
"self",
".",
"management_address",
")",
"if",
"management_address_len",
"==",
"0",
"or"... | run layer specific checks | [
"run",
"layer",
"specific",
"checks"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/lldp.py#L668-L677 | train | run layer specific checks
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/structures.py | GetIcmpStatistics | def GetIcmpStatistics():
"""Return all Windows ICMP stats from iphlpapi"""
statistics = MIB_ICMP()
_GetIcmpStatistics(byref(statistics))
results = _struct_to_dict(statistics)
del(statistics)
return results | python | def GetIcmpStatistics():
"""Return all Windows ICMP stats from iphlpapi"""
statistics = MIB_ICMP()
_GetIcmpStatistics(byref(statistics))
results = _struct_to_dict(statistics)
del(statistics)
return results | [
"def",
"GetIcmpStatistics",
"(",
")",
":",
"statistics",
"=",
"MIB_ICMP",
"(",
")",
"_GetIcmpStatistics",
"(",
"byref",
"(",
"statistics",
")",
")",
"results",
"=",
"_struct_to_dict",
"(",
"statistics",
")",
"del",
"(",
"statistics",
")",
"return",
"results"
] | Return all Windows ICMP stats from iphlpapi | [
"Return",
"all",
"Windows",
"ICMP",
"stats",
"from",
"iphlpapi"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/structures.py#L166-L172 | train | Return all Windows ICMP stats from iphlpapi | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/structures.py | GetAdaptersAddresses | def GetAdaptersAddresses(AF=AF_UNSPEC):
"""Return all Windows Adapters addresses from iphlpapi"""
# We get the size first
size = ULONG()
flags = GAA_FLAG_INCLUDE_PREFIX
res = _GetAdaptersAddresses(AF, flags,
None, None,
byref(size))
... | python | def GetAdaptersAddresses(AF=AF_UNSPEC):
"""Return all Windows Adapters addresses from iphlpapi"""
# We get the size first
size = ULONG()
flags = GAA_FLAG_INCLUDE_PREFIX
res = _GetAdaptersAddresses(AF, flags,
None, None,
byref(size))
... | [
"def",
"GetAdaptersAddresses",
"(",
"AF",
"=",
"AF_UNSPEC",
")",
":",
"# We get the size first",
"size",
"=",
"ULONG",
"(",
")",
"flags",
"=",
"GAA_FLAG_INCLUDE_PREFIX",
"res",
"=",
"_GetAdaptersAddresses",
"(",
"AF",
",",
"flags",
",",
"None",
",",
"None",
",... | Return all Windows Adapters addresses from iphlpapi | [
"Return",
"all",
"Windows",
"Adapters",
"addresses",
"from",
"iphlpapi"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/structures.py#L377-L399 | train | Get all Windows Adapters addresses from iphlpapi | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/structures.py | GetIpForwardTable | def GetIpForwardTable():
"""Return all Windows routes (IPv4 only) from iphlpapi"""
# We get the size first
size = ULONG()
res = _GetIpForwardTable(None, byref(size), False)
if res != 0x7a: # ERROR_INSUFFICIENT_BUFFER -> populate size
raise RuntimeError("Error getting structure length (%d)" ... | python | def GetIpForwardTable():
"""Return all Windows routes (IPv4 only) from iphlpapi"""
# We get the size first
size = ULONG()
res = _GetIpForwardTable(None, byref(size), False)
if res != 0x7a: # ERROR_INSUFFICIENT_BUFFER -> populate size
raise RuntimeError("Error getting structure length (%d)" ... | [
"def",
"GetIpForwardTable",
"(",
")",
":",
"# We get the size first",
"size",
"=",
"ULONG",
"(",
")",
"res",
"=",
"_GetIpForwardTable",
"(",
"None",
",",
"byref",
"(",
"size",
")",
",",
"False",
")",
"if",
"res",
"!=",
"0x7a",
":",
"# ERROR_INSUFFICIENT_BUFF... | Return all Windows routes (IPv4 only) from iphlpapi | [
"Return",
"all",
"Windows",
"routes",
"(",
"IPv4",
"only",
")",
"from",
"iphlpapi"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/structures.py#L439-L458 | train | Get all Windows routes from iphlpapi | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/structures.py | GetIpForwardTable2 | def GetIpForwardTable2(AF=AF_UNSPEC):
"""Return all Windows routes (IPv4/IPv6) from iphlpapi"""
if WINDOWS_XP:
raise OSError("Not available on Windows XP !")
table = PMIB_IPFORWARD_TABLE2()
res = _GetIpForwardTable2(AF, byref(table))
if res != NO_ERROR:
raise RuntimeError("Error retr... | python | def GetIpForwardTable2(AF=AF_UNSPEC):
"""Return all Windows routes (IPv4/IPv6) from iphlpapi"""
if WINDOWS_XP:
raise OSError("Not available on Windows XP !")
table = PMIB_IPFORWARD_TABLE2()
res = _GetIpForwardTable2(AF, byref(table))
if res != NO_ERROR:
raise RuntimeError("Error retr... | [
"def",
"GetIpForwardTable2",
"(",
"AF",
"=",
"AF_UNSPEC",
")",
":",
"if",
"WINDOWS_XP",
":",
"raise",
"OSError",
"(",
"\"Not available on Windows XP !\"",
")",
"table",
"=",
"PMIB_IPFORWARD_TABLE2",
"(",
")",
"res",
"=",
"_GetIpForwardTable2",
"(",
"AF",
",",
"b... | Return all Windows routes (IPv4/IPv6) from iphlpapi | [
"Return",
"all",
"Windows",
"routes",
"(",
"IPv4",
"/",
"IPv6",
")",
"from",
"iphlpapi"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/structures.py#L516-L528 | train | Return all Windows routes from iphlpapi | 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/cipher_block.py | _BlockCipher.encrypt | def encrypt(self, data):
"""
Encrypt the data. Also, update the cipher iv. This is needed for SSLv3
and TLS 1.0. For TLS 1.1/1.2, it is overwritten in TLS.post_build().
"""
if False in six.itervalues(self.ready):
raise CipherError(data)
encryptor = self._ciphe... | python | def encrypt(self, data):
"""
Encrypt the data. Also, update the cipher iv. This is needed for SSLv3
and TLS 1.0. For TLS 1.1/1.2, it is overwritten in TLS.post_build().
"""
if False in six.itervalues(self.ready):
raise CipherError(data)
encryptor = self._ciphe... | [
"def",
"encrypt",
"(",
"self",
",",
"data",
")",
":",
"if",
"False",
"in",
"six",
".",
"itervalues",
"(",
"self",
".",
"ready",
")",
":",
"raise",
"CipherError",
"(",
"data",
")",
"encryptor",
"=",
"self",
".",
"_cipher",
".",
"encryptor",
"(",
")",
... | Encrypt the data. Also, update the cipher iv. This is needed for SSLv3
and TLS 1.0. For TLS 1.1/1.2, it is overwritten in TLS.post_build(). | [
"Encrypt",
"the",
"data",
".",
"Also",
"update",
"the",
"cipher",
"iv",
".",
"This",
"is",
"needed",
"for",
"SSLv3",
"and",
"TLS",
"1",
".",
"0",
".",
"For",
"TLS",
"1",
".",
"1",
"/",
"1",
".",
"2",
"it",
"is",
"overwritten",
"in",
"TLS",
".",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/cipher_block.py#L77-L87 | train | Encrypt the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/crypto/cipher_block.py | _BlockCipher.decrypt | def decrypt(self, data):
"""
Decrypt the data. Also, update the cipher iv. This is needed for SSLv3
and TLS 1.0. For TLS 1.1/1.2, it is overwritten in TLS.pre_dissect().
If we lack the key, we raise a CipherError which contains the input.
"""
if False in six.itervalues(se... | python | def decrypt(self, data):
"""
Decrypt the data. Also, update the cipher iv. This is needed for SSLv3
and TLS 1.0. For TLS 1.1/1.2, it is overwritten in TLS.pre_dissect().
If we lack the key, we raise a CipherError which contains the input.
"""
if False in six.itervalues(se... | [
"def",
"decrypt",
"(",
"self",
",",
"data",
")",
":",
"if",
"False",
"in",
"six",
".",
"itervalues",
"(",
"self",
".",
"ready",
")",
":",
"raise",
"CipherError",
"(",
"data",
")",
"decryptor",
"=",
"self",
".",
"_cipher",
".",
"decryptor",
"(",
")",
... | Decrypt the data. Also, update the cipher iv. This is needed for SSLv3
and TLS 1.0. For TLS 1.1/1.2, it is overwritten in TLS.pre_dissect().
If we lack the key, we raise a CipherError which contains the input. | [
"Decrypt",
"the",
"data",
".",
"Also",
"update",
"the",
"cipher",
"iv",
".",
"This",
"is",
"needed",
"for",
"SSLv3",
"and",
"TLS",
"1",
".",
"0",
".",
"For",
"TLS",
"1",
".",
"1",
"/",
"1",
".",
"2",
"it",
"is",
"overwritten",
"in",
"TLS",
".",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/crypto/cipher_block.py#L89-L100 | train | Decrypt the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/radius.py | prepare_packed_data | def prepare_packed_data(radius_packet, packed_req_authenticator):
"""
Pack RADIUS data prior computing the authentication MAC
"""
packed_hdr = struct.pack("!B", radius_packet.code)
packed_hdr += struct.pack("!B", radius_packet.id)
packed_hdr += struct.pack("!H", radius_packet.len)
packed_a... | python | def prepare_packed_data(radius_packet, packed_req_authenticator):
"""
Pack RADIUS data prior computing the authentication MAC
"""
packed_hdr = struct.pack("!B", radius_packet.code)
packed_hdr += struct.pack("!B", radius_packet.id)
packed_hdr += struct.pack("!H", radius_packet.len)
packed_a... | [
"def",
"prepare_packed_data",
"(",
"radius_packet",
",",
"packed_req_authenticator",
")",
":",
"packed_hdr",
"=",
"struct",
".",
"pack",
"(",
"\"!B\"",
",",
"radius_packet",
".",
"code",
")",
"packed_hdr",
"+=",
"struct",
".",
"pack",
"(",
"\"!B\"",
",",
"radi... | Pack RADIUS data prior computing the authentication MAC | [
"Pack",
"RADIUS",
"data",
"prior",
"computing",
"the",
"authentication",
"MAC"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/radius.py#L534-L547 | train | Pack RADIUS data prior computing the authentication 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/layers/radius.py | RadiusAttribute.register_variant | def register_variant(cls):
"""
Registers the RADIUS attributes defined in this module.
"""
if hasattr(cls, "val"):
cls.registered_attributes[cls.val] = cls
else:
cls.registered_attributes[cls.type.default] = cls | python | def register_variant(cls):
"""
Registers the RADIUS attributes defined in this module.
"""
if hasattr(cls, "val"):
cls.registered_attributes[cls.val] = cls
else:
cls.registered_attributes[cls.type.default] = cls | [
"def",
"register_variant",
"(",
"cls",
")",
":",
"if",
"hasattr",
"(",
"cls",
",",
"\"val\"",
")",
":",
"cls",
".",
"registered_attributes",
"[",
"cls",
".",
"val",
"]",
"=",
"cls",
"else",
":",
"cls",
".",
"registered_attributes",
"[",
"cls",
".",
"ty... | Registers the RADIUS attributes defined in this module. | [
"Registers",
"the",
"RADIUS",
"attributes",
"defined",
"in",
"this",
"module",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/radius.py#L239-L247 | train | Registers the RADIUS attributes defined in this module. | 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/radius.py | RadiusAttribute.dispatch_hook | def dispatch_hook(cls, _pkt=None, *args, **kargs):
"""
Returns the right RadiusAttribute class for the given data.
"""
if _pkt:
attr_type = orb(_pkt[0])
return cls.registered_attributes.get(attr_type, cls)
return cls | python | def dispatch_hook(cls, _pkt=None, *args, **kargs):
"""
Returns the right RadiusAttribute class for the given data.
"""
if _pkt:
attr_type = orb(_pkt[0])
return cls.registered_attributes.get(attr_type, cls)
return cls | [
"def",
"dispatch_hook",
"(",
"cls",
",",
"_pkt",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"_pkt",
":",
"attr_type",
"=",
"orb",
"(",
"_pkt",
"[",
"0",
"]",
")",
"return",
"cls",
".",
"registered_attributes",
".",
"get"... | Returns the right RadiusAttribute class for the given data. | [
"Returns",
"the",
"right",
"RadiusAttribute",
"class",
"for",
"the",
"given",
"data",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/radius.py#L250-L258 | train | Dispatches the given class to the right RadiusAttribute 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/radius.py | RadiusAttr_Message_Authenticator.compute_message_authenticator | def compute_message_authenticator(radius_packet, packed_req_authenticator,
shared_secret):
"""
Computes the "Message-Authenticator" of a given RADIUS packet.
"""
data = prepare_packed_data(radius_packet, packed_req_authenticator)
radius_hmac... | python | def compute_message_authenticator(radius_packet, packed_req_authenticator,
shared_secret):
"""
Computes the "Message-Authenticator" of a given RADIUS packet.
"""
data = prepare_packed_data(radius_packet, packed_req_authenticator)
radius_hmac... | [
"def",
"compute_message_authenticator",
"(",
"radius_packet",
",",
"packed_req_authenticator",
",",
"shared_secret",
")",
":",
"data",
"=",
"prepare_packed_data",
"(",
"radius_packet",
",",
"packed_req_authenticator",
")",
"radius_hmac",
"=",
"hmac",
".",
"new",
"(",
... | Computes the "Message-Authenticator" of a given RADIUS packet. | [
"Computes",
"the",
"Message",
"-",
"Authenticator",
"of",
"a",
"given",
"RADIUS",
"packet",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/radius.py#L566-L575 | train | Computes the Message - Authenticator of a given RADIUS 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/radius.py | Radius.compute_authenticator | def compute_authenticator(self, packed_request_auth, shared_secret):
"""
Computes the authenticator field (RFC 2865 - Section 3)
"""
data = prepare_packed_data(self, packed_request_auth)
radius_mac = hashlib.md5(data + shared_secret)
return radius_mac.digest() | python | def compute_authenticator(self, packed_request_auth, shared_secret):
"""
Computes the authenticator field (RFC 2865 - Section 3)
"""
data = prepare_packed_data(self, packed_request_auth)
radius_mac = hashlib.md5(data + shared_secret)
return radius_mac.digest() | [
"def",
"compute_authenticator",
"(",
"self",
",",
"packed_request_auth",
",",
"shared_secret",
")",
":",
"data",
"=",
"prepare_packed_data",
"(",
"self",
",",
"packed_request_auth",
")",
"radius_mac",
"=",
"hashlib",
".",
"md5",
"(",
"data",
"+",
"shared_secret",
... | Computes the authenticator field (RFC 2865 - Section 3) | [
"Computes",
"the",
"authenticator",
"field",
"(",
"RFC",
"2865",
"-",
"Section",
"3",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/radius.py#L1132-L1139 | train | Computes the authenticator field based on the request auth and shared 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/keyexchange_tls13.py | KeyShareEntry.do_build | def do_build(self):
"""
We need this hack, else 'self' would be replaced by __iter__.next().
"""
tmp = self.explicit
self.explicit = True
b = super(KeyShareEntry, self).do_build()
self.explicit = tmp
return b | python | def do_build(self):
"""
We need this hack, else 'self' would be replaced by __iter__.next().
"""
tmp = self.explicit
self.explicit = True
b = super(KeyShareEntry, self).do_build()
self.explicit = tmp
return b | [
"def",
"do_build",
"(",
"self",
")",
":",
"tmp",
"=",
"self",
".",
"explicit",
"self",
".",
"explicit",
"=",
"True",
"b",
"=",
"super",
"(",
"KeyShareEntry",
",",
"self",
")",
".",
"do_build",
"(",
")",
"self",
".",
"explicit",
"=",
"tmp",
"return",
... | We need this hack, else 'self' would be replaced by __iter__.next(). | [
"We",
"need",
"this",
"hack",
"else",
"self",
"would",
"be",
"replaced",
"by",
"__iter__",
".",
"next",
"()",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange_tls13.py#L48-L56 | train | This method is used to build the key share entry. | 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/keyexchange_tls13.py | KeyShareEntry.create_privkey | def create_privkey(self):
"""
This is called by post_build() for key creation.
"""
if self.group in _tls_named_ffdh_groups:
params = _ffdh_groups[_tls_named_ffdh_groups[self.group]][0]
privkey = params.generate_private_key()
self.privkey = privkey
... | python | def create_privkey(self):
"""
This is called by post_build() for key creation.
"""
if self.group in _tls_named_ffdh_groups:
params = _ffdh_groups[_tls_named_ffdh_groups[self.group]][0]
privkey = params.generate_private_key()
self.privkey = privkey
... | [
"def",
"create_privkey",
"(",
"self",
")",
":",
"if",
"self",
".",
"group",
"in",
"_tls_named_ffdh_groups",
":",
"params",
"=",
"_ffdh_groups",
"[",
"_tls_named_ffdh_groups",
"[",
"self",
".",
"group",
"]",
"]",
"[",
"0",
"]",
"privkey",
"=",
"params",
"."... | This is called by post_build() for key creation. | [
"This",
"is",
"called",
"by",
"post_build",
"()",
"for",
"key",
"creation",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange_tls13.py#L59-L89 | train | This method creates a private key for the current 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/arch/unix.py | _guess_iface_name | def _guess_iface_name(netif):
"""
We attempt to guess the name of interfaces that are truncated from the
output of ifconfig -l.
If there is only one possible candidate matching the interface name then we
return it.
If there are none or more, then we return None.
"""
with os.popen('%s -l'... | python | def _guess_iface_name(netif):
"""
We attempt to guess the name of interfaces that are truncated from the
output of ifconfig -l.
If there is only one possible candidate matching the interface name then we
return it.
If there are none or more, then we return None.
"""
with os.popen('%s -l'... | [
"def",
"_guess_iface_name",
"(",
"netif",
")",
":",
"with",
"os",
".",
"popen",
"(",
"'%s -l'",
"%",
"conf",
".",
"prog",
".",
"ifconfig",
")",
"as",
"fdesc",
":",
"ifaces",
"=",
"fdesc",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
".",
"spl... | We attempt to guess the name of interfaces that are truncated from the
output of ifconfig -l.
If there is only one possible candidate matching the interface name then we
return it.
If there are none or more, then we return None. | [
"We",
"attempt",
"to",
"guess",
"the",
"name",
"of",
"interfaces",
"that",
"are",
"truncated",
"from",
"the",
"output",
"of",
"ifconfig",
"-",
"l",
".",
"If",
"there",
"is",
"only",
"one",
"possible",
"candidate",
"matching",
"the",
"interface",
"name",
"t... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/unix.py#L28-L41 | train | Try to guess the name of the interface that is truncated from the ifconfig output of ifconfig - l. If there is only one possible candidate then we return None. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/unix.py | _in6_getifaddr | def _in6_getifaddr(ifname):
"""
Returns a list of IPv6 addresses configured on the interface ifname.
"""
# Get the output of ifconfig
try:
f = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
except OSError:
log_interactive.warning("Failed to execute ifconfig.")
return [... | python | def _in6_getifaddr(ifname):
"""
Returns a list of IPv6 addresses configured on the interface ifname.
"""
# Get the output of ifconfig
try:
f = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
except OSError:
log_interactive.warning("Failed to execute ifconfig.")
return [... | [
"def",
"_in6_getifaddr",
"(",
"ifname",
")",
":",
"# Get the output of ifconfig",
"try",
":",
"f",
"=",
"os",
".",
"popen",
"(",
"\"%s %s\"",
"%",
"(",
"conf",
".",
"prog",
".",
"ifconfig",
",",
"ifname",
")",
")",
"except",
"OSError",
":",
"log_interactiv... | Returns a list of IPv6 addresses configured on the interface ifname. | [
"Returns",
"a",
"list",
"of",
"IPv6",
"addresses",
"configured",
"on",
"the",
"interface",
"ifname",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/unix.py#L149-L181 | train | Returns a list of IPv6 addresses configured on the interface ifname. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/unix.py | in6_getifaddr | def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'iface'.
This is the list of all addresses of all interfaces available on
the system.
"""
# List all network interfaces
if O... | python | def in6_getifaddr():
"""
Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'iface'.
This is the list of all addresses of all interfaces available on
the system.
"""
# List all network interfaces
if O... | [
"def",
"in6_getifaddr",
"(",
")",
":",
"# List all network interfaces",
"if",
"OPENBSD",
":",
"try",
":",
"f",
"=",
"os",
".",
"popen",
"(",
"\"%s\"",
"%",
"conf",
".",
"prog",
".",
"ifconfig",
")",
"except",
"OSError",
":",
"log_interactive",
".",
"warnin... | Returns a list of 3-tuples of the form (addr, scope, iface) where
'addr' is the address of scope 'scope' associated to the interface
'iface'.
This is the list of all addresses of all interfaces available on
the system. | [
"Returns",
"a",
"list",
"of",
"3",
"-",
"tuples",
"of",
"the",
"form",
"(",
"addr",
"scope",
"iface",
")",
"where",
"addr",
"is",
"the",
"address",
"of",
"scope",
"scope",
"associated",
"to",
"the",
"interface",
"iface",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/unix.py#L184-L222 | train | Get the list of addresses of all interfaces associated to the interface in the system. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/unix.py | read_routes6 | def read_routes6():
"""Return a list of IPv6 routes than can be used by Scapy."""
# Call netstat to retrieve IPv6 routes
fd_netstat = os.popen("netstat -rn -f inet6")
# List interfaces IPv6 addresses
lifaddr = in6_getifaddr()
if not lifaddr:
return []
# Routes header information
... | python | def read_routes6():
"""Return a list of IPv6 routes than can be used by Scapy."""
# Call netstat to retrieve IPv6 routes
fd_netstat = os.popen("netstat -rn -f inet6")
# List interfaces IPv6 addresses
lifaddr = in6_getifaddr()
if not lifaddr:
return []
# Routes header information
... | [
"def",
"read_routes6",
"(",
")",
":",
"# Call netstat to retrieve IPv6 routes",
"fd_netstat",
"=",
"os",
".",
"popen",
"(",
"\"netstat -rn -f inet6\"",
")",
"# List interfaces IPv6 addresses",
"lifaddr",
"=",
"in6_getifaddr",
"(",
")",
"if",
"not",
"lifaddr",
":",
"re... | Return a list of IPv6 routes than can be used by Scapy. | [
"Return",
"a",
"list",
"of",
"IPv6",
"routes",
"than",
"can",
"be",
"used",
"by",
"Scapy",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/unix.py#L225-L339 | train | Reads IPv6 routes from netstat and returns a list of IPv6 routes than can be used by Scapy. | 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/main.py | _read_config_file | def _read_config_file(cf, _globals=globals(), _locals=locals(), interactive=True): # noqa: E501
"""Read a config file: execute a python file while loading scapy, that may contain # noqa: E501
some pre-configured values.
If _globals or _locals are specified, they will be updated with the loaded vars. # n... | python | def _read_config_file(cf, _globals=globals(), _locals=locals(), interactive=True): # noqa: E501
"""Read a config file: execute a python file while loading scapy, that may contain # noqa: E501
some pre-configured values.
If _globals or _locals are specified, they will be updated with the loaded vars. # n... | [
"def",
"_read_config_file",
"(",
"cf",
",",
"_globals",
"=",
"globals",
"(",
")",
",",
"_locals",
"=",
"locals",
"(",
")",
",",
"interactive",
"=",
"True",
")",
":",
"# noqa: E501",
"log_loading",
".",
"debug",
"(",
"\"Loading config file [%s]\"",
",",
"cf",... | Read a config file: execute a python file while loading scapy, that may contain # noqa: E501
some pre-configured values.
If _globals or _locals are specified, they will be updated with the loaded vars. # noqa: E501
This allows an external program to use the function. Otherwise, vars are only available #... | [
"Read",
"a",
"config",
"file",
":",
"execute",
"a",
"python",
"file",
"while",
"loading",
"scapy",
"that",
"may",
"contain",
"#",
"noqa",
":",
"E501",
"some",
"pre",
"-",
"configured",
"values",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L64-L95 | train | Read a config file and return a tuple of the base classes that can be used to instantiate 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/main.py | _load | def _load(module, globals_dict=None, symb_list=None):
"""Loads a Python module to make variables, objects and functions
available globally.
The idea is to load the module using importlib, then copy the
symbols to the global symbol table.
"""
if globals_dict is None:
globals_dict = six.moves.bu... | python | def _load(module, globals_dict=None, symb_list=None):
"""Loads a Python module to make variables, objects and functions
available globally.
The idea is to load the module using importlib, then copy the
symbols to the global symbol table.
"""
if globals_dict is None:
globals_dict = six.moves.bu... | [
"def",
"_load",
"(",
"module",
",",
"globals_dict",
"=",
"None",
",",
"symb_list",
"=",
"None",
")",
":",
"if",
"globals_dict",
"is",
"None",
":",
"globals_dict",
"=",
"six",
".",
"moves",
".",
"builtins",
".",
"__dict__",
"try",
":",
"mod",
"=",
"impo... | Loads a Python module to make variables, objects and functions
available globally.
The idea is to load the module using importlib, then copy the
symbols to the global symbol table. | [
"Loads",
"a",
"Python",
"module",
"to",
"make",
"variables",
"objects",
"and",
"functions",
"available",
"globally",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L123-L149 | train | Loads a Python module to make variables objects and functions
available globally. | 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/main.py | load_module | def load_module(name, globals_dict=None, symb_list=None):
"""Loads a Scapy module to make variables, objects and functions
available globally.
"""
_load("scapy.modules." + name,
globals_dict=globals_dict, symb_list=symb_list) | python | def load_module(name, globals_dict=None, symb_list=None):
"""Loads a Scapy module to make variables, objects and functions
available globally.
"""
_load("scapy.modules." + name,
globals_dict=globals_dict, symb_list=symb_list) | [
"def",
"load_module",
"(",
"name",
",",
"globals_dict",
"=",
"None",
",",
"symb_list",
"=",
"None",
")",
":",
"_load",
"(",
"\"scapy.modules.\"",
"+",
"name",
",",
"globals_dict",
"=",
"globals_dict",
",",
"symb_list",
"=",
"symb_list",
")"
] | Loads a Scapy module to make variables, objects and functions
available globally. | [
"Loads",
"a",
"Scapy",
"module",
"to",
"make",
"variables",
"objects",
"and",
"functions",
"available",
"globally",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L152-L158 | train | Loads a Scapy module to make variables objects and functions available globally. | 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/main.py | load_layer | def load_layer(name, globals_dict=None, symb_list=None):
"""Loads a Scapy layer module to make variables, objects and functions
available globally.
"""
_load("scapy.layers." + LAYER_ALIASES.get(name, name),
globals_dict=globals_dict, symb_list=symb_list) | python | def load_layer(name, globals_dict=None, symb_list=None):
"""Loads a Scapy layer module to make variables, objects and functions
available globally.
"""
_load("scapy.layers." + LAYER_ALIASES.get(name, name),
globals_dict=globals_dict, symb_list=symb_list) | [
"def",
"load_layer",
"(",
"name",
",",
"globals_dict",
"=",
"None",
",",
"symb_list",
"=",
"None",
")",
":",
"_load",
"(",
"\"scapy.layers.\"",
"+",
"LAYER_ALIASES",
".",
"get",
"(",
"name",
",",
"name",
")",
",",
"globals_dict",
"=",
"globals_dict",
",",
... | Loads a Scapy layer module to make variables, objects and functions
available globally. | [
"Loads",
"a",
"Scapy",
"layer",
"module",
"to",
"make",
"variables",
"objects",
"and",
"functions",
"available",
"globally",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L161-L167 | train | Loads a Scapy layer module to make variables objects and functions
available globally. | 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/main.py | load_contrib | def load_contrib(name, globals_dict=None, symb_list=None):
"""Loads a Scapy contrib module to make variables, objects and
functions available globally.
If no contrib module can be found with the given name, try to find
a layer module, since a contrib module may become a layer module.
"""
try:
... | python | def load_contrib(name, globals_dict=None, symb_list=None):
"""Loads a Scapy contrib module to make variables, objects and
functions available globally.
If no contrib module can be found with the given name, try to find
a layer module, since a contrib module may become a layer module.
"""
try:
... | [
"def",
"load_contrib",
"(",
"name",
",",
"globals_dict",
"=",
"None",
",",
"symb_list",
"=",
"None",
")",
":",
"try",
":",
"importlib",
".",
"import_module",
"(",
"\"scapy.contrib.\"",
"+",
"name",
")",
"_load",
"(",
"\"scapy.contrib.\"",
"+",
"name",
",",
... | Loads a Scapy contrib module to make variables, objects and
functions available globally.
If no contrib module can be found with the given name, try to find
a layer module, since a contrib module may become a layer module. | [
"Loads",
"a",
"Scapy",
"contrib",
"module",
"to",
"make",
"variables",
"objects",
"and",
"functions",
"available",
"globally",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L170-L188 | train | Loads a Scapy contrib module to make variables objects and functions available globally. | 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/main.py | list_contrib | def list_contrib(name=None, ret=False, _debug=False):
"""Show the list of all existing contribs.
Params:
- name: filter to search the contribs
- ret: whether the function should return a dict instead of printing it
"""
# _debug: checks that all contrib modules have correctly defined:
# # s... | python | def list_contrib(name=None, ret=False, _debug=False):
"""Show the list of all existing contribs.
Params:
- name: filter to search the contribs
- ret: whether the function should return a dict instead of printing it
"""
# _debug: checks that all contrib modules have correctly defined:
# # s... | [
"def",
"list_contrib",
"(",
"name",
"=",
"None",
",",
"ret",
"=",
"False",
",",
"_debug",
"=",
"False",
")",
":",
"# _debug: checks that all contrib modules have correctly defined:",
"# # scapy.contrib.description = [...]",
"# # scapy.contrib.status = [...]",
"# # scapy.contrib... | Show the list of all existing contribs.
Params:
- name: filter to search the contribs
- ret: whether the function should return a dict instead of printing it | [
"Show",
"the",
"list",
"of",
"all",
"existing",
"contribs",
".",
"Params",
":",
"-",
"name",
":",
"filter",
"to",
"search",
"the",
"contribs",
"-",
"ret",
":",
"whether",
"the",
"function",
"should",
"return",
"a",
"dict",
"instead",
"of",
"printing",
"i... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L191-L249 | train | Show the list of all existing contribs. | 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/main.py | save_session | def save_session(fname=None, session=None, pickleProto=-1):
"""Save current Scapy session to the file specified in the fname arg.
params:
- fname: file to save the scapy session in
- session: scapy session to use. If None, the console one will be used
- pickleProto: pickle proto version (default... | python | def save_session(fname=None, session=None, pickleProto=-1):
"""Save current Scapy session to the file specified in the fname arg.
params:
- fname: file to save the scapy session in
- session: scapy session to use. If None, the console one will be used
- pickleProto: pickle proto version (default... | [
"def",
"save_session",
"(",
"fname",
"=",
"None",
",",
"session",
"=",
"None",
",",
"pickleProto",
"=",
"-",
"1",
")",
":",
"from",
"scapy",
"import",
"utils",
"if",
"fname",
"is",
"None",
":",
"fname",
"=",
"conf",
".",
"session",
"if",
"not",
"fnam... | Save current Scapy session to the file specified in the fname arg.
params:
- fname: file to save the scapy session in
- session: scapy session to use. If None, the console one will be used
- pickleProto: pickle proto version (default: -1 = latest) | [
"Save",
"current",
"Scapy",
"session",
"to",
"the",
"file",
"specified",
"in",
"the",
"fname",
"arg",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L265-L308 | train | Save the current Scapy session to the file specified in fname. | 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/main.py | load_session | def load_session(fname=None):
"""Load current Scapy session from the file specified in the fname arg.
This will erase any existing session.
params:
- fname: file to load the scapy session from"""
if fname is None:
fname = conf.session
try:
s = six.moves.cPickle.load(gzip.open(f... | python | def load_session(fname=None):
"""Load current Scapy session from the file specified in the fname arg.
This will erase any existing session.
params:
- fname: file to load the scapy session from"""
if fname is None:
fname = conf.session
try:
s = six.moves.cPickle.load(gzip.open(f... | [
"def",
"load_session",
"(",
"fname",
"=",
"None",
")",
":",
"if",
"fname",
"is",
"None",
":",
"fname",
"=",
"conf",
".",
"session",
"try",
":",
"s",
"=",
"six",
".",
"moves",
".",
"cPickle",
".",
"load",
"(",
"gzip",
".",
"open",
"(",
"fname",
",... | Load current Scapy session from the file specified in the fname arg.
This will erase any existing session.
params:
- fname: file to load the scapy session from | [
"Load",
"current",
"Scapy",
"session",
"from",
"the",
"file",
"specified",
"in",
"the",
"fname",
"arg",
".",
"This",
"will",
"erase",
"any",
"existing",
"session",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L311-L333 | train | Load current Scapy session from the file specified in the fname arg. | 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/main.py | update_session | def update_session(fname=None):
"""Update current Scapy session from the file specified in the fname arg.
params:
- fname: file to load the scapy session from"""
if fname is None:
fname = conf.session
try:
s = six.moves.cPickle.load(gzip.open(fname, "rb"))
except IOError:
... | python | def update_session(fname=None):
"""Update current Scapy session from the file specified in the fname arg.
params:
- fname: file to load the scapy session from"""
if fname is None:
fname = conf.session
try:
s = six.moves.cPickle.load(gzip.open(fname, "rb"))
except IOError:
... | [
"def",
"update_session",
"(",
"fname",
"=",
"None",
")",
":",
"if",
"fname",
"is",
"None",
":",
"fname",
"=",
"conf",
".",
"session",
"try",
":",
"s",
"=",
"six",
".",
"moves",
".",
"cPickle",
".",
"load",
"(",
"gzip",
".",
"open",
"(",
"fname",
... | Update current Scapy session from the file specified in the fname arg.
params:
- fname: file to load the scapy session from | [
"Update",
"current",
"Scapy",
"session",
"from",
"the",
"file",
"specified",
"in",
"the",
"fname",
"arg",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L336-L349 | train | Update the current Scapy session from the file specified in the fname arg. | 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/main.py | _prepare_quote | def _prepare_quote(quote, author, max_len=78):
"""This function processes a quote and returns a string that is ready
to be used in the fancy prompt.
"""
quote = quote.split(' ')
max_len -= 6
lines = []
cur_line = []
def _len(line):
return sum(len(elt) for elt in line) + len(line) -... | python | def _prepare_quote(quote, author, max_len=78):
"""This function processes a quote and returns a string that is ready
to be used in the fancy prompt.
"""
quote = quote.split(' ')
max_len -= 6
lines = []
cur_line = []
def _len(line):
return sum(len(elt) for elt in line) + len(line) -... | [
"def",
"_prepare_quote",
"(",
"quote",
",",
"author",
",",
"max_len",
"=",
"78",
")",
":",
"quote",
"=",
"quote",
".",
"split",
"(",
"' '",
")",
"max_len",
"-=",
"6",
"lines",
"=",
"[",
"]",
"cur_line",
"=",
"[",
"]",
"def",
"_len",
"(",
"line",
... | This function processes a quote and returns a string that is ready
to be used in the fancy prompt. | [
"This",
"function",
"processes",
"a",
"quote",
"and",
"returns",
"a",
"string",
"that",
"is",
"ready",
"to",
"be",
"used",
"in",
"the",
"fancy",
"prompt",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/main.py#L413-L435 | train | This function processes a quote and returns a string that is ready to be used in the fancy prompt. | 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/autorun.py | autorun_get_interactive_session | def autorun_get_interactive_session(cmds, **kargs):
"""Create an interactive session and execute the
commands passed as "cmds" and return all output
params:
- cmds: a list of commands to run
returns: (output, returned)
The output contains both sys.stdout and sys.stderr logs"""
sstdout, s... | python | def autorun_get_interactive_session(cmds, **kargs):
"""Create an interactive session and execute the
commands passed as "cmds" and return all output
params:
- cmds: a list of commands to run
returns: (output, returned)
The output contains both sys.stdout and sys.stderr logs"""
sstdout, s... | [
"def",
"autorun_get_interactive_session",
"(",
"cmds",
",",
"*",
"*",
"kargs",
")",
":",
"sstdout",
",",
"sstderr",
"=",
"sys",
".",
"stdout",
",",
"sys",
".",
"stderr",
"sw",
"=",
"StringWriter",
"(",
")",
"try",
":",
"try",
":",
"sys",
".",
"stdout",... | Create an interactive session and execute the
commands passed as "cmds" and return all output
params:
- cmds: a list of commands to run
returns: (output, returned)
The output contains both sys.stdout and sys.stderr logs | [
"Create",
"an",
"interactive",
"session",
"and",
"execute",
"the",
"commands",
"passed",
"as",
"cmds",
"and",
"return",
"all",
"output"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/autorun.py#L103-L123 | train | Create an interactive session and execute the passed commands and return all output | 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/ethercat.py | LEBitField._check_field_type | def _check_field_type(self, pkt, index):
"""
check if the field addressed by given index relative to this field
shares type of this field so we can catch a mix of LEBitField
and BitField/other types
"""
my_idx = pkt.fields_desc.index(self)
try:
next_fi... | python | def _check_field_type(self, pkt, index):
"""
check if the field addressed by given index relative to this field
shares type of this field so we can catch a mix of LEBitField
and BitField/other types
"""
my_idx = pkt.fields_desc.index(self)
try:
next_fi... | [
"def",
"_check_field_type",
"(",
"self",
",",
"pkt",
",",
"index",
")",
":",
"my_idx",
"=",
"pkt",
".",
"fields_desc",
".",
"index",
"(",
"self",
")",
"try",
":",
"next_field",
"=",
"pkt",
".",
"fields_desc",
"[",
"my_idx",
"+",
"index",
"]",
"if",
"... | check if the field addressed by given index relative to this field
shares type of this field so we can catch a mix of LEBitField
and BitField/other types | [
"check",
"if",
"the",
"field",
"addressed",
"by",
"given",
"index",
"relative",
"to",
"this",
"field",
"shares",
"type",
"of",
"this",
"field",
"so",
"we",
"can",
"catch",
"a",
"mix",
"of",
"LEBitField",
"and",
"BitField",
"/",
"other",
"types"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ethercat.py#L78-L96 | train | check if the field addressed by given index is of type LEBitField or bitField | 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/ethercat.py | LEBitField.getfield | def getfield(self, pkt, s):
"""
extract data from raw str
collect all instances belonging to the bit field set.
if we reach a field that ends at a octet boundary, dissect the whole bit field at once # noqa: E501
:param pkt: packet instance the field belongs to
:param ... | python | def getfield(self, pkt, s):
"""
extract data from raw str
collect all instances belonging to the bit field set.
if we reach a field that ends at a octet boundary, dissect the whole bit field at once # noqa: E501
:param pkt: packet instance the field belongs to
:param ... | [
"def",
"getfield",
"(",
"self",
",",
"pkt",
",",
"s",
")",
":",
"if",
"type",
"(",
"s",
")",
"is",
"tuple",
"and",
"len",
"(",
"s",
")",
"==",
"3",
":",
"s",
",",
"bits_in_set",
",",
"fields",
"=",
"s",
"else",
":",
"bits_in_set",
"=",
"0",
"... | extract data from raw str
collect all instances belonging to the bit field set.
if we reach a field that ends at a octet boundary, dissect the whole bit field at once # noqa: E501
:param pkt: packet instance the field belongs to
:param s: raw string representing the frame -or- tuple c... | [
"extract",
"data",
"from",
"raw",
"str"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ethercat.py#L160-L251 | train | extracts data from raw string and returns the bit field value and the bits_in_set of the bitfield. | 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/ethercat.py | EtherCat.post_build | def post_build(self, pkt, pay):
"""
need to set the length of the whole PDU manually
to avoid any bit fiddling use a dummy class to build the layer content
also add padding if frame is < 64 bytes
Note: padding only handles Ether/n*Dot1Q/EtherCat
(no special mumbo ... | python | def post_build(self, pkt, pay):
"""
need to set the length of the whole PDU manually
to avoid any bit fiddling use a dummy class to build the layer content
also add padding if frame is < 64 bytes
Note: padding only handles Ether/n*Dot1Q/EtherCat
(no special mumbo ... | [
"def",
"post_build",
"(",
"self",
",",
"pkt",
",",
"pay",
")",
":",
"class",
"_EtherCatLengthCalc",
"(",
"Packet",
")",
":",
"\"\"\"\n dummy class used to generate str representation easily\n \"\"\"",
"fields_desc",
"=",
"[",
"LEBitField",
"(",
"'len... | need to set the length of the whole PDU manually
to avoid any bit fiddling use a dummy class to build the layer content
also add padding if frame is < 64 bytes
Note: padding only handles Ether/n*Dot1Q/EtherCat
(no special mumbo jumbo)
:param pkt: raw string containing th... | [
"need",
"to",
"set",
"the",
"length",
"of",
"the",
"whole",
"PDU",
"manually",
"to",
"avoid",
"any",
"bit",
"fiddling",
"use",
"a",
"dummy",
"class",
"to",
"build",
"the",
"layer",
"content"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ethercat.py#L561-L619 | train | This method is called when the packet is sent to the EtherCat. | 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/utils6.py | get_source_addr_from_candidate_set | def get_source_addr_from_candidate_set(dst, candidate_set):
"""
This function implement a limited version of source address selection
algorithm defined in section 5 of RFC 3484. The format is very different
from that described in the document because it operates on a set
of candidate source address ... | python | def get_source_addr_from_candidate_set(dst, candidate_set):
"""
This function implement a limited version of source address selection
algorithm defined in section 5 of RFC 3484. The format is very different
from that described in the document because it operates on a set
of candidate source address ... | [
"def",
"get_source_addr_from_candidate_set",
"(",
"dst",
",",
"candidate_set",
")",
":",
"def",
"scope_cmp",
"(",
"a",
",",
"b",
")",
":",
"\"\"\"\n Given two addresses, returns -1, 0 or 1 based on comparison of\n their scope\n \"\"\"",
"scope_mapper",
"=",
... | This function implement a limited version of source address selection
algorithm defined in section 5 of RFC 3484. The format is very different
from that described in the document because it operates on a set
of candidate source address for some specific route. | [
"This",
"function",
"implement",
"a",
"limited",
"version",
"of",
"source",
"address",
"selection",
"algorithm",
"defined",
"in",
"section",
"5",
"of",
"RFC",
"3484",
".",
"The",
"format",
"is",
"very",
"different",
"from",
"that",
"described",
"in",
"the",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L86-L165 | train | This function returns the source address from a candidate set. | 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/utils6.py | in6_mactoifaceid | def in6_mactoifaceid(mac, ulbit=None):
"""
Compute the interface ID in modified EUI-64 format associated
to the Ethernet address provided as input.
value taken by U/L bit in the interface identifier is basically
the reversed value of that in given MAC address it can be forced
to a specific value... | python | def in6_mactoifaceid(mac, ulbit=None):
"""
Compute the interface ID in modified EUI-64 format associated
to the Ethernet address provided as input.
value taken by U/L bit in the interface identifier is basically
the reversed value of that in given MAC address it can be forced
to a specific value... | [
"def",
"in6_mactoifaceid",
"(",
"mac",
",",
"ulbit",
"=",
"None",
")",
":",
"if",
"len",
"(",
"mac",
")",
"!=",
"17",
":",
"return",
"None",
"m",
"=",
"\"\"",
".",
"join",
"(",
"mac",
".",
"split",
"(",
"':'",
")",
")",
"if",
"len",
"(",
"m",
... | Compute the interface ID in modified EUI-64 format associated
to the Ethernet address provided as input.
value taken by U/L bit in the interface identifier is basically
the reversed value of that in given MAC address it can be forced
to a specific value by using optional 'ulbit' parameter. | [
"Compute",
"the",
"interface",
"ID",
"in",
"modified",
"EUI",
"-",
"64",
"format",
"associated",
"to",
"the",
"Ethernet",
"address",
"provided",
"as",
"input",
".",
"value",
"taken",
"by",
"U",
"/",
"L",
"bit",
"in",
"the",
"interface",
"identifier",
"is",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L203-L222 | train | Compute the interface ID in modified EUI - 64 format associated to the given MAC address. | 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/utils6.py | in6_ifaceidtomac | def in6_ifaceidtomac(ifaceid):
"""
Extract the mac address from provided iface ID. Iface ID is provided
in printable format ("XXXX:XXFF:FEXX:XXXX", eventually compressed). None
is returned on error.
"""
try:
# Set ifaceid to a binary form
ifaceid = inet_pton(socket.AF_INET6, "::"... | python | def in6_ifaceidtomac(ifaceid):
"""
Extract the mac address from provided iface ID. Iface ID is provided
in printable format ("XXXX:XXFF:FEXX:XXXX", eventually compressed). None
is returned on error.
"""
try:
# Set ifaceid to a binary form
ifaceid = inet_pton(socket.AF_INET6, "::"... | [
"def",
"in6_ifaceidtomac",
"(",
"ifaceid",
")",
":",
"try",
":",
"# Set ifaceid to a binary form",
"ifaceid",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"\"::\"",
"+",
"ifaceid",
")",
"[",
"8",
":",
"16",
"]",
"except",
"Exception",
":",
"return"... | Extract the mac address from provided iface ID. Iface ID is provided
in printable format ("XXXX:XXFF:FEXX:XXXX", eventually compressed). None
is returned on error. | [
"Extract",
"the",
"mac",
"address",
"from",
"provided",
"iface",
"ID",
".",
"Iface",
"ID",
"is",
"provided",
"in",
"printable",
"format",
"(",
"XXXX",
":",
"XXFF",
":",
"FEXX",
":",
"XXXX",
"eventually",
"compressed",
")",
".",
"None",
"is",
"returned",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L225-L248 | train | Extract the MAC address from a given iface ID. | 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/utils6.py | in6_addrtomac | def in6_addrtomac(addr):
"""
Extract the mac address from provided address. None is returned
on error.
"""
mask = inet_pton(socket.AF_INET6, "::ffff:ffff:ffff:ffff")
x = in6_and(mask, inet_pton(socket.AF_INET6, addr))
ifaceid = inet_ntop(socket.AF_INET6, x)[2:]
return in6_ifaceidtomac(if... | python | def in6_addrtomac(addr):
"""
Extract the mac address from provided address. None is returned
on error.
"""
mask = inet_pton(socket.AF_INET6, "::ffff:ffff:ffff:ffff")
x = in6_and(mask, inet_pton(socket.AF_INET6, addr))
ifaceid = inet_ntop(socket.AF_INET6, x)[2:]
return in6_ifaceidtomac(if... | [
"def",
"in6_addrtomac",
"(",
"addr",
")",
":",
"mask",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"\"::ffff:ffff:ffff:ffff\"",
")",
"x",
"=",
"in6_and",
"(",
"mask",
",",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"addr",
")",
")",
"if... | Extract the mac address from provided address. None is returned
on error. | [
"Extract",
"the",
"mac",
"address",
"from",
"provided",
"address",
".",
"None",
"is",
"returned",
"on",
"error",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L251-L259 | train | Extract the mac address from provided address. | 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/utils6.py | in6_addrtovendor | def in6_addrtovendor(addr):
"""
Extract the MAC address from a modified EUI-64 constructed IPv6
address provided and use the IANA oui.txt file to get the vendor.
The database used for the conversion is the one loaded by Scapy
from a Wireshark installation if discovered in a well-known
location. ... | python | def in6_addrtovendor(addr):
"""
Extract the MAC address from a modified EUI-64 constructed IPv6
address provided and use the IANA oui.txt file to get the vendor.
The database used for the conversion is the one loaded by Scapy
from a Wireshark installation if discovered in a well-known
location. ... | [
"def",
"in6_addrtovendor",
"(",
"addr",
")",
":",
"mac",
"=",
"in6_addrtomac",
"(",
"addr",
")",
"if",
"mac",
"is",
"None",
"or",
"conf",
".",
"manufdb",
"is",
"None",
":",
"return",
"None",
"res",
"=",
"conf",
".",
"manufdb",
".",
"_get_manuf",
"(",
... | Extract the MAC address from a modified EUI-64 constructed IPv6
address provided and use the IANA oui.txt file to get the vendor.
The database used for the conversion is the one loaded by Scapy
from a Wireshark installation if discovered in a well-known
location. None is returned on error, "UNKNOWN" if ... | [
"Extract",
"the",
"MAC",
"address",
"from",
"a",
"modified",
"EUI",
"-",
"64",
"constructed",
"IPv6",
"address",
"provided",
"and",
"use",
"the",
"IANA",
"oui",
".",
"txt",
"file",
"to",
"get",
"the",
"vendor",
".",
"The",
"database",
"used",
"for",
"the... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L262-L279 | train | Convert an IPv6 address to the vendor 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/utils6.py | in6_getLinkScopedMcastAddr | def in6_getLinkScopedMcastAddr(addr, grpid=None, scope=2):
"""
Generate a Link-Scoped Multicast Address as described in RFC 4489.
Returned value is in printable notation.
'addr' parameter specifies the link-local address to use for generating
Link-scoped multicast address IID.
By default, the ... | python | def in6_getLinkScopedMcastAddr(addr, grpid=None, scope=2):
"""
Generate a Link-Scoped Multicast Address as described in RFC 4489.
Returned value is in printable notation.
'addr' parameter specifies the link-local address to use for generating
Link-scoped multicast address IID.
By default, the ... | [
"def",
"in6_getLinkScopedMcastAddr",
"(",
"addr",
",",
"grpid",
"=",
"None",
",",
"scope",
"=",
"2",
")",
":",
"if",
"scope",
"not",
"in",
"[",
"0",
",",
"1",
",",
"2",
"]",
":",
"return",
"None",
"try",
":",
"if",
"not",
"in6_islladdr",
"(",
"addr... | Generate a Link-Scoped Multicast Address as described in RFC 4489.
Returned value is in printable notation.
'addr' parameter specifies the link-local address to use for generating
Link-scoped multicast address IID.
By default, the function returns a ::/96 prefix (aka last 32 bits of
returned addre... | [
"Generate",
"a",
"Link",
"-",
"Scoped",
"Multicast",
"Address",
"as",
"described",
"in",
"RFC",
"4489",
".",
"Returned",
"value",
"is",
"in",
"printable",
"notation",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L282-L338 | train | Generate a Link - Scoped Multicast Address as described in RFC 4489. | 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/utils6.py | in6_getLocalUniquePrefix | def in6_getLocalUniquePrefix():
"""
Returns a pseudo-randomly generated Local Unique prefix. Function
follows recommendation of Section 3.2.2 of RFC 4193 for prefix
generation.
"""
# Extracted from RFC 1305 (NTP) :
# NTP timestamps are represented as a 64-bit unsigned fixed-point number,
... | python | def in6_getLocalUniquePrefix():
"""
Returns a pseudo-randomly generated Local Unique prefix. Function
follows recommendation of Section 3.2.2 of RFC 4193 for prefix
generation.
"""
# Extracted from RFC 1305 (NTP) :
# NTP timestamps are represented as a 64-bit unsigned fixed-point number,
... | [
"def",
"in6_getLocalUniquePrefix",
"(",
")",
":",
"# Extracted from RFC 1305 (NTP) :",
"# NTP timestamps are represented as a 64-bit unsigned fixed-point number,",
"# in seconds relative to 0h on 1 January 1900. The integer part is in the",
"# first 32 bits and the fraction part in the last 32 bits.... | Returns a pseudo-randomly generated Local Unique prefix. Function
follows recommendation of Section 3.2.2 of RFC 4193 for prefix
generation. | [
"Returns",
"a",
"pseudo",
"-",
"randomly",
"generated",
"Local",
"Unique",
"prefix",
".",
"Function",
"follows",
"recommendation",
"of",
"Section",
"3",
".",
"2",
".",
"2",
"of",
"RFC",
"4193",
"for",
"prefix",
"generation",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L369-L395 | train | Returns a pseudo - randomly generated Local Unique prefix. | 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/utils6.py | in6_getRandomizedIfaceId | def in6_getRandomizedIfaceId(ifaceid, previous=None):
"""
Implements the interface ID generation algorithm described in RFC 3041.
The function takes the Modified EUI-64 interface identifier generated
as described in RFC 4291 and an optional previous history value (the
first element of the output of ... | python | def in6_getRandomizedIfaceId(ifaceid, previous=None):
"""
Implements the interface ID generation algorithm described in RFC 3041.
The function takes the Modified EUI-64 interface identifier generated
as described in RFC 4291 and an optional previous history value (the
first element of the output of ... | [
"def",
"in6_getRandomizedIfaceId",
"(",
"ifaceid",
",",
"previous",
"=",
"None",
")",
":",
"s",
"=",
"b\"\"",
"if",
"previous",
"is",
"None",
":",
"d",
"=",
"b\"\"",
".",
"join",
"(",
"chb",
"(",
"x",
")",
"for",
"x",
"in",
"range",
"(",
"256",
")"... | Implements the interface ID generation algorithm described in RFC 3041.
The function takes the Modified EUI-64 interface identifier generated
as described in RFC 4291 and an optional previous history value (the
first element of the output of this function). If no previous interface
identifier is provide... | [
"Implements",
"the",
"interface",
"ID",
"generation",
"algorithm",
"described",
"in",
"RFC",
"3041",
".",
"The",
"function",
"takes",
"the",
"Modified",
"EUI",
"-",
"64",
"interface",
"identifier",
"generated",
"as",
"described",
"in",
"RFC",
"4291",
"and",
"a... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L398-L430 | train | This function generates a randomized interface identifier for the specified interface ID. | 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/utils6.py | in6_ptoc | def in6_ptoc(addr):
"""
Converts an IPv6 address in printable representation to RFC
1924 Compact Representation ;-)
Returns None on error.
"""
try:
d = struct.unpack("!IIII", inet_pton(socket.AF_INET6, addr))
except Exception:
return None
res = 0
m = [2**96, 2**64, 2*... | python | def in6_ptoc(addr):
"""
Converts an IPv6 address in printable representation to RFC
1924 Compact Representation ;-)
Returns None on error.
"""
try:
d = struct.unpack("!IIII", inet_pton(socket.AF_INET6, addr))
except Exception:
return None
res = 0
m = [2**96, 2**64, 2*... | [
"def",
"in6_ptoc",
"(",
"addr",
")",
":",
"try",
":",
"d",
"=",
"struct",
".",
"unpack",
"(",
"\"!IIII\"",
",",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"addr",
")",
")",
"except",
"Exception",
":",
"return",
"None",
"res",
"=",
"0",
"m",
... | Converts an IPv6 address in printable representation to RFC
1924 Compact Representation ;-)
Returns None on error. | [
"Converts",
"an",
"IPv6",
"address",
"in",
"printable",
"representation",
"to",
"RFC",
"1924",
"Compact",
"Representation",
";",
"-",
")",
"Returns",
"None",
"on",
"error",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L462-L482 | train | Convert an IPv6 address in printable representation to RFC 1924 Compact 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/utils6.py | in6_isaddrTeredo | def in6_isaddrTeredo(x):
"""
Return True if provided address is a Teredo, meaning it is under
the /32 conf.teredoPrefix prefix value (by default, 2001::).
Otherwise, False is returned. Address must be passed in printable
format.
"""
our = inet_pton(socket.AF_INET6, x)[0:4]
teredoPrefix =... | python | def in6_isaddrTeredo(x):
"""
Return True if provided address is a Teredo, meaning it is under
the /32 conf.teredoPrefix prefix value (by default, 2001::).
Otherwise, False is returned. Address must be passed in printable
format.
"""
our = inet_pton(socket.AF_INET6, x)[0:4]
teredoPrefix =... | [
"def",
"in6_isaddrTeredo",
"(",
"x",
")",
":",
"our",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"x",
")",
"[",
"0",
":",
"4",
"]",
"teredoPrefix",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"conf",
".",
"teredoPrefix",
")",
"... | Return True if provided address is a Teredo, meaning it is under
the /32 conf.teredoPrefix prefix value (by default, 2001::).
Otherwise, False is returned. Address must be passed in printable
format. | [
"Return",
"True",
"if",
"provided",
"address",
"is",
"a",
"Teredo",
"meaning",
"it",
"is",
"under",
"the",
"/",
"32",
"conf",
".",
"teredoPrefix",
"prefix",
"value",
"(",
"by",
"default",
"2001",
"::",
")",
".",
"Otherwise",
"False",
"is",
"returned",
".... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L498-L507 | train | Returns True if provided address is a Teredo. | 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/utils6.py | teredoAddrExtractInfo | def teredoAddrExtractInfo(x):
"""
Extract information from a Teredo address. Return value is
a 4-tuple made of IPv4 address of Teredo server, flag value (int),
mapped address (non obfuscated) and mapped port (non obfuscated).
No specific checks are performed on passed address.
"""
addr = ine... | python | def teredoAddrExtractInfo(x):
"""
Extract information from a Teredo address. Return value is
a 4-tuple made of IPv4 address of Teredo server, flag value (int),
mapped address (non obfuscated) and mapped port (non obfuscated).
No specific checks are performed on passed address.
"""
addr = ine... | [
"def",
"teredoAddrExtractInfo",
"(",
"x",
")",
":",
"addr",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"x",
")",
"server",
"=",
"inet_ntop",
"(",
"socket",
".",
"AF_INET",
",",
"addr",
"[",
"4",
":",
"8",
"]",
")",
"flag",
"=",
"struct",
... | Extract information from a Teredo address. Return value is
a 4-tuple made of IPv4 address of Teredo server, flag value (int),
mapped address (non obfuscated) and mapped port (non obfuscated).
No specific checks are performed on passed address. | [
"Extract",
"information",
"from",
"a",
"Teredo",
"address",
".",
"Return",
"value",
"is",
"a",
"4",
"-",
"tuple",
"made",
"of",
"IPv4",
"address",
"of",
"Teredo",
"server",
"flag",
"value",
"(",
"int",
")",
"mapped",
"address",
"(",
"non",
"obfuscated",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L510-L522 | train | Extract information from a Teredo address. | 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/utils6.py | in6_iseui64 | def in6_iseui64(x):
"""
Return True if provided address has an interface identifier part
created in modified EUI-64 format (meaning it matches *::*:*ff:fe*:*).
Otherwise, False is returned. Address must be passed in printable
format.
"""
eui64 = inet_pton(socket.AF_INET6, '::ff:fe00:0')
... | python | def in6_iseui64(x):
"""
Return True if provided address has an interface identifier part
created in modified EUI-64 format (meaning it matches *::*:*ff:fe*:*).
Otherwise, False is returned. Address must be passed in printable
format.
"""
eui64 = inet_pton(socket.AF_INET6, '::ff:fe00:0')
... | [
"def",
"in6_iseui64",
"(",
"x",
")",
":",
"eui64",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"'::ff:fe00:0'",
")",
"x",
"=",
"in6_and",
"(",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"x",
")",
",",
"eui64",
")",
"return",
"x",
"=... | Return True if provided address has an interface identifier part
created in modified EUI-64 format (meaning it matches *::*:*ff:fe*:*).
Otherwise, False is returned. Address must be passed in printable
format. | [
"Return",
"True",
"if",
"provided",
"address",
"has",
"an",
"interface",
"identifier",
"part",
"created",
"in",
"modified",
"EUI",
"-",
"64",
"format",
"(",
"meaning",
"it",
"matches",
"*",
"::",
"*",
":",
"*",
"ff",
":",
"fe",
"*",
":",
"*",
")",
".... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L525-L534 | train | Returns True if provided address has an interface identifier part
created in modified EUI - 64 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/utils6.py | in6_getnsma | def in6_getnsma(a):
"""
Return link-local solicited-node multicast address for given
address. Passed address must be provided in network format.
Returned value is also in network format.
"""
r = in6_and(a, inet_pton(socket.AF_INET6, '::ff:ffff'))
r = in6_or(inet_pton(socket.AF_INET6, 'ff02:... | python | def in6_getnsma(a):
"""
Return link-local solicited-node multicast address for given
address. Passed address must be provided in network format.
Returned value is also in network format.
"""
r = in6_and(a, inet_pton(socket.AF_INET6, '::ff:ffff'))
r = in6_or(inet_pton(socket.AF_INET6, 'ff02:... | [
"def",
"in6_getnsma",
"(",
"a",
")",
":",
"r",
"=",
"in6_and",
"(",
"a",
",",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"'::ff:ffff'",
")",
")",
"r",
"=",
"in6_or",
"(",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"'ff02::1:ff00:0'",
")",... | Return link-local solicited-node multicast address for given
address. Passed address must be provided in network format.
Returned value is also in network format. | [
"Return",
"link",
"-",
"local",
"solicited",
"-",
"node",
"multicast",
"address",
"for",
"given",
"address",
".",
"Passed",
"address",
"must",
"be",
"provided",
"in",
"network",
"format",
".",
"Returned",
"value",
"is",
"also",
"in",
"network",
"format",
"."... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L611-L620 | train | Returns a network format multicast address for given address. | 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/utils6.py | in6_getha | def in6_getha(prefix):
"""
Return the anycast address associated with all home agents on a given
subnet.
"""
r = in6_and(inet_pton(socket.AF_INET6, prefix), in6_cidr2mask(64))
r = in6_or(r, inet_pton(socket.AF_INET6, '::fdff:ffff:ffff:fffe'))
return inet_ntop(socket.AF_INET6, r) | python | def in6_getha(prefix):
"""
Return the anycast address associated with all home agents on a given
subnet.
"""
r = in6_and(inet_pton(socket.AF_INET6, prefix), in6_cidr2mask(64))
r = in6_or(r, inet_pton(socket.AF_INET6, '::fdff:ffff:ffff:fffe'))
return inet_ntop(socket.AF_INET6, r) | [
"def",
"in6_getha",
"(",
"prefix",
")",
":",
"r",
"=",
"in6_and",
"(",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"prefix",
")",
",",
"in6_cidr2mask",
"(",
"64",
")",
")",
"r",
"=",
"in6_or",
"(",
"r",
",",
"inet_pton",
"(",
"socket",
".",
"... | Return the anycast address associated with all home agents on a given
subnet. | [
"Return",
"the",
"anycast",
"address",
"associated",
"with",
"all",
"home",
"agents",
"on",
"a",
"given",
"subnet",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L635-L642 | train | Returns the anycast address associated with all home agents on a given subnet. | 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/utils6.py | in6_isincluded | def in6_isincluded(addr, prefix, plen):
"""
Returns True when 'addr' belongs to prefix/plen. False otherwise.
"""
temp = inet_pton(socket.AF_INET6, addr)
pref = in6_cidr2mask(plen)
zero = inet_pton(socket.AF_INET6, prefix)
return zero == in6_and(temp, pref) | python | def in6_isincluded(addr, prefix, plen):
"""
Returns True when 'addr' belongs to prefix/plen. False otherwise.
"""
temp = inet_pton(socket.AF_INET6, addr)
pref = in6_cidr2mask(plen)
zero = inet_pton(socket.AF_INET6, prefix)
return zero == in6_and(temp, pref) | [
"def",
"in6_isincluded",
"(",
"addr",
",",
"prefix",
",",
"plen",
")",
":",
"temp",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"addr",
")",
"pref",
"=",
"in6_cidr2mask",
"(",
"plen",
")",
"zero",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_IN... | Returns True when 'addr' belongs to prefix/plen. False otherwise. | [
"Returns",
"True",
"when",
"addr",
"belongs",
"to",
"prefix",
"/",
"plen",
".",
"False",
"otherwise",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L653-L660 | train | Returns True when addr belongs to prefix and plen. | 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/utils6.py | in6_isllsnmaddr | def in6_isllsnmaddr(str):
"""
Return True if provided address is a link-local solicited node
multicast address, i.e. belongs to ff02::1:ff00:0/104. False is
returned otherwise.
"""
temp = in6_and(b"\xff" * 13 + b"\x00" * 3, inet_pton(socket.AF_INET6, str))
temp2 = b'\xff\x02\x00\x00\x00\x00\... | python | def in6_isllsnmaddr(str):
"""
Return True if provided address is a link-local solicited node
multicast address, i.e. belongs to ff02::1:ff00:0/104. False is
returned otherwise.
"""
temp = in6_and(b"\xff" * 13 + b"\x00" * 3, inet_pton(socket.AF_INET6, str))
temp2 = b'\xff\x02\x00\x00\x00\x00\... | [
"def",
"in6_isllsnmaddr",
"(",
"str",
")",
":",
"temp",
"=",
"in6_and",
"(",
"b\"\\xff\"",
"*",
"13",
"+",
"b\"\\x00\"",
"*",
"3",
",",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"str",
")",
")",
"temp2",
"=",
"b'\\xff\\x02\\x00\\x00\\x00\\x00\\x00\\x... | Return True if provided address is a link-local solicited node
multicast address, i.e. belongs to ff02::1:ff00:0/104. False is
returned otherwise. | [
"Return",
"True",
"if",
"provided",
"address",
"is",
"a",
"link",
"-",
"local",
"solicited",
"node",
"multicast",
"address",
"i",
".",
"e",
".",
"belongs",
"to",
"ff02",
"::",
"1",
":",
"ff00",
":",
"0",
"/",
"104",
".",
"False",
"is",
"returned",
"o... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L663-L671 | train | Return True if provided address is a link - local solicited node
multicast address i. e. belongs to ff00 : 0 / 104. False is
returned otherwise. | 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/utils6.py | in6_getscope | def in6_getscope(addr):
"""
Returns the scope of the address.
"""
if in6_isgladdr(addr) or in6_isuladdr(addr):
scope = IPV6_ADDR_GLOBAL
elif in6_islladdr(addr):
scope = IPV6_ADDR_LINKLOCAL
elif in6_issladdr(addr):
scope = IPV6_ADDR_SITELOCAL
elif in6_ismaddr(addr):
... | python | def in6_getscope(addr):
"""
Returns the scope of the address.
"""
if in6_isgladdr(addr) or in6_isuladdr(addr):
scope = IPV6_ADDR_GLOBAL
elif in6_islladdr(addr):
scope = IPV6_ADDR_LINKLOCAL
elif in6_issladdr(addr):
scope = IPV6_ADDR_SITELOCAL
elif in6_ismaddr(addr):
... | [
"def",
"in6_getscope",
"(",
"addr",
")",
":",
"if",
"in6_isgladdr",
"(",
"addr",
")",
"or",
"in6_isuladdr",
"(",
"addr",
")",
":",
"scope",
"=",
"IPV6_ADDR_GLOBAL",
"elif",
"in6_islladdr",
"(",
"addr",
")",
":",
"scope",
"=",
"IPV6_ADDR_LINKLOCAL",
"elif",
... | Returns the scope of the address. | [
"Returns",
"the",
"scope",
"of",
"the",
"address",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L783-L808 | train | Returns the scope of the address. | 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/utils6.py | in6_get_common_plen | def in6_get_common_plen(a, b):
"""
Return common prefix length of IPv6 addresses a and b.
"""
def matching_bits(byte1, byte2):
for i in range(8):
cur_mask = 0x80 >> i
if (byte1 & cur_mask) != (byte2 & cur_mask):
return i
return 8
tmpA = inet_p... | python | def in6_get_common_plen(a, b):
"""
Return common prefix length of IPv6 addresses a and b.
"""
def matching_bits(byte1, byte2):
for i in range(8):
cur_mask = 0x80 >> i
if (byte1 & cur_mask) != (byte2 & cur_mask):
return i
return 8
tmpA = inet_p... | [
"def",
"in6_get_common_plen",
"(",
"a",
",",
"b",
")",
":",
"def",
"matching_bits",
"(",
"byte1",
",",
"byte2",
")",
":",
"for",
"i",
"in",
"range",
"(",
"8",
")",
":",
"cur_mask",
"=",
"0x80",
">>",
"i",
"if",
"(",
"byte1",
"&",
"cur_mask",
")",
... | Return common prefix length of IPv6 addresses a and b. | [
"Return",
"common",
"prefix",
"length",
"of",
"IPv6",
"addresses",
"a",
"and",
"b",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L811-L828 | train | Return the common prefix length of IPv6 addresses a and b. | 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/utils6.py | in6_isvalid | def in6_isvalid(address):
"""Return True if 'address' is a valid IPv6 address string, False
otherwise."""
try:
socket.inet_pton(socket.AF_INET6, address)
return True
except Exception:
return False | python | def in6_isvalid(address):
"""Return True if 'address' is a valid IPv6 address string, False
otherwise."""
try:
socket.inet_pton(socket.AF_INET6, address)
return True
except Exception:
return False | [
"def",
"in6_isvalid",
"(",
"address",
")",
":",
"try",
":",
"socket",
".",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"address",
")",
"return",
"True",
"except",
"Exception",
":",
"return",
"False"
] | Return True if 'address' is a valid IPv6 address string, False
otherwise. | [
"Return",
"True",
"if",
"address",
"is",
"a",
"valid",
"IPv6",
"address",
"string",
"False",
"otherwise",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils6.py#L831-L839 | train | Return True if the given string is a valid IPv6 address string False otherwise. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/core.py | get_if_raw_addr | def get_if_raw_addr(ifname):
"""Returns the IPv4 address configured on 'ifname', packed with inet_pton.""" # noqa: E501
# Get ifconfig output
try:
fd = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
except OSError as msg:
warning("Failed to execute ifconfig: (%s)", msg)
retur... | python | def get_if_raw_addr(ifname):
"""Returns the IPv4 address configured on 'ifname', packed with inet_pton.""" # noqa: E501
# Get ifconfig output
try:
fd = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
except OSError as msg:
warning("Failed to execute ifconfig: (%s)", msg)
retur... | [
"def",
"get_if_raw_addr",
"(",
"ifname",
")",
":",
"# noqa: E501",
"# Get ifconfig output",
"try",
":",
"fd",
"=",
"os",
".",
"popen",
"(",
"\"%s %s\"",
"%",
"(",
"conf",
".",
"prog",
".",
"ifconfig",
",",
"ifname",
")",
")",
"except",
"OSError",
"as",
"... | Returns the IPv4 address configured on 'ifname', packed with inet_pton. | [
"Returns",
"the",
"IPv4",
"address",
"configured",
"on",
"ifname",
"packed",
"with",
"inet_pton",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/core.py#L36-L56 | train | Returns the IPv4 address configured on ifname packed with inet_pton. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/core.py | get_if_raw_hwaddr | def get_if_raw_hwaddr(ifname):
"""Returns the packed MAC address configured on 'ifname'."""
NULL_MAC_ADDRESS = b'\x00' * 6
# Handle the loopback interface separately
if ifname == LOOPBACK_NAME:
return (ARPHDR_LOOPBACK, NULL_MAC_ADDRESS)
# Get ifconfig output
try:
fd = os.popen... | python | def get_if_raw_hwaddr(ifname):
"""Returns the packed MAC address configured on 'ifname'."""
NULL_MAC_ADDRESS = b'\x00' * 6
# Handle the loopback interface separately
if ifname == LOOPBACK_NAME:
return (ARPHDR_LOOPBACK, NULL_MAC_ADDRESS)
# Get ifconfig output
try:
fd = os.popen... | [
"def",
"get_if_raw_hwaddr",
"(",
"ifname",
")",
":",
"NULL_MAC_ADDRESS",
"=",
"b'\\x00'",
"*",
"6",
"# Handle the loopback interface separately",
"if",
"ifname",
"==",
"LOOPBACK_NAME",
":",
"return",
"(",
"ARPHDR_LOOPBACK",
",",
"NULL_MAC_ADDRESS",
")",
"# Get ifconfig ... | Returns the packed MAC address configured on 'ifname'. | [
"Returns",
"the",
"packed",
"MAC",
"address",
"configured",
"on",
"ifname",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/core.py#L59-L84 | train | Returns the packed MAC address configured on ifname. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/core.py | get_dev_bpf | def get_dev_bpf():
"""Returns an opened BPF file object"""
# Get the first available BPF handle
for bpf in range(256):
try:
fd = os.open("/dev/bpf%i" % bpf, os.O_RDWR)
return (fd, bpf)
except OSError:
continue
raise Scapy_Exception("No /dev/bpf handl... | python | def get_dev_bpf():
"""Returns an opened BPF file object"""
# Get the first available BPF handle
for bpf in range(256):
try:
fd = os.open("/dev/bpf%i" % bpf, os.O_RDWR)
return (fd, bpf)
except OSError:
continue
raise Scapy_Exception("No /dev/bpf handl... | [
"def",
"get_dev_bpf",
"(",
")",
":",
"# Get the first available BPF handle",
"for",
"bpf",
"in",
"range",
"(",
"256",
")",
":",
"try",
":",
"fd",
"=",
"os",
".",
"open",
"(",
"\"/dev/bpf%i\"",
"%",
"bpf",
",",
"os",
".",
"O_RDWR",
")",
"return",
"(",
"... | Returns an opened BPF file object | [
"Returns",
"an",
"opened",
"BPF",
"file",
"object"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/core.py#L89-L100 | train | Returns an opened BPF file 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/arch/bpf/core.py | attach_filter | def attach_filter(fd, bpf_filter, iface):
"""Attach a BPF filter to the BPF file descriptor"""
bp = compile_filter(bpf_filter, iface)
# Assign the BPF program to the interface
ret = LIBC.ioctl(c_int(fd), BIOCSETF, cast(pointer(bp), c_char_p))
if ret < 0:
raise Scapy_Exception("Can't attach t... | python | def attach_filter(fd, bpf_filter, iface):
"""Attach a BPF filter to the BPF file descriptor"""
bp = compile_filter(bpf_filter, iface)
# Assign the BPF program to the interface
ret = LIBC.ioctl(c_int(fd), BIOCSETF, cast(pointer(bp), c_char_p))
if ret < 0:
raise Scapy_Exception("Can't attach t... | [
"def",
"attach_filter",
"(",
"fd",
",",
"bpf_filter",
",",
"iface",
")",
":",
"bp",
"=",
"compile_filter",
"(",
"bpf_filter",
",",
"iface",
")",
"# Assign the BPF program to the interface",
"ret",
"=",
"LIBC",
".",
"ioctl",
"(",
"c_int",
"(",
"fd",
")",
",",... | Attach a BPF filter to the BPF file descriptor | [
"Attach",
"a",
"BPF",
"filter",
"to",
"the",
"BPF",
"file",
"descriptor"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/core.py#L103-L109 | train | Attach a BPF filter to the BPF file descriptor | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/core.py | get_if_list | def get_if_list():
"""Returns a list containing all network interfaces."""
# Get ifconfig output
try:
fd = os.popen("%s -a" % conf.prog.ifconfig)
except OSError as msg:
raise Scapy_Exception("Failed to execute ifconfig: (%s)" % msg)
# Get interfaces
interfaces = [line[:line.fin... | python | def get_if_list():
"""Returns a list containing all network interfaces."""
# Get ifconfig output
try:
fd = os.popen("%s -a" % conf.prog.ifconfig)
except OSError as msg:
raise Scapy_Exception("Failed to execute ifconfig: (%s)" % msg)
# Get interfaces
interfaces = [line[:line.fin... | [
"def",
"get_if_list",
"(",
")",
":",
"# Get ifconfig output",
"try",
":",
"fd",
"=",
"os",
".",
"popen",
"(",
"\"%s -a\"",
"%",
"conf",
".",
"prog",
".",
"ifconfig",
")",
"except",
"OSError",
"as",
"msg",
":",
"raise",
"Scapy_Exception",
"(",
"\"Failed to ... | Returns a list containing all network interfaces. | [
"Returns",
"a",
"list",
"containing",
"all",
"network",
"interfaces",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/core.py#L114-L126 | train | Returns a list containing all network interfaces. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/bpf/core.py | get_working_ifaces | def get_working_ifaces():
"""
Returns an ordered list of interfaces that could be used with BPF.
Note: the order mimics pcap_findalldevs() behavior
"""
# Only root is allowed to perform the following ioctl() call
if os.getuid() != 0:
return []
# Test all network interfaces
inte... | python | def get_working_ifaces():
"""
Returns an ordered list of interfaces that could be used with BPF.
Note: the order mimics pcap_findalldevs() behavior
"""
# Only root is allowed to perform the following ioctl() call
if os.getuid() != 0:
return []
# Test all network interfaces
inte... | [
"def",
"get_working_ifaces",
"(",
")",
":",
"# Only root is allowed to perform the following ioctl() call",
"if",
"os",
".",
"getuid",
"(",
")",
"!=",
"0",
":",
"return",
"[",
"]",
"# Test all network interfaces",
"interfaces",
"=",
"[",
"]",
"for",
"ifname",
"in",
... | Returns an ordered list of interfaces that could be used with BPF.
Note: the order mimics pcap_findalldevs() behavior | [
"Returns",
"an",
"ordered",
"list",
"of",
"interfaces",
"that",
"could",
"be",
"used",
"with",
"BPF",
".",
"Note",
":",
"the",
"order",
"mimics",
"pcap_findalldevs",
"()",
"behavior"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/bpf/core.py#L132-L182 | train | Returns an ordered list of interfaces that could be used with BPF. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | get_temp_file | def get_temp_file(keep=False, autoext="", fd=False):
"""Creates a temporary file.
:param keep: If False, automatically delete the file when Scapy exits.
:param autoext: Suffix to add to the generated file name.
:param fd: If True, this returns a file-like object with the temporary
file o... | python | def get_temp_file(keep=False, autoext="", fd=False):
"""Creates a temporary file.
:param keep: If False, automatically delete the file when Scapy exits.
:param autoext: Suffix to add to the generated file name.
:param fd: If True, this returns a file-like object with the temporary
file o... | [
"def",
"get_temp_file",
"(",
"keep",
"=",
"False",
",",
"autoext",
"=",
"\"\"",
",",
"fd",
"=",
"False",
")",
":",
"f",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"prefix",
"=",
"\"scapy\"",
",",
"suffix",
"=",
"autoext",
",",
"delete",
"=",
"Fal... | Creates a temporary file.
:param keep: If False, automatically delete the file when Scapy exits.
:param autoext: Suffix to add to the generated file name.
:param fd: If True, this returns a file-like object with the temporary
file opened. If False (default), this returns a file path. | [
"Creates",
"a",
"temporary",
"file",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L51-L69 | train | Creates a temporary file and returns its path. | 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/utils.py | get_temp_dir | def get_temp_dir(keep=False):
"""Creates a temporary file, and returns its name.
:param keep: If False (default), the directory will be recursively
deleted when Scapy exits.
:return: A full path to a temporary directory.
"""
dname = tempfile.mkdtemp(prefix="scapy")
if not kee... | python | def get_temp_dir(keep=False):
"""Creates a temporary file, and returns its name.
:param keep: If False (default), the directory will be recursively
deleted when Scapy exits.
:return: A full path to a temporary directory.
"""
dname = tempfile.mkdtemp(prefix="scapy")
if not kee... | [
"def",
"get_temp_dir",
"(",
"keep",
"=",
"False",
")",
":",
"dname",
"=",
"tempfile",
".",
"mkdtemp",
"(",
"prefix",
"=",
"\"scapy\"",
")",
"if",
"not",
"keep",
":",
"conf",
".",
"temp_files",
".",
"append",
"(",
"dname",
")",
"return",
"dname"
] | Creates a temporary file, and returns its name.
:param keep: If False (default), the directory will be recursively
deleted when Scapy exits.
:return: A full path to a temporary directory. | [
"Creates",
"a",
"temporary",
"file",
"and",
"returns",
"its",
"name",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L72-L85 | train | Creates a temporary file and returns its 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/utils.py | restart | def restart():
"""Restarts scapy"""
if not conf.interactive or not os.path.isfile(sys.argv[0]):
raise OSError("Scapy was not started from console")
if WINDOWS:
try:
res_code = subprocess.call([sys.executable] + sys.argv)
except KeyboardInterrupt:
res_code = 1
... | python | def restart():
"""Restarts scapy"""
if not conf.interactive or not os.path.isfile(sys.argv[0]):
raise OSError("Scapy was not started from console")
if WINDOWS:
try:
res_code = subprocess.call([sys.executable] + sys.argv)
except KeyboardInterrupt:
res_code = 1
... | [
"def",
"restart",
"(",
")",
":",
"if",
"not",
"conf",
".",
"interactive",
"or",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
":",
"raise",
"OSError",
"(",
"\"Scapy was not started from console\"",
")",
"if",
"WI... | Restarts scapy | [
"Restarts",
"scapy"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L111-L122 | train | Restarts scapy | 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/utils.py | hexdump | def hexdump(x, dump=False):
"""Build a tcpdump like hexadecimal view
:param x: a Packet
:param dump: define if the result must be printed or returned in a variable
:returns: a String only when dump=True
"""
s = ""
x = bytes_encode(x)
x_len = len(x)
i = 0
while i < x_len:
... | python | def hexdump(x, dump=False):
"""Build a tcpdump like hexadecimal view
:param x: a Packet
:param dump: define if the result must be printed or returned in a variable
:returns: a String only when dump=True
"""
s = ""
x = bytes_encode(x)
x_len = len(x)
i = 0
while i < x_len:
... | [
"def",
"hexdump",
"(",
"x",
",",
"dump",
"=",
"False",
")",
":",
"s",
"=",
"\"\"",
"x",
"=",
"bytes_encode",
"(",
"x",
")",
"x_len",
"=",
"len",
"(",
"x",
")",
"i",
"=",
"0",
"while",
"i",
"<",
"x_len",
":",
"s",
"+=",
"\"%04x \"",
"%",
"i",... | Build a tcpdump like hexadecimal view
:param x: a Packet
:param dump: define if the result must be printed or returned in a variable
:returns: a String only when dump=True | [
"Build",
"a",
"tcpdump",
"like",
"hexadecimal",
"view"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L137-L162 | train | Builds a tcpdump like hexadecimal 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/utils.py | linehexdump | def linehexdump(x, onlyasc=0, onlyhex=0, dump=False):
"""Build an equivalent view of hexdump() on a single line
Note that setting both onlyasc and onlyhex to 1 results in a empty output
:param x: a Packet
:param onlyasc: 1 to display only the ascii view
:param onlyhex: 1 to display only the hexade... | python | def linehexdump(x, onlyasc=0, onlyhex=0, dump=False):
"""Build an equivalent view of hexdump() on a single line
Note that setting both onlyasc and onlyhex to 1 results in a empty output
:param x: a Packet
:param onlyasc: 1 to display only the ascii view
:param onlyhex: 1 to display only the hexade... | [
"def",
"linehexdump",
"(",
"x",
",",
"onlyasc",
"=",
"0",
",",
"onlyhex",
"=",
"0",
",",
"dump",
"=",
"False",
")",
":",
"s",
"=",
"\"\"",
"s",
"=",
"hexstr",
"(",
"x",
",",
"onlyasc",
"=",
"onlyasc",
",",
"onlyhex",
"=",
"onlyhex",
",",
"color",... | Build an equivalent view of hexdump() on a single line
Note that setting both onlyasc and onlyhex to 1 results in a empty output
:param x: a Packet
:param onlyasc: 1 to display only the ascii view
:param onlyhex: 1 to display only the hexadecimal view
:param dump: print the view if False
:retu... | [
"Build",
"an",
"equivalent",
"view",
"of",
"hexdump",
"()",
"on",
"a",
"single",
"line"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L166-L182 | train | This function is used to display a hexdump of a single line 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/utils.py | chexdump | def chexdump(x, dump=False):
"""Build a per byte hexadecimal representation
Example:
>>> chexdump(IP())
0x45, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x7c, 0xe7, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01 # noqa: E501
:param x: a Packet
:param dump: print the view if... | python | def chexdump(x, dump=False):
"""Build a per byte hexadecimal representation
Example:
>>> chexdump(IP())
0x45, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x7c, 0xe7, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01 # noqa: E501
:param x: a Packet
:param dump: print the view if... | [
"def",
"chexdump",
"(",
"x",
",",
"dump",
"=",
"False",
")",
":",
"x",
"=",
"bytes_encode",
"(",
"x",
")",
"s",
"=",
"\", \"",
".",
"join",
"(",
"\"%#04x\"",
"%",
"orb",
"(",
"x",
")",
"for",
"x",
"in",
"x",
")",
"if",
"dump",
":",
"return",
... | Build a per byte hexadecimal representation
Example:
>>> chexdump(IP())
0x45, 0x00, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x7c, 0xe7, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x01 # noqa: E501
:param x: a Packet
:param dump: print the view if False
:returns: a String only i... | [
"Build",
"a",
"per",
"byte",
"hexadecimal",
"representation"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L186-L202 | train | Builds a per byte hexadecimal representation 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/utils.py | hexstr | def hexstr(x, onlyasc=0, onlyhex=0, color=False):
"""Build a fancy tcpdump like hex from bytes."""
x = bytes_encode(x)
_sane_func = sane_color if color else sane
s = []
if not onlyasc:
s.append(" ".join("%02X" % orb(b) for b in x))
if not onlyhex:
s.append(_sane_func(x))
retu... | python | def hexstr(x, onlyasc=0, onlyhex=0, color=False):
"""Build a fancy tcpdump like hex from bytes."""
x = bytes_encode(x)
_sane_func = sane_color if color else sane
s = []
if not onlyasc:
s.append(" ".join("%02X" % orb(b) for b in x))
if not onlyhex:
s.append(_sane_func(x))
retu... | [
"def",
"hexstr",
"(",
"x",
",",
"onlyasc",
"=",
"0",
",",
"onlyhex",
"=",
"0",
",",
"color",
"=",
"False",
")",
":",
"x",
"=",
"bytes_encode",
"(",
"x",
")",
"_sane_func",
"=",
"sane_color",
"if",
"color",
"else",
"sane",
"s",
"=",
"[",
"]",
"if"... | Build a fancy tcpdump like hex from bytes. | [
"Build",
"a",
"fancy",
"tcpdump",
"like",
"hex",
"from",
"bytes",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L206-L215 | train | Build a fancy tcpdump like hex from bytes. | 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/utils.py | hexdiff | def hexdiff(x, y):
"""Show differences between 2 binary strings"""
x = bytes_encode(x)[::-1]
y = bytes_encode(y)[::-1]
SUBST = 1
INSERT = 1
d = {(-1, -1): (0, (-1, -1))}
for j in range(len(y)):
d[-1, j] = d[-1, j - 1][0] + INSERT, (-1, j - 1)
for i in range(len(x)):
d[i, ... | python | def hexdiff(x, y):
"""Show differences between 2 binary strings"""
x = bytes_encode(x)[::-1]
y = bytes_encode(y)[::-1]
SUBST = 1
INSERT = 1
d = {(-1, -1): (0, (-1, -1))}
for j in range(len(y)):
d[-1, j] = d[-1, j - 1][0] + INSERT, (-1, j - 1)
for i in range(len(x)):
d[i, ... | [
"def",
"hexdiff",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"bytes_encode",
"(",
"x",
")",
"[",
":",
":",
"-",
"1",
"]",
"y",
"=",
"bytes_encode",
"(",
"y",
")",
"[",
":",
":",
"-",
"1",
"]",
"SUBST",
"=",
"1",
"INSERT",
"=",
"1",
"d",
"=",... | Show differences between 2 binary strings | [
"Show",
"differences",
"between",
"2",
"binary",
"strings"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L224-L325 | train | Show differences between two binary strings | 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/utils.py | fletcher16_checkbytes | def fletcher16_checkbytes(binbuf, offset):
"""Calculates the Fletcher-16 checkbytes returned as 2 byte binary-string.
Including the bytes into the buffer (at the position marked by offset) the # noqa: E501
global Fletcher-16 checksum of the buffer will be 0. Thus it is easy to verify # noqa: E501
... | python | def fletcher16_checkbytes(binbuf, offset):
"""Calculates the Fletcher-16 checkbytes returned as 2 byte binary-string.
Including the bytes into the buffer (at the position marked by offset) the # noqa: E501
global Fletcher-16 checksum of the buffer will be 0. Thus it is easy to verify # noqa: E501
... | [
"def",
"fletcher16_checkbytes",
"(",
"binbuf",
",",
"offset",
")",
":",
"# This is based on the GPLed C implementation in Zebra <http://www.zebra.org/> # noqa: E501",
"if",
"len",
"(",
"binbuf",
")",
"<",
"offset",
":",
"raise",
"Exception",
"(",
"\"Packet too short for chec... | Calculates the Fletcher-16 checkbytes returned as 2 byte binary-string.
Including the bytes into the buffer (at the position marked by offset) the # noqa: E501
global Fletcher-16 checksum of the buffer will be 0. Thus it is easy to verify # noqa: E501
the integrity of the buffer on the receiver ... | [
"Calculates",
"the",
"Fletcher",
"-",
"16",
"checkbytes",
"returned",
"as",
"2",
"byte",
"binary",
"-",
"string",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L373-L399 | train | Calculates the Fletcher - 16 checkbytes returned as 2 byte binary - 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/utils.py | randstring | def randstring(l):
"""
Returns a random string of length l (l >= 0)
"""
return b"".join(struct.pack('B', random.randint(0, 255)) for _ in range(l)) | python | def randstring(l):
"""
Returns a random string of length l (l >= 0)
"""
return b"".join(struct.pack('B', random.randint(0, 255)) for _ in range(l)) | [
"def",
"randstring",
"(",
"l",
")",
":",
"return",
"b\"\"",
".",
"join",
"(",
"struct",
".",
"pack",
"(",
"'B'",
",",
"random",
".",
"randint",
"(",
"0",
",",
"255",
")",
")",
"for",
"_",
"in",
"range",
"(",
"l",
")",
")"
] | Returns a random string of length l (l >= 0) | [
"Returns",
"a",
"random",
"string",
"of",
"length",
"l",
"(",
"l",
">",
"=",
"0",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L420-L424 | train | Returns a random string of length l | 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/utils.py | strxor | def strxor(s1, s2):
"""
Returns the binary XOR of the 2 provided strings s1 and s2. s1 and s2
must be of same length.
"""
return b"".join(map(lambda x, y: chb(orb(x) ^ orb(y)), s1, s2)) | python | def strxor(s1, s2):
"""
Returns the binary XOR of the 2 provided strings s1 and s2. s1 and s2
must be of same length.
"""
return b"".join(map(lambda x, y: chb(orb(x) ^ orb(y)), s1, s2)) | [
"def",
"strxor",
"(",
"s1",
",",
"s2",
")",
":",
"return",
"b\"\"",
".",
"join",
"(",
"map",
"(",
"lambda",
"x",
",",
"y",
":",
"chb",
"(",
"orb",
"(",
"x",
")",
"^",
"orb",
"(",
"y",
")",
")",
",",
"s1",
",",
"s2",
")",
")"
] | Returns the binary XOR of the 2 provided strings s1 and s2. s1 and s2
must be of same length. | [
"Returns",
"the",
"binary",
"XOR",
"of",
"the",
"2",
"provided",
"strings",
"s1",
"and",
"s2",
".",
"s1",
"and",
"s2",
"must",
"be",
"of",
"same",
"length",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L434-L439 | train | Returns the binary XOR of the 2 provided strings s1 and s2. | 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/utils.py | do_graph | def do_graph(graph, prog=None, format=None, target=None, type=None, string=None, options=None): # noqa: E501
"""do_graph(graph, prog=conf.prog.dot, format="svg",
target="| conf.prog.display", options=None, [string=1]):
string: if not None, simply return the graph string
graph: GraphViz graph descr... | python | def do_graph(graph, prog=None, format=None, target=None, type=None, string=None, options=None): # noqa: E501
"""do_graph(graph, prog=conf.prog.dot, format="svg",
target="| conf.prog.display", options=None, [string=1]):
string: if not None, simply return the graph string
graph: GraphViz graph descr... | [
"def",
"do_graph",
"(",
"graph",
",",
"prog",
"=",
"None",
",",
"format",
"=",
"None",
",",
"target",
"=",
"None",
",",
"type",
"=",
"None",
",",
"string",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"# noqa: E501",
"if",
"format",
"is",
"N... | do_graph(graph, prog=conf.prog.dot, format="svg",
target="| conf.prog.display", options=None, [string=1]):
string: if not None, simply return the graph string
graph: GraphViz graph description
format: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
target: filename or redirec... | [
"do_graph",
"(",
"graph",
"prog",
"=",
"conf",
".",
"prog",
".",
"dot",
"format",
"=",
"svg",
"target",
"=",
"|",
"conf",
".",
"prog",
".",
"display",
"options",
"=",
"None",
"[",
"string",
"=",
"1",
"]",
")",
":",
"string",
":",
"if",
"not",
"No... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L600-L662 | train | This function will run a GraphViz program and return the graph as 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/utils.py | save_object | def save_object(fname, obj):
"""Pickle a Python object"""
fd = gzip.open(fname, "wb")
six.moves.cPickle.dump(obj, fd)
fd.close() | python | def save_object(fname, obj):
"""Pickle a Python object"""
fd = gzip.open(fname, "wb")
six.moves.cPickle.dump(obj, fd)
fd.close() | [
"def",
"save_object",
"(",
"fname",
",",
"obj",
")",
":",
"fd",
"=",
"gzip",
".",
"open",
"(",
"fname",
",",
"\"wb\"",
")",
"six",
".",
"moves",
".",
"cPickle",
".",
"dump",
"(",
"obj",
",",
"fd",
")",
"fd",
".",
"close",
"(",
")"
] | Pickle a Python object | [
"Pickle",
"a",
"Python",
"object"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L794-L799 | train | Pickle a Python object to a gzipped 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/utils.py | corrupt_bytes | def corrupt_bytes(s, p=0.01, n=None):
"""Corrupt a given percentage or number of bytes from a string"""
s = array.array("B", bytes_encode(s))
s_len = len(s)
if n is None:
n = max(1, int(s_len * p))
for i in random.sample(range(s_len), n):
s[i] = (s[i] + random.randint(1, 255)) % 256
... | python | def corrupt_bytes(s, p=0.01, n=None):
"""Corrupt a given percentage or number of bytes from a string"""
s = array.array("B", bytes_encode(s))
s_len = len(s)
if n is None:
n = max(1, int(s_len * p))
for i in random.sample(range(s_len), n):
s[i] = (s[i] + random.randint(1, 255)) % 256
... | [
"def",
"corrupt_bytes",
"(",
"s",
",",
"p",
"=",
"0.01",
",",
"n",
"=",
"None",
")",
":",
"s",
"=",
"array",
".",
"array",
"(",
"\"B\"",
",",
"bytes_encode",
"(",
"s",
")",
")",
"s_len",
"=",
"len",
"(",
"s",
")",
"if",
"n",
"is",
"None",
":"... | Corrupt a given percentage or number of bytes from a string | [
"Corrupt",
"a",
"given",
"percentage",
"or",
"number",
"of",
"bytes",
"from",
"a",
"string"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L808-L816 | train | Corrupt a given percentage or number of bytes from 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/utils.py | wrpcap | def wrpcap(filename, pkt, *args, **kargs):
"""Write a list of packets to a pcap file
filename: the name of the file to write packets to, or an open,
writable file-like object. The file descriptor will be
closed at the end of the call, so do not use an object you
do not want to close (... | python | def wrpcap(filename, pkt, *args, **kargs):
"""Write a list of packets to a pcap file
filename: the name of the file to write packets to, or an open,
writable file-like object. The file descriptor will be
closed at the end of the call, so do not use an object you
do not want to close (... | [
"def",
"wrpcap",
"(",
"filename",
",",
"pkt",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"with",
"PcapWriter",
"(",
"filename",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
"as",
"fdesc",
":",
"fdesc",
".",
"write",
"(",
"pkt",
")"
] | Write a list of packets to a pcap file
filename: the name of the file to write packets to, or an open,
writable file-like object. The file descriptor will be
closed at the end of the call, so do not use an object you
do not want to close (e.g., running wrpcap(sys.stdout, [])
in ... | [
"Write",
"a",
"list",
"of",
"packets",
"to",
"a",
"pcap",
"file"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L836-L851 | train | Write a list of packets to a pcap 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/utils.py | rdpcap | def rdpcap(filename, count=-1):
"""Read a pcap or pcapng file and return a packet list
count: read only <count> packets
"""
with PcapReader(filename) as fdesc:
return fdesc.read_all(count=count) | python | def rdpcap(filename, count=-1):
"""Read a pcap or pcapng file and return a packet list
count: read only <count> packets
"""
with PcapReader(filename) as fdesc:
return fdesc.read_all(count=count) | [
"def",
"rdpcap",
"(",
"filename",
",",
"count",
"=",
"-",
"1",
")",
":",
"with",
"PcapReader",
"(",
"filename",
")",
"as",
"fdesc",
":",
"return",
"fdesc",
".",
"read_all",
"(",
"count",
"=",
"count",
")"
] | Read a pcap or pcapng file and return a packet list
count: read only <count> packets | [
"Read",
"a",
"pcap",
"or",
"pcapng",
"file",
"and",
"return",
"a",
"packet",
"list"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L855-L862 | train | Read a pcap or pcapng file and return a list of packets | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | import_hexcap | def import_hexcap():
"""Imports a tcpdump like hexadecimal view
e.g: exported via hexdump() or tcpdump or wireshark's "export as hex"
"""
re_extract_hexcap = re.compile(r"^((0x)?[0-9a-fA-F]{2,}[ :\t]{,3}|) *(([0-9a-fA-F]{2} {,2}){,16})") # noqa: E501
p = ""
try:
while True:
... | python | def import_hexcap():
"""Imports a tcpdump like hexadecimal view
e.g: exported via hexdump() or tcpdump or wireshark's "export as hex"
"""
re_extract_hexcap = re.compile(r"^((0x)?[0-9a-fA-F]{2,}[ :\t]{,3}|) *(([0-9a-fA-F]{2} {,2}){,16})") # noqa: E501
p = ""
try:
while True:
... | [
"def",
"import_hexcap",
"(",
")",
":",
"re_extract_hexcap",
"=",
"re",
".",
"compile",
"(",
"r\"^((0x)?[0-9a-fA-F]{2,}[ :\\t]{,3}|) *(([0-9a-fA-F]{2} {,2}){,16})\"",
")",
"# noqa: E501",
"p",
"=",
"\"\"",
"try",
":",
"while",
"True",
":",
"line",
"=",
"input",
"(",
... | Imports a tcpdump like hexadecimal view
e.g: exported via hexdump() or tcpdump or wireshark's "export as hex" | [
"Imports",
"a",
"tcpdump",
"like",
"hexadecimal",
"view"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1421-L1442 | train | Imports a tcpdump like hexadecimal view of a node s network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | wireshark | def wireshark(pktlist, wait=False, **kwargs):
"""
Runs Wireshark on a list of packets.
See :func:`tcpdump` for more parameter description.
Note: this defaults to wait=False, to run Wireshark in the background.
"""
return tcpdump(pktlist, prog=conf.prog.wireshark, wait=wait, **kwargs) | python | def wireshark(pktlist, wait=False, **kwargs):
"""
Runs Wireshark on a list of packets.
See :func:`tcpdump` for more parameter description.
Note: this defaults to wait=False, to run Wireshark in the background.
"""
return tcpdump(pktlist, prog=conf.prog.wireshark, wait=wait, **kwargs) | [
"def",
"wireshark",
"(",
"pktlist",
",",
"wait",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"tcpdump",
"(",
"pktlist",
",",
"prog",
"=",
"conf",
".",
"prog",
".",
"wireshark",
",",
"wait",
"=",
"wait",
",",
"*",
"*",
"kwargs",
")"
] | Runs Wireshark on a list of packets.
See :func:`tcpdump` for more parameter description.
Note: this defaults to wait=False, to run Wireshark in the background. | [
"Runs",
"Wireshark",
"on",
"a",
"list",
"of",
"packets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1446-L1454 | train | Runs Wireshark on a list of packets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | tdecode | def tdecode(pktlist, args=None, **kwargs):
"""
Run tshark on a list of packets.
:param args: If not specified, defaults to ``tshark -V``.
See :func:`tcpdump` for more parameters.
"""
if args is None:
args = ["-V"]
return tcpdump(pktlist, prog=conf.prog.tshark, args=args, **kwargs) | python | def tdecode(pktlist, args=None, **kwargs):
"""
Run tshark on a list of packets.
:param args: If not specified, defaults to ``tshark -V``.
See :func:`tcpdump` for more parameters.
"""
if args is None:
args = ["-V"]
return tcpdump(pktlist, prog=conf.prog.tshark, args=args, **kwargs) | [
"def",
"tdecode",
"(",
"pktlist",
",",
"args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"is",
"None",
":",
"args",
"=",
"[",
"\"-V\"",
"]",
"return",
"tcpdump",
"(",
"pktlist",
",",
"prog",
"=",
"conf",
".",
"prog",
".",
"tsh... | Run tshark on a list of packets.
:param args: If not specified, defaults to ``tshark -V``.
See :func:`tcpdump` for more parameters. | [
"Run",
"tshark",
"on",
"a",
"list",
"of",
"packets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1458-L1468 | train | Run tshark on a list of packets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | tcpdump | def tcpdump(pktlist, dump=False, getfd=False, args=None,
prog=None, getproc=False, quiet=False, use_tempfile=None,
read_stdin_opts=None, linktype=None, wait=True):
"""Run tcpdump or tshark on a list of packets.
When using ``tcpdump`` on OSX (``prog == conf.prog.tcpdump``), this uses a
... | python | def tcpdump(pktlist, dump=False, getfd=False, args=None,
prog=None, getproc=False, quiet=False, use_tempfile=None,
read_stdin_opts=None, linktype=None, wait=True):
"""Run tcpdump or tshark on a list of packets.
When using ``tcpdump`` on OSX (``prog == conf.prog.tcpdump``), this uses a
... | [
"def",
"tcpdump",
"(",
"pktlist",
",",
"dump",
"=",
"False",
",",
"getfd",
"=",
"False",
",",
"args",
"=",
"None",
",",
"prog",
"=",
"None",
",",
"getproc",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"use_tempfile",
"=",
"None",
",",
"read_stdin_... | Run tcpdump or tshark on a list of packets.
When using ``tcpdump`` on OSX (``prog == conf.prog.tcpdump``), this uses a
temporary file to store the packets. This works around a bug in Apple's
version of ``tcpdump``: http://apple.stackexchange.com/questions/152682/
Otherwise, the packets are passed in s... | [
"Run",
"tcpdump",
"or",
"tshark",
"on",
"a",
"list",
"of",
"packets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1472-L1644 | train | Run tcpdump or tshark on a list of packets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | hexedit | def hexedit(pktlist):
"""Run hexedit on a list of packets, then return the edited packets."""
f = get_temp_file()
wrpcap(f, pktlist)
with ContextManagerSubprocess("hexedit()", conf.prog.hexedit):
subprocess.call([conf.prog.hexedit, f])
pktlist = rdpcap(f)
os.unlink(f)
return pktlist | python | def hexedit(pktlist):
"""Run hexedit on a list of packets, then return the edited packets."""
f = get_temp_file()
wrpcap(f, pktlist)
with ContextManagerSubprocess("hexedit()", conf.prog.hexedit):
subprocess.call([conf.prog.hexedit, f])
pktlist = rdpcap(f)
os.unlink(f)
return pktlist | [
"def",
"hexedit",
"(",
"pktlist",
")",
":",
"f",
"=",
"get_temp_file",
"(",
")",
"wrpcap",
"(",
"f",
",",
"pktlist",
")",
"with",
"ContextManagerSubprocess",
"(",
"\"hexedit()\"",
",",
"conf",
".",
"prog",
".",
"hexedit",
")",
":",
"subprocess",
".",
"ca... | Run hexedit on a list of packets, then return the edited packets. | [
"Run",
"hexedit",
"on",
"a",
"list",
"of",
"packets",
"then",
"return",
"the",
"edited",
"packets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1648-L1656 | train | Run hexedit on a list of packets then return the edited 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/utils.py | get_terminal_width | def get_terminal_width():
"""Get terminal width (number of characters) if in a window.
Notice: this will try several methods in order to
support as many terminals and OS as possible.
"""
# Let's first try using the official API
# (Python 3.3+)
if not six.PY2:
import shutil
s... | python | def get_terminal_width():
"""Get terminal width (number of characters) if in a window.
Notice: this will try several methods in order to
support as many terminals and OS as possible.
"""
# Let's first try using the official API
# (Python 3.3+)
if not six.PY2:
import shutil
s... | [
"def",
"get_terminal_width",
"(",
")",
":",
"# Let's first try using the official API",
"# (Python 3.3+)",
"if",
"not",
"six",
".",
"PY2",
":",
"import",
"shutil",
"sizex",
"=",
"shutil",
".",
"get_terminal_size",
"(",
"fallback",
"=",
"(",
"0",
",",
"0",
")",
... | Get terminal width (number of characters) if in a window.
Notice: this will try several methods in order to
support as many terminals and OS as possible. | [
"Get",
"terminal",
"width",
"(",
"number",
"of",
"characters",
")",
"if",
"in",
"a",
"window",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1659-L1705 | train | Get the terminal width of a node. | 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/utils.py | pretty_list | def pretty_list(rtlst, header, sortBy=0, borders=False):
"""Pretty list to fit the terminal, and add header"""
if borders:
_space = "|"
else:
_space = " "
# Windows has a fat terminal border
_spacelen = len(_space) * (len(header) - 1) + (10 if WINDOWS else 0)
_croped = False
... | python | def pretty_list(rtlst, header, sortBy=0, borders=False):
"""Pretty list to fit the terminal, and add header"""
if borders:
_space = "|"
else:
_space = " "
# Windows has a fat terminal border
_spacelen = len(_space) * (len(header) - 1) + (10 if WINDOWS else 0)
_croped = False
... | [
"def",
"pretty_list",
"(",
"rtlst",
",",
"header",
",",
"sortBy",
"=",
"0",
",",
"borders",
"=",
"False",
")",
":",
"if",
"borders",
":",
"_space",
"=",
"\"|\"",
"else",
":",
"_space",
"=",
"\" \"",
"# Windows has a fat terminal border",
"_spacelen",
"=",
... | Pretty list to fit the terminal, and add header | [
"Pretty",
"list",
"to",
"fit",
"the",
"terminal",
"and",
"add",
"header"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1708-L1752 | train | Pretty list to fit the terminal and add header | 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/utils.py | __make_table | def __make_table(yfmtfunc, fmtfunc, endline, data, fxyz, sortx=None, sorty=None, seplinefunc=None): # noqa: E501
"""Core function of the make_table suite, which generates the table"""
vx = {}
vy = {}
vz = {}
vxf = {}
# Python 2 backward compatibility
fxyz = lambda_tuple_converter(fxyz)
... | python | def __make_table(yfmtfunc, fmtfunc, endline, data, fxyz, sortx=None, sorty=None, seplinefunc=None): # noqa: E501
"""Core function of the make_table suite, which generates the table"""
vx = {}
vy = {}
vz = {}
vxf = {}
# Python 2 backward compatibility
fxyz = lambda_tuple_converter(fxyz)
... | [
"def",
"__make_table",
"(",
"yfmtfunc",
",",
"fmtfunc",
",",
"endline",
",",
"data",
",",
"fxyz",
",",
"sortx",
"=",
"None",
",",
"sorty",
"=",
"None",
",",
"seplinefunc",
"=",
"None",
")",
":",
"# noqa: E501",
"vx",
"=",
"{",
"}",
"vy",
"=",
"{",
... | Core function of the make_table suite, which generates the table | [
"Core",
"function",
"of",
"the",
"make_table",
"suite",
"which",
"generates",
"the",
"table"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1755-L1814 | train | This function generates the table of the n - grams in the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/utils.py | whois | def whois(ip_address):
"""Whois client for Python"""
whois_ip = str(ip_address)
try:
query = socket.gethostbyname(whois_ip)
except Exception:
query = whois_ip
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("whois.ripe.net", 43))
s.send(query.encode("utf8") +... | python | def whois(ip_address):
"""Whois client for Python"""
whois_ip = str(ip_address)
try:
query = socket.gethostbyname(whois_ip)
except Exception:
query = whois_ip
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("whois.ripe.net", 43))
s.send(query.encode("utf8") +... | [
"def",
"whois",
"(",
"ip_address",
")",
":",
"whois_ip",
"=",
"str",
"(",
"ip_address",
")",
"try",
":",
"query",
"=",
"socket",
".",
"gethostbyname",
"(",
"whois_ip",
")",
"except",
"Exception",
":",
"query",
"=",
"whois_ip",
"s",
"=",
"socket",
".",
... | Whois client for Python | [
"Whois",
"client",
"for",
"Python"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1835-L1861 | train | Whois client for Python | 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/utils.py | PcapReader_metaclass.open | def open(filename):
"""Open (if necessary) filename, and read the magic."""
if isinstance(filename, six.string_types):
try:
fdesc = gzip.open(filename, "rb")
magic = fdesc.read(4)
except IOError:
fdesc = open(filename, "rb")
... | python | def open(filename):
"""Open (if necessary) filename, and read the magic."""
if isinstance(filename, six.string_types):
try:
fdesc = gzip.open(filename, "rb")
magic = fdesc.read(4)
except IOError:
fdesc = open(filename, "rb")
... | [
"def",
"open",
"(",
"filename",
")",
":",
"if",
"isinstance",
"(",
"filename",
",",
"six",
".",
"string_types",
")",
":",
"try",
":",
"fdesc",
"=",
"gzip",
".",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"magic",
"=",
"fdesc",
".",
"read",
"(",
"... | Open (if necessary) filename, and read the magic. | [
"Open",
"(",
"if",
"necessary",
")",
"filename",
"and",
"read",
"the",
"magic",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L904-L917 | train | Open ( if necessary ) filename and read the magic. | 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/utils.py | RawPcapReader.read_all | def read_all(self, count=-1):
"""return a list of all packets in the pcap file
"""
res = []
while count != 0:
count -= 1
p = self.read_packet()
if p is None:
break
res.append(p)
return res | python | def read_all(self, count=-1):
"""return a list of all packets in the pcap file
"""
res = []
while count != 0:
count -= 1
p = self.read_packet()
if p is None:
break
res.append(p)
return res | [
"def",
"read_all",
"(",
"self",
",",
"count",
"=",
"-",
"1",
")",
":",
"res",
"=",
"[",
"]",
"while",
"count",
"!=",
"0",
":",
"count",
"-=",
"1",
"p",
"=",
"self",
".",
"read_packet",
"(",
")",
"if",
"p",
"is",
"None",
":",
"break",
"res",
"... | return a list of all packets in the pcap file | [
"return",
"a",
"list",
"of",
"all",
"packets",
"in",
"the",
"pcap",
"file"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L988-L998 | train | return a list of all packets in the pcap 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/utils.py | RawPcapNgReader.read_packet | def read_packet(self, size=MTU):
"""Read blocks until it reaches either EOF or a packet, and
returns None or (packet, (linktype, sec, usec, wirelen)),
where packet is a string.
"""
while True:
try:
blocktype, blocklen = struct.unpack(self.endian + "2I... | python | def read_packet(self, size=MTU):
"""Read blocks until it reaches either EOF or a packet, and
returns None or (packet, (linktype, sec, usec, wirelen)),
where packet is a string.
"""
while True:
try:
blocktype, blocklen = struct.unpack(self.endian + "2I... | [
"def",
"read_packet",
"(",
"self",
",",
"size",
"=",
"MTU",
")",
":",
"while",
"True",
":",
"try",
":",
"blocktype",
",",
"blocklen",
"=",
"struct",
".",
"unpack",
"(",
"self",
".",
"endian",
"+",
"\"2I\"",
",",
"self",
".",
"f",
".",
"read",
"(",
... | Read blocks until it reaches either EOF or a packet, and
returns None or (packet, (linktype, sec, usec, wirelen)),
where packet is a string. | [
"Read",
"blocks",
"until",
"it",
"reaches",
"either",
"EOF",
"or",
"a",
"packet",
"and",
"returns",
"None",
"or",
"(",
"packet",
"(",
"linktype",
"sec",
"usec",
"wirelen",
"))",
"where",
"packet",
"is",
"a",
"string",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1101-L1127 | train | Read a packet from the file and return the corresponding 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/utils.py | RawPcapNgReader.read_block_idb | def read_block_idb(self, block, _):
"""Interface Description Block"""
options = block[16:]
tsresol = 1000000
while len(options) >= 4:
code, length = struct.unpack(self.endian + "HH", options[:4])
# PCAP Next Generation (pcapng) Capture File Format
# 4.... | python | def read_block_idb(self, block, _):
"""Interface Description Block"""
options = block[16:]
tsresol = 1000000
while len(options) >= 4:
code, length = struct.unpack(self.endian + "HH", options[:4])
# PCAP Next Generation (pcapng) Capture File Format
# 4.... | [
"def",
"read_block_idb",
"(",
"self",
",",
"block",
",",
"_",
")",
":",
"options",
"=",
"block",
"[",
"16",
":",
"]",
"tsresol",
"=",
"1000000",
"while",
"len",
"(",
"options",
")",
">=",
"4",
":",
"code",
",",
"length",
"=",
"struct",
".",
"unpack... | Interface Description Block | [
"Interface",
"Description",
"Block"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1129-L1149 | train | Read the IDB block and store it in the internal 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/utils.py | RawPcapNgReader.read_block_epb | def read_block_epb(self, block, size):
"""Enhanced Packet Block"""
intid, tshigh, tslow, caplen, wirelen = struct.unpack(
self.endian + "5I",
block[:20],
)
return (block[20:20 + caplen][:size],
RawPcapNgReader.PacketMetadata(linktype=self.interface... | python | def read_block_epb(self, block, size):
"""Enhanced Packet Block"""
intid, tshigh, tslow, caplen, wirelen = struct.unpack(
self.endian + "5I",
block[:20],
)
return (block[20:20 + caplen][:size],
RawPcapNgReader.PacketMetadata(linktype=self.interface... | [
"def",
"read_block_epb",
"(",
"self",
",",
"block",
",",
"size",
")",
":",
"intid",
",",
"tshigh",
",",
"tslow",
",",
"caplen",
",",
"wirelen",
"=",
"struct",
".",
"unpack",
"(",
"self",
".",
"endian",
"+",
"\"5I\"",
",",
"block",
"[",
":",
"20",
"... | Enhanced Packet Block | [
"Enhanced",
"Packet",
"Block"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1151-L1162 | train | Read an enhanced packet block. | 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/utils.py | RawPcapWriter.write | def write(self, pkt):
"""
Writes a Packet or bytes to a pcap file.
:param pkt: Packet(s) to write (one record for each Packet), or raw
bytes to write (as one record).
:type pkt: iterable[Packet], Packet or bytes
"""
if isinstance(pkt, bytes):
... | python | def write(self, pkt):
"""
Writes a Packet or bytes to a pcap file.
:param pkt: Packet(s) to write (one record for each Packet), or raw
bytes to write (as one record).
:type pkt: iterable[Packet], Packet or bytes
"""
if isinstance(pkt, bytes):
... | [
"def",
"write",
"(",
"self",
",",
"pkt",
")",
":",
"if",
"isinstance",
"(",
"pkt",
",",
"bytes",
")",
":",
"if",
"not",
"self",
".",
"header_present",
":",
"self",
".",
"_write_header",
"(",
"pkt",
")",
"self",
".",
"_write_packet",
"(",
"pkt",
")",
... | Writes a Packet or bytes to a pcap file.
:param pkt: Packet(s) to write (one record for each Packet), or raw
bytes to write (as one record).
:type pkt: iterable[Packet], Packet or bytes | [
"Writes",
"a",
"Packet",
"or",
"bytes",
"to",
"a",
"pcap",
"file",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1282-L1299 | train | Writes a Packet or bytes to a pcap 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/utils.py | PcapWriter._write_packet | def _write_packet(self, packet, sec=None, usec=None, caplen=None,
wirelen=None):
"""
Writes a single packet to the pcap file.
:param packet: Packet, or bytes for a single packet
:type packet: Packet or bytes
:param sec: time the packet was captured, in seco... | python | def _write_packet(self, packet, sec=None, usec=None, caplen=None,
wirelen=None):
"""
Writes a single packet to the pcap file.
:param packet: Packet, or bytes for a single packet
:type packet: Packet or bytes
:param sec: time the packet was captured, in seco... | [
"def",
"_write_packet",
"(",
"self",
",",
"packet",
",",
"sec",
"=",
"None",
",",
"usec",
"=",
"None",
",",
"caplen",
"=",
"None",
",",
"wirelen",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"packet",
",",
"\"time\"",
")",
":",
"if",
"sec",
"is",
... | Writes a single packet to the pcap file.
:param packet: Packet, or bytes for a single packet
:type packet: Packet or bytes
:param sec: time the packet was captured, in seconds since epoch. If
not supplied, defaults to now.
:type sec: int or long
:param usec: ... | [
"Writes",
"a",
"single",
"packet",
"to",
"the",
"pcap",
"file",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L1373-L1417 | train | Writes a single packet to the pcap 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/modules/voip.py | voip_play | def voip_play(s1, lst=None, **kargs):
"""Play VoIP packets with RAW data that
are either sniffed either from an IP, or
specified as a list.
It will play only the incoming packets !
:param s1: The IP of the src of all VoIP packets.
:param lst: (optional) A list of packets to load
:type s1: ... | python | def voip_play(s1, lst=None, **kargs):
"""Play VoIP packets with RAW data that
are either sniffed either from an IP, or
specified as a list.
It will play only the incoming packets !
:param s1: The IP of the src of all VoIP packets.
:param lst: (optional) A list of packets to load
:type s1: ... | [
"def",
"voip_play",
"(",
"s1",
",",
"lst",
"=",
"None",
",",
"*",
"*",
"kargs",
")",
":",
"dsp",
",",
"rd",
"=",
"os",
".",
"popen2",
"(",
"sox_base",
"%",
"\"\"",
")",
"def",
"play",
"(",
"pkt",
")",
":",
"if",
"not",
"pkt",
":",
"return",
"... | Play VoIP packets with RAW data that
are either sniffed either from an IP, or
specified as a list.
It will play only the incoming packets !
:param s1: The IP of the src of all VoIP packets.
:param lst: (optional) A list of packets to load
:type s1: string
:type lst: list
:Example:
... | [
"Play",
"VoIP",
"packets",
"with",
"RAW",
"data",
"that",
"are",
"either",
"sniffed",
"either",
"from",
"an",
"IP",
"or",
"specified",
"as",
"a",
"list",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/voip.py#L49-L96 | train | Play VoIP packets with RAW data that are either sniffed from an IP or from a list of packets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/modules/voip.py | voip_play2 | def voip_play2(s1, **kargs):
"""
Same than voip_play, but will play
both incoming and outcoming packets.
The sound will surely suffer distortion.
Only supports sniffing.
.. seealso:: voip_play
to play only incoming packets.
"""
dsp, rd = os.popen2(sox_base % "-c 2")
global x1, ... | python | def voip_play2(s1, **kargs):
"""
Same than voip_play, but will play
both incoming and outcoming packets.
The sound will surely suffer distortion.
Only supports sniffing.
.. seealso:: voip_play
to play only incoming packets.
"""
dsp, rd = os.popen2(sox_base % "-c 2")
global x1, ... | [
"def",
"voip_play2",
"(",
"s1",
",",
"*",
"*",
"kargs",
")",
":",
"dsp",
",",
"rd",
"=",
"os",
".",
"popen2",
"(",
"sox_base",
"%",
"\"-c 2\"",
")",
"global",
"x1",
",",
"x2",
"x1",
"=",
"\"\"",
"x2",
"=",
"\"\"",
"def",
"play",
"(",
"pkt",
")"... | Same than voip_play, but will play
both incoming and outcoming packets.
The sound will surely suffer distortion.
Only supports sniffing.
.. seealso:: voip_play
to play only incoming packets. | [
"Same",
"than",
"voip_play",
"but",
"will",
"play",
"both",
"incoming",
"and",
"outcoming",
"packets",
".",
"The",
"sound",
"will",
"surely",
"suffer",
"distortion",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/modules/voip.py#L105-L136 | train | Same than voip_play but will play only incoming packets and outcoming 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/tls/keyexchange.py | phantom_mode | def phantom_mode(pkt):
"""
We expect this. If tls_version is not set, this means we did not process
any complete ClientHello, so we're most probably reading/building a
signature_algorithms extension, hence we cannot be in phantom_mode.
However, if the tls_version has been set, we test for TLS 1.2.
... | python | def phantom_mode(pkt):
"""
We expect this. If tls_version is not set, this means we did not process
any complete ClientHello, so we're most probably reading/building a
signature_algorithms extension, hence we cannot be in phantom_mode.
However, if the tls_version has been set, we test for TLS 1.2.
... | [
"def",
"phantom_mode",
"(",
"pkt",
")",
":",
"if",
"not",
"pkt",
".",
"tls_session",
":",
"return",
"False",
"if",
"not",
"pkt",
".",
"tls_session",
".",
"tls_version",
":",
"return",
"False",
"return",
"pkt",
".",
"tls_session",
".",
"tls_version",
"<",
... | We expect this. If tls_version is not set, this means we did not process
any complete ClientHello, so we're most probably reading/building a
signature_algorithms extension, hence we cannot be in phantom_mode.
However, if the tls_version has been set, we test for TLS 1.2. | [
"We",
"expect",
"this",
".",
"If",
"tls_version",
"is",
"not",
"set",
"this",
"means",
"we",
"did",
"not",
"process",
"any",
"complete",
"ClientHello",
"so",
"we",
"re",
"most",
"probably",
"reading",
"/",
"building",
"a",
"signature_algorithms",
"extension",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L59-L70 | train | Return True if we are in phantom mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | phantom_decorate | def phantom_decorate(f, get_or_add):
"""
Decorator for version-dependent fields.
If get_or_add is True (means get), we return s, self.phantom_value.
If it is False (means add), we return s.
"""
def wrapper(*args):
self, pkt, s = args[:3]
if phantom_mode(pkt):
if get_o... | python | def phantom_decorate(f, get_or_add):
"""
Decorator for version-dependent fields.
If get_or_add is True (means get), we return s, self.phantom_value.
If it is False (means add), we return s.
"""
def wrapper(*args):
self, pkt, s = args[:3]
if phantom_mode(pkt):
if get_o... | [
"def",
"phantom_decorate",
"(",
"f",
",",
"get_or_add",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"self",
",",
"pkt",
",",
"s",
"=",
"args",
"[",
":",
"3",
"]",
"if",
"phantom_mode",
"(",
"pkt",
")",
":",
"if",
"get_or_add",
":",
"r... | Decorator for version-dependent fields.
If get_or_add is True (means get), we return s, self.phantom_value.
If it is False (means add), we return s. | [
"Decorator",
"for",
"version",
"-",
"dependent",
"fields",
".",
"If",
"get_or_add",
"is",
"True",
"(",
"means",
"get",
")",
"we",
"return",
"s",
"self",
".",
"phantom_value",
".",
"If",
"it",
"is",
"False",
"(",
"means",
"add",
")",
"we",
"return",
"s"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L73-L86 | train | Decorator for phantom mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/keyexchange.py | SigLenField.addfield | def addfield(self, pkt, s, val):
"""With SSLv2 you will never be able to add a sig_len."""
v = pkt.tls_session.tls_version
if v and v < 0x0300:
return s
return super(SigLenField, self).addfield(pkt, s, val) | python | def addfield(self, pkt, s, val):
"""With SSLv2 you will never be able to add a sig_len."""
v = pkt.tls_session.tls_version
if v and v < 0x0300:
return s
return super(SigLenField, self).addfield(pkt, s, val) | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"val",
")",
":",
"v",
"=",
"pkt",
".",
"tls_session",
".",
"tls_version",
"if",
"v",
"and",
"v",
"<",
"0x0300",
":",
"return",
"s",
"return",
"super",
"(",
"SigLenField",
",",
"self",
")",
... | With SSLv2 you will never be able to add a sig_len. | [
"With",
"SSLv2",
"you",
"will",
"never",
"be",
"able",
"to",
"add",
"a",
"sig_len",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L119-L124 | train | Add a sig_len 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/keyexchange.py | _TLSSignature._update_sig | def _update_sig(self, m, key):
"""
Sign 'm' with the PrivKey 'key' and update our own 'sig_val'.
Note that, even when 'sig_alg' is not None, we use the signature scheme
of the PrivKey (neither do we care to compare the both of them).
"""
if self.sig_alg is None:
... | python | def _update_sig(self, m, key):
"""
Sign 'm' with the PrivKey 'key' and update our own 'sig_val'.
Note that, even when 'sig_alg' is not None, we use the signature scheme
of the PrivKey (neither do we care to compare the both of them).
"""
if self.sig_alg is None:
... | [
"def",
"_update_sig",
"(",
"self",
",",
"m",
",",
"key",
")",
":",
"if",
"self",
".",
"sig_alg",
"is",
"None",
":",
"if",
"self",
".",
"tls_session",
".",
"tls_version",
">=",
"0x0300",
":",
"self",
".",
"sig_val",
"=",
"key",
".",
"sign",
"(",
"m"... | Sign 'm' with the PrivKey 'key' and update our own 'sig_val'.
Note that, even when 'sig_alg' is not None, we use the signature scheme
of the PrivKey (neither do we care to compare the both of them). | [
"Sign",
"m",
"with",
"the",
"PrivKey",
"key",
"and",
"update",
"our",
"own",
"sig_val",
".",
"Note",
"that",
"even",
"when",
"sig_alg",
"is",
"not",
"None",
"we",
"use",
"the",
"signature",
"scheme",
"of",
"the",
"PrivKey",
"(",
"neither",
"do",
"we",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange.py#L171-L188 | train | Update our own sig_val. | 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.