o
    j                     @   s   d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZmZ d	d
 Zdd ZedkrIe  dS dS )    N)logger)
__banner__)SMBConnectionFactory)DCERPC5Connection)
DCERPCAuth)EPM)	REMSVCRPCServiceStatusc           
   
      s"  zut d t| }|  }t d tj|t j| j	| j
dI d H \}}|d ur1|t d t| }t||}tj|ddI d H \}}|d urS|td | 2 z3 d H W \}}|d urj|t | q\6 t d W d	S  ty }	 zt  d
|	fW  Y d }	~	S d }	~	ww )Nz$[+] Parsing connection parameters...z[+] Connecting to EPM...)dc_ipdomainz3[+] Connecting to Remote Service Manager service...T)perform_dummyzService DCE Connected!z[+] Finished!)TNF)printr   from_url
get_targetget_hostname_or_ipr   create_targetr   service_uuidr
   r   r   from_smb_gssapiget_credentialr   from_rpcconnectionr   debuglist	Exception	traceback	print_exc)
urlsuiptargeterrauth
connectionrpcservicee r%   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/aiosmb/examples/dceservice.pyamain   s8   
,


r'   c                  C   sn   dd l } | jdd}|jddddd |jdd	d
 | }tt |jdkr-tt	j
 tt|j d S )Nr   z*Remore Registry Service client via DCE/RPC)descriptionz-vz	--verbosecount)actiondefaultsmb_urlzConnection string that describes the authentication and target. Example: smb+ntlm-password://TEST\Administrator:password@10.10.10.2)help   )argparseArgumentParseradd_argument
parse_argsr   r   verboser   setLevelloggingDEBUGasynciorunr'   r,   )r/   parserargsr%   r%   r&   main0   s   
r;   __main__)r7   r   r5   aiosmbr   aiosmb._versionr   !aiosmb.commons.connection.factoryr   aiosmb.dcerpc.v5.connectionr   1aiosmb.dcerpc.v5.common.connection.authenticationr   'aiosmb.dcerpc.v5.interfaces.endpointmgrr   *aiosmb.dcerpc.v5.interfaces.servicemanagerr   r	   r'   r;   __name__r%   r%   r%   r&   <module>   s   "
