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mZ d dlm	Z	m
Z
 edkrRe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 ej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 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$d%d&d ejd'd%d(d ejd)d*d
ejd+d, ejd-d%d.d ejd/d%d0d ejd1d%d2d ejd3d
d4d5d, ejd6d%d7d8d, ejd9d:d%d;d ejd<d%d7d=d, ejd>d
dd?d, ee jƒd@kre ¡  e  d@¡ ze ¡ ZW n ey* Z ze eeƒ¡ e  d@¡ W Y dZ[ndZ[ww e ejej¡ ejdu r<dAZnejZdBevrMej rJdCndDe_!ej"ej!e#ej$ƒej dEZ%ej&rle 'dFej& ¡ e% (ej&¡ e%j)ej* +¡ ej,eej-r{dGndHdI e% .ej/¡ e% 0ej1¡ e% 2ej3 ¡ e% 4ej5 ¡ ej6duràej7du r¾ej8du r¾d dJl9m9Z9 e9dKƒZ7e	e7ƒZ:e
e7ƒZ;nej7durÏe	ej7ƒZ:e
ej7ƒZ;nej8 <dL¡\Z:Z;e% =ej6d e:e;¡ ej>ej?ej@gZAejBejCejDgZEeFeAƒr1ej6re dM¡ e  d@¡ eGeAƒse dN¡ e  d@¡ eFeEƒs!e dO¡ e  d@¡ e% Hej>ejBejCejDej?ej@¡ e% IdA¡ ze% J¡  W dS  eKyQ   edPƒ e  dQ¡ Y dS w dS )Ré    N)Úlogger)Ú	smbserverÚversion)Úcompute_lmhashÚcompute_nthashÚ__main__Ta  This script will launch a SMB Server and add a share specified as an argument. Usually, you need to be root in order to bind to port 445. For optional authentication, it is possible to specify username and password or the NTLM hash. Example: smbserver.py -comment 'My share' TMP /tmp)Úadd_helpÚdescriptionÚ	shareNameÚstorezname of the share to add)ÚactionÚhelpÚ	sharePathzpath of the share to addz-commentz0share's comment to display when asked for sharesz	-usernamez Username to authenticate clientsz	-passwordzPassword for the Usernamez-computeraccountnamezZcomputer account name to authenticate arbitrary clients with signing via NetLogon/Kerberosz-computeraccounthashz]computer account NT hash to authenticate arbitrary clients with signing via NetLogon/Kerberosz-computeraccountaesz]computer account AES key to authenticate arbitrary clients with signing via NetLogon/Kerberosz-computeraccountpasswordz-computeraccountdomainz\computer account domain to authenticate arbitrary clients with signing via NetLogon/Kerberosz-dc-ipz\IP of domain controller to authenticate arbitrary clients with signing via NetLogon/Kerberosz-hasheszLMHASH:NTHASHz5NTLM hashes for the Username, format is LMHASH:NTHASH)r   Úmetavarr   z-tsÚ
store_truez&Adds timestamp to every logging outputz-debugzTurn DEBUG output ONz-ipz--interface-addressz@ip address of listening interface ("0.0.0.0" or "::" if omitted))r   Údefaultr   z	-readonlyzOnly allow reading of filesz-disablekerberosz$Do not offer Kerberos authenticationz-disablentlmz Do not offer NTLM authenticationz-portÚ445z9TCP port for listening incoming connections (default 445)z-dropsspFz'Disable NTLM ESS/SSP during negotiationz-6z--ipv6zListen on IPv6z-smb2supportzSMB2 Support (experimental!)z-outputfilez,Output file to log smbserver output messagesé   Ú Úinterface_addressz::z0.0.0.0)ÚlistenAddressÚ
listenPortÚipv6zSwitching output to file %sÚyesÚno)ÚreadOnly)Úgetpassz	Password:ú:zTYou cannot use account credentials AND computer account credentials at the same timez¥All of the following options need to be set for accepting signed connections from arbitrary users in the domain: -computeraccountname, -computeraccountdomain, -dc-ipz½At least one of the following options need to be set for accepting signed connections from arbitrary users in the domain: -computeraccounthash, -computeraccountaes, -computeraccountpasswordz
Interrupted, exiting...é‚   )LÚsysÚargparseÚloggingÚimpacket.examplesr   Úimpacketr   r   Úimpacket.ntlmr   r   Ú__name__ÚprintÚBANNERÚArgumentParserÚparserÚadd_argumentÚSUPPRESSÚlenÚargvÚ
print_helpÚexitÚ
parse_argsÚoptionsÚ	ExceptionÚeÚcriticalÚstrÚinitÚtsÚdebugÚcommentr   r   ÚSimpleSMBServerÚintÚportÚserverÚ
outputfileÚinfoÚ
setLogFileÚaddSharer
   Úupperr   ÚreadonlyÚsetSMB2SupportÚsmb2supportÚ
setDropSSPÚdropsspÚsetKerberosSupportÚdisablekerberosÚsetNTLMSupportÚdisablentlmÚusernameÚpasswordÚhashesr   ÚlmhashÚnthashÚsplitÚaddCredentialÚcomputeraccountnameÚcomputeraccountdomainÚdc_ipÚrequired_secure_server_optionsÚcomputeraccounthashÚcomputeraccountaesÚcomputeraccountpasswordÚ"at_least_one_secure_server_optionsÚanyÚallÚsetComputerAccountÚsetSMBChallengeÚstartÚKeyboardInterrupt© ra   ra   ú‰/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/../../../bin/smbserver.pyÚ<module>   s²   


€þ
&










 
þ“