o
    j/                     @   s8   d dl Z d dlmZmZ G dd dZG dd dZdS )    N)IteratorListc                   @   s   e Zd Zdd ZdS )NGCProtectorc                 C   s   d | _ d | _d | _d | _d S N)sidpathproviderguidself r   /root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pypykatz/dpapi/finders/ngc.py__init__   s   
zNGCProtector.__init__N)__name__
__module____qualname__r   r   r   r   r   r      s    r   c                   @   sb   e Zd Zdd Zdee fddZeddee	j
B defd	d
Zeddee	j
B defddZdS )NGCProtectorFinderc                 C   s   g d| _ g | _d S )N)ServiceProfilesLocalServiceAppDataLocal	MicrosoftNgc)startdirentriesr
   r   r   r   r      s   

zNGCProtectorFinder.__init__returnc                 C   s
   t | jS r   )iterr   r
   r   r   r   __iter__   s   
zNGCProtectorFinder.__iter__Twin_dirraise_errorc                 C   sl   t | trt|  } |  st|  d| }t jD ]}|| }| s.t| dqtj	||dS )N is not a directoryz does not exist)r   )

isinstancestrpathlibPathabsoluteis_dir
ValueErrorr   r   from_dir)r   r   ngc_dir	directoryr   r   r   from_windir   s   
zNGCProtectorFinder.from_windirr)   c           
      C   sP  t | trt|  } |  s|rt|  dt S t }|  D ]}| s*q#|j	
dr|j	dr| | d }| | d d }| sPtd|  q#| s\td|  q#|d	d
}|d }| sttd|  q#|d }| std|  q#t }	||	_|d	d
|	_|d	d
|	_||	_|j|	 q#|S )Nr    {}z1.dat
Protectors1zNGC missing SID file at: z$NGC missing Protector directory at: z	utf-16-le zNGC missing Protector file at: z2.datzNGC missing GUID file at: )r!   r"   r#   r$   r%   r&   r'   r   iterdirname
startswithendswithexistsprint	read_textstripr   r   r   r	   r   r   append)
r)   r   finderr*   sid_file_pathfpdr   pfpgfp	protectorr   r   r   r(   $   sH   
zNGCProtectorFinder.from_dirN)T)r   r   r   r   r   r   r   staticmethodr"   r#   r$   boolr+   r(   r   r   r   r   r      s     r   )r#   typingr   r   r   r   r   r   r   r   <module>   s    