This repository has been archived by the owner on Jun 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
apol
executable file
·66 lines (55 loc) · 2.11 KB
/
apol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
# Copyright 2015, Tresys Technology, LLC
#
# This file is part of SETools.
#
# SETools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# SETools 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.
#
# You should have received a copy of the GNU General Public License
# along with SETools. If not, see <http://www.gnu.org/licenses/>.
#
import sys
import argparse
import logging
from PyQt5.QtWidgets import QApplication
import setools
import setoolsgui
parser = argparse.ArgumentParser(description="Graphical SELinux policy analysis tool.")
parser.add_argument("--version", action="version", version=setools.__version__)
parser.add_argument("policy", nargs="?",
help="Path to the SELinux policy to analyze.")
parser.add_argument("-v", "--verbose", action="store_true",
help="Print extra informational messages")
parser.add_argument("--debug", action="store_true", dest="debug", help="Enable debugging.")
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG, filename="/dev/null")
console_handler = logging.StreamHandler()
if args.debug:
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(
logging.Formatter('%(asctime)s|%(levelname)s|%(name)s|%(message)s'))
elif args.verbose:
console_handler.setLevel(logging.INFO)
console_handler.setFormatter(logging.Formatter('%(message)s'))
else:
console_handler.setLevel(logging.WARNING)
console_handler.setFormatter(logging.Formatter('%(message)s'))
logging.getLogger().addHandler(console_handler)
try:
app = QApplication(sys.argv)
mainwindow = setoolsgui.ApolMainWindow(args.policy)
sys.exit(app.exec_())
except Exception as err:
if args.debug:
raise
else:
print(err)
sys.exit(1)