text
stringlengths
81
112k
x.graph(ASres=conf.AS_resolver, other args): ASres=None : no AS resolver => no clustering ASres=AS_resolver() : default whois AS resolver (riswhois.ripe.net) ASres=AS_resolver_cymru(): use whois.cymru.com whois database ASres=AS_resolver(server="whois.ra.net") type: outp...
The good thing about safedec is that it may still decode ASN1 even if there is a mismatch between the expected tag (self.ASN1_tag) and the actual tag; the decoded ASN1 object will simply be put into an ASN1_BADTAG object. However, safedec prevents the raising of exceptions needed for ASN...
ASN1F_SEQUENCE behaves transparently, with nested ASN1_objects being dissected one by one. Because we use obj.dissect (see loop below) instead of obj.m2i (as we trust dissect to do the appropriate set_vals) we do not directly retrieve the list of nested objects. Thus m2i returns an empty...
First we have to retrieve the appropriate choice. Then we extract the field/packet, according to this choice. def m2i(self, pkt, s): """ First we have to retrieve the appropriate choice. Then we extract the field/packet, according to this choice. """ if len(s) == 0: ...
Called to explicitly fixup the packet according to the IGMP RFC The rules are: General: 1. the Max Response time is meaningful only in Membership Queries and should be zero IP: 1. Send General Group Query to 224.0.0.1 (all systems) 2. Send Leave Group to 224...
Returns the right class for a given BGP message. def _bgp_dispatcher(payload): """ Returns the right class for a given BGP message. """ cls = conf.raw_layer # By default, calling BGP() will build a BGPHeader. if payload is None: cls = _get_cls("BGPHeader", conf.raw_layer) else: ...
Returns the right class for a given BGP capability. def _bgp_capability_dispatcher(payload): """ Returns the right class for a given BGP capability. """ cls = _capabilities_registry["BGPCapGeneric"] # By default, calling BGPCapability() will build a "generic" capability. if payload is None: ...
Internal" (IP as bytes, mask as int) to "machine" representation. def i2m(self, pkt, i): """"Internal" (IP as bytes, mask as int) to "machine" representation.""" mask, ip = i ip = socket.inet_aton(ip) return struct.pack(">B", mask) + ip[:self.mask2iplen(mask)]
Internal" (IP as bytes, mask as int) to "machine" representation. def i2m(self, pkt, i): """"Internal" (IP as bytes, mask as int) to "machine" representation.""" # noqa: E501 mask, ip = i ip = pton_ntop.inet_pton(socket.AF_INET6, ip) return struct.pack(">B", mask) + ip[:self.mask2iplen...
Check that the payload is long enough (at least 2 bytes). def pre_dissect(self, s): """ Check that the payload is long enough (at least 2 bytes). """ length = len(s) if length < _BGP_CAPABILITY_MIN_SIZE: err = " ({}".format(length) + " is < _BGP_CAPABILITY_MIN_SIZE "...
This will set the ByteField 'length' to the correct value. def post_build(self, pkt, pay): """ This will set the ByteField 'length' to the correct value. """ if self.length is None: pkt = pkt[:4] + chb(len(pay)) + pkt[5:] return pkt + pay
ISOTP encodes the frame type in the first nibble of a frame. def guess_payload_class(self, payload): """ ISOTP encodes the frame type in the first nibble of a frame. """ t = (orb(payload[0]) & 0xf0) >> 4 if t == 0: return ISOTP_SF elif t == 1: ret...
Attempt to feed an incoming CAN frame into the state machine def feed(self, can): """Attempt to feed an incoming CAN frame into the state machine""" if not isinstance(can, CAN): raise Scapy_Exception("argument is not a CAN frame") identifier = can.identifier data = bytes(can...
Returns a built ISOTP message :param identifier: if not None, only return isotp messages with this destination :param ext_addr: if identifier is not None, only return isotp messages with this extended address for destination :param basecls: the...
Begin the transmission of message p. This method returns after sending the first frame. If multiple frames are necessary to send the message, this socket will unable to send other messages until either the transmission of this frame succeeds or it fails. def begin_send(self, p): """Begi...
Receive a complete ISOTP message, blocking until a message is received or the specified timeout is reached. If timeout is 0, then this function doesn't block and returns the first frame in the receive buffer or None if there isn't any. def recv_with_timeout(self, timeout=1): """Receive ...
Receive a complete ISOTP message, blocking until a message is received or the specified timeout is reached. If self.timeout is 0, then this function doesn't block and returns the first frame in the receive buffer or None if there isn't any. def recv_raw(self, x=0xffff): """Receive a com...
This function is called during sendrecv() routine to wait for sockets to be ready to receive def select(sockets, remain=None): """This function is called during sendrecv() routine to wait for sockets to be ready to receive """ blocking = remain is None or remain > 0 def...
Call 'callback' in 'timeout' seconds, unless cancelled. def set_timeout(self, timeout, callback): """Call 'callback' in 'timeout' seconds, unless cancelled.""" if not self._ready_sem.acquire(False): raise Scapy_Exception("Timer was already started") self._callback = callback ...
Stop the timer without executing the callback. def cancel(self): """Stop the timer without executing the callback.""" self._cancelled.set() if not self._dead: self._ready_sem.acquire() self._ready_sem.release()
Stop the thread, making this object unusable. def stop(self): """Stop the thread, making this object unusable.""" if not self._dead: self._killed = True self._cancelled.set() self._busy_sem.release() self.join() if not self._ready_sem.acquire(...
Method called every time the rx_timer times out, due to the peer not sending a consecutive frame within the expected time window def _rx_timer_handler(self): """Method called every time the rx_timer times out, due to the peer not sending a consecutive frame within the expected time window""" ...
Method called every time the tx_timer times out, which can happen in two situations: either a Flow Control frame was not received in time, or the Separation Time Min is expired and a new frame must be sent. def _tx_timer_handler(self): """Method called every time the tx_timer times out, which c...
Function that must be called every time a CAN frame is received, to advance the state machine. def on_recv(self, cf): """Function that must be called every time a CAN frame is received, to advance the state machine.""" data = bytes(cf.data) if len(data) < 2: return...
Process a received 'Flow Control' frame def _recv_fc(self, data): """Process a received 'Flow Control' frame""" if (self.tx_state != ISOTP_WAIT_FC and self.tx_state != ISOTP_WAIT_FIRST_FC): return 0 self.tx_timer.cancel() if len(data) < 3: self....
Process a received 'Single Frame' frame def _recv_sf(self, data): """Process a received 'Single Frame' frame""" self.rx_timer.cancel() if self.rx_state != ISOTP_IDLE: warning("RX state was reset because single frame was received") self.rx_state = ISOTP_IDLE leng...
Process a received 'First Frame' frame def _recv_ff(self, data): """Process a received 'First Frame' frame""" self.rx_timer.cancel() if self.rx_state != ISOTP_IDLE: warning("RX state was reset because first frame was received") self.rx_state = ISOTP_IDLE if len(...
Process a received 'Consecutive Frame' frame def _recv_cf(self, data): """Process a received 'Consecutive Frame' frame""" if self.rx_state != ISOTP_WAIT_DATA: return 0 self.rx_timer.cancel() # CFs are never longer than the FF if len(data) > self.rx_ll_dl: ...
Begins sending an ISOTP message. This method does not block. def begin_send(self, x): """Begins sending an ISOTP message. This method does not block.""" with self.tx_mutex: if self.tx_state != ISOTP_IDLE: raise Scapy_Exception("Socket is already sending, retry later") ...
Send an ISOTP frame and block until the message is sent or an error happens. def send(self, p): """Send an ISOTP frame and block until the message is sent or an error happens.""" with self.send_mutex: self.begin_send(p) # Wait until the tx callback is called ...
Receive an ISOTP frame, blocking if none is available in the buffer for at most 'timeout' seconds. def recv(self, timeout=None): """Receive an ISOTP frame, blocking if none is available in the buffer for at most 'timeout' seconds.""" try: return self.rx_queue.get(timeout is...
If the server sent a CertificateRequest, we send a Certificate message. If no certificate is available, an empty Certificate message is sent: - this is a SHOULD in RFC 4346 (Section 7.4.6) - this is a MUST in RFC 5246 (Section 7.4.6) XXX We may want to add a complete chain. def should_...
XXX Section 7.4.7.1 of RFC 5246 states that the CertificateVerify message is only sent following a client certificate that has signing capability (i.e. not those containing fixed DH params). We should verify that before adding the message. We should also handle the case when the Certific...
The user may type in: GET / HTTP/1.1\r\nHost: testserver.com\r\n\r\n Special characters are handled so that it becomes a valid HTTP request. def add_ClientData(self): """ The user may type in: GET / HTTP/1.1\r\nHost: testserver.com\r\n\r\n Special characters are handled ...
Returns the right parameter set class. def dispatch_hook(cls, _pkt=None, *args, **kargs): """ Returns the right parameter set class. """ cls = conf.raw_layer if _pkt is not None: ptype = orb(_pkt[0]) return globals().get(_param_set_cls.get(ptype), conf.r...
source_addr_mode This function depending on the arguments returns the amount of bits to be used by the source address. Keyword arguments: pkt -- packet object instance def source_addr_mode2(pkt): """source_addr_mode This function depending on the arguments returns the amount of bits to be ...
destiny_addr_mode This function depending on the arguments returns the amount of bits to be used by the destiny address. Keyword arguments: pkt -- packet object instance def destiny_addr_mode(pkt): """destiny_addr_mode This function depending on the arguments returns the amount of bits to be...
This function extracts the source/destination address of a 6LoWPAN from its upper Dot15d4Data (802.15.4 data) layer. params: - source: if True, the address is the source one. Otherwise, it is the destination. returns: the packed & processed address def _extract_dot15d4address(pkt, sour...
Split a packet into different links to transmit as 6lowpan packets. Usage example: >>> ipv6 = ..... (very big packet) >>> pkts = sixlowpan_fragment(ipv6, datagram_tag=0x17) >>> send = [Dot15d4()/Dot15d4Data()/x for x in pkts] >>> wireshark(send) def sixlowpan_fragment(pa...
Add an internal value to a string def addfield(self, pkt, s, val): """Add an internal value to a string""" tmp_len = self.length_of(pkt) if tmp_len == 0: return s internal = self.i2m(pkt, val)[-tmp_len:] return s + struct.pack("!%ds" % tmp_len, internal)
Add an internal value to a string def addfield(self, pkt, s, val): """Add an internal value to a string""" if self.length_of(pkt) == 8: return s + struct.pack(self.fmt[0] + "B", val) if self.length_of(pkt) == 16: return s + struct.pack(self.fmt[0] + "H", val) if ...
dissect the IPv6 package compressed into this IPHC packet. The packet payload needs to be decompressed and depending on the arguments, several conversions should be done. def post_dissect(self, data): """dissect the IPv6 package compressed into this IPHC packet. The packet payload nee...
Page 6, draft feb 2011 def _getTrafficClassAndFlowLabel(self): """Page 6, draft feb 2011 """ if self.tf == 0x0: return (self.tc_ecn << 6) + self.tc_dscp, self.flowlabel elif self.tf == 0x1: return (self.tc_ecn << 6), self.flowlabel elif self.tf == 0x2: ...
Depending on the payload content, the frame type we should interpretate def dispatch_hook(cls, _pkt=b"", *args, **kargs): """Depending on the payload content, the frame type we should interpretate""" # noqa: E501 if _pkt and len(_pkt) >= 1: if orb(_pkt[0]) == 0x41: return L...
Returns a one-line string containing every type/value in a rather specific order. sorted() built-in ensures unicity. def get_issuer_str(self): """ Returns a one-line string containing every type/value in a rather specific order. sorted() built-in ensures unicity. """ nam...
DEV: entry point. Will be called by sniff() for each received packet (that passes the filters). def on_packet_received(self, pkt): """DEV: entry point. Will be called by sniff() for each received packet (that passes the filters). """ if not pkt: return if sel...
Bind 2 layers for dissection. The upper layer will be chosen for dissection on top of the lower layer, if ALL the passed arguments are validated. If multiple calls are made with the same # noqa: E501 layers, the last one will be used as default. ex: >>> bind_bottom_up(Ether, SNAP, type=0x1234)...
Bind 2 layers for building. When the upper layer is added as a payload of the lower layer, all the arguments # noqa: E501 will be applied to them. ex: >>> bind_top_down(Ether, SNAP, type=0x1234) >>> Ether()/SNAP() <Ether type=0x1234 |<SNAP |>> def bind_top_down(lower, upper, __f...
Bind 2 layers on some specific fields' values. It makes the packet being built # noqa: E501 and dissected when the arguments are present. This functions calls both bind_bottom_up and bind_top_down, with all passed arguments. # noqa: E501 Please have a look at their docs: - help(bind_bottom_up) ...
This call un-links an association that was made using bind_bottom_up. Have a look at help(bind_bottom_up) def split_bottom_up(lower, upper, __fval=None, **fval): """This call un-links an association that was made using bind_bottom_up. Have a look at help(bind_bottom_up) """ if __fval is not None: ...
This call un-links an association that was made using bind_top_down. Have a look at help(bind_top_down) def split_top_down(lower, upper, __fval=None, **fval): """This call un-links an association that was made using bind_top_down. Have a look at help(bind_top_down) """ if __fval is not None: ...
Split 2 layers previously bound. This call un-links calls bind_top_down and bind_bottom_up. It is the opposite of # noqa: E501 bind_layers. Please have a look at their docs: - help(split_bottom_up) - help(split_top_down) def split_layers(lower, upper, __fval=None, **fval): """Split 2 layers...
Function used to discover the Scapy layers and protocols. It helps to see which packets exists in contrib or layer files. params: - layer: If specified, the function will explore the layer. If not, the GUI mode will be activated, to browse the available layers examples: >>> explor...
List available layers, or infos on a given layer class or name. params: - obj: Packet / packet name to use - case_sensitive: if obj is a string, is it case sensitive? - verbose def ls(obj=None, case_sensitive=False, verbose=False): """List available layers, or infos on a given layer class or n...
Transform a layer into a fuzzy layer by replacing some default values by random objects def fuzz(p, _inplace=0): """Transform a layer into a fuzzy layer by replacing some default values by random objects""" # noqa: E501 if not _inplace: p = p.copy() q = p while not isinstance(q, NoPayload): ...
Initialize each fields of the fields_desc dict def init_fields(self): """ Initialize each fields of the fields_desc dict """ if self.class_dont_cache.get(self.__class__, False): self.do_init_fields(self.fields_desc) else: self.do_init_cached_fields()
Initialize each fields of the fields_desc dict def do_init_fields(self, flist): """ Initialize each fields of the fields_desc dict """ for f in flist: self.default_fields[f.name] = copy.deepcopy(f.default) self.fieldtype[f.name] = f if f.holds_packets...
Initialize each fields of the fields_desc dict, or use the cached fields information def do_init_cached_fields(self): """ Initialize each fields of the fields_desc dict, or use the cached fields information """ cls_name = self.__class__ # Build the fields infor...
Prepare the cached fields of the fields_desc dict def prepare_cached_fields(self, flist): """ Prepare the cached fields of the fields_desc dict """ cls_name = self.__class__ # Fields cache initialization if flist: Packet.class_default_fields[cls_name] = dic...
DEV: will be called after a dissection is completed def dissection_done(self, pkt): """DEV: will be called after a dissection is completed""" self.post_dissection(pkt) self.payload.dissection_done(pkt)
Returns a deep copy of the instance. def copy(self): """Returns a deep copy of the instance.""" clone = self.__class__() clone.fields = self.copy_fields_dict(self.fields) clone.default_fields = self.copy_fields_dict(self.default_fields) clone.overloaded_fields = self.overloaded_...
Return a list of slots and methods, including those from subclasses. def _superdir(self): """ Return a list of slots and methods, including those from subclasses. """ attrs = set() cls = self.__class__ if hasattr(cls, '__all_slots__'): attrs.update(cls.__all_...
Clear the raw packet cache for the field and all its subfields def clear_cache(self): """Clear the raw packet cache for the field and all its subfields""" self.raw_packet_cache = None for _, fval in six.iteritems(self.fields): if isinstance(fval, Packet): fval.clear_...
Create the default layer regarding fields_desc dict :param field_pos_list: def self_build(self, field_pos_list=None): """ Create the default layer regarding fields_desc dict :param field_pos_list: """ if self.raw_packet_cache is not None: for fname, fval in...
Create the default version of the layer :return: a string of the packet with the payload def do_build(self): """ Create the default version of the layer :return: a string of the packet with the payload """ if not self.explicit: self = next(iter(self)) ...
Create the current layer :return: string of the packet with the payload def build(self): """ Create the current layer :return: string of the packet with the payload """ p = self.do_build() p += self.build_padding() p = self.build_done(p) return ...
Perform the dissection of the layer's payload :param str s: the raw layer def do_dissect_payload(self, s): """ Perform the dissection of the layer's payload :param str s: the raw layer """ if s: cls = self.guess_payload_class(s) try: ...
DEV: Guesses the next payload class from layer bonds. Can be overloaded to use a different mechanism. :param str payload: the layer's payload :return: the payload class def guess_payload_class(self, payload): """ DEV: Guesses the next payload class from layer bonds. Can...
Removes fields' values that are the same as default values. def hide_defaults(self): """Removes fields' values that are the same as default values.""" # use list(): self.fields is modified in the loop for k, v in list(six.iteritems(self.fields)): v = self.fields[k] if k ...
returns a list of layer classes (including subclasses) in this packet def layers(self): """returns a list of layer classes (including subclasses) in this packet""" # noqa: E501 layers = [] lyr = self while lyr: layers.append(lyr.__class__) lyr = lyr.payload.getl...
Return the nb^th layer that is an instance of cls, matching flt values. def getlayer(self, cls, nb=1, _track=None, _subclass=None, **flt): """Return the nb^th layer that is an instance of cls, matching flt values. """ if _subclass is None: _subclass = self.match_subclass or None ...
Internal method that shows or dumps a hierarchical view of a packet. Called by show. :param dump: determine if it prints or returns the string value :param int indent: the size of indentation for each layer :param str lvl: additional information about the layer lvl :param str la...
Prints or returns (when "dump" is true) a hierarchical view of the packet. :param dump: determine if it prints or returns the string value :param int indent: the size of indentation for each layer :param str lvl: additional information about the layer lvl :param str label_lvl: a...
Prints or returns (when "dump" is true) a hierarchical view of an assembled version of the packet, so that automatic fields are calculated (checksums, etc.) :param dump: determine if it prints or returns the string value :param int indent: the size of indentation for each layer ...
sprintf(format, [relax=1]) -> str where format is a string that can include directives. A directive begins and ends by % and has the following format %[fmt[r],][cls[:nb].]field%. fmt is a classic printf directive, "r" can be appended for raw substitution (ex: IP.flags=0x18 instead of SA), nb is the number of the layer...
Returns a string representing the command you have to type to obtain the same packet def command(self): """ Returns a string representing the command you have to type to obtain the same packet """ f = [] for fn, fv in six.iteritems(self.fields): fld =...
XXX We should offer the right key according to the client's suites. For now server_rsa_key is only used for RSAkx, but we should try to replace every server_key with both server_rsa_key and server_ecdsa_key. def INIT_TLS_SESSION(self): """ XXX We should offer the right key according to ...
We extract cipher suites candidates from the client's proposition. def should_check_ciphersuites(self): """ We extract cipher suites candidates from the client's proposition. """ if isinstance(self.mykey, PrivKeyRSA): kx = "RSA" elif isinstance(self.mykey, PrivKeyECD...
Selecting a cipher suite should be no trouble as we already caught the None case previously. Also, we do not manage extensions at all. def should_add_ServerHello(self): """ Selecting a cipher suite should be no trouble as we already caught the None case previously. Als...
Mandatory arguments: @iface: interface to use (must be in monitor mode) @ap_mac: AP's MAC @ssid: AP's SSID @passphrase: AP's Passphrase (min 8 char.) Optional arguments: @channel: used by the interface. Default 6, autodetected on windows Krack attacks options: ...
Compute and install the PMK def install_PMK(self): """Compute and install the PMK""" self.pmk = PBKDF2HMAC( algorithm=hashes.SHA1(), length=32, salt=self.ssid.encode(), iterations=4096, backend=default_backend(), ).derive(self.passphra...
Use the client nonce @client_nonce to compute and install PTK, KCK, KEK, TK, MIC (AP -> STA), MIC (STA -> AP) def install_unicast_keys(self, client_nonce): """Use the client nonce @client_nonce to compute and install PTK, KCK, KEK, TK, MIC (AP -> STA), MIC (STA -> AP) """ pmk = ...
Compute a new GTK and install it alongs MIC (AP -> Group = broadcast + multicast) def install_GTK(self): """Compute a new GTK and install it alongs MIC (AP -> Group = broadcast + multicast) """ # Compute GTK self.gtk_full = self.gen_nonce(32) self.gtk = self.gtk...
Build a packet with info describing the current AP For beacon / proberesp use def build_ap_info_pkt(self, layer_cls, dest): """Build a packet with info describing the current AP For beacon / proberesp use """ return RadioTap() \ / Dot11(addr1=dest, addr2=self.mac, ad...
Build the Key Data Encapsulation for GTK KeyID: 0 Ref: 802.11i p81 def build_GTK_KDE(self): """Build the Key Data Encapsulation for GTK KeyID: 0 Ref: 802.11i p81 """ return b''.join([ b'\xdd', # Type KDE chb(len(self.gtk_full) + 6), ...
Send an encrypted packet with content @data, using IV @iv, sequence number @seqnum, MIC key @mic_key def send_wpa_enc(self, data, iv, seqnum, dest, mic_key, key_idx=0, additionnal_flag=["from-DS"], encrypt_key=None): """Send an encrypted packet with content @da...
Send an Ethernet packet using the WPA channel Extra arguments will be ignored, and are just left for compatibility def send_ether_over_wpa(self, pkt, **kwargs): """Send an Ethernet packet using the WPA channel Extra arguments will be ignored, and are just left for compatibility """ ...
The purpose of the function is to make next message(s) available in self.buffer_in. If the list is not empty, nothing is done. If not, in order to fill it, the function uses the data already available in self.remain_in from a previous call and waits till there are enough to dissect a TLS...
If the next message to be processed has type 'pkt_cls', raise 'state'. If there is no message waiting to be processed, we try to get one with the default 'get_next_msg' parameters. def raise_on_packet(self, pkt_cls, state, get_next_msg=True): """ If the next message to be processed has ...
Add a new TLS or SSLv2 or TLS 1.3 record to the packets buffered out. def add_record(self, is_sslv2=None, is_tls13=None): """ Add a new TLS or SSLv2 or TLS 1.3 record to the packets buffered out. """ if is_sslv2 is None and is_tls13 is None: v = (self.cur_session.tls_version...
Add a TLS message (e.g. TLSClientHello or TLSApplicationData) inside the latest record to be sent through the socket. We believe a good automaton should not use the first test. def add_msg(self, pkt): """ Add a TLS message (e.g. TLSClientHello or TLSApplicationData) inside the l...
Send all buffered records and update the session accordingly. def flush_records(self): """ Send all buffered records and update the session accordingly. """ s = b"".join(p.raw_stateful() for p in self.buffer_out) self.socket.send(s) self.buffer_out = []
A source PAN ID is included if and only if both src addr mode != 0 and PAN ID Compression in FCF == 0 def util_srcpanid_present(pkt): '''A source PAN ID is included if and only if both src addr mode != 0 and PAN ID Compression in FCF == 0''' # noqa: E501 if (pkt.underlayer.getfieldval("fcf_srcaddrmode") != 0)...
Convert internal value to a nice representation def i2repr(self, pkt, x): """Convert internal value to a nice representation""" if len(hex(self.i2m(pkt, x))) < 7: # short address return hex(self.i2m(pkt, x)) else: # long address x = "%016x" % self.i2m(pkt, x) ...
Add an internal value to a string def addfield(self, pkt, s, val): """Add an internal value to a string""" if self.adjust(pkt, self.length_of) == 2: return s + struct.pack(self.fmt[0] + "H", val) elif self.adjust(pkt, self.length_of) == 8: return s + struct.pack(self.fmt...
Provides the implementation of P_hash function defined in section 5 of RFC 4346 (and section 5 of RFC 5246). Two parameters have been added (hm and req_len): - secret : the key to be used. If RFC 4868 is to be believed, the length must match hm.key_len. Actually, python hmac t...
Provides the implementation of SSLv3 PRF function: SSLv3-PRF(secret, seed) = MD5(secret || SHA-1("A" || secret || seed)) || MD5(secret || SHA-1("BB" || secret || seed)) || MD5(secret || SHA-1("CCC" || secret || seed)) || ... req_len should not be more than 26 x 16 = 416. def _ssl_PR...
Provides the implementation of TLS PRF function as defined in section 5 of RFC 4346: PRF(secret, label, seed) = P_MD5(S1, label + seed) XOR P_SHA-1(S2, label + seed) Parameters are: - secret: the secret used by the HMAC in the 2 expansion functions (S1 and...
Provides the implementation of TLS 1.2 PRF function as defined in section 5 of RFC 5246: PRF(secret, label, seed) = P_SHA256(secret, label + seed) Parameters are: - secret: the secret used by the HMAC in the 2 expansion functions (S1 and S2 are the halves of this secret). - label: s...
Return the 48-byte master_secret, computed from pre_master_secret, client_random and server_random. See RFC 5246, section 6.3. def compute_master_secret(self, pre_master_secret, client_random, server_random): """ Return the 48-byte master_secret, computed from pre_...