forked from saeeddhqan/Maryam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaryam
executable file
·77 lines (65 loc) · 2.14 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/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.0'
import sys
import platform
import argparse
# Check the OS
if platform.system() not in ('Linux', 'Darwin', 'OSX', "FreeBSD"):
print('[!] This tool is designed for Linux, Darwin, OSX, and FreeBSD. Maybe not work!')
# Check the version
if sys.version_info.major != 3:
print('[!] Maryam migrated to python3.')
exit(0)
# Import framework
from core import initial
def cui(args, format_help):
x = initial.initialize
if args:
option = args[0]
if option in ['-v', '--version']:
print(f"OWASP MARYAM V.{__VERSION__}")
exit(0)
command = ' '.join(args[1:])
if not v or option not in ['-e', '--execute', '-s', '--start']:
print(format_help)
exit(0)
x = x('execute')
if option in ['-e', '--execute']:
x.onecmd(command)
exit(0)
elif args[0] in ['-s', '--start']:
x.onecmd(command)
else:
x = x('run')
while True:
try:
x.cmdloop()
break
except KeyboardInterrupt:
print('\n[!] Use exit command to exit ')
except Exception as e:
raise e
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 = sys.argv[1:]
for k, v in enumerate(argv):
if ' ' in v:
argv[k] = f'"{v}"'
cui(argv, format_help)