o
    j                  
   @   s  d dl mZ d dl mZ 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 G d	d
 d
Zedkreej ejdddZejdddd ejdeddd ejddddd ejdddd ejdddd eejd kre  ed  e Ze	ejej  ej!du rej"du re#d! ed  z
eeZ$e$%  W n+ e&e'fy Z( ze) j*ej+krd dl,Z,e,-  e#e.e( W Y dZ([(ndZ([(ww ed  dS dS )"    )division)print_functionN)version)logger)DCERPCException)DCERPCTransportFactory)MSRPC_UUID_PORTMAPc                   @   s   e Zd Zdd Zdd ZdS )
TARGETARCHc                 C   s   t  | _|| _d| _d S )N)z$71710533-BEBA-4937-8319-B5DBEF9CCC36z1.0)list_TARGETARCH__machinesList_TARGETARCH__optionsNDR64Syntax)selfoptions r   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/../../../bin/getArch.py__init__*   s   
zTARGETARCH.__init__c                 C   sf  | j jd ur| j j D ]}| j|d qn| j| j j tdt	| j  td| j j
  | jD ]y}zZd| }t|}|t| j j
 | }|  z
|jt| jd W n* ty } zt|ddkrutd|  ntt| 	 W Y d }~nd }~ww td	|  |  W q7 ty } ztd
|t|f  W Y d }~q7d }~ww d S )Nz 
z)Gathering OS architecture for %d machinesz%Socket connect timeout set to %s secszncacn_ip_tcp:%s[135])transfer_syntaxsyntaxes_not_supportedr   z%s is 32-bitz%s is 64-bitz%s: %s)r   targets	readlinesr   appendstriptargetlogginginfolentimeoutr   set_connect_timeoutintget_dce_rpcconnectbindr   r   r   strfindprinterror
disconnect	Exception)r   linemachinestringBinding	transportdceer   r   r   run/   s<   
"zTARGETARCH.runN)__name__
__module____qualname__r   r/   r   r   r   r   r	   )   s    r	   __main__Tz0Gets the target system's OS architecture version)add_helpdescriptionz-targetstorez<targetName or address>)actionhelpz-targetsrzBinput file with targets system to query Arch from (one per line). )typer8   z-timeout2z@socket timeout out when connecting to the target (default 2 sec))r7   defaultr8   z-debug
store_truezTurn DEBUG output ONz-tsz&Adds timestamp to every logging output   zYou have to specify a target!)/
__future__r   r   argparser   sysimpacketr   impacket.examplesr   impacket.dcerpc.v5.rpcrtr   impacket.dcerpc.v5.transportr   impacket.dcerpc.v5.epmr   r	   r0   r%   BANNERArgumentParserparseradd_argumentFileTyper   argv
print_helpexit
parse_argsr   inittsdebugr   r   r&   getArchr/   r(   KeyboardInterruptr.   	getLoggerlevelDEBUG	traceback	print_excr#   r   r   r   r   <module>   sN   )



