forked from k4yt3x/defense-matrix
/
defenseMatrix.py
executable file
·100 lines (78 loc) · 3.2 KB
/
defenseMatrix.py
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
d8888b. d88888b d88888b d88888b d8b db .d8888. d88888b
88 `8D 88' 88' 88' 888o 88 88' YP 88'
88 88 88ooooo 88ooo 88ooooo 88V8o 88 `8bo. 88ooooo
88 88 88~~~~~ 88~~~ 88~~~~~ 88 V8o88 `Y8b. 88~~~~~
88 .8D 88. 88 88. 88 V888 db 8D 88.
Y8888D' Y88888P YP Y88888P VP V8P `8888Y' Y88888P
.88b d88. .d8b. d888888b d8888b. d888888b db db
88'YbdP`88 d8' `8b `~~88~~' 88 `8D `88' `8b d8'
88 88 88 88ooo88 88 88oobY' 88 `8bd8'
88 88 88 88~~~88 88 88`8b 88 .dPYb.
88 88 88 88 88 88 88 `88. .88. .8P Y8.
YP YP YP YP YP YP 88 YD Y888888P YP YP
Name: K4YT3X
Fa11en
Date Created: September 16, 2017
Last Modified: March 18, 2018
Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt
(C) 2017 - 2018 K4YT3X
(C) 2017 fa11en
(C) 2017 Ivens Portugal
(C) 2017 Ahmed
"""
import argparse
import os
import sys
# Import Controller Packages
from install import Install
import avalon_framework as avalon
import securityAudit
VERSION = "1.0 alpha"
# -------------------------------- Functions --------------------------------
def processArguments():
"""
This function parses all arguments
"""
parser = argparse.ArgumentParser()
control_group = parser.add_argument_group('Controls')
control_group.add_argument("--enable", help="Enable DefenseMatrix", action="store_true", default=False)
control_group.add_argument("--disable", help="Disable DefenseMatrix", action="store_true", default=False)
control_group.add_argument("--audit", help="Run system security audit", action="store_true", default=False)
inst_group = parser.add_argument_group('Installation')
inst_group.add_argument("--install", help="Install DefenseMatrix Automatically", action="store_true", default=False)
inst_group.add_argument("--uninstall", help="Uninstall DefenseMatrix Automatically", action="store_true", default=False)
inst_group.add_argument("--upgrade", help="Check DefenseMatrix & AVALON Framework Updates", action="store_true", default=False)
etc = parser.add_argument_group('Extra')
etc.add_argument("--version", help="Show DefenseMatrix version and exit", action="store_true", default=False)
if len(sys.argv) == 1:
parser.print_help(sys.stderr)
sys.exit(1)
return parser.parse_args()
# -------------------------------- Procedural --------------------------------
args = processArguments()
if args.version: # prints program legal / dev / version info
print("Current Version: " + VERSION)
print("Author: K4YT3X")
print("License: GNU GPL v3")
print("Github Page: https://github.com/K4YT3X/DefenseMatrix")
print("Contact: k4yt3x@protonmail.com")
print()
exit(0)
if os.getuid() != 0:
avalon.error("This app requires root privilege to run!")
exit(0)
try:
if args.install:
installer = Install()
installer.install()
elif args.uninstall:
uninstaller = Install()
uninstaller.uninstall()
elif args.audit:
securityAudit.audit()
except KeyboardInterrupt:
avalon.warning("Aborting")