
    Xfa                         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 d dl	m
Z
  ej                  e      Z G d de
j                        Zy)    N)List)	renderers
interfaces)requirements)pluginsc                   d    e Zd ZdZdZedeej                  j                     fd       Z
d Zd Zy)ConfigWriterzZRuns the automagics and both prints and outputs configuration in the
    output directory.)   r   r   returnc                 h    t        j                  ddddg      t        j                  dddd	
      gS )NprimaryzMemory layer for the kernelIntel32Intel64)namedescriptionarchitecturesextraz Outputs whole configuration treeFT)r   r   defaultoptional)r   TranslationLayerRequirementBooleanRequirement)clss    \/home/panchajanya/Development/work/volatility3/volatility3/framework/plugins/configwriter.pyget_requirementszConfigWriter.get_requirements   sF     449()4
 ++>	
 	
    c           
   #   X  K   d}t        | j                               }| j                  j                  dd      r6t        j                  d       t        | j                  j                        }d}	 | j                  |      5 }|j                  t        t        j                  |dd      d	             d d d        |j                         D ]   \  }}d|t        j                  |      ff " y # 1 sw Y   =xY w# t        $ r"}t        j                  d
|        Y d }~fd }~ww xY ww)Nzconfig.jsonr   FzHOutputting additional information, this will NOT work with the -c optionzconfig.extraTr
   )	sort_keysindentraw_unicode_escapez%Unable to JSON encode configuration: r   )dictbuild_configurationconfiggetvollogdebugcontextopenwritebytesjsondumps	Exceptionwarningitems)selffilenamer"   	file_dataexcpkvs          r   
_generatorzConfigWriter._generator&   s     d..01;;??7E*LLZ $,,--.F%H		K8$ 	

6T!D, LLN 	*DAqq$**Q-())	*   	KNNB4&IJJ	KsH   A.D*1C< 2C04C< <4D*0C95C< <	D'D"D*"D''D*c                 f    t        j                  dt        fdt        fg| j                               S )NKeyValue)r   TreeGridstrr5   )r/   s    r   runzConfigWriter.run=   s)    !!E3<'3"@$//BSTTr   N)__name__
__module____qualname____doc___required_framework_versionclassmethodr   r   configurationRequirementInterfacer   r5   r;    r   r   r	   r	      sD     #,
j&>&>&S&S!T 
 
*.Ur   r	   )r*   loggingtypingr   volatility3.frameworkr   r   #volatility3.framework.configurationr    volatility3.framework.interfacesr   	getLoggerr<   r$   PluginInterfacer	   rD   r   r   <module>rL      s?   
    7 < 4			8	$.U7** .Ur   