9 | 9 |
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
10 | 10 |
--- a/setup.py
|
11 | 11 |
+++ b/setup.py
|
12 | |
@@ -31,67 +31,67 @@ import site
|
13 | |
IS_VIRTUAL_ENV = False
|
14 | |
|
15 | |
# Get packagesPaths depending on whether the user launched it with sudo or not
|
16 | |
-if sys.platform == 'win32':
|
17 | |
+#if sys.platform == 'win32':
|
18 | |
# This will throw two folders, but we need the first one only. Typically:
|
19 | |
# ['c:\\Users\\<a_user>\\AppData\\Roaming\\Python\\Python27\\site-packages']
|
20 | |
- packagesPaths = site.getusersitepackages()[0]
|
21 | |
- print "[*] The installation is going to be run as superuser."
|
22 | |
-else:
|
23 | |
+# packagesPaths = site.getusersitepackages()[0]
|
24 | |
+# print "[*] The installation is going to be run as superuser."
|
25 | |
+#else:
|
26 | |
# We need this verification because Windows does not have a wrapper ofr os.geteuid()
|
27 | |
- if not os.geteuid() == 0:
|
28 | |
- try:
|
29 | |
- packagesPaths = site.getusersitepackages()
|
30 | |
+# if not os.geteuid() == 0:
|
31 | |
+# try:
|
32 | |
+# packagesPaths = site.getusersitepackages()
|
33 | |
# TODO: Check whether the packagesPaths is in the PATH, if not, add it
|
34 | |
- print "[*] The installation has not been launched as superuser."
|
35 | |
- user_bin_path = site.USER_BASE + "/bin"
|
36 | |
- print "[*] We will verify is the '" + user_bin_path + "' folder is in the path so as to make the utils available anywhere in the system."
|
37 | |
- bin_path = os.popen("echo $PATH").read()
|
38 | |
- if user_bin_path in bin_path:
|
39 | |
- print "[*] Great. '" + user_bin_path + "' is in the path. No further actions needed."
|
40 | |
- else:
|
41 | |
- print "[*] We are manually adding the '" + user_bin_path + "' folder to the ~/.bashrc file."
|
42 | |
+# print "[*] The installation has not been launched as superuser."
|
43 | |
+# user_bin_path = site.USER_BASE + "/bin"
|
44 | |
+# print "[*] We will verify is the '" + user_bin_path + "' folder is in the path so as to make the utils available anywhere in the system."
|
45 | |
+# bin_path = os.popen("echo $PATH").read()
|
46 | |
+# if user_bin_path in bin_path:
|
47 | |
+# print "[*] Great. '" + user_bin_path + "' is in the path. No further actions needed."
|
48 | |
+# else:
|
49 | |
+# print "[*] We are manually adding the '" + user_bin_path + "' folder to the ~/.bashrc file."
|
50 | |
# Building the commands to be added to .bashrc
|
51 | |
- new_lines = """
|
52 | |
+# new_lines = """
|
53 | |
# Added by OSRFramework
|
54 | |
# ---------------------
|
55 | |
# Check this issue in Github for additional information about why these lines where added: <https://github.com/i3visio/osrframework/issues/187>
|
56 | |
|
57 | |
- export PY_USER_BIN= """ + user_bin_path + """
|
58 | |
- export PATH=$PATH:$PY_USER_BIN
|
59 | |
- """
|
60 | |
-
|
61 | |
- command = "echo '''" + new_lines + "''' >> ~/.bashrc"
|
62 | |
- print "[*] As we want to be transparent, the command that is being run is the following:\n" + command
|
63 | |
- a = os.popen(command).read()
|
64 | |
- except:
|
65 | |
- IS_VIRTUAL_ENV = True
|
66 | |
- else:
|
67 | |
+# export PY_USER_BIN= """ + user_bin_path + """
|
68 | |
+# export PATH=$PATH:$PY_USER_BIN
|
69 | |
+# """
|
70 | |
+
|
71 | |
+# command = "echo '''" + new_lines + "''' >> ~/.bashrc"
|
72 | |
+# print "[*] As we want to be transparent, the command that is being run is the following:\n" + command
|
73 | |
+# a = os.popen(command).read()
|
74 | |
+# except:
|
75 | |
+# IS_VIRTUAL_ENV = True
|
76 | |
+# else:
|
77 | |
# This will throw two folders, but we need the first one only:
|
78 | |
# ['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
|
79 | |
- packagesPaths = site.getsitepackages()[0]
|
80 | |
- print "[*] The installation is going to be run as superuser."
|
81 | |
+# packagesPaths = site.getsitepackages()[0]
|
82 | |
+# print "[*] The installation is going to be run as superuser."
|
83 | |
|
84 | |
-if not IS_VIRTUAL_ENV:
|
85 | |
- osrframeworkSystemPath = os.path.join(packagesPaths, "osrframework")
|
86 | |
+#if not IS_VIRTUAL_ENV:
|
87 | |
+# osrframeworkSystemPath = os.path.join(packagesPaths, "osrframework")
|
88 | |
|
89 | |
- print "[*] The chosen installation path is: " + osrframeworkSystemPath
|
90 | |
+# print "[*] The chosen installation path is: " + osrframeworkSystemPath
|
91 | |
|
92 | |
# Removing old installations first...
|
93 | |
- if os.path.isdir(osrframeworkSystemPath):
|
94 | |
- print "[!] Found an old installation at: " + osrframeworkSystemPath
|
95 | |
- try:
|
96 | |
- shutil.rmtree(osrframeworkSystemPath)
|
97 | |
- print "[*] Successfully removed the old installation. Installation will resume now to upgrade it..."
|
98 | |
- except Exception as e:
|
99 | |
- print str(e)
|
100 | |
- print "[E] The installed version of OSRFramework cannot be removed. Try to remove it manually in your python installation under 'local/lib/python2.7/dist-packages/'."
|
101 | |
- print sys.exit()
|
102 | |
- else:
|
103 | |
- print "[*] No OSRFramework installation found in the system."
|
104 | |
-else:
|
105 | |
- print "[*] OSRFramework seems to be installed using `virtualenv`."
|
106 | |
+# if os.path.isdir(osrframeworkSystemPath):
|
107 | |
+# print "[!] Found an old installation at: " + osrframeworkSystemPath
|
108 | |
+# try:
|
109 | |
+# shutil.rmtree(osrframeworkSystemPath)
|
110 | |
+# print "[*] Successfully removed the old installation. Installation will resume now to upgrade it..."
|
111 | |
+# except Exception as e:
|
112 | |
+# print str(e)
|
113 | |
+# print "[E] The installed version of OSRFramework cannot be removed. Try to remove it manually in your python installation under 'local/lib/python2.7/dist-packages/'."
|
114 | |
+# print sys.exit()
|
115 | |
+# else:
|
116 | |
+# print "[*] No OSRFramework installation found in the system."
|
117 | |
+#else:
|
118 | |
+# print "[*] OSRFramework seems to be installed using `virtualenv`."
|
119 | |
|
120 | |
-HERE = os.path.abspath(os.path.dirname(__file__))
|
121 | |
+#HERE = os.path.abspath(os.path.dirname(__file__))
|
122 | |
|
123 | |
# Importing the temporal scripts for the setup and taking the new version number
|
124 | |
import osrframework
|
125 | |
@@ -100,15 +100,15 @@ NEW_VERSION = osrframework.__version__
|
|
12 |
@@ -37,15 +37,15 @@ NEW_VERSION = osrframework.__version__
|
126 | 13 |
import osrframework.utils.configuration as configuration
|
127 | 14 |
|
128 | 15 |
# Depending on the place in which the project is going to be upgraded
|
|
147 | 34 |
|
148 | 35 |
# Reading the .md file
|
149 | 36 |
try:
|
150 | |
@@ -206,49 +206,49 @@ setup(
|
|
37 |
@@ -149,49 +149,49 @@ setup(
|
151 | 38 |
############################
|
152 | 39 |
### Creating other files ###
|
153 | 40 |
############################
|
154 | |
-print "[*] Changing permissions of the user folders..."
|
|
41 |
-print("[*] Changing permissions of the user folders...")
|
155 | 42 |
-try:
|
156 | 43 |
- configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
|
157 | 44 |
-except:
|
158 | |
+#print "[*] Changing permissions of the user folders..."
|
|
45 |
+#print("[*] Changing permissions of the user folders...")
|
159 | 46 |
+#try:
|
160 | 47 |
+# configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
|
161 | 48 |
+#except:
|
|
163 | 50 |
- pass
|
164 | 51 |
+# pass
|
165 | 52 |
|
166 | |
-print "[*] Copying relevant files..."
|
|
53 |
-print("[*] Copying relevant files...")
|
167 | 54 |
-files_to_copy= {
|
168 | 55 |
- paths["appPath"] : [
|
169 | 56 |
- os.path.join("config", "browser.cfg"),
|
|
182 | 69 |
- os.path.join("config", "plugins", "pattern.py.sample"),
|
183 | 70 |
- ]
|
184 | 71 |
-}
|
185 | |
+#print "[*] Copying relevant files..."
|
|
72 |
+#print("[*] Copying relevant files...")
|
186 | 73 |
+#files_to_copy= {
|
187 | 74 |
+# paths["appPath"] : [
|
188 | 75 |
+# os.path.join("config", "browser.cfg"),
|
|
204 | 91 |
|
205 | 92 |
# Iterating through all destinations to write the info
|
206 | 93 |
-for destiny in files_to_copy.keys():
|
207 | |
+#for destiny in files_to_copy.keys():
|
208 | |
# Grabbing each source file to be moved
|
|
94 |
- # Grabbing each source file to be moved
|
209 | 95 |
- for sourceFile in files_to_copy[destiny]:
|
210 | 96 |
- fileToMove = os.path.join(HERE,sourceFile)
|
211 | |
+# for sourceFile in files_to_copy[destiny]:
|
212 | |
+# fileToMove = os.path.join(HERE,sourceFile)
|
213 | |
|
214 | |
# Choosing the command depending on the SO
|
|
97 |
-
|
|
98 |
- cmd = ""
|
|
99 |
- # Choosing the command depending on the SO
|
215 | 100 |
- if sys.platform == 'win32':
|
216 | 101 |
- if os.path.isdir(fileToMove):
|
217 | 102 |
- cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e"
|
|
222 | 107 |
- cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
|
223 | 108 |
- else:
|
224 | 109 |
- cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
|
|
110 |
- output = os.popen(cmd).read()
|
|
111 |
+#for destiny in files_to_copy.keys():
|
|
112 |
+# # Grabbing each source file to be moved
|
|
113 |
+# for sourceFile in files_to_copy[destiny]:
|
|
114 |
+# fileToMove = os.path.join(HERE,sourceFile)
|
|
115 |
+#
|
|
116 |
+# cmd = ""
|
|
117 |
+# # Choosing the command depending on the SO
|
225 | 118 |
+# if sys.platform == 'win32':
|
226 | 119 |
+# if os.path.isdir(fileToMove):
|
227 | 120 |
+# cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e"
|
|
232 | 125 |
+# cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
|
233 | 126 |
+# else:
|
234 | 127 |
+# cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
|
235 | |
#print cmd
|
236 | |
- output = os.popen(cmd).read()
|
237 | 128 |
+# output = os.popen(cmd).read()
|