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
mZ edkree
j e jddd	Zejd
ddd ejdddd ejddddd ejdddd ejdddd ejdddd ejddddd ejd e d!d"d# ejd$dd%d&d ejd'dd%d(d ed)Zejd*dd+d,d- ejd.dd/d ejd0dd1d ejd2dd3d4d- ed5Zejd6dd7d8d- ejd9dd7d:d- ejd;dd<d=d eejd>kre  ed> e Zeejej eej\ZZ Z!Z"edu rd%Ze!d%kr'e d%kr'ej#du r'ej$du r'ej%du r'd d?l&m&Z& e&d@Z!ej'du r0e"e_'ej%dur9de_(ej)ej'e*ej+e"ej,ej-dAZ.e./  z*ej(du ree.j0ej1e e!eej#ej%ej2dBZ3ne.4ej1e e!eej#ej5Z3e.6  W n# e7y Z8 zejdCddD e9e:e8 dZ3W Y dZ8[8ndZ8[8ww e3du ree.ej;Z<ej=rej=> D ]Z?edEe? dFdG e<@e? qnejArejAD ]ZBedEeB  e<@eB qne<C  e.D  dS dS )H    N)logger)SQLSHELL)parse_target)versiontds__main__Tz*TDS client implementation (SSL supported).)add_helpdescriptiontargetstorez6[[domain/]username[:password]@]<targetName or address>)actionhelpz-dbz&MSSQL database instance (default None)z-windows-auth
store_trueFz<whether or not to use Windows Authentication (default False))r   defaultr   z-debugzTurn DEBUG output ONz-tsz&Adds timestamp to every logging outputz-showzshow the queriesz-commandextend*zFCommands to execute in the SQL shell. Multiple commands can be passed.)r   nargsr   z-filerz4input file with commands to execute in the SQL shell)typer   z--host-name z;HostName property to use when connecting to the MSSQLServerz
--app-namez:AppName property to use when connecting to the MSSQLServerauthenticationz-hasheszLMHASH:NTHASHz$NTLM hashes, format is LMHASH:NTHASH)r   metavarr   z-no-passz&don't ask for password (useful for -k)z-kzUse Kerberos authentication. Grabs credentials from ccache file (KRB5CCNAME) based on target parameters. If valid credentials cannot be found, it will use the ones specified in the command linez-aesKeyzhex keyz<AES key to use for Kerberos Authentication (128 or 256 bits)
connectionz-dc-ipz
ip addresszoIP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target parameterz
-target-ipzIP Address of the target machine. If omitted it will use whatever was specified as target. This is useful when target is the NetBIOS name and you cannot resolve itz-port1433z target MSSQL port (default 1433)   )getpassz	Password:)workstation_idapplication_name)kdcHostz
Exception:)exc_infozSQL> %s )end)Eargparsesysloggingimpacket.examplesr   impacket.examples.mssqlshellr   impacket.examples.utilsr   impacketr   r   __name__printBANNERArgumentParserparseradd_argumentFileTypeadd_argument_groupgrouplenargv
print_helpexit
parse_argsoptionsinittsdebugr
   domainusernamepassword
remoteNamehashesno_passaesKeyr   	target_ipkMSSQLintport	host_nameapp_namems_sqlconnectkerberosLogindbdc_ipresloginwindows_authprintReplies	Exceptioneerrorstrshowshellfile	readlineslineonecmdcommandccmdloop
disconnect r`   r`   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/../../../bin/mssqlclient.py<module>   s   






8 

