o
    js
                     @   s   d dl mZ G dd dZdS )    )RDPCredParserc                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )RDPCMDHelperc                 C   s   dg| _ dg| _d S )Nrdp)live_keywordskeywords)self r   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pypykatz/rdp/cmdhelper.py__init__   s   zRDPCMDHelper.__init__c                 C   s   |j ddd}| }d|_d|_|j ddd}|jdtd	d
 |jdddd |j ddd}|jdtd	d
 |jdddd |j ddd}| }d|_d|_|j ddd}	|	jddgd |	jddd |j ddd}
|
jddgd |
jddd d S )Nr   a)helpTlive_rdp_modulelogonpasswordsz#Parse RDP credentials (SERVER side)z--pidz+Search a specific process PID for RDP creds)typer   z--all
store_truez;Looks for all processes which use the rdp DLL rdpcorets.dll)actionr   mstscz#Parse RDP credentials (CLIENT side)z9Looks for all processes which use the rdp DLL mstscax.dllz(Parse RDP credentials from minidump file
rdp_modulezgParse RDP credentials (SERVER side) from minidump file. Plain-text passwords only for WINVER <= Win2012cmdminidump)choices
memoryfilezpath to the dump filezgParse RDP credentials (CLIENT side) from minidump file. Unable to recover plain-text passwords offline.)
add_parseradd_subparsersrequireddestadd_argumentint)r   parserlive_parser
live_grouplive_rdp_subparserslive_logonpasswords_grouplive_mstsc_groupgrouprdp_subparserslogonpasswords_groupmstsc_groupr   r   r	   add_args   s(   zRDPCMDHelper.add_argsc                 C   sb   t | jdkr|j| jv r| | t | jdkr+|jdkr-|j| jv r/| | d S d S d S d S )Nr   live)lenr   commandrunr   modulerun_live)r   argsr   r   r	   execute-   s
   
$zRDPCMDHelper.executec                 C   s<   t j|j|j|jd}|D ]}|jD ]}tt| qqd S )N)pidall_rdpr   )r   go_liver1   allr   credentialsprintstrr   r/   credparsers
credparsercredr   r   r	   r.   4   s   
zRDPCMDHelper.run_livec                 C   s6   t |j|j}|D ]}|jD ]}tt| qq
d S )N)r   parse_minidump_filer   r   r5   r6   r7   r8   r   r   r	   r,   :   s   
zRDPCMDHelper.runN)__name__
__module____qualname__r
   r(   r0   r.   r,   r   r   r   r	   r      s    r   N)pypykatz.rdp.parserr   r   r   r   r   r	   <module>   s   