~apparmor-dev/apparmor/master

« back to all changes in this revision

Viewing changes to utils/aa-audit

  • Committer: Steve Beattie
  • Date: 2019-02-19 09:38:13 UTC
  • Revision ID: sbeattie@ubuntu.com-20190219093813-ud526ee6hwn8nljz
The AppArmor project has been converted to git and is now hosted on
gitlab.

To get the converted repository, please do
  git clone https://gitlab.com/apparmor/apparmor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/python3
2
 
# ----------------------------------------------------------------------
3
 
#    Copyright (C) 2013 Kshitij Gupta <kgupta8592@gmail.com>
4
 
#
5
 
#    This program is free software; you can redistribute it and/or
6
 
#    modify it under the terms of version 2 of the GNU General Public
7
 
#    License as published by the Free Software Foundation.
8
 
#
9
 
#    This program is distributed in the hope that it will be useful,
10
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
#    GNU General Public License for more details.
13
 
#
14
 
# ----------------------------------------------------------------------
15
 
import argparse
16
 
 
17
 
import apparmor.tools
18
 
 
19
 
# setup exception handling
20
 
from apparmor.fail import enable_aa_exception_handler
21
 
enable_aa_exception_handler()
22
 
 
23
 
# setup module translations
24
 
from apparmor.translations import init_translation
25
 
_ = init_translation()
26
 
 
27
 
parser = argparse.ArgumentParser(description=_('Switch the given programs to audit mode'))
28
 
parser.add_argument('-d', '--dir', type=str, help=_('path to profiles'))
29
 
parser.add_argument('-r', '--remove', action='store_true', help=_('remove audit mode'))
30
 
parser.add_argument('program', type=str, nargs='+', help=_('name of program'))
31
 
parser.add_argument('--no-reload', dest='do_reload', action='store_false', default=True, help=_('Do not reload the profile after modifying it'))
32
 
args = parser.parse_args()
33
 
 
34
 
tool = apparmor.tools.aa_tools('audit', args)
35
 
 
36
 
tool.cmd_audit()
37