Current File : //lib/python3.9/site-packages/sepolgen/__pycache__/audit.cpython-39.pyc |
a
z
f�U � @ s� d dl Z d dlZddlmZ ddlmZ ddlmZ dd� Zdd � Zd
d� ZG dd
� d
�Z G dd� de �Z
G dd� de �Zd dlm
Z
i ZG dd� de �ZG dd� de �ZG dd� de �ZG dd� de �ZG dd� d�ZG dd� d�ZG dd� d�ZdS ) � N� )� refpolicy)�access)�utilc C s� ddl } ddl}tdd�}t|�� �� d �}|j |�|�� | �}|�d|�}|�d|�}| j ddd d
||g| j
d��� d }tj
r�t�|�}|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.
r Nz/proc/uptime�rz%xz%X�/sbin/ausearch�-m�5AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERRz-ts��stdout)�
subprocess�time�open�float�read�split�close� localtime�strftime�Popen�PIPE�communicater �PY3�decode_input)r
r �fdZoff�sZbootdateZboottime�output� r �2/usr/lib/python3.9/site-packages/sepolgen/audit.py�get_audit_boot_msgs s
��
r c C s8 ddl } | jg d�| jd��� d }tjr4t�|�}|S )r r N)r r r
r �r
r r r r r r �r
r r r r �get_audit_msgs2 s
��
r# c C s6 ddl } | jdg| jd��� d }tjr2t�|�}|S )z�Obtain all of the avc and policy load messages from /bin/dmesg.
Returns:
string contain all of the audit messages returned by dmesg.
r Nz
/bin/dmesgr r! r"