
    #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y)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y
)LsmodzLists loaded kernel modules.)   r   r   returnc                 8    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   s%     ***?
 	
    contextvmlinux_module_namec              #   6  K   |j                   |   }|j                  d      j                  d      }|j                  j                  j                  t        j                        d   }|j                  |t        j                  z   dz   d      D ]  }|  yw)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HHU[[**00@C
ooj9>>&AH&LfU 	FL	s   BBc              #     K   	 | j                  | j                  | j                  d         D ]r  }|j                         |j	                         z   }t        j                  |j                        }dt        j                  |j                  j                        ||ff t y # t        j                  $ r t        j                  d       Y y w xY w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     	++DLL$++h:OP S!//1F4H4H4JJ"226;;?,**6::+<+<=xRRRS %% 	LL [	s)   CBB# "C#(CCCCc                     t        j                  dt        j                  fdt        fdt
        fg| j                               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&S!T 
 
  ((99PS	*$$4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\      sH   '  ! N N < 4 1 8			8	$;
G## ;
r   