5 | 5 |
import subprocess
|
6 | 6 |
-import pip
|
7 | 7 |
|
8 | |
from utils.logs import getLogger
|
9 | |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) # Necessary?
|
10 | |
@@ -195,37 +194,6 @@ def query_user_bool(question, default=Tr
|
|
8 |
from utils.logs import getLogger, setUpLogger
|
|
9 |
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/external_libs/lib/python2.7/dist-packages')
|
|
10 |
@@ -188,42 +187,6 @@ def query_user_bool(question, default=Tr
|
11 | 11 |
"(or 'y' or 'n').\n")
|
12 | 12 |
|
13 | 13 |
|
|
24 | 24 |
- modules = []
|
25 | 25 |
- f = open(CONST_REQUIREMENTS_FILE)
|
26 | 26 |
- for line in f:
|
27 | |
- if line.find('#'):
|
|
27 |
- if not line.find('#'):
|
|
28 |
- break
|
|
29 |
- else:
|
28 | 30 |
- modules.append([line[:line.index('=')], (line[line.index('=')+2:]).strip()])
|
29 | 31 |
- f.close()
|
30 | 32 |
-
|
|
33 |
- pip_dist = [dist.project_name.lower() for dist in pip.get_installed_distributions()]
|
|
34 |
-
|
31 | 35 |
- for module in modules:
|
32 | |
- try:
|
33 | |
- __import__(module[0])
|
34 | |
- except ImportError:
|
35 | |
- if query_user_bool("Missing module %s." \
|
36 | |
- " Do you wish to install it?" % module[0]):
|
37 | |
- pip.main(['install', "%s==%s" %
|
38 | |
- (module[0], module[1]), '--user'])
|
|
36 |
- if module[0].lower() not in pip_dist:
|
|
37 |
- try:
|
|
38 |
- __import__(module[0])
|
|
39 |
- except ImportError:
|
|
40 |
- if query_user_bool("Missing module %s." \
|
|
41 |
- " Do you wish to install it?" % module[0]):
|
|
42 |
- pip.main(['install', "%s==%s" %
|
|
43 |
- (module[0], module[1]), '--user'])
|
39 | 44 |
-
|
40 | |
- else:
|
41 | |
- return False
|
|
45 |
- else:
|
|
46 |
- return False
|
42 | 47 |
-
|
43 | 48 |
- return True
|
44 | 49 |
-
|
45 | 50 |
|
46 | 51 |
def startProfiler(app, output, depth):
|
47 | 52 |
"""Profiler handler.
|
48 | |
@@ -300,10 +268,10 @@ def startFaraday():
|
49 | |
print(Fore.WHITE + Style.BRIGHT + \
|
50 | |
"\n*" + string.center("faraday ui is ready", 53 - 6) )
|
51 | |
print(Fore.WHITE + Style.BRIGHT + \
|
52 | |
- """Make sure you got couchdb up and running.\nIf couchdb is up, point your browser to: \n[%s]""" % url)
|
53 | |
+ """Make sure you got couchdb up and running.\nIf couchdb is up, point your browser to: \n[%s]""" % url)
|
54 | |
else:
|
55 | |
print(Fore.WHITE + Style.BRIGHT + \
|
56 | |
- """Please config Couchdb for fancy HTML5 Dashboard""")
|
57 | |
+ """Please config Couchdb for fancy HTML5 Dashboard""")
|
58 | |
|
59 | |
print(Fore.RESET + Back.RESET + Style.RESET_ALL)
|
60 | |
|
61 | |
@@ -501,31 +469,6 @@ _/ ____\_____ ____________ __| _/__
|
|
53 |
@@ -491,39 +454,6 @@ _/ ____\_____ ____________ __| _/__
|
62 | 54 |
print(Fore.RESET + Back.RESET + Style.RESET_ALL)
|
63 | 55 |
logger.info("Starting Faraday IDE.")
|
64 | 56 |
|
|
74 | 66 |
- logger.info("Update process finished with no errors")
|
75 | 67 |
- logger.info("Faraday will start now.")
|
76 | 68 |
-
|
77 | |
-def checkUpdates():
|
|
69 |
-def checkUpdates():
|
78 | 70 |
- import requests
|
79 | |
- uri = getInstanceConfiguration().getUpdatesUri()
|
|
71 |
- uri = getInstanceConfiguration().getUpdatesUri()
|
80 | 72 |
- resp = u"OK"
|
81 | 73 |
- try:
|
82 | |
- resp = requests.get(uri, timeout=1, verify=True)
|
|
74 |
- f = open(CONST_VERSION_FILE)
|
|
75 |
-
|
|
76 |
- getInstanceConfiguration().setVersion(f.read().strip())
|
|
77 |
- getInstanceConfiguration().setAppname("Faraday - Penetration Test IDE Community")
|
|
78 |
- parameter = {"version": getInstanceConfiguration().getVersion()}
|
|
79 |
-
|
|
80 |
- f.close
|
|
81 |
- resp = requests.get(uri, params=parameter, timeout=1, verify=True)
|
83 | 82 |
- resp = resp.text.strip()
|
84 | 83 |
- except Exception as e:
|
85 | 84 |
- logger.error(e)
|
|
87 | 86 |
- logger.info("You have available updates. Run ./faraday.py --update to catchup!")
|
88 | 87 |
- else:
|
89 | 88 |
- logger.info("No updates available, enjoy Faraday")
|
|
89 |
-
|
90 | 90 |
|
91 | |
|
92 | |
def init():
|
93 | |
@@ -549,16 +492,11 @@ def main():
|
|
91 |
def checkCouchUrl():
|
|
92 |
import requests
|
|
93 |
@@ -562,20 +492,11 @@ def main():
|
94 | 94 |
"""
|
95 | 95 |
|
96 | 96 |
init()
|
97 | |
- update()
|
98 | 97 |
- if checkDependencies():
|
99 | 98 |
- printBanner()
|
100 | 99 |
- logger.info("Dependencies met.")
|
|
100 |
- if args.cert_path:
|
|
101 |
- os.environ['REQUESTS_CA_BUNDLE'] = args.cert_path
|
101 | 102 |
- checkConfiguration()
|
102 | 103 |
- setConf()
|
|
104 |
- checkCouchUrl()
|
|
105 |
- setUpLogger()
|
|
106 |
- update()
|
103 | 107 |
- checkUpdates()
|
104 | 108 |
- startFaraday()
|
105 | 109 |
- else:
|