
    %fe                         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 d d	lmZ  e j        e          Z G d
 dej                  ZdS )    N)List)
interfaces	renderers
exceptions	constants)requirements)plugins)utility)format_hints)linux)lsmodc                   ^    e Zd ZdZdZedeej        j	                 fd            Z
d Zd ZdS )	tty_checkzChecks tty devices for hooks   r   r   returnc                     t          j        ddg d          t          j        dt          j        d          t          j        dt          j        d	          gS )
NkernelzLinux kernel)Intel32Intel64AArch64)namedescriptionarchitecturesr   r   )r   pluginversion
linuxutils)r   	componentr   )r   ModuleRequirementPluginRequirementr   LsmodVersionRequirementr   LinuxUtilities)clss    _/home/panchajanya/Development/work/volatility3/volatility3/framework/plugins/linux/tty_check.pyget_requirementsztty_check.get_requirements   ss     **???  
 *U[)   +!U-A9  
 	
    c              #     K   | j         j        | j        d                  }t          j                            | j         |j                  }t          j        	                    | j         |j        |          }	 |
                    d                              d          }n# t          j        $ r d }Y nw xY w|st          d          |                    |j        t"          j        z   dz   d          D ]}	 t'          j        |j                                        |j        |j        t"          j        z   dz   | j                   }n# t          j        $ r Y cw xY w|D ]s}|dk    r	t'          j        |j                  }|j        j        j        }	t          j                            |||	          \  }
}d|t=          j        |	          |
|ffV  td S )	Nr   tty_drivers	list_headzThis plugin requires the tty_drivers 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.
tty_driver
tty_struct)countsubtypecontextr   ) r/   modulesconfigr   r!   list_modulesr   r   r#   generate_kernel_handler_infoobject_from_symbolcastr   SymbolError	TypeErrorto_listsymbol_table_namer   BANGr
   array_of_pointersttysdereferencenumPagedInvalidAddressExceptionarray_to_stringldiscopsreceive_buflookup_module_addressr   Hex)selfvmlinuxr0   handlersr)   ttyr<   tty_devr   recv_bufmodule_namesymbol_names               r%   
_generatorztty_check._generator(   s     ,&t{8'<=+**4<FF'DDL',
 
	!44]CCHHUUKK% 	 	 	KKK	  	z   &&%	6E}
 
 	X 	XC0H((**'#5	FU L	   :      X Xa<<.w|<<"=,8+0+?+U+UXx, ,([ 4!1(!;!;[+VWWWWWX	X 	Xs%   6(B B32B35AEEEc                     t          j        dt          fdt          j        fdt          fdt          fg|                                           S )NNameAddressModuleSymbol)r   TreeGridstrr   rE   rN   )rF   s    r%   runztty_check.runX   sK    !L,-33	 OO
 
 	
r'   N)__name__
__module____qualname____doc___required_framework_versionclassmethodr   r   configurationRequirementInterfacer&   rN   rV    r'   r%   r   r      sr        &&"+
j&>&S!T 
 
 
 [
.X .X .X`	
 	
 	
 	
 	
r'   r   )loggingtypingr   volatility3.frameworkr   r   r   r   #volatility3.framework.configurationr    volatility3.framework.interfacesr	   volatility3.framework.objectsr
   volatility3.framework.renderersr   volatility3.framework.symbolsr   volatility3.plugins.linuxr   	getLoggerrW   vollogPluginInterfacer   r_   r'   r%   <module>rl      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	$	$N
 N
 N
 N
 N
' N
 N
 N
 N
 N
r'   