
    Xf                         d Z ddl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  G d d	e
j                  Zd
S )zeA module containing a collection of plugins that produce data typically
found in Mac's lsmod command.    )Set)	renderers
interfaces
exceptions)requirements)plugins)utility)format_hintsc                   p    e Zd ZdZdZdZed             Zedej	        j
        defd            Zd Zd Zd	S )
LsmodzLists loaded kernel modules.)   r   r   c                 6    t          j        ddddg          gS )NkernelzKernel module for the OSIntel32Intel64)namedescriptionarchitectures)r   ModuleRequirement)clss    Y/home/panchajanya/Development/work/volatility3/volatility3/framework/plugins/mac/lsmod.pyget_requirementszLsmod.get_requirements   s1     *6()4  
 	
    contextdarwin_module_namec              #     K   |j         |         }|j        |j                 }|                    d          }	 |                                                    d          }n# t          j        $ r Y dS w xY w|V  	 |j        }n# t          j        $ r Y dS w xY wt                      }|dk    r||vrt          |          dk     r|                                }|                    |j        j        |j        j                  snU|                    |           |V  	 |j        }n# t          j        $ r Y dS w xY w|dk    r||vrt          |          dk     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
            darwin_symbols: The name of the table containing the kernel symbols

        Returns:
            A list of modules from the `layer_name` layer
        kmod)symbol_name	kmod_infoNr   i   )moduleslayers
layer_nameobject_from_symboldereferencecastr   InvalidAddressExceptionnextsetlenis_validvoloffsetsizeadd)	r   r   r   r   kernel_layerkmod_ptrr   seenkmod_objs	            r   list_moduleszLsmod.list_modules    s      !34~f&78,,,@@	''))..{;;DD1 	 	 	FF	 


	9DD1 	 	 	FF	 EEaiiD,,TT1A1A''))H(()<hl>OPP HHTNNNJJJy5   tt aiiD,,TT1A1A 	s5   'A! !A43A4<B BBD& &D98D9c              #      K   |                      | j        | j        d                   D ]G}t          j        |j                  }|j        }dt          j        |j	        j
                  ||ffV  Hd S )Nr   r   )r3   r   configr	   array_to_stringr   r-   r
   Hexr+   r,   )selfmodulemod_namemod_sizes       r   
_generatorzLsmod._generatorQ   s      ''dk(6KLL 	O 	OF.v{;;H{Hl&vz'8998XNNNNNN		O 	Or   c                     t          j        dt          j        fdt          fdt
          fg|                                           S )NOffsetNameSize)r   TreeGridr
   r7   strintr<   )r8   s    r   runz	Lsmod.runX   s>    !()FC=63-HOO
 
 	
r   N)__name__
__module____qualname____doc___required_framework_version_versionclassmethodr   r   r   ContextInterfacerB   r3   r<   rD    r   r   r   r      s        &&"+H
 
 [
 . (9.OR. . . [.`O O O
 
 
 
 
r   r   N)rH   typingr   volatility3.frameworkr   r   r   #volatility3.framework.configurationr    volatility3.framework.interfacesr   volatility3.framework.objectsr	   volatility3.framework.renderersr
   PluginInterfacer   rM   r   r   <module>rU      s   ! !       C C C C C C C C C C < < < < < < 4 4 4 4 4 4 1 1 1 1 1 1 8 8 8 8 8 8M
 M
 M
 M
 M
G# M
 M
 M
 M
 M
r   