-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.py
94 lines (86 loc) · 3.53 KB
/
installer.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
#!/usr/bin/env python
'''
OWASP ZSC
https://www.owasp.org/index.php/OWASP_ZSC_Tool_Project
https://github.com/zscproject/OWASP-ZSC
http://api.z3r0d4y.com/
https://groups.google.com/d/forum/owasp-zsc [ owasp-zsc[at]googlegroups[dot]com ]
'''
import os
import sys
from core import start
from core import color
#start.logo()
def check_prv():
try:
if os.geteuid() is not 0:
sys.exit(color.color('red') +
'Sorry, you most run this file as root.' + color.color(
'reset'))
except AttributeError:
import ctypes
if ctypes.windll.shell32.IsUserAnAdmin() != 1:
sys.exit(color.color('red') +
'Sorry, you most run this file as admin.' + color.color(
'reset'))
def linux():
check_prv()
executor = '''#!/bin/bash\npython /usr/share/owasp_zsc/zsc.py "$@"'''
print(color.color('cyan') + 'Building Commandline')
commandline = open('/usr/bin/zsc', 'w')
commandline.write(executor)
commandline.close()
print(color.color('green') + 'Copying Files' + color.color('white'))
os.system(
'rm -rf /usr/share/owasp_zsc && mkdir /usr/share/owasp_zsc && cp -r * /usr/share/owasp_zsc/ && chmod +x /usr/share/owasp_zsc/zsc.py && chmod +x /usr/bin/zsc')
print(
color.color('yellow') +
'\nNow you can remove this folder\nfiles copied in /usr/share/owasp_zsc.\nto run zcr shellcoder please use "zsc" command line\n'
+ color.color('reset'))
def osx():
check_prv()
executor = '''#!/bin/bash\npython /usr/local/share/owasp_zsc/zsc.py "$@"'''
print(color.color('cyan') + 'Building Commandline')
commandline = open('/usr/local/bin/zsc', 'w')
commandline.write(executor)
commandline.close()
print(color.color('green') + 'Copying Files' + color.color('white'))
os.system(
'rm -rf /usr/local/share/owasp_zsc && mkdir /usr/local/share/owasp_zsc && cp -r * /usr/local/share/owasp_zsc/ && chmod +x /usr/local/share/owasp_zsc/zsc.py && chmod +x /usr/local/bin/zsc')
print(
color.color('yellow') +
'\nNow you can remove this folder\nfiles copied in /usr/local/share/owasp_zsc.\nto run zcr shellcoder please use "zsc" command line\n'
+ color.color('reset'))
def windows():
#check_prv()
installing_path = str(sys.prefix) + str('\\Scripts\\zsc')
try:
os.mkdir(installing_path)
except:
pass
print(color.color('green') + 'Copying Files' + color.color('white'))
tmp_copy = os.popen('xcopy /y /s /i . %s' % installing_path).read()
print(color.color('cyan') + 'Building Commandline')
tmp_add_command_line = open('%s\\..\\zsc.bat' % installing_path, 'w')
tmp_add_command_line.write('@echo off\npython %s\\zsc.py %%*' %
installing_path)
tmp_add_command_line.close()
print(
color.color('yellow') +
'\nNow you can remove this folder\nfiles copied in %s.\nto run zcr shellcoder please use "zsc" command line\nNOTE: IF COMMAND LINE "zsc" NOT FOUND, PLEASE RE-OPEN YOUR CMD!\n'
% installing_path + color.color('reset'))
if 'linux' in sys.platform:
os.system('clear')
linux()
elif 'darwin' in sys.platform:
os.system('clear')
osx()
elif 'win32' in sys.platform or 'win64' in sys.platform:
os.system('cls')
windows()
else:
sys.exit(
color.color('red') +
'OWASP ZSC currently supports install on windows/linux/osx only, for other platforms please copy source files to a directory and run'
+ color.color('reset'))
start.sig()