
    #fu                         d Z ddlZddlmZ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  ej        e          Z G d	 d
ej                  ZdS )zkA module containing a collection of plugins that produce data typically
found in Linux's /proc file system.    N)ListIterable)
exceptions	renderers	constants
interfaces)requirements)plugins)utility)format_hintsc                       e Zd ZdZdZdZedeej	        j
                 fd            Zedej        j        dedeej        j                 fd            Zd Zd	 Zd
S )LsmodzLists loaded kernel modules.)   r   r   returnc                 6    t          j        ddg d          gS )NkernelzLinux kernel)Intel32Intel64AArch64)namedescriptionarchitectures)r	   ModuleRequirement)clss    [/home/panchajanya/Development/work/volatility3/volatility3/framework/plugins/linux/lsmod.pyget_requirementszLsmod.get_requirements   s2     **???  
 	
    contextvmlinux_module_namec              #   .  K   |j         |         }|                    d                              d          }|j        j                            t          j                  d         }|                    |t          j        z   dz   d          D ]}|V  dS )a  Lists all the modules in the primary layer.

        Args:
            context: The context to retrieve required elements (layers, symbol tables) from
            layer_name: The name of the layer on which to operate
            vmlinux_symbols: The name of the table containing the kernel symbols

        Yields:
            The modules present in the `layer_name` layer's modules list

        This function will throw a SymbolError exception if kernel module support is not enabled.
        modules)symbol_name	list_headr   modulelistN)	r!   object_from_symbolcastvol	type_namesplitr   BANGto_list)r   r   r   vmlinuxr!   
table_namer$   s          r   list_moduleszLsmod.list_modules#   s        /"56,,,CCHHUU[*00@@C
ooj9>&AH&LfUU 	 	FLLLL	 	r   c              #     K   	 |                      | j        | j        d                   D ]i}|                                |                                z   }t          j        |j                  }dt          j	        |j
        j                  ||ffV  jd S # t          j        $ r t                              d           Y d S w xY w)Nr   r   zThe required symbol 'module' is not present in symbol table. Please check that kernel modules are enabled for the system under analysis.)r/   r   configget_init_sizeget_core_sizer   array_to_stringr   r   Hexr(   offsetr   SymbolErrorvollogdebug)selfr$   mod_sizemod_names       r   
_generatorzLsmod._generator<   s      	++DL$+h:OPP S S!//11F4H4H4J4JJ"26;??,*6:+<==xRRRRRRS S % 	 	 	LL [     	s   BB )CCc                     t          j        dt          j        fdt          fdt
          fg|                                           S )NOffsetNameSize)r   TreeGridr   r5   strintr=   )r:   s    r   runz	Lsmod.runJ   s>    !()FC=63-HOO
 
 	
r   N)__name__
__module____qualname____doc___required_framework_version_versionclassmethodr   r   configurationRequirementInterfacer   r   ContextInterfacerC   r   objectsObjectInterfacer/   r=   rE    r   r   r   r      s        &&"+H
j&>&S!T 
 
 
 [
  (9PS	*$4	5   [0  
 
 
 
 
r   r   )rI   loggingtypingr   r   volatility3.frameworkr   r   r   r   #volatility3.framework.configurationr	    volatility3.framework.interfacesr
   volatility3.framework.objectsr   volatility3.framework.renderersr   	getLoggerrF   r8   PluginInterfacer   rR   r   r   <module>r\      s   ' '  ! ! ! ! ! ! ! ! N N N N N N N N N N N N < < < < < < 4 4 4 4 4 4 1 1 1 1 1 1 8 8 8 8 8 8		8	$	$;
 ;
 ;
 ;
 ;
G# ;
 ;
 ;
 ;
 ;
r   