
    [
#g=i                     H   d dl Z d dlZd dlmZmZ d dlmZmZmZm	Z	m
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  G d	 d
ej0                        Z G d dej4                  j6                        Z G d de      Z G d de      Z G d de      Z G d de       Z!y)    N)ABCabstractmethod)IteratorListTupleOptionalUnion)	framework)	constants
exceptions
interfacesobjects)utility)intermed)
extensionsc                   (     e Zd ZddiZd fdZ xZS )LinuxKernelIntermedSymbolstype	interfacec                 d	   t        |   |i | | j                  dt        j                         | j                  dt        j
                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         | j                  d	t        j                         | j                  d
t        j                         | j                  dt        j                         | j                  dt        j                         | j                  dt        j                          | j                  dt        j"                         | j                  dt        j$                         | j                  dt        j&                         | j)                  dt        j*                         | j)                  dt        j,                         | j)                  dt        j.                         | j)                  dt        j0                         | j)                  dt        j2                         | j)                  dt        j4                         | j)                  dt        j4                         | j                  dt        j6                         | j)                  dt        j8                         | j)                  dt        j:                         | j                  dt        j<                         | j                  dt        j>                         | j                  dt        j@                         | j                  dt        jB                         | j                  dt        jD                         | j)                  d t        jF                         | j)                  d!t        jH                         | j)                  d"t        jJ                         | j)                  d#t        jL                         | j)                  d$t        jN                         | j)                  d%t        jP                         y )&Nfile	list_head	mm_structsuper_blocktask_structvm_area_structqstrdentry	fs_structfiles_structkobjectcredinodeidraddress_spacepagemodulebpf_progbpf_prog_auxkernel_cap_structkernel_cap_t
timespec64timespecvfsmountmountmnt_namespacenetsocketsock	inet_sock	unix_socknetlink_sock
vsock_sockpacket_sockbt_sockxdp_sock
maple_tree))super__init__set_type_classr   struct_filer   r   r   r   r   r   r   r   r    r!   r"   r#   IDRr%   r&   optional_set_type_classr'   r(   r)   r*   r+   r,   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   )selfargskwargs	__class__s      ^/home/panchajanya/Development/work/volatility3/volatility3/framework/symbols/linux/__init__.pyr=   z#LinuxKernelIntermedSymbols.__init__   sC   $)&) 	FJ$:$:;K)=)=>K)=)=>M:+A+ABM:+A+AB,j.G.GHFJOO4Hj&7&78K)=)=>NJ,C,CDIz'9'9:FJOO4GZ%5%56E:>>2OZ-E-EFFJOO4$$Xz/@/@A$$Z1D1DE$$^Z5L5LM$$%8*:V:VW$$^Z5L5LM 	$$\:3H3HI$$Z1F1FG 	J
(;(;<$$Wj.>.>?$$_j6N6NO 	E:>>2Hj&7&78FJOO4K)=)=>K)=)=>$$^Z5L5LM$$\:3H3HI$$]J4J4JK$$Y
0B0BC$$Z1D1DE 	$$\:3H3HI    returnN)__name__
__module____qualname__providesr=   __classcell__rE   s   @rF   r   r      s    $H4J 4JrG   r   c                      e Zd ZdZdZdZ ej                  e  ede	fd       Z
ede	fd       Zedede	f   fd       Zede	fd	       Zede	fd
       Zedej"                  j$                  de	dej&                  j(                  fd       Zedej"                  j$                  de	deej&                  j(                     deee	eef      fd       Zedej"                  j$                  de	deej&                  j(                     deee	eef      fd       Zedej"                  j8                  deee	eef      defd       Zed        Zedede	de	dej"                  j8                  deej&                  j(                     f
d       Z edej"                  j$                  dej&                  j(                  dej"                  j8                  fd        Z!y)!LinuxUtilitiesz+Class with multiple useful linux functions.)      rS   )rR   r   r   rI   c                     |j                   j                         }|j                   j                         }|j                         }|j	                         }| j                  ||||      S )a  Returns the file pathname relative to the task's root directory.

        Args:
            task (task_struct): A reference task
            filp (file *): A pointer to an open file

        Returns:
            str: File pathname relative to the task's root directory.
        )fsget_root_dentryget_root_mnt
get_vfsmnt
get_dentrydo_get_path)clstaskfilprdentryrmntvfsmntr   s          rF   _get_path_filezLinuxUtilities._get_path_fileR   sU     ''))+ww##%""wff==rG   c                     |j                   j                         }|j                   j                         }|j                         }|j	                         }| j                  ||||      S )a  Returns the mount point pathname relative to the task's root directory.

        Args:
            task (task_struct): A reference task
            mnt (vfsmount or mount): A mounted filesystem or a mount point.
                - kernels < 3.3.8 type is 'vfsmount'
                - kernels >= 3.3.8 type is 'mount'

        Returns:
            str: Pathname of the mount point relative to the task's root directory.
        )rU   rV   rW   get_vfsmnt_currentget_dentry_currentrZ   )r[   r\   mntr^   r_   r`   r   s          rF   get_path_mntzLinuxUtilities.get_path_mntd   sY     ''))+ww##%'')'')wff==rG   Nc                    g }||k7  s|j                  |      s||j                         k(  s|j                         rF||j                         k7  rn|j                         sn|j	                         }|j                         }|j                  }|j                  j                         }|j                  |j                  d             |}||k7  r|j                  |      sddj                  t        |            z   }|S )a  Returns a pathname of the mount point or file
        It mimics the Linux kernel prepend_path function.

        Args:
            rdentry (dentry *): A pointer to the root dentry
            rmnt (vfsmount *): A pointer to the root vfsmount
            dentry (dentry *): A pointer to the dentry
            vfsmnt (vfsmount *): A pointer to the vfsmount

        Returns:
            str: Pathname of the mount point or file
        /)is_equalget_mnt_rootis_root
has_parentget_dentry_parentget_vfsmnt_parentd_parentd_namename_as_strappendstripjoinreversed)	r[   r^   r_   r   r`   path_reversedparentdnamepaths	            rF   rZ   zLinuxUtilities.do_get_pathy   s     vt'<,,..&..2BV0022 ((*113113__FMM--/E  S!12F% vt'<( SXXh}566rG   c                     |j                         }| j                  ||      }|j                  j                  }t	        |j                  |            }t        |      dk(  r||d   j                  t        j                        d   }|dk(  rd}	n.|dk(  rd}	n&|dk(  rd}	n|d	k(  r| j                  ||      }	nd
| d}		 |j                  j                  }
|	 d|
 d}|S d|d}|S # t        j                  $ r d}
Y )w xY w)a  Returns the sock pipe pathname relative to the task's root directory.

        Args:
            context: The context to retrieve required elements (layers, symbol tables) from
            task (task_struct): A reference task
            filp (file *): A pointer to a sock pipe open file

        Returns:
            str: Sock pipe pathname relative to the task's root directory.
        rS   r   sockfs_dnamer2   anon_inodefs_dname
anon_inodepipefs_dnamepipesimple_dnamez<unsupported d_op symbol: >z	<UNKNOWN>z:[]z<invalid d_dname pointer> x)rY   get_module_from_volobj_typed_opd_dnamelist get_symbols_by_absolute_locationlensplitr   BANGra   d_inodei_inor   InvalidAddressException)r[   contextr\   r]   r   kernel_modulesym_addrsymbssympre_name	inode_numrets               rF   _get_new_sock_pipe_pathz&LinuxUtilities._get_new_sock_pipe_path   s    "77H;;&&]CCHMNu:?(..03Cn$#,,'&!&--dD9 8uA>("NN00	 Jb1-C
 
 /xl;C
 55 ('	(s   =C% %C=<C=c                    	 |j                         }|j                          |dk(  ryd}	 |j                  r3|j                  j                  d      r|j                  j                  rd}|rt        j                  |||      }|S t        j                  ||      }|S # t        j                  $ r Y yw xY w# t        j                  $ r d}Y cw xY w)a<  Returns a file (or sock pipe) pathname relative to the task's root directory.

        A 'file' structure doesn't have enough information to properly restore its
        full path we need the root mount information from task_struct to determine this

        Args:
            context: The context to retrieve required elements (layers, symbol tables) from
            task (task_struct): A reference task
            filp (file *): A pointer to an open file

        Returns:
            str: A file (or sock pipe) pathname relative to the task's root directory.
         r   Fr   T)
rY   rk   r   r   r   
has_memberr   rQ   r   ra   )r[   r   r\   r]   r   dname_is_validr   s          rF   path_for_filezLinuxUtilities.path_for_file   s    "	__&FNN Q;		#KK**95KK''!%
  88$MC 
 !//d;C
3 11 		" 11 	#"N	#s"    B ?B6 B32B36CCr   symbol_tabler\   c              #     K   |j                   sy |j                   j                         }|dk(  ry |j                   j                         }|dkD  ry |t        j                  z   dz   }t
        j                  j                  ||||      }t        |      D ])  \  }}	|	dk7  st        j                  |||	      }
||	|
f + y w)Nr   i  r   )countsubtyper   )filesget_fdsget_max_fdsr   r   r   r   array_of_pointers	enumeraterQ   r   )r[   r   r   r\   fd_tablemax_fds	file_typefdsfd_numr]   	full_paths              rF   files_descriptors_for_processz,LinuxUtilities.files_descriptors_for_process  s      zz::%%'q=**((* V 9>>1F:	oo//GY 0 
 &cNLFDqy*88$M	dI--	 +s   BC !C
layer_namemodsc                    |j                   |   j                  }|D cg c]W  }t        j                  |j                        |j                         |z  |j                         |z  |j                         z   fY c}S c c}w )zZ
        A helper function to mask the starting and end address of kernel modules
        )layersaddress_maskr   array_to_stringnameget_module_baseget_core_size)r[   r   r   r   maskmods         rF   mask_mods_listzLinuxUtilities.mask_mods_list"  s     ~~j)66 
 	 ''1##%,$$&-1B1B1DD
 	
 
s   AA=kernel_module_name	mods_listc                    |j                   |   }|j                  |j                     j                  }|j	                  d      }|j
                  j                  |z  }|j	                  d      }|j
                  j                  |z  }t        j                  j                  ||fgt        j                  ||j                  |      z   S )z`
        A helper function that gets the beginning and end address of the kernel module
        _text_etext)modulesr   r   r   object_from_symbolvoloffsetr   linuxKERNEL_NAMErQ   r   )r[   r   r   r   kernelr   
start_addrend_addrs           rF   generate_kernel_handler_infoz+LinuxUtilities.generate_kernel_handler_info7  s     !34~~f//0==..w7
^^**T1
,,X6<<&&- __((*h?
))'63D3DiPQ 	QrG   r   handlerstarget_addressc                 T   d}d}|D ]  \  }}}||cxk  r|k  sn |}|t         j                  j                  k(  rdt        |j	                  |            }	t        |	      r?t         j                  |	d   v r%|	d   j                  t         j                        d   n|	d   } ||fS  ||fS )z
        Searches between the start and end address of the kernel module using target_address.
        Returns the module and symbol name of the address provided.
        UNKNOWNzN/Ar   rS   )r   r   r   r   r   r   r   r   )
r[   r   r   r   mod_namesymbol_namer   startendsymbolss
             rF   lookup_module_addressz$LinuxUtilities.lookup_module_addressP  s      (D%-#-9??666"%FF~VG 7|  )~~; $AJ,,Y^^<Q?!( $ $$# !)" $$rG   c              #      K   |r;|j                  ||j                  j                        }| t        ||      }|r:y y w)N)object_typer   )objectr   r   getattr)r[   vmlinuxstruct_namelist_member
list_startlist_structs         rF   walk_internal_listz!LinuxUtilities.walk_internal_listr  sD     !..'
0E0E ) K  k:J s
   <AAaddr	type_namemember_namer   c                 ~    |sy|j                  |      }|j                  |      }||z
  }|j                  ||d      S )a  Cast a member of a structure out to the containing structure.
        It mimicks the Linux kernel macro container_of() see include/linux.kernel.h

        Args:
            addr: The pointer to the member.
            type_name: The type of the container struct this is embedded in.
            member_name: The name of the member within the struct.
            vmlinux: The kernel symbols object

        Returns:
            The constructed object or None
        NT)r   r   absolute)get_typerelative_child_offsetr   )r[   r   r   r   r   type_decmember_offsetcontainer_addrs           rF   container_ofzLinuxUtilities.container_of{  sQ    * ##I. 66{C-~~!.4  
 	
rG   volobjc                     |j                         }|j                  j                  |      }t        |      }|st	        d| d      |d   }|j                  |   }|S )aV  Get the vmlinux from a vol obj

        Args:
            context: The context to retrieve required elements (layers, symbol tables) from
            volobj (vol object): A vol object

        Raises:
            ValueError: If it cannot obtain any module from the symbol table

        Returns:
            A kernel object (vmlinux)
        z"No module using the symbol table ''r   )get_symbol_table_namer   get_modules_by_symbol_tablesr   
ValueError)r[   r   r   r   module_namesr   r   s          rF   r   z*LinuxUtilities.get_module_from_volobj_type  sf    $ 335CCLQL)A,qQRR)!_!34rG   )"rJ   rK   rL   __doc___version_required_framework_versionr
   require_interface_versionclassmethodstrra   rf   r	   rZ   r   r   r   r   ContextInterfacer   ObjectInterfacer   r   r   r   intr   r   ModuleInterfacer   r   r   r   r    rG   rF   rQ   rQ   J   s   5H"+'I'')DE>3 > >" > > >( $5s;K $ $L /S / /b ,3 , ,\ .##44. .   00	. .@ 
##44
 
 z))99:	

 
eCcM"	#
 
( Q##44Q  Q J..>>?	Q
 
eCcM"	#Q Q0 %!))99% uS#s]+,% 	% %B ; ; 

 
 	

 ##33
 
*$$44	5
 
< ##44 ""22 
			+	+	 rG   rQ   c                      e Zd ZdZdZdZdZdej                  j                  de
fdZedej                  j                  de
dd fd       Zeede
fd              Zedefd	       Zedefd
       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zedefd       Zdej6                  j8                  fdZdefdZdefdZdej6                  j8                  defdZ y)	IDStoragez0Abstraction to support both XArray and RadixTreeNr   r   c                    |j                   |   | _        | j                  j                  j                  | j                  j                     | _        | j                  j                  d      j                  | _        | j                  j                  | j                        }|j                  d      j                  }|j                         dz
  | _        d| j                  z  | _        | j                  dz
  | _        y )NpointerslotsrS   )r   r   r   r   r   vmlinux_layerr   sizepointer_sizenode_type_namechild_templater   
bit_lengthCHUNK_SHIFT
CHUNK_SIZE
CHUNK_MASK)rB   r   r   	node_typeslots_array_sizes        rF   r=   zIDStorage.__init__  s    
 '9:!\\11889P9PQ LL11)<AA LL))$*=*=>	$33G<BB ,6681<t/////A-rG   rI   c                    |j                   |   }|j                  d      }|j                  d      }|r%|j                  d      j                  j
                  nd}|j                  t        j                  dz         }|j                  t        j                  dz         xr  |j                  d      j                  d      }|s|rt        ||      S t        ||      S )a  Returns the appropriate ID storage data structure instance for the current kernel implementation.
        This is used by the IDR and the PageCache to choose between the XArray and RadixTree.

        Args:
            context: The context to retrieve required elements (layers, symbol tables) from
            kernel_module_name: The name of the kernel module on which to operate

        Returns:
            The appropriate ID storage instance for the current kernel
        r%   i_pagesr   xarrayradix_tree_rootxa_head)r   r   r   r  r   r   endswithr   r   XArray	RadixTree)	r[   r   r   r   address_space_typeaddress_space_has_i_pagesi_pages_type_namei_pages_is_xarrayi_pages_is_radix_tree_roots	            rF   choose_id_storagezIDStorage.choose_id_storage  s      //"45$--o>$6$A$A)$L! ) --i8<<FF 	
 .66y~~7PQ%6%?%?NN..&
 &H01<<YG 	#  :'#566W&899rG   c                     t               )zvReturns the Tree implementation node type name

        Returns:
            A string with the node type name
        NotImplementedErrorrB   s    rF   r  zIDStorage.node_type_name  s     "##rG   c                     t               )z+Returns the internal node flag for the treer  r  s    rF   tag_internal_valuezIDStorage.tag_internal_value   s     "##rG   c                     t         )zChecks if the node is internalr  rB   nodeps     rF   node_is_internalzIDStorage.node_is_internal  
     "!rG   c                     t         )z$Checks if the node pointer is taggedr  r  s     rF   is_node_taggedzIDStorage.is_node_tagged
  r!  rG   c                     t         )zUntags a node pointerr  r  s     rF   
untag_nodezIDStorage.untag_node  r!  rG   c                     t         )zReturns the tree heightr  rB   treeps     rF   get_tree_heightzIDStorage.get_tree_height  r!  rG   c                     t         )zReturns the node heightr  r  s     rF   get_node_heightzIDStorage.get_node_height  r!  rG   c                     t         )z$Returns a pointer to the tree's headr  rB   trees     rF   get_head_nodezIDStorage.get_head_node  r!  rG   c                     t         )zValidates a node pointerr  r  s     rF   is_valid_nodezIDStorage.is_valid_node#  r!  rG   c                 V    | j                   j                  | j                  |d      }|S )zInstanciates a tree node from its pointer

        Args:
            nodep: Pointer to the XArray/RadixTree node

        Returns:
            A XArray/RadixTree node instance
        Tr   r   )r   r   r  rB   r  nodes      rF   nodep_to_nodezIDStorage.nodep_to_node(  s*     ||""4#6#6ut"TrG   c                 P    | j                  |      r|| j                   z  }|S |}|S N)r   r  )rB   slotr  s      rF   _slot_to_nodepzIDStorage._slot_to_nodep4  s6      &D3333E  ErG   c              #   &  K   | j                  |      }|j                  }t        | j                        D ]X  }||   }|dk(  r| j	                  |      }|dk(  r| j                  |      s6| ;| j                  ||dz
        D ]  }|  Z y w)Nr   rS   )r6  r   ranger  r:  r1  
_iter_node)rB   r  heightr5  
node_slotsoffr9  
child_nodes           rF   r=  zIDStorage._iter_node<  s     !!%(ZZ
)Cc?Dqy''-E{%%e,K"&//%!"DJ$$ #E *s   A(B+&Brootc              #   x  K   | j                  |j                  j                        }| j                  |      }|sy| j	                  |      }| j                  |      r| j                  |      }|r| j                  |      }|dk(  r| j                  |      r| yy| j                  ||      D ]  }|  yw)zWalks the tree data structure

        Args:
            root: The tree root object

        Yields:
            A tree node pointer
        Nr   )
r)  r   r   r/  r   r#  r%  r+  r1  r=  )rB   rB  r>  r  is_internalrA  s         rF   get_entrieszIDStorage.get_entriesM  s      %%dhhoo6""4( ++E2u%OOE*E))%0FQ;!!%( ) #ooeV<
   =s   B8B:)!rJ   rK   rL   r   r  r  r  r   r   r   r   r=   r   r  propertyr   r  r   r  boolr   r#  r%  r)  r+  r/  r1  r   r   r6  r:  r=  rE  r   rG   rF   r   r     s   : KJJ.##44.  .& :##44:  : 
	: :B $ $  $ $C $ $ " " " "t " " "3 " " " " " " " " "S " " "d " "
j&8&8&H&H 
c %3 %"!
 2 2 B B !s !rG   r   c                       e Zd ZdZdZdefdZedefd       Z	edefd       Z
defdZdefdZdefd	Zdefd
ZdefdZdefdZy)r     rR   rI   c                      yNr   r   r'  s     rF   r)  zXArray.get_tree_heightp  s    rG   c                      y)Nxa_noder   r  s    rF   r  zXArray.node_type_names  s    rG   c                     | j                   S r8  )XARRAY_TAG_INTERNALr  s    rF   r  zXArray.tag_internal_valuew  s    '''rG   c                 \    | j                  |      }|j                  | j                  z  dz   S )NrS   )r6  shiftr  r4  s      rF   r+  zXArray.get_node_height{  s,    !!%(

T---22rG   c                     |j                   S r8  )r  r-  s     rF   r/  zXArray.get_head_node  s    ||rG   c                 :    || j                   z  | j                  k(  S r8  )XARRAY_TAG_MASKrO  r  s     rF   r   zXArray.node_is_internal  s    ,,,1I1IIIrG   c                 &    || j                   z  dk7  S rK  rT  r  s     rF   r#  zXArray.is_node_tagged  s    ,,,22rG   c                 "    || j                    z  S r8  rV  r  s     rF   r%  zXArray.untag_node  s    ---..rG   c                 &    | j                  |       S r8  )r#  r  s     rF   r1  zXArray.is_valid_node  s    &&u---rG   N)rJ   rK   rL   rT  rO  r   r)  rF  r   r  r  r+  r/  rG  r   r#  r%  r1  r   rG   rF   r  r  l  s    O     (C ( (3 3S J J3t 3/3 /.d .rG   r  c                        e Zd ZdZdZdZdZdZdZdZ	d fdZ
edefd       Zedefd       Zdefd	Zdefd
ZdefdZdefdZdefdZdefdZdefdZdefdZ xZS )r  rS   rR   rI  NrI   c                 r   t        |   |i | d}|| j                  z  | _        t	        t        j                  | j                  t        | j                        z              | _	        | j                  dz   | _
        d| j                  z  dz
  | _        | j                  j                  d      sd| _        y y )N   rS   r  rR   )r<   r=   r   RADIX_TREE_INDEX_BITSr   mathceilfloatr  RADIX_TREE_MAX_PATHRADIX_TREE_HEIGHT_SHIFTRADIX_TREE_HEIGHT_MASKr   has_typeRADIX_TREE_INTERNAL_NODE)rB   rC   rD   	char_bitsrE   s       rF   r=   zRadixTree.__init__  s    $)&)	%.1B1B%B"#&IId0059I9I3JJK$
  (,'?'?!'C$'(D,H,H'HA&M#||$$%67
 -.D) 8rG   c                      y)Nradix_tree_noder   r  s    rF   r  zRadixTree.node_type_name  s     rG   c                     | j                   S r8  rd  r  s    rF   r  zRadixTree.tag_internal_value  s    ,,,rG   c                 0   t        j                  t        j                        5  | j                  j                  d      j                  d      r3| j                  j                  d|d      }|j                  cd d d        S 	 d d d        y# 1 sw Y   yxY w)Nr  r>  Tr3  r   )	
contextlibsuppressr   SymbolErrorr   r   r   r   r>  )rB   r(  r  s      rF   r)  zRadixTree.get_tree_height  s      !7!78 	.||$$%67BB8L"&,,"5"5%ed #6 # '--	. 	.L	. 	. s   ABBc                     | j                   j                  d      s| j                  |j                  z  dz
  S | j                   j	                  d      }||   }|S )zMReturn the maximum key which can be store into a radix tree with this height.height_to_maxindexrS   )r   
has_symbolr  rQ  r   )rB   r5  r>  height_to_maxindex_arraymaxindexs        rF   _radix_tree_maxindexzRadixTree._radix_tree_maxindex  sZ     ||&&';<OOtzz1Q66 (,||'F'F$($ 07HOrG   c                    | j                  |      }t        |d      r|j                  | j                  z  dz   S t        |d      r|j                  | j
                  z  S t        |d      r|j                  S t        j                  d      )NrQ  rS   ry   r>  z"Cannot find radix-tree node height)	r6  hasattrrQ  r  ry   rb  r>  r   VolatilityExceptionr4  s      rF   r+  zRadixTree.get_node_height  s{    !!%(4!JJ!1!11Q66T6"99t::::T8$;;001UVVrG   c                     |j                   S r8  )rnoder-  s     rF   r/  zRadixTree.get_head_node  s    zzrG   c                 &    || j                   z  dk7  S rK  ri  r  s     rF   r   zRadixTree.node_is_internal  s    555!;;rG   c                 $    | j                  |      S r8  )r   r  s     rF   r#  zRadixTree.is_node_tagged  s    $$U++rG   c                 "    || j                    z  S r8  )RADIX_TREE_ENTRY_MASKr  s     rF   r%  zRadixTree.untag_node  s    33344rG   c                 r    | j                   j                  d      r|| j                  z  | j                  k7  S y)Nr  T)r   rc  r|  RADIX_TREE_EXCEPTIONAL_ENTRYr  s     rF   r1  zRadixTree.is_valid_node  s;    <<  !23222223 3 rG   rH   )rJ   rK   rL   rd  r~  r|  r\  r`  ra  rb  r=   rF  r   r  r   r  r)  rs  r+  r/  rG  r   r#  r%  r1  rN   rO   s   @rF   r  r    s     #$  !"!.$ ! ! ! -C - -
 
C W WS < <,t ,53 5d rG   r  c                       e Zd ZdZdej
                  j                  dedej                  j                  fdZ
dej                  j                  fdZy)		PageCachezLinux Page Cache abstractionr   r   
page_cachec                 p    |j                   |   | _        || _        t        j	                  ||      | _        y)z
        Args:
            context: interfaces.context.ContextInterface,
            kernel_module_name: The name of the kernel module on which to operate
            page_cache: Page cache address space
        N)r   r   _page_cacher   r  
_idstorage)rB   r   r   r  s       rF   r=   zPageCache.__init__  s2     '9:%#55g?QRrG   rI   c              #      K   | j                   j                  | j                  j                        D ]*  }|s| j                  j                  d|d      }|s'| , yw)zRReturns all page cache contents

        Yields:
            Page objects
        r&   Tr3  N)r  rE  r  r
  r   r   )rB   	page_addrr&   s      rF   get_cached_pageszPageCache.get_cached_pages  sW      44T5E5E5M5MNI<<&&vi$&OD
 Os   AA A N)rJ   rK   rL   r   r   r   r   r   r   r   r=   r  r   rG   rF   r  r    sZ    &S##44S  S &&66	S"*"4"4"D"D rG   r  )"r]  rk  abcr   r   typingr   r   r   r   r	   volatility3r
   volatility3.frameworkr   r   r   r   volatility3.framework.objectsr   volatility3.framework.symbolsr   #volatility3.framework.symbols.linuxr   IntermediateSymbolTabler   configurationVersionableInterfacerQ   r   r  r  r   r  r   rG   rF   <module>r     s      # 9 9 ! L L 1 2 :7J!A!A 7JtlZ--BB l^p! p!f!.Y !.H`	 `F! !rG   