
    F#f                         d dl Z d dlmZ d dlmZ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 d dlmZ  e j$                  e      Z G d	 d
ej*                        Zy)    N)List)
interfaces	renderers
exceptions	constants)requirements)plugins)utility)format_hints)lsmodc                       e Zd ZdZdZedeej                  j                     fd       Z
edej                  j                  defd       Zd Zd	 Zy
)Check_modulesz0Compares module list to sysfs info, if available   r   r   returnc                     t        j                  ddg d      t        j                  dt        j                  d      gS )NkernelzLinux kernel)Intel32Intel64AArch64)namedescriptionarchitecturesr   r   )r   pluginversion)r   ModuleRequirementPluginRequirementr   Lsmod)clss    c/home/panchajanya/Development/work/volatility3/volatility3/framework/plugins/linux/check_modules.pyget_requirementszCheck_modules.get_requirements   s@     ***?
 **U[[)	
 		
    contextvmlinux_namec                 V   |j                   |   }	 |j                  d      }|st	        d      i }|j                  d      j                  d      }|j                  j                  |j                  t        j                  z   dz   d      D ]  }|j                  d|j                  j                  |z
  d      }|j                  }	t!        j"                  |j$                  d	      }
|j$                  sg|j'                         d
kD  s{|	||
<    |S # t        j                  $ r d }Y w xY w)Nmodule_ksetzThis plugin requires the module_kset structure. This structure is not present in the supplied symbol table. This means you are either analyzing an unsupported kernel version or that your symbol table is corrupt.module_kobjectkobjkobjectentryT)object_typeoffsetabsolute    r   )modulesobject_from_symbolr   SymbolError	TypeErrorget_typerelative_child_offsetlistto_listsymbol_table_namer   BANGobjectvolr,   modr
   pointer_to_stringr   reference_count)r   r#   r$   vmlinuxr&   retkobj_offr(   mod_kobjr;   r   s              r    get_kset_moduleszCheck_modules.get_kset_modules$   s*    //,/	!44]CK  f  ##$45KKFS$$,,%%	6BG
 	 D ~~,xx1 & H ,,C,,TYY;DyyT113a7D		  
7 %% 	K	s   D D('D(c              #     K   | j                  | j                  | j                  d         }t        d t        j
                  j                  | j                  | j                  d         D              }t        |j                               j                  |      D ])  }dt        j                  ||         t        |      ff + y w)Nr   c              3   l   K   | ],  }t        t        j                  |j                               . y w)N)strr
   array_to_stringr   ).0r/   s     r    	<genexpr>z+Check_modules._generator.<locals>.<genexpr>L   s,      
 ''56
s   24r   )rB   r#   configsetr   r   list_moduleskeys
differencer   HexrE   )selfkset_moduleslsmod_modulesmod_names       r    
_generatorzCheck_modules._generatorI   s     ,,T\\4;;x;PQ 
 ;;33DLL$++hBWX
 

 L--/0;;MJ 	QH|''X(>?XOPP	Qs   CCc                 z    t        j                  dt        j                  fdt        fg| j                               S )NzModule AddresszModule Name)r   TreeGridr   rN   rE   rS   )rO   s    r    runzCheck_modules.runT   s7    !! 0 01M33GHOO
 	
r"   N)__name__
__module____qualname____doc___required_framework_versionclassmethodr   r   configurationRequirementInterfacer!   r#   ContextInterfacerE   rB   rS   rV    r"   r    r   r      sq    :"+

j&>&>&S&S!T 

 

 " ((99"IL" "H	Q
r"   r   )loggingtypingr   volatility3.frameworkr   r   r   r   #volatility3.framework.configurationr    volatility3.framework.interfacesr	   volatility3.framework.objectsr
   volatility3.framework.renderersr   volatility3.plugins.linuxr   	getLoggerrW   vollogPluginInterfacer   r`   r"   r    <module>rl      sH   
   N N < 4 1 8 +			8	$F
G++ F
r"   