
    %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y)    N)List)
interfaces	renderers
exceptions	constants)requirements)plugins)utility)format_hints)linux)lsmodc                   d    e Zd ZdZdZedeej                  j                     fd       Z
d Zd Zy)	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   s]     ***?
 **U[[) ++!U-A-A9
 	
    c              #   >  K   | j                   j                  | j                  d      }t        j                  j                  | j                   |j                        }t        j                  j                  | j                   |j                  |      }	 |j                  d      j                  d      }|st        d      |j                  |j                   t"        j$                  z   dz   d      D ]  }	 t'        j(                  |j*                  j-                         |j.                  |j                   t"        j$                  z   dz   | j                         }|D ]  }|dk(  r	t'        j2                  |j                        }|j4                  j6                  j8                  }	t        j                  j;                  |||	      \  }
}d|t=        j>                  |	      |
|ff   y # t        j                  $ r d }Y Lw xY w# t        j0                  $ r Y )w xY ww)	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''DDLL',,
	!44]CHHUK z  &&%%	6E}
 	XC00HH((*''#55	FU LL	   Xa<..w||<"==,,88+0+?+?+U+UXx,([ 4!1!1(!;[+VWWX	X %% 	K	( :: sQ   BH G' 3A H4A#HBH'H <H?H  HHHHHc                     t        j                  dt        fdt        j                  fdt        fdt        fg| j                               S )NNameAddressModuleSymbol)r   TreeGridstrr   rE   rN   )rF   s    r%   runztty_check.runX   sI    !!L,,-33	 OO
 	
r'   N)__name__
__module____qualname____doc___required_framework_versionclassmethodr   r   configurationRequirementInterfacer&   rN   rV    r'   r%   r   r      sA    &"+
j&>&>&S&S!T 
 
.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      sK   
   N N < 4 1 8 / +			8	$N
'' N
r'   