
    %
i                        d dl Z d dlZd dlZ G d de          ZddZd ZdZd Ze	d	k    rd dl
Z
	  e
j
        e j        d
d         d          \  ZZn"# e
j        $ rZ ee           Y dZ[ndZ[ww xY wdZ ee          d k    r ed           eD ];\  ZZedk    r eee           edk    r ee           edk    r ee          Z:dS dS )    Nc                       e Zd ZdS )ConnectionErrorN)__name__
__module____qualname__     C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32/scripts/rasutil.pyr   r   	   s        Dr	   r      c                    |dk    sJ t          j                    D ]N}|d                                         |                                 k    rt          d|            d|d         fc S Ot          j        d|           \  }}|s2t          d           t          d           t          j        d           t          d| d           |}|dk    r_t          j        dd|d          \  }}t          j        |          rd}n.t          d	           t          j
        d
           |dz  }|dk    _|r"t          |t          j        |                    d|fS )aa  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22(,777d1g: 3 $6t\JJK DEEEX	
 	
 	
 		/<///J
q..%]4{DII	7!),, 	Fmta
 q..  Igx'>w'G'GHHHi<r	   c                    t          | t                    rct          j                    D ]<}|d                                         |                                 k    r
|d         }  n=t          dd| z            t          j        |            d S )Nr   r   zNot connected to entry '%s')
isinstancestrr   r   r   r   HangUp)handler   s     r
   
Disconnectr)   4   s    &# M,.. 	M 	MDAw}}&,,..00a 1 "!%BV%KLLLOF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                 t    t          |            t          t                     t          j        d           d S )Nr   )r   usager   r   )whys    r
   Usager-   K   s)    	#JJJ	%LLLHQKKKKKr	   __main__r   zr:c:d:zInvalid argumentz-cz-dz-r)r   )r   r   r   	Exceptionr   r#   r)   r+   r-   r   getoptargvoptsargserrorr,   retrieslenoptvalintr   r	   r
   <module>r:      s   



  	 	 	 	 	i 	 	 	$ $ $ $N	 	 		   zMMM"V]38ABB<::
dd<   c







G
s4yyA~~ !!!  S$;;GC!!!$;;JsOOO$;;c#hhG#  s   !A 
A3A..A3