o
    Žõ±j¡  ã                   @   s   G d d„ dƒZ dS )c                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚCryptoCMDHelperc                 C   s   g | _ dg| _d S )NÚcrypto)Úlive_keywordsÚkeywords)Úself© r   ú’/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pypykatz/utils/crypto/cmdhelper.pyÚ__init__   s   zCryptoCMDHelper.__init__c                 C   s  |j ddd�}| ¡ }d|_d|_|j ddd�}|jdd	d� |j d
dd�}|jdd	d� |j ddd�}|jddd� |jdd	d� |j ddd�}|jddd� |jdd	d� |jddtddd� |j ddd�}|jddd� |j ddd�}|jddd� |j ddd�}|jddd� d S )Nr   z2Utils for generating hashes/decrypting secrets etc)ÚhelpTÚcrypto_moduleÚntz!Generates NT hash of the passwordÚpasswordzPassword to be hashedÚlmz!Generates LM hash of the passwordÚdcczKGenerates DCC v1 (domain cached credentials version 1) hash of the passwordÚusernameÚdcc2zKGenerates DCC v2 (domain cached credentials version 2) hash of the passwordz-iz--iteration-counti (  ziteration-count)ÚtypeÚdefaultr	   ÚgppasszDecrypt GP passwordsÚenczEncrypted password stringÚofscanz)Decrypt TrendMicro OfficeScan config filez5Encrypted password string or path to ofcscan.ini fileÚvnczDecrypt VNC password)Ú
add_parserÚadd_subparsersÚrequiredÚdestÚadd_argumentÚint)r   ÚparserÚlive_parserÚcrypto_groupÚcrypto_subparsersÚgroupr   r   r   Úadd_args   s*   zCryptoCMDHelper.add_argsc                 C   sN   |j | jv r|  |¡ t| jƒdkr!|j dkr#|j| jv r%tdƒ‚d S d S d S )Né    Úlivez&There are no live commands for crypto.)Úcommandr   ÚrunÚlenr   ÚmoduleÚ	Exception)r   Úargsr   r   r   Úexecute+   s
   
$ÿzCryptoCMDHelper.executec                 C   s6  ddl m}m}m}m} ddlm} ddlm} ddl	m
} |jdkr.t||jƒ ¡ ƒ d S |jdkr>t||jƒ ¡ ƒ d S |jdkrPt||j|jƒ ¡ ƒ d S |jd	krdt||j|j|jƒ ¡ ƒ d S |jd
krrt||jƒƒ d S |jdkr‹||jƒD ]\}	}
td|	|
f ƒ q|d S |jdkr™t||jƒƒ d S d S )Nr#   )ÚNTÚLMÚMSDCCÚMSDCCv2)Ú
gppassword)Úofscan_decrypt_data)Ú
vncdecryptr   r   r   r   r   r   z%s: %sr   )Úpypykatz.utils.crypto.winhashr,   r-   r.   r/   Ú pypykatz.utils.crypto.gppasswordr0   Ú pypykatz.utils.crypto.ofcdecryptr1   Úpypykatz.utils.crypto.othersr2   r
   Úprintr   Úhexr   Úiteration_countr   )r   r*   r,   r-   r.   r/   r0   r1   r2   ÚparamÚresr   r   r   r&   2   s*   





ÿ
ÿzCryptoCMDHelper.runN)Ú__name__Ú
__module__Ú__qualname__r   r"   r+   r&   r   r   r   r   r      s
    r   N)r   r   r   r   r   Ú<module>   s   