
    	h                        S SK r S SKrS SKr " S S\5      rSS jrS rSrS r\	S	:X  ax  S SK
r
 \
R                  " \ R                  S
S S5      u  rrSr\" \5      S :w  a  \" S5        \ H3  u  rr\S:X  a	  \" \\5        \S:X  a  \" \5        \S:X  d  M+  \" \5      rM5     gg! \
R                   a  r\" \5         SrCNnSrCff = f)    Nc                       \ rS rSrSrg)ConnectionError	    N)__name__
__module____qualname____firstlineno____static_attributes__r       hC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\win32/scripts/rasutil.pyr   r   	   s    r   r      c                    US:  d   e[         R                  " 5        H=  nUS   R                  5       U R                  5       :X  d  M*  [        SU 5        SUS   4s  $    [         R                  " SU 5      u  p4U(       d,  [        S5        [        S5        [
        R                  " S5        [        SU S5        UnUS:  ag  [         R                  " SSUS5      u  pg[         R                  " U5      (       a  SnO.[        S	5        [        R                  " S
5        US-  nUS:  a  Mg  W(       a   [        U[         R                  " U5      5      eSW4$ )aM  Make a connection to the specified RAS entry.

Returns a tuple of (bool, handle) on success.
- bool is 1 if a new connection was established, or 0 is a connection already existed.
- handle is a RAS HANDLE that can be passed to Disconnect() to end the connection.

Raises a ConnectionError if the connection could not be established.
r      zAlready connected toNz4Error: The password is not saved for this connectionzJPlease connect manually selecting the 'save password' option and try againzConnecting toz...zRetrying...i  )win32rasEnumConnectionslowerprintGetEntryDialParamssysexitDialIsHandleValidwin32apiSleepr   GetErrorString)	rasEntryName
numRetriesinfodial_paramshave_pw
retryCount	rasHandleerrCodebValids	            r   Connectr&      s'    >>((*7==?l0022(,7d1g: +
 $66t\JKDEX	
 		/</J
q.%]]4{DI	!!),,Fmta
 q. gx'>'>w'GHHi<r   c                    [        U [        5      (       aW  [        R                  " 5        H/  nUS   R	                  5       U R	                  5       :X  d  M*  US   n   O   [        SSU -  5      e[        R                  " U 5        g )Nr   r   zNot connected to entry '%s')
isinstancestrr   r   r   r   HangUp)handler   s     r   
Disconnectr,   4   sg    &#,,.DAw}}&,,.0a /
 "!%BV%KLLOOFr   a+  rasutil.py - Utilities for using RAS

Usage:
  rasutil [-r retryCount] [-c rasname] [-d rasname]

  -r retryCount - Number of times to retry the RAS connection
  -c rasname - Connect to the phonebook entry specified by rasname
  -d rasname - Disconnect from the phonebook entry specified by rasname
c                 d    [        U 5        [        [        5        [        R                  " S5        g )Nr   )r   usager   r   )whys    r   Usager0   K   s    	#J	%LHHQKr   __main__r   zr:c:d:zInvalid argumentz-cz-dz-r)r   )r   r   r   	Exceptionr   r&   r,   r.   r0   r   getoptargvoptsargserrorr/   retrieslenoptvalintr   r   r   <module>r=      s    
  	i 	$N		 z]]388AB<:
d G
4yA~ !S$;C!$;sO$;#hG  
 << c

s   #B$ $C4CC