ok
Direktori : /usr/lib64/python2.7/site-packages/sepolgen/ |
Current File : //usr/lib64/python2.7/site-packages/sepolgen/audit.pyo |
� ��^c @ sL d d l Z d d l Z d d l m Z d d l m Z d d l m Z d � Z d � Z d � Z d f d � � YZ d e f d � � YZ d e f d � � YZ d d l j Z i Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d f d � � YZ d f d � � YZ d f d � � YZ d S( i����Ni ( t refpolicy( t access( t utilc C s� d d l } d d l } t d d � } t | j � j � d � } | j | j | j � | � } | j d | � } | j d | � } | j d d d d | | g d | j �j � d } t j r� t j | � } n | S( s Obtain all of the avc and policy load messages from the audit log. This function uses ausearch and requires that the current process have sufficient rights to run ausearch. Returns: string contain all of the audit messages returned by ausearch. i����Ns /proc/uptimet ri s %xs %Xs /sbin/ausearchs -ms5 AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERRs -tst stdout( t subprocesst timet opent floatt readt splitt closet localtimet strftimet Popent PIPEt communicateR t PY3t decode_input( R R t fdt offt st bootdatet boottimet output( ( s4 /usr/lib64/python2.7/site-packages/sepolgen/audit.pyt get_audit_boot_msgs s c C sV d d l } | j d d d g d | j �j � d } t j rR t j | � } n | S( s Obtain all of the avc and policy load messages from the audit log. This function uses ausearch and requires that the current process have sufficient rights to run ausearch. Returns: string contain all of the audit messages returned by ausearch. i����Ns /sbin/ausearchs -ms5 AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERRR i ( R R R R R R R ( R R ( ( s4 /usr/lib64/python2.7/site-packages/sepolgen/audit.pyt get_audit_msgs2 s c C sP d d l } | j d g d | j �j � d } t j rL t j | � } n | S( s� Obtain all of the avc and policy load messages from /bin/dmesg. Returns: string contain all of the audit messages returned by dmesg. i����Ns /bin/dmesgR i ( R R R R R R R ( R R ( ( s4 /usr/lib64/python2.7/site-packages/sepolgen/audit.pyt get_dmesg_msgsA s t AuditMessagec B s e Z d Z d � Z d � Z RS( s� Base class for all objects representing audit messages. AuditMessage is a base class for all audit messages and only provides storage for the raw message (as a string) and a parsing function that does nothing. c C s | | _ d | _ d S( Nt ( t messaget header( t selfR ( ( s4 /usr/lib64/python2.7/site-packages/sepolgen/audit.pyt __init__W s c C sz xs | D]k } | j d � } t | � d k rQ | d d k r | | _ d Sq n | d d k r | d | _ d Sq Wd S( s� Parse a string that has been split into records by space into an audit message. This method should be overridden by subclasses. Error reporting should be done by raise ValueError exceptions. t =i i s audit(Ni t msgi ( R t lenR ( R t recsR# t fields( ( s4 /usr/lib64/python2.7/site-packages/sepolgen/audit.pyt from_split_string[ s ( t __name__t __module__t __doc__R! R'