text stringlengths 81 112k |
|---|
DBInstance Iops validation rules.
def validate_iops(iops):
"""DBInstance Iops validation rules."""
iops = integer(iops)
if int(iops) == 0:
return iops
if int(iops) < 1000:
raise ValueError("DBInstance Iops, if set, must be greater than 1000.")
return iops |
Validate PreferredBackupWindow for DBInstance
def validate_backup_window(window):
"""Validate PreferredBackupWindow for DBInstance"""
hour = r'[01]?[0-9]|2[0-3]'
minute = r'[0-5][0-9]'
r = ("(?P<start_hour>%s):(?P<start_minute>%s)-"
"(?P<end_hour>%s):(?P<end_minute>%s)") % (hour, minute, hour... |
Validate PreferredMaintenanceWindow for DBInstance
def validate_maintenance_window(window):
"""Validate PreferredMaintenanceWindow for DBInstance"""
days = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
day_re = r'[A-Z]{1}[a-z]{2}'
hour = r'[01]?[0-9]|2[0-3]'
minute = r'[0-5][0-9]'
r = ("(?... |
Validate ScalingConfiguration capacity for serverless DBCluster
def validate_capacity(capacity):
"""Validate ScalingConfiguration capacity for serverless DBCluster"""
if capacity not in VALID_SCALING_CONFIGURATION_CAPACITIES:
raise ValueError(
"ScalingConfiguration capacity must be one of:... |
Given a file name to a valid file returns the file object.
def file_contents(file_name):
"""Given a file name to a valid file returns the file object."""
curr_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(curr_dir, file_name)) as the_file:
contents = the_file.read()
re... |
Handles using .title if the given object is a troposphere resource.
If the given object is a troposphere resource, use the `.title` attribute
of that resource. If it's a string, just use the string. This should allow
more pythonic use of DependsOn.
def depends_on_helper(obj):
""" Handles using .title ... |
Sets the Label used in the User Interface for the given parameter.
:type parameter: str or Parameter
:type label: str
def set_parameter_label(self, parameter, label):
"""
Sets the Label used in the User Interface for the given parameter.
:type parameter: str or Parameter
... |
Add a parameter under a group (created if needed).
:type parameter: str or Parameter
:type group_name: str
def add_parameter_to_group(self, parameter, group_name):
"""
Add a parameter under a group (created if needed).
:type parameter: str or Parameter
:type group_name: ... |
Imports userdata from a file.
:type filepath: string
:param filepath The absolute path to the file.
:type delimiter: string
:param: delimiter Delimiter to use with the troposphere.Join().
:type blanklines: boolean
:param blanklines If blank lines shoud be ignored
rtype: troposphere... |
Get the events in batches and return in chronological order
def get_events(conn, stackname):
"""Get the events in batches and return in chronological order"""
next = None
event_list = []
while 1:
events = conn.describe_stack_events(stackname, next)
event_list.append(events)
if e... |
Show and then tail the event log
def tail(conn, stack_name, log_func=_tail_print, sleep_time=5,
include_initial=True):
"""Show and then tail the event log"""
# First dump the full list of events in chronological order and keep
# track of the events we've seen already
seen = set()
initial_e... |
Validate memory size for Lambda Function
:param memory_value: The memory size specified in the Function
:return: The provided memory size if it is valid
def validate_memory_size(memory_value):
""" Validate memory size for Lambda Function
:param memory_value: The memory size specified in the Function
... |
Return a list of validators specified in the override file
def get_validator_list(self):
"""Return a list of validators specified in the override file"""
ignore = [
'dict',
]
vlist = []
if not self.override:
return vlist
for k, v in list(self.ove... |
Look for a Tags object to output a Tags import
def _output_tags(self):
"""Look for a Tags object to output a Tags import"""
for class_name, properties in sorted(self.resources.items()):
for key, value in sorted(properties.items()):
validator = self.override.get_validator(cla... |
Decode a properties type looking for a specific type.
def _check_type(self, check_type, properties):
"""Decode a properties type looking for a specific type."""
if 'PrimitiveType' in properties:
return properties['PrimitiveType'] == check_type
if properties['Type'] == 'List':
... |
Walk the resources/properties looking for a specific type.
def _walk_for_type(self, check_type):
"""Walk the resources/properties looking for a specific type."""
for class_name, properties in sorted(self.resources.items()):
for key, value in sorted(properties.items()):
if se... |
Return a list of non-primitive types used by this object.
def _get_type_list(self, props):
"""Return a list of non-primitive types used by this object."""
type_list = []
for k, v in list(props.items()):
t = self._get_property_type(v)
if t is not None:
typ... |
Output common validator types based on usage.
def _output_validators(self):
"""Output common validator types based on usage."""
if self._walk_for_type('Boolean'):
print("from .validators import boolean")
if self._walk_for_type('Integer'):
print("from .validators import i... |
Build a tree of non-primitive typed dependency order.
def build_tree(self, name, props, resource_name=None):
"""Build a tree of non-primitive typed dependency order."""
n = Node(name, props, resource_name)
prop_type_list = self._get_type_list(props)
if not prop_type_list:
re... |
Given a dependency tree of objects, output it in DFS order.
def output_tree(self, t, seen):
"""Given a dependency tree of objects, output it in DFS order."""
if not t:
return
for c in t.children:
self.output_tree(c, seen)
if t.name in seen:
return
... |
Output the generated source file.
def output(self):
"""Output the generated source file."""
print(copyright_header % spec_version)
self._output_imports()
self._output_tags()
self._output_validators()
header = self.override.get_header()
if header:
prin... |
Returns the list of all troposphere members we are able to
construct
def inspect_members(self):
"""
Returns the list of all troposphere members we are able to
construct
"""
if not self._inspect_members:
TemplateGenerator._inspect_members = \
s... |
Returns a map of `ResourceType: ResourceClass`
def inspect_resources(self):
""" Returns a map of `ResourceType: ResourceClass` """
if not self._inspect_resources:
d = {}
for m in self.inspect_members:
if issubclass(m, (AWSObject, cloudformation.AWSCustomObject)) ... |
Returns a map of `FunctionName: FunctionClass`
def inspect_functions(self):
""" Returns a map of `FunctionName: FunctionClass` """
if not self._inspect_functions:
d = {}
for m in self.inspect_members:
if issubclass(m, AWSHelperFn):
d[m.__name_... |
Attempts to return troposphere class that represents Type of
provided resource. Attempts to find the troposphere class who's
`resource_type` field is the same as the provided resources `Type`
field.
:param resource: Resource to find troposphere class for
:return: None: If no cla... |
Converts any object to its troposphere equivalent, if applicable.
This function will recurse into lists and mappings to create
additional objects as necessary.
:param {*} definition: Object to convert
:param str ref: Name of key in parent dict that the provided definition
... |
Returns an instance of `cls` with `args` passed as arguments.
Recursively inspects `args` to create nested objects and functions as
necessary.
`cls` will only be considered only if it's an object we track
(i.e.: troposphere objects).
If `cls` has a `props` attribute, nested p... |
Inspects the definition and returns a copy of it that is updated
with any special property such as Condition, UpdatePolicy and the
like.
def _normalize_properties(self, definition):
"""
Inspects the definition and returns a copy of it that is updated
with any special property su... |
Dynamically allocates a new CustomResource class definition using the
specified Custom::SomeCustomName resource type. This special resource
type is equivalent to the AWS::CloudFormation::CustomResource.
def _generate_custom_type(self, resource_type):
"""
Dynamically allocates a new Cust... |
Provides special handling for the autoscaling.Metadata object
def _generate_autoscaling_metadata(self, cls, args):
""" Provides special handling for the autoscaling.Metadata object """
assert isinstance(args, Mapping)
init_config = self._create_instance(
cloudformation.InitConfig,
... |
Returns the function object that matches the provided name.
Only Fn:: and Ref functions are supported here so that other
functions specific to troposphere are skipped.
def _get_function_type(self, function_name):
"""
Returns the function object that matches the provided name.
On... |
Imports all troposphere modules and returns them
def _import_all_troposphere_modules(self):
""" Imports all troposphere modules and returns them """
dirname = os.path.join(os.path.dirname(__file__))
module_names = [
pkg_name
for importer, pkg_name, is_pkg in
... |
Choose the correct PCO element.
def PCO_option_dispatcher(s):
"""Choose the correct PCO element."""
option = orb(s[0])
cls = PCO_OPTION_CLASSES.get(option, Raw)
return cls(s) |
Choose the correct PCO element.
def PCO_protocol_dispatcher(s):
"""Choose the correct PCO element."""
proto_num = orb(s[0]) * 256 + orb(s[1])
cls = PCO_PROTOCOL_CLASSES.get(proto_num, Raw)
return cls(s) |
Get a Npcap parameter matching key in the registry.
List:
AdminOnly, DefaultFilterSettings, DltNull, Dot11Adapters, Dot11Support
LoopbackAdapter, LoopbackSupport, NdisImPlatformBindingOptions, VlanSupport
WinPcapCompatible
def _get_npcap_config(param_key):
"""
Get a Npcap parameter matching ke... |
Call a CMD command and return the output and returncode
def _exec_cmd(command):
"""Call a CMD command and return the output and returncode"""
proc = sp.Popen(command,
stdout=sp.PIPE,
shell=True)
if six.PY2:
res = proc.communicate()[0]
else:
res = ... |
Returns windows interfaces through GetAdaptersAddresses.
params:
- extended: include anycast and multicast IPv6 (default False)
def get_windows_if_list(extended=False):
"""Returns windows interfaces through GetAdaptersAddresses.
params:
- extended: include anycast and multicast IPv6 (default Fa... |
Returns all available IPs matching to interfaces, using the windows system.
Should only be used as a WinPcapy fallback.
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.iter... |
Backward compatibility: indirectly calls get_ips
Deprecated.
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] |
Internal util to run pcap control command
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("... |
Get the device pcap name by device name or Scapy NetworkInterface
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 IFAC... |
open_pcap: Windows routine for creating a pcap from an interface.
This function is also responsible for detecting monitor mode.
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.
"""
... |
Retrieve Windows routes through a GetIpForwardTable call.
This is compatible with XP but won't get IPv6 routes.
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... |
Retrieve Windows routes through a GetIpForwardTable2 call.
This is not available on Windows XP !
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 =... |
Returns all IPv6 addresses found on the computer
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... |
Return an interface that works
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 ... |
Add a route to 127.0.0.1 and ::1 to simplify unit tests on Windows
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... |
Update info about a network interface according
to a given dictionary. Such data is provided by get_windows_if_list
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... |
Internal function. Set a [key] parameter to [value]
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 th... |
Returns True if the interface is in monitor mode.
Only available with Npcap.
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.mo... |
Alias for setmode('monitor') or setmode('managed')
Only available with Npcap
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... |
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 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
... |
Performs checks/restart pcap adapter
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 the first pcap device name for a given Windows
device 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... |
Return Windows device name for given pcap device name.
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 (StopI... |
Return interface name from interface 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 ... |
Reload interface list
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()
... |
Print list of available network interfaces in human readable form
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 = ... |
This function is called during sendrecv() routine to select
the available sockets.
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)
... |
Returns the right class for a given NTP packet.
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 ... |
Check that the payload is long enough to build a NTP packet.
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 "
... |
Specific: NTPHeader().haslayer(NTP) should return True.
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):
... |
Handles NTPv4 extensions and MAC part (when authentication is used.)
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
... |
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.
def sslv2_derive_keys(self, key_material):
"""
There is actually only one key, the CLIENT-READ-KEY o... |
This is used mostly as a way to keep the cipher state and the seq_num.
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,
... |
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... |
Ciphers key and IV are updated accordingly for 0-RTT data.
self.handshake_messages should be ClientHello only.
def compute_tls13_early_secrets(self):
"""
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 Handshake data.
self.handshake_messages should be ClientHello...ServerHello.
def compute_tls13_handshake_secrets(self):
"""
Ciphers key and IV are updated accordingly for Handshake data.
self.handshake_messages should be ClientHello...Serve... |
Ciphers key and IV are updated accordingly for Application data.
self.handshake_messages should be ClientHello...ServerFinished.
def compute_tls13_traffic_secrets(self):
"""
Ciphers key and IV are updated accordingly for Application data.
self.handshake_messages should be ClientHello...... |
self.handshake_messages should be ClientHello...ClientFinished.
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 == "c... |
Ciphers key and IV are updated accordingly.
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[-... |
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... |
Guess the correct LLS class for a given payload
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 = glob... |
Guess the correct OSPFv3 LSA class for a given payload
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")
... |
Return MAC address corresponding to a given IP address
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) ... |
Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None
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 =... |
Try to guess if target is in Promisc mode. The target is provided by its ip.
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=E... |
Send ARP who-has requests to determine which hosts are in promiscuous mode
promiscping(net, iface=conf.iface)
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... |
Exploit Etherleak flaw
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) |
Exploit ARP leak flaws, like NetBSD-SA2017-002.
https://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2017-002.txt.asc
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
... |
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)
def dns_get_str(s, poin... |
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
def dns_encode(x, check_built=False):
"""Encodes a bytes string into the DNS format
:param x: the string
:param check_built: dete... |
This function compresses a DNS packet according to compression rules.
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)
... |
Encode a list of integers representing Resource Records to a bitmap field
used in the NSEC Resource Record.
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
... |
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
def dyndns_add(nameserver, name, rdata, type="A", ttl=10):
"""Send a DNS add message to a nam... |
Unpack the internal representation.
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 |
Convert the number of seconds since 1-Jan-70 UTC to the packed
representation.
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) & 0xFF... |
Convert the internal representation to a nice one using the RFC
format.
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.strftim... |
DEV: true if self is an answer from other
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.requestServiceI... |
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... |
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)
def get... |
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... |
Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters.
def defragment6(packets):
"""
Performs defragmentation of a list of IPv6 packets. Packets are reordered.
Crap is dropped. What lacks is completed by 'X' characters.
... |
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... |
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 !!!
def names2dnsrepr(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.
def dnsrepr2names(x):
"""
Take as input a DNS encod... |
Internal generic helper accepting a specific callback as first argument,
for NS or NA reply. See the two specific functions below.
def _NDP_Attack_DAD_DoS(reply_callback, iface=None, mac_src_filter=None,
tgt_filter=None, reply_mac=None):
"""
Internal generic helper accepting a speci... |
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 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.