
    Xf                         d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm	Z	m
Z
 d dlmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ  ej.                  e      Z G d	 d
ej4                        Zy)    N)	GeneratorList)schemassymbols)	constants
interfaces	renderers)symbol_cache)requirements)plugins)	resourcesc                       e Zd ZdZdZdZedeej                  j                     fd       Zedeeddf   fd       Zd Zd Zy)	IsfInfozQDetermines information about the currently available ISF files, or a specific one)   r   r   returnc           
         t        j                  dddg       t        j                  ddd d      t        j                  dd	d
d      t        j                  dt
        j                  d      t        j                  ddd
d      gS )Nfilterz>String that must be present in the file URI to display the ISFT)namedescriptionoptionaldefaultisfzSpecific ISF file to process)r   r   r   r   validatez#Validate against schema if possibleFSQLiteCache)   r   r   )r   	componentversionlivez-Traverse all files, rather than use the cache)r   ListRequirementURIRequirementBooleanRequirementVersionRequirementr
   SqliteCache)clss    W/home/panchajanya/Development/work/volatility3/volatility3/framework/plugins/isfinfo.pyget_requirementszIsfInfo.get_requirements   s     ((\	 '':	 ++A	 ++"&22!
 ++K	1
 	
    Nc              #     K   t         j                  D ]1  }t        j                  |d      D ]  \  }}}|D ]  }t        j                  j                  ||      }|j                  d      rt        j                  |d      5 }|j                         D ]R  }t        j                  D ]=  }	|j                  |	      sdt        t        j                  |            z   dz   |z    ? T 	 ddd       t        j                  D ]9  }	|j                  |	      st        j                  |      j                          ; 	  4 y# 1 sw Y   xY ww)z)Lists all the ISF files that can be foundT)followlinksziprz	jar:file:!N)r   __path__oswalkpathjoinendswithzipfileZipFilenamelistr   ISF_EXTENSIONSstrpathlibPathas_uri)
r$   symbol_pathrootdirsfilesfilename	base_namezfiler   	extensions
             r%   list_all_isf_fileszIsfInfo.list_all_isf_files=   sD     #++ 	GK%'WW[d%K G!dE % GH "T8 <I((/$__Y< 7(-(8 71:1I1I !7I'+}}Y'?.9C,3LL,C=* /*,//026/7 )7!777 7 *3)A)A GI'00;&-ll9&=&D&D&F FGGG	G
7 7s*   BE8E		<-E		*-E1E	EEc              #     K   | j                   j                  dd       | j                   d   g}nt        | j                               }g }t	        | j                   d         s|}n1|D ],  }| j                   d   D ]  }||v s|j                  |        . 	 dd l}| j                   d   st        d }| j                   d   re|D ]^  }dx}x}	x}
}d}t        j                         j                  |	      5 }	 t        j                  |      }t	        |j                  d
g             }t	        |j                  dg             }t	        |j                  dg             }	t	        |j                  dg             }
t        j                  j                  t         j"                  t         j$                        }t'        j(                  |      }|j+                  |      }|r|j-                  dd      }nt/        j0                         } ||      }d d d        d|||
|||	ff a y t        j                  j                  t         j"                  t         j$                        }t'        j(                  |      }d}|j=                         j?                         D ]  \  }}|jA                  |      \  }
}}	}|s|jC                  |      }|r|tD        jF                  v rd}| j                   d   rKt        j                         j                  |	      5 }	 t        j                  |      } ||      }d d d        d|||
|||	tI        |      ff  y # t        $ r d }Y w xY w# t2        t        j4                  j6                  f$ r t8        j;                  d|        Y w xY w# 1 sw Y   xY w# t2        t        j4                  j6                  f$ r t8        j;                  d|        Y w xY w# 1 sw Y   xY ww)Nr   r   r   r   c                 6    t        j                  | d      rdS dS )NTTrueFalse)r   r   datas    r%   check_validz'IsfInfo._generator.<locals>.check_validi   s    !(!1!1$!=vJ7Jr'   c                      y)NUnknown rH   s    r%   rJ   z'IsfInfo._generator.<locals>.check_validn   s     r'   r   rL   )urlr   
user_typesenums
base_types)locationzutf-8replace)errorszInvalid ISF: zTrue (cached))%configgetlistrC   lenappend
jsonschemaImportErrorr   ResourceAccessoropenjsonloadr.   r0   r1   r   
CACHE_PATHIDENTIFIERS_FILENAMEr
   r#   get_identifierdecoder	   NotAvailableValueUnicodeDecodeErrordecoderJSONDecodeErrorvollogwarningget_identifier_dictionaryitemsget_location_statisticsget_hashr   cached_validationsr7   )self	file_listfiltered_listisf_filefilter_itemrZ   rJ   entry	num_types	num_enums	num_basesnum_symbolsvalidfprI   identifiers_pathidentifier_cache
identifiercacherR   	json_hashs                        r%   
_generatorzIsfInfo._generatorS   s    ;;??5$'3U+,IT4467I 4;;x()%M% 7#';;x#8 7K"h.%,,X677
	!;;z*!!K ;;v& "BCC	CIC	K!//16656A @R@#yy}&)$((9b*A&B$'r(B$C	$'"(=$>	$'r(B$C	+-77<<%00)2P2P,( ,8+C+CDT+U(%5%D%De%D%T
%)3):):79):)UJ)2)D)D)FJ +D 1#@* !!#!" /"H  "ww||$$i&D&D  !,,-=>EE(-(G(G(I(O(O(Q $
H 11(; %x 8I Y'2L2L%L /{{:.&779>>8>L KPRK'+yy}(3D(9K $!%%'%
O )a  	!!	!8 /0L0LM @ug'>?@%@ @n %78T8T#U K &xj/I JK	K Ks   A?PPM 4AP8N(:DM&B(P9APO6N52!PM#P"M##P&;N%!N($N%%N((N2	-P5;O30O62O33O66O?	;Pc           
          t        j                  dt        fdt        fdt        fdt        fdt        fdt        fdt        fg| j	                               S )NURIValidzNumber of base_typeszNumber of typeszNumber of symbolszNumber of enumszIdentifying information)r	   TreeGridr7   intr   )ro   s    r%   runzIsfInfo.run   s\    !!#'-"C($c*"C(*C0 OO
 	
r'   )__name__
__module____qualname____doc___required_framework_version_versionclassmethodr   r   configurationRequirementInterfacer&   r   r7   rC   r   r   rM   r'   r%   r   r      sp    ["+H
j&>&>&S&S!T 
 
B G9S$_#= G G*hX
r'   r   )r^   loggingr.   r8   r3   typingr   r   volatility3r   r   volatility3.frameworkr   r   r	   volatility3.framework.automagicr
   #volatility3.framework.configurationr    volatility3.framework.interfacesr   volatility3.framework.layersr   	getLoggerr   rh   PluginInterfacer   rM   r'   r%   <module>r      sT      	   " ( B B 8 < 4 2			8	$v
g%% v
r'   