5 | 5 |
Last-Update: 2016-08-18
|
6 | 6 |
---
|
7 | 7 |
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
8 | |
--- a/faraday.py
|
9 | |
+++ b/faraday.py
|
10 | |
@@ -198,44 +198,6 @@ def query_user_bool(question, default=Tr
|
11 | |
"(or 'y' or 'n').\n")
|
12 | |
|
13 | |
|
14 | |
-def checkDependencies():
|
15 | |
- """Dependency resolver based on a previously specified CONST_REQUIREMENTS_FILE.
|
16 | |
-
|
17 | |
- Currently checks a list of dependencies from a file and asks for user
|
18 | |
- confirmation on whether to install it with a specific version or not.
|
19 | |
-
|
20 | |
- """
|
21 | |
-
|
22 | |
- if not args.ignore_deps:
|
23 | |
- try:
|
24 | |
- import pip
|
25 | |
- modules = []
|
26 | |
- f = open(FARADAY_REQUIREMENTS_FILE)
|
27 | |
- for line in f:
|
28 | |
- if not line.find('#'):
|
29 | |
- break
|
30 | |
- else:
|
31 | |
- modules.append(line.strip('\n'))
|
32 | |
- f.close()
|
33 | |
- pip_dist = [dist.project_name.lower() for dist in pip.get_installed_distributions()]
|
34 | |
- for module in modules:
|
35 | |
- if module.lower() not in pip_dist:
|
36 | |
- try:
|
37 | |
- __import__(module)
|
38 | |
- except ImportError:
|
39 | |
- if query_user_bool("Missing module %s."
|
40 | |
- " Do you wish to install it?" % module):
|
41 | |
- pip.main(['install', "%s" %
|
42 | |
- module, '--user'])
|
43 | |
-
|
44 | |
- else:
|
45 | |
- return False
|
46 | |
- except ImportError:
|
47 | |
- pass
|
48 | |
-
|
49 | |
- return True
|
50 | |
-
|
51 | |
-
|
52 | |
def startProfiler(app, output, depth):
|
53 | |
"""Profiler handler.
|
54 | |
|
55 | |
@@ -469,27 +431,6 @@ def update():
|
56 | |
logger.info("Update process finished with no errors")
|
57 | |
logger.info("Faraday will start now.")
|
58 | |
|
59 | |
-def checkUpdates():
|
60 | |
- import requests
|
61 | |
- uri = getInstanceConfiguration().getUpdatesUri()
|
62 | |
- resp = u"OK"
|
63 | |
- try:
|
64 | |
- f = open(FARADAY_VERSION_FILE)
|
65 | |
-
|
66 | |
- getInstanceConfiguration().setVersion(f.read().strip())
|
67 | |
- getInstanceConfiguration().setAppname("Faraday - Penetration Test IDE Community")
|
68 | |
- parameter = {"version": getInstanceConfiguration().getVersion()}
|
69 | |
-
|
70 | |
- f.close()
|
71 | |
- resp = requests.get(uri, params=parameter, timeout=1, verify=True)
|
72 | |
- resp = resp.text.strip()
|
73 | |
- except Exception as e:
|
74 | |
- logger.error(e)
|
75 | |
- if not resp == u'OK':
|
76 | |
- logger.info("You have available updates. Run ./faraday.py --update to catchup!")
|
77 | |
- else:
|
78 | |
- logger.info("No updates available, enjoy Faraday.")
|
79 | |
-
|
80 | |
|
81 | |
def checkCouchUrl():
|
82 | |
import requests
|
83 | |
@@ -506,23 +447,6 @@ def checkCouchUrl():
|
84 | |
# Non fatal error
|
85 | |
pass
|
86 | |
|
87 | |
-def checkVersion():
|
88 | |
- try:
|
89 | |
- f = open(FARADAY_VERSION_FILE)
|
90 | |
- f_version = f.read().strip()
|
91 | |
- if not args.update:
|
92 | |
- if getInstanceConfiguration().getVersion() != None and getInstanceConfiguration().getVersion() != f_version:
|
93 | |
- logger.warning("You have different version of Faraday since your last run.\nRun ./faraday.py --update to update configuration!")
|
94 | |
- if query_yes_no('Do you want to close Faraday?', 'yes'):
|
95 | |
- sys.exit(-1)
|
96 | |
-
|
97 | |
- getInstanceConfiguration().setVersion(f_version)
|
98 | |
- f.close()
|
99 | |
-
|
100 | |
- except Exception as e:
|
101 | |
- getLogger("launcher").error("It seems that something's wrong with your version\nPlease contact customer support")
|
102 | |
- sys.exit(-1)
|
103 | |
-
|
104 | |
|
105 | |
def init():
|
106 | |
"""Initializes what is needed before starting.
|
107 | |
@@ -550,20 +474,20 @@ def main():
|
108 | |
os.chdir(FARADAY_BASE)
|
109 | |
|
110 | |
init()
|
111 | |
- if checkDependencies():
|
112 | |
- printBanner()
|
113 | |
- logger.info("Dependencies met.")
|
114 | |
- if args.cert_path:
|
115 | |
- os.environ[REQUESTS_CA_BUNDLE_VAR] = args.cert_path
|
116 | |
- checkConfiguration(args.gui)
|
117 | |
- setConf()
|
118 | |
- checkCouchUrl()
|
119 | |
- checkVersion()
|
120 | |
- update()
|
121 | |
- checkUpdates()
|
122 | |
- startFaraday()
|
123 | |
- else:
|
124 | |
- logger.error("Dependencies not met. Unable to start Faraday.")
|
125 | |
+# if checkDependencies():
|
126 | |
+ printBanner()
|
127 | |
+ # logger.info("Dependencies met.")
|
128 | |
+ if args.cert_path:
|
129 | |
+ os.environ[REQUESTS_CA_BUNDLE_VAR] = args.cert_path
|
130 | |
+ checkConfiguration(args.gui)
|
131 | |
+ setConf()
|
132 | |
+ checkCouchUrl()
|
133 | |
+# checkVersion()
|
134 | |
+ update()
|
135 | |
+# checkUpdates()
|
136 | |
+ startFaraday()
|
137 | |
+# else:
|
138 | |
+# logger.error("Dependencies not met. Unable to start Faraday.")
|
139 | |
|
140 | |
|
141 | |
if __name__ == '__main__':
|
142 | 8 |
--- a/faraday-server.py
|
143 | 9 |
+++ b/faraday-server.py
|
144 | |
@@ -11,7 +11,6 @@ import server.config
|
|
10 |
@@ -11,7 +11,7 @@ import server.config
|
145 | 11 |
import server.couchdb
|
146 | |
|
|
12 |
import server.utils.logger
|
147 | 13 |
from server.utils import daemonize
|
148 | |
-from utils.dependencies import DependencyChecker
|
|
14 |
-from utils import dependencies
|
|
15 |
+#from utils import dependencies
|
149 | 16 |
from utils.user_input import query_yes_no
|
150 | 17 |
|
151 | 18 |
logger = server.utils.logger.get_logger(__name__)
|
152 | |
@@ -57,42 +56,12 @@ def setup_environment():
|
|
19 |
@@ -21,28 +21,28 @@ def setup_environment(check_deps=False):
|
153 | 20 |
# Configuration files generation
|
154 | 21 |
server.config.copy_default_config_to_local()
|
155 | 22 |
|
156 | |
- # Dependencies installation
|
157 | |
- missing_packages = check_dependencies()
|
158 | |
- if len(missing_packages) > 0:
|
159 | |
- install_packages(missing_packages)
|
160 | |
-
|
|
23 |
- if check_deps:
|
|
24 |
+# if check_deps:
|
|
25 |
|
|
26 |
# Check dependencies
|
|
27 |
- installed_deps, missing_deps = dependencies.check_dependencies(
|
|
28 |
- requirements_file=server.config.REQUIREMENTS_FILE)
|
|
29 |
-
|
|
30 |
- logger.info("Checking dependencies...")
|
|
31 |
-
|
|
32 |
- if missing_deps:
|
|
33 |
-
|
|
34 |
- install_deps = query_yes_no("Do you want to install them?", default="no")
|
|
35 |
-
|
|
36 |
- if install_deps:
|
|
37 |
- dependencies.install_packages(missing_deps)
|
|
38 |
- logger.info("Dependencies installed. Please launch Faraday Server again.")
|
|
39 |
- sys.exit(0)
|
|
40 |
- else:
|
|
41 |
- logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
|
|
42 |
- ", ".join(missing_deps))
|
|
43 |
- sys.exit(1)
|
|
44 |
-
|
|
45 |
- logger.info("Dependencies met")
|
|
46 |
+# installed_deps, missing_deps = dependencies.check_dependencies(
|
|
47 |
+# requirements_file=server.config.REQUIREMENTS_FILE)
|
|
48 |
+#
|
|
49 |
+# logger.info("Checking dependencies...")
|
|
50 |
+#
|
|
51 |
+# if missing_deps:
|
|
52 |
+#
|
|
53 |
+# install_deps = query_yes_no("Do you want to install them?", default="no")
|
|
54 |
+#
|
|
55 |
+# if install_deps:
|
|
56 |
+# dependencies.install_packages(missing_deps)
|
|
57 |
+# logger.info("Dependencies installed. Please launch Faraday Server again.")
|
|
58 |
+# sys.exit(0)
|
|
59 |
+# else:
|
|
60 |
+# logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
|
|
61 |
+# ", ".join(missing_deps))
|
|
62 |
+# sys.exit(1)
|
|
63 |
+#
|
|
64 |
+# logger.info("Dependencies met")
|
|
65 |
|
161 | 66 |
# Web configuration file generation
|
162 | 67 |
server.config.gen_web_config()
|
163 | |
|
164 | |
# Reports DB creation
|
165 | |
server.couchdb.push_reports()
|
166 | |
|
167 | |
-def check_dependencies():
|
168 | |
- checker = DependencyChecker(server.config.REQUIREMENTS_FILE)
|
169 | |
- missing = checker.check_dependencies()
|
170 | |
- return missing
|
171 | |
-
|
172 | |
-def install_packages(packages):
|
173 | |
- if ask_to_install(packages):
|
174 | |
- logger.info("Dependencies installed. Please launch Faraday Server again")
|
175 | |
- sys.exit(0)
|
176 | |
- else:
|
177 | |
- logger.error("Dependencies not met")
|
178 | |
- sys.exit(1)
|
179 | |
-
|
180 | |
-def ask_to_install(missing_packages):
|
181 | |
- logger.warning("The following packages are not installed:")
|
182 | |
- for package in missing_packages:
|
183 | |
- logger.warning("%s" % package)
|
184 | |
-
|
185 | |
- if query_yes_no("Do you want to install them?", default="no"):
|
186 | |
- checker = DependencyChecker(server.config.REQUIREMENTS_FILE)
|
187 | |
- checker.install_packages(missing_packages)
|
188 | |
- return True
|
189 | |
-
|
190 | |
- return False
|
191 | |
-
|
192 | |
def import_workspaces():
|
193 | |
import server.importer
|
194 | |
server.importer.import_workspaces()
|
|
68 |
@@ -92,7 +92,7 @@ def main():
|
|
69 |
parser.add_argument('--debug', action='store_true', help='run Faraday Server in debug mode')
|
|
70 |
parser.add_argument('--start', action='store_true', help='run Faraday Server in background')
|
|
71 |
parser.add_argument('--stop', action='store_true', help='stop Faraday Server')
|
|
72 |
- parser.add_argument('--nodeps', action='store_true', help='Skip dependency check')
|
|
73 |
+# parser.add_argument('--nodeps', action='store_true', help='Skip dependency check')
|
|
74 |
parser.add_argument('--no-setup', action='store_true', help=argparse.SUPPRESS)
|
|
75 |
args = parser.parse_args()
|
|
76 |
|
|
77 |
@@ -110,7 +110,7 @@ def main():
|
|
78 |
server.config.ssl.set('enabled', 'true')
|
|
79 |
|
|
80 |
if not args.no_setup:
|
|
81 |
- setup_environment(not args.nodeps)
|
|
82 |
+ setup_environment()
|
|
83 |
import_workspaces()
|
|
84 |
|
|
85 |
if args.start:
|
195 | 86 |
--- a/updates/updater.py
|
196 | 87 |
+++ b/updates/updater.py
|
197 | 88 |
@@ -24,19 +24,19 @@ from persistence.server.models import cr
|
|
226 | 117 |
|
227 | 118 |
|
228 | 119 |
# logger.info('Upgrading DBs to latest version')
|
|
120 |
--- a/faraday.py
|
|
121 |
+++ b/faraday.py
|
|
122 |
@@ -18,7 +18,7 @@ import sys
|
|
123 |
|
|
124 |
from config.configuration import getInstanceConfiguration
|
|
125 |
from config.globals import *
|
|
126 |
-from utils import dependencies
|
|
127 |
+#from utils import dependencies
|
|
128 |
from utils.logs import getLogger, setUpLogger
|
|
129 |
from utils.profilehooks import profile
|
|
130 |
from utils.user_input import query_yes_no
|
|
131 |
@@ -121,11 +121,11 @@ def getParserArgs():
|
|
132 |
default=False,
|
|
133 |
help="Enable dev mode. This will use the user config and plugin folder.")
|
|
134 |
|
|
135 |
- parser.add_argument('--ignore-deps',
|
|
136 |
- action="store_true",
|
|
137 |
- dest="ignore_deps",
|
|
138 |
- default=False,
|
|
139 |
- help="Ignore python dependencies resolution.")
|
|
140 |
+# parser.add_argument('--ignore-deps',
|
|
141 |
+# action="store_true",
|
|
142 |
+# dest="ignore_deps",
|
|
143 |
+# default=False,
|
|
144 |
+# help="Ignore python dependencies resolution.")
|
|
145 |
|
|
146 |
parser.add_argument('--update',
|
|
147 |
action="store_true",
|
|
148 |
@@ -171,37 +171,37 @@ def getParserArgs():
|
|
149 |
default=False,
|
|
150 |
help="Enables debug mode. Default = disabled")
|
|
151 |
|
|
152 |
- parser.add_argument('--nodeps', action='store_true', help='Skip dependency check')
|
|
153 |
+# parser.add_argument('--nodeps', action='store_true', help='Skip dependency check')
|
|
154 |
|
|
155 |
# args = parser.parse_args(['@parser_args.cfg'])
|
|
156 |
return parser.parse_args()
|
|
157 |
|
|
158 |
|
|
159 |
-def check_dependencies_or_exit():
|
|
160 |
- """Dependency resolver based on a previously specified CONST_REQUIREMENTS_FILE.
|
|
161 |
-
|
|
162 |
- Currently checks a list of dependencies from a file and exits if they are not met.
|
|
163 |
-
|
|
164 |
- """
|
|
165 |
-
|
|
166 |
- installed_deps, missing_deps = dependencies.check_dependencies(requirements_file=FARADAY_REQUIREMENTS_FILE)
|
|
167 |
-
|
|
168 |
- logger.info("Checking dependencies...")
|
|
169 |
-
|
|
170 |
- if missing_deps:
|
|
171 |
-
|
|
172 |
- install_deps = query_yes_no("Do you want to install them?", default="no")
|
|
173 |
-
|
|
174 |
- if install_deps:
|
|
175 |
- dependencies.install_packages(missing_deps)
|
|
176 |
- logger.info("Dependencies installed. Please launch Faraday Server again.")
|
|
177 |
- sys.exit(0)
|
|
178 |
- else:
|
|
179 |
- logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
|
|
180 |
- ", ".join(missing_deps))
|
|
181 |
- sys.exit(1)
|
|
182 |
-
|
|
183 |
- logger.info("Dependencies met")
|
|
184 |
+#def check_dependencies_or_exit():
|
|
185 |
+# """Dependency resolver based on a previously specified CONST_REQUIREMENTS_FILE.
|
|
186 |
+#
|
|
187 |
+# Currently checks a list of dependencies from a file and exits if they are not met.
|
|
188 |
+#
|
|
189 |
+# """
|
|
190 |
+#
|
|
191 |
+# installed_deps, missing_deps = dependencies.check_dependencies(requirements_file=FARADAY_REQUIREMENTS_FILE)
|
|
192 |
+#
|
|
193 |
+# logger.info("Checking dependencies...")
|
|
194 |
+#
|
|
195 |
+# if missing_deps:
|
|
196 |
+#
|
|
197 |
+# install_deps = query_yes_no("Do you want to install them?", default="no")
|
|
198 |
+#
|
|
199 |
+# if install_deps:
|
|
200 |
+# dependencies.install_packages(missing_deps)
|
|
201 |
+# logger.info("Dependencies installed. Please launch Faraday Server again.")
|
|
202 |
+# sys.exit(0)
|
|
203 |
+# else:
|
|
204 |
+# logger.error("Dependencies not met. Please refer to the documentation in order to install them. [%s]",
|
|
205 |
+# ", ".join(missing_deps))
|
|
206 |
+# sys.exit(1)
|
|
207 |
+#
|
|
208 |
+# logger.info("Dependencies met")
|
|
209 |
|
|
210 |
|
|
211 |
def startProfiler(app, output, depth):
|
|
212 |
@@ -439,26 +439,26 @@ def update():
|
|
213 |
logger.info("Faraday will start now.")
|
|
214 |
|
|
215 |
|
|
216 |
-def checkUpdates():
|
|
217 |
- import requests
|
|
218 |
- uri = getInstanceConfiguration().getUpdatesUri()
|
|
219 |
- resp = u"OK"
|
|
220 |
- try:
|
|
221 |
- f = open(FARADAY_VERSION_FILE)
|
|
222 |
-
|
|
223 |
- getInstanceConfiguration().setVersion(f.read().strip())
|
|
224 |
- getInstanceConfiguration().setAppname("Faraday - Penetration Test IDE Community")
|
|
225 |
- parameter = {"version": getInstanceConfiguration().getVersion()}
|
|
226 |
-
|
|
227 |
- f.close()
|
|
228 |
- resp = requests.get(uri, params=parameter, timeout=1, verify=True)
|
|
229 |
- resp = resp.text.strip()
|
|
230 |
- except Exception as e:
|
|
231 |
- logger.error(e)
|
|
232 |
- if not resp == u'OK':
|
|
233 |
- logger.info("You have available updates. Run ./faraday.py --update to catchup!")
|
|
234 |
- else:
|
|
235 |
- logger.info("No updates available, enjoy Faraday.")
|
|
236 |
+#def checkUpdates():
|
|
237 |
+# import requests
|
|
238 |
+# uri = getInstanceConfiguration().getUpdatesUri()
|
|
239 |
+# resp = u"OK"
|
|
240 |
+# try:
|
|
241 |
+# f = open(FARADAY_VERSION_FILE)
|
|
242 |
+#
|
|
243 |
+# getInstanceConfiguration().setVersion(f.read().strip())
|
|
244 |
+# getInstanceConfiguration().setAppname("Faraday - Penetration Test IDE Community")
|
|
245 |
+# parameter = {"version": getInstanceConfiguration().getVersion()}
|
|
246 |
+#
|
|
247 |
+# f.close()
|
|
248 |
+# resp = requests.get(uri, params=parameter, timeout=1, verify=True)
|
|
249 |
+# resp = resp.text.strip()
|
|
250 |
+# except Exception as e:
|
|
251 |
+# logger.error(e)
|
|
252 |
+# if not resp == u'OK':
|
|
253 |
+# logger.info("You have available updates. Run ./faraday.py --update to catchup!")
|
|
254 |
+# else:
|
|
255 |
+# logger.info("No updates available, enjoy Faraday.")
|
|
256 |
|
|
257 |
|
|
258 |
def checkCouchUrl():
|
|
259 |
@@ -529,8 +529,8 @@ def main():
|
|
260 |
setupFolders(CONST_FARADAY_FOLDER_LIST)
|
|
261 |
setUpLogger(args.debug)
|
|
262 |
|
|
263 |
- if not args.nodeps:
|
|
264 |
- check_dependencies_or_exit()
|
|
265 |
+# if not args.nodeps:
|
|
266 |
+# check_dependencies_or_exit()
|
|
267 |
|
|
268 |
printBanner()
|
|
269 |
if args.cert_path:
|
|
270 |
@@ -538,12 +538,12 @@ def main():
|
|
271 |
checkConfiguration(args.gui)
|
|
272 |
setConf()
|
|
273 |
checkCouchUrl()
|
|
274 |
- checkVersion()
|
|
275 |
+ #checkVersion()
|
|
276 |
|
|
277 |
check_faraday_version()
|
|
278 |
|
|
279 |
update()
|
|
280 |
- checkUpdates()
|
|
281 |
+ #checkUpdates()
|
|
282 |
startFaraday()
|
|
283 |
|
|
284 |
|