
    h	                     z   d Z ddlmZmZmZmZmZmZ ddlm	Z	 ddl
mZmZ  G d de          Z G d de          Z G d	 d
e          Z G d de          Z G d de          Z eeed            eeed            eeed            eeed            ee	ed            ee	ed           dS )zWireGuard Module
Implements the WireGuard network tunnel protocol.
Based on the whitepaper: https://www.wireguard.com/papers/wireguard.pdf
    )ByteEnumFieldThreeBytesFieldXLEIntFieldXStrFixedLenFieldXLELongField	XStrField)UDP)Packetbind_layersc            	       R    e Zd ZdZd Z eddddddd           ed	d
          gZdS )	Wireguardz6
    Wrapper that only contains the message type.
    message_type   initiaterespondzcookie reply	transport)r            reserved_zeror   N)__name__
__module____qualname____doc__namer   r   fields_desc     [/mounts/lovelace/software/anaconda3/lib/python3.11/site-packages/scapy/contrib/wireguard.pyr   r      sc          D 	A!	 	
 	
 	++KKKr   r   c            
           e Zd ZdZ edd           eddd           eddd           eddd	           ed
dd           eddd          gZdS )WireguardInitiationzWireguard Initiationsender_indexr   unencrypted_ephemeral    encrypted_static0   encrypted_timestamp   mac1   mac2Nr   r   r   r   r   r   r   r   r   r   r!   r!   '   s        !D 	NA&&11b99,a44/B77&!R((&!R((KKKr   r!   c            
           e Zd ZdZ edd           edd           eddd           eddd           ed	dd           ed
dd          gZdS )WireguardResponsezWireguard Responser"   r   receiver_indexr#   r$   encrypted_nothingr*   r)   r+   Nr,   r   r   r   r.   r.   4   s        D 	NA&&$a((11b99-q"55&!R((&!R((KKKr   r.   c                   X    e Zd ZdZ edd           edd           edd          gZdS )WireguardTransportzWireguard Transportr/   r   counterencrypted_encapsulated_packetN)r   r   r   r   r   r   r   r   r   r   r   r2   r2   A   sK         D 	$a((Y""	1488KKKr   r2   c                   \    e Zd ZdZ edd           eddd           eddd          gZdS )	WireguardCookieReplyzWireguard Cookie Replyr/   r   nonce   encrypted_cookier$   Nr,   r   r   r   r6   r6   K   sQ        #D 	$a(('1b)),a44KKKr   r6   r   )r   r   r   r   il  )dport)sportN)r   scapy.fieldsr   r   r   r   r   r   scapy.layers.inetr	   scapy.packetr
   r   r   r!   r.   r2   r6   r   r   r   <module>r?      s   
/ / / / / / / / / / / / / / / / ! ! ! ! ! ! , , , , , , , ,       (
 
 
 
 
& 
 
 

 
 
 
 
 
 
 
           6    I* ; ; ; ; I(q 9 9 9 9 I+! < < < < I) : : : : C% ( ( ( ( C% ( ( ( ( ( (r   