Codebase list python-faraday / 49db4c0
Refresh patches Sophie Brun 9 years ago
4 changed file(s) with 40 addition(s) and 117 deletion(s). Raw diff Collapse all Expand all
11
22 * Import new upstream release
33 * Update debian files
4 * Refresh patch remove-unwanted-checks
5 * Drop patch upstream-patch as it's included in new version
46
57 -- Sophie Brun <[email protected]> Tue, 12 May 2015 15:22:16 +0200
68
55 import subprocess
66 -import pip
77
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
1111 "(or 'y' or 'n').\n")
1212
1313
2424 - modules = []
2525 - f = open(CONST_REQUIREMENTS_FILE)
2626 - for line in f:
27 - if line.find('#'):
27 - if not line.find('#'):
28 - break
29 - else:
2830 - modules.append([line[:line.index('=')], (line[line.index('=')+2:]).strip()])
2931 - f.close()
3032 -
33 - pip_dist = [dist.project_name.lower() for dist in pip.get_installed_distributions()]
34 -
3135 - 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'])
3944 -
40 - else:
41 - return False
45 - else:
46 - return False
4247 -
4348 - return True
4449 -
4550
4651 def startProfiler(app, output, depth):
4752 """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 @@ _/ ____\_____ ____________ __| _/__
6254 print(Fore.RESET + Back.RESET + Style.RESET_ALL)
6355 logger.info("Starting Faraday IDE.")
6456
7466 - logger.info("Update process finished with no errors")
7567 - logger.info("Faraday will start now.")
7668 -
77 -def checkUpdates():
69 -def checkUpdates():
7870 - import requests
79 - uri = getInstanceConfiguration().getUpdatesUri()
71 - uri = getInstanceConfiguration().getUpdatesUri()
8072 - resp = u"OK"
8173 - 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)
8382 - resp = resp.text.strip()
8483 - except Exception as e:
8584 - logger.error(e)
8786 - logger.info("You have available updates. Run ./faraday.py --update to catchup!")
8887 - else:
8988 - logger.info("No updates available, enjoy Faraday")
89 -
9090
91
92 def init():
93 @@ -549,16 +492,11 @@ def main():
91 def checkCouchUrl():
92 import requests
93 @@ -562,20 +492,11 @@ def main():
9494 """
9595
9696 init()
97 - update()
9897 - if checkDependencies():
9998 - printBanner()
10099 - logger.info("Dependencies met.")
100 - if args.cert_path:
101 - os.environ['REQUESTS_CA_BUNDLE'] = args.cert_path
101102 - checkConfiguration()
102103 - setConf()
104 - checkCouchUrl()
105 - setUpLogger()
106 - update()
103107 - checkUpdates()
104108 - startFaraday()
105109 - else:
00 remove-unwanted-checks.diff
1 upstream-patch.diff
+0
-82
debian/patches/upstream-patch.diff less more
0 --- a/faraday.py
1 +++ b/faraday.py
2 @@ -19,28 +19,17 @@ import platform
3 import subprocess
4
5 from utils.logs import getLogger
6 -sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) # Necessary?
7 +sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) +
8 + '/external_libs/lib/python2.7/dist-packages')
9 from config.configuration import getInstanceConfiguration
10 from config.globals import *
11 from utils.profilehooks import profile
12
13
14 -QTDIR='/usr/local/qt'
15 -PATH='%s/bin:%s' %(QTDIR, os.environ['PATH'])
16 -MANPATH='%s/doc/man' % QTDIR
17 -LD_LIBRARY_PATH='%s/lib:%s' % (QTDIR, os.environ.get('LD_LIBRARY_PATH', ''))
18 -
19 -libs_exports = {
20 -'QTDIR': QTDIR,
21 -'PATH': PATH,
22 -'MANPATH': MANPATH,
23 -'LD_LIBRARY_PATH': LD_LIBRARY_PATH
24 -}
25 -
26 -os.environ.update(libs_exports)
27
28 USER_HOME = os.path.expanduser(CONST_USER_HOME)
29 FARADAY_BASE = os.path.dirname(os.path.realpath(__file__))
30 +QTDIR=os.path.join(FARADAY_BASE, 'external_libs', 'qt')
31
32 FARADAY_USER_HOME = os.path.expanduser(CONST_FARADAY_HOME_PATH)
33 FARADAY_PLUGINS_PATH = os.path.join(FARADAY_USER_HOME,
34 @@ -276,7 +265,6 @@ def startFaraday():
35 print(Fore.RESET + Back.RESET + Style.RESET_ALL)
36
37 exit_status = start()
38 - restoreQtrc()
39
40 return exit_status
41
42 @@ -311,30 +299,15 @@ def setupQtrc():
43 Existing qtrc files will be backed up and faraday qtrc will be set.
44
45 """
46 -
47 - if os.path.isfile(USER_QTRC):
48 - shutil.copy2(USER_QTRC, USER_QTRCBAK)
49 -
50 - if os.path.isfile(FARADAY_QTRCBAK):
51 - shutil.copy(FARADAY_QTRCBAK, USER_QTRC)
52 - else:
53 - if not os.path.exists(USER_QT):
54 - os.makedirs(USER_QT)
55 - shutil.copy(FARADAY_QTRC, USER_QTRC)
56 - shutil.copy(FARADAY_QTRC, FARADAY_QTRCBAK)
57 -
58 -def restoreQtrc():
59 - """Restores user qtrc.
60 -
61 - After exiting faraday the original qtrc is restored.
62 -
63 - """
64 -
65 - logger.info("Restoring user Qt configuration.")
66 - shutil.copy2(USER_QTRC, FARADAY_QTRCBAK)
67 - if os.path.isfile(USER_QTRCBAK):
68 - shutil.copy(USER_QTRCBAK, USER_QTRC)
69 -
70 + from ctypes import cdll
71 + try:
72 + import qt
73 + except:
74 + try:
75 + cdll.LoadLibrary(os.path.join(QTDIR, 'lib', 'libqt.so'))
76 + cdll.LoadLibrary(os.path.join(QTDIR, 'lib', 'libqui.so'))
77 + except:
78 + pass
79
80 def setupZSH():
81 """Cheks and handles Faraday's integration with ZSH.