forked from saeeddhqan/Maryam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaryam
executable file
·62 lines (53 loc) · 1.88 KB
/
maryam
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
#!/usr/bin/env python3
"""
OWASP Maryam!
This program 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 3 of the License, or
any later version.
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
__VERSION__ = '2.0.5'
import sys
import argparse
# Import framework
from core import initial
def cui(args, format_help):
core = initial.initialize
if args:
option = args[0]
if option in ['-v', '--version']:
print(f"OWASP MARYAM V.{__VERSION__}")
exit(0)
if not option or option not in ['-e', '--execute', '-s', '--start']:
print(format_help)
exit(0)
core = core('execute')
if option in ['-e', '--execute', '-s', '--start']:
core.onecmd(' '.join(args[1:]))
if option in ['-e', '--execute']:
exit(0)
else:
core = core('run')
while True:
try:
core.cmdloop()
break
except KeyboardInterrupt:
print('\n[!] Use exit command to exit')
except Exception as e:
raise e
if __name__ == '__main__':
desc = 'maryam -h'
parse = argparse.ArgumentParser(description=desc)
parse.add_argument('-e', help='execute a command and exit', metavar='execute', dest='execute', action='store')
parse.add_argument('-s', help='run a command without exit', metavar='start', dest='start', action='store')
parse.add_argument('-v', help='show version and exit', action='version', version=f"OWASP MARYAM V.{__VERSION__}")
format_help = parse.format_help()
argv = [f'"{arg}"' if ' ' in arg else arg for arg in sys.argv[1:]]
cui(argv, format_help)