コード例 #1
0
    def AASetup(self):
        # Redirect sys.stdout to a buffer
        sys.stdout = io.StringIO()

        global _, debug_logger

        enable_aa_exception_handler()
        _ = init_translation()
        atexit.register(aa.on_exit)
        debug_logger = DebugLogger('Test AA')
        debug_logger.debug('Starting test')
コード例 #2
0
ファイル: signal.py プロジェクト: youngker/apparmor
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
# ----------------------------------------------------------------------

import re

from apparmor.regex import RE_PROFILE_SIGNAL, RE_PROFILE_NAME
from apparmor.common import AppArmorBug, AppArmorException
from apparmor.rule import BaseRule, BaseRuleset, check_and_split_list, logprof_value_or_all, parse_modifiers, quote_if_needed

# setup module translations
from apparmor.translations import init_translation
_ = init_translation()

access_keywords_read = ['receive', 'r', 'read']
access_keywords_write = ['send', 'w', 'write']
access_keywords_rw = ['rw', 'wr']
access_keywords = access_keywords_read + access_keywords_write + access_keywords_rw

signal_keywords = [
    'hup', 'int', 'quit', 'ill', 'trap', 'abrt', 'bus', 'fpe', 'kill', 'usr1',
    'segv', 'usr2', 'pipe', 'alrm', 'term', 'stkflt', 'chld', 'cont', 'stop',
    'stp', 'ttin', 'ttou', 'urg', 'xcpu', 'xfsz', 'vtalrm', 'prof', 'winch',
    'io', 'pwr', 'sys', 'emt', 'exists'
]
RE_SIGNAL_REALTIME = re.compile(
    '^rtmin\+0*([0-9]|[12][0-9]|3[0-2])$'
)  # rtmin+0..rtmin+32, number may have leading zeros
コード例 #3
0
ファイル: ui.py プロジェクト: crossbuild/apparmor
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
# ----------------------------------------------------------------------
import sys
import re
import readline
from apparmor.yasti import yastLog, SendDataToYast, GetDataFromYast

from apparmor.common import readkey, AppArmorException, DebugLogger

# setup module translations
from apparmor.translations import init_translation
_ = init_translation()

# Set up UI logger for separate messages from UI module
debug_logger = DebugLogger('UI')

# The operating mode: yast or text, text by default
UI_mode = 'text'

# If Python3, wrap input in raw_input so make check passes
if not 'raw_input' in dir(__builtins__): raw_input = input

ARROWS = {'A': 'UP', 'B': 'DOWN', 'C': 'RIGHT', 'D': 'LEFT'}

def getkey():
    key = readkey()
    if key == '\x1B':