Initial packaging for kali
Sophie Brun
9 years ago
0 | depends to python-qt3 / qt4 | |
1 | the upstream version depends of python-qt3. | |
2 | As python-qt3 not available in kali, we will use the lib downloaded in | |
3 | https://www.faradaysec.com/down/faraday/lib... but it does not exist for | |
4 | armel and armhf | |
5 | Upstream should update in april 2015 the depends to pyton-qt4. When it's | |
6 | done, update the package, add the depends to python-qt4 and drop the | |
7 | downloaded lib. | |
8 | ||
9 | faraday/shell/core/_helpers.so.* | |
10 | if upstream gives the makefile, update the debian/rules to compile the | |
11 | helpers.c during the build. |
0 | python-faraday (1.0.7-0kali1) kali; urgency=low | |
1 | ||
2 | * Initial packaging for kali. | |
3 | * debian/rules: as qt3 not available in kali, download a library provided by | |
4 | upstream (until a release that will use qt4) and exclude this library of | |
5 | dh_shlibdeps processing | |
6 | * Add an upstream patch to use the downloaded library qt and fix the qt | |
7 | directory | |
8 | * Add a patch to remove the unwanted functions: checkDependencies, update, | |
9 | checkUpdates. | |
10 | * Add depends to python-sip (not included in requirements.txt given by | |
11 | upstream) | |
12 | * Add minimal version 0.10.1 on depends python-sip | |
13 | * Add a helper-script | |
14 | ||
15 | -- Sophie Brun <[email protected]> Mon, 19 Jan 2015 09:24:23 +0100 |
0 | 9 |
0 | Source: python-faraday | |
1 | Section: python | |
2 | Priority: optional | |
3 | Maintainer: Sophie Brun <[email protected]> | |
4 | Build-Depends: debhelper (>= 9), python, wget, ca-certificates | |
5 | Standards-Version: 3.9.5 | |
6 | Homepage: http://faradaysec.com | |
7 | Vcs-Git: git://git.kali.org/packages/python-faraday.git | |
8 | Vcs-Browser: http://git.kali.org/gitweb/?p=packages/python-faraday.git;a=summary | |
9 | ||
10 | Package: python-faraday | |
11 | Architecture: amd64 i386 | |
12 | Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, | |
13 | ipython, couchdb, python-couchdbkit, python-mockito, python-whoosh, | |
14 | python-argparse, python-ipy, python-restkit, python-requests, python-tornado, | |
15 | python-flask (>= 0.10.1), python-colorama, python-psycopg2, python-sip, | |
16 | zsh | zsh-beta | |
17 | Description: Collaborative Penetration Test IDE | |
18 | Faraday introduces a new concept (IPE) Integrated Penetration-Test Environment | |
19 | a multiuser Penetration test IDE. Designed for distribution, indexation and | |
20 | analysis of the generated data during the process of a security audit. | |
21 | . | |
22 | The main purpose of Faraday is to re-use the available tools in the community | |
23 | to take advantage of them in a multiuser way. |
0 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | |
1 | Upstream-Name: faraday | |
2 | Source: https://github.com/infobyte/faraday | |
3 | ||
4 | Files: * | |
5 | Copyright: 2013 Infobyte LLC (http://www.infobytesec.com/) | |
6 | License: GPL-3 | |
7 | ||
8 | Files: debian/* | |
9 | Copyright: 2014 Sophie Brun <[email protected]> | |
10 | License: GPL-3 | |
11 | ||
12 | License: GPL-3 | |
13 | This package is free software; you can redistribute it and/or modify | |
14 | it under the terms of the GNU General Public License as published by | |
15 | the Free Software Foundation, version 3. | |
16 | . | |
17 | This package is distributed in the hope that it will be useful, | |
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | GNU General Public License for more details. | |
21 | . | |
22 | You should have received a copy of the GNU General Public License | |
23 | along with this program. If not, see <http://www.gnu.org/licenses/> | |
24 | . | |
25 | On Debian systems, the complete text of the GNU General | |
26 | Public License version 3 can be found in | |
27 | "/usr/share/common-licenses/GPL-3". | |
28 |
0 | usr/lib/python-faraday/external_libs |
0 | apis/ usr/share/python-faraday/ | |
1 | auth/ usr/share/python-faraday/ | |
2 | bin/ usr/share/python-faraday/ | |
3 | config/ usr/share/python-faraday/ | |
4 | controllers/ usr/share/python-faraday/ | |
5 | data/ usr/share/python-faraday/ | |
6 | deps/ usr/share/python-faraday/ | |
7 | exporters/ usr/share/python-faraday/ | |
8 | gui/ usr/share/python-faraday/ | |
9 | managers/ usr/share/python-faraday/ | |
10 | model/ usr/share/python-faraday/ | |
11 | persistence/ usr/share/python-faraday/ | |
12 | plugins/ usr/share/python-faraday/ | |
13 | scripts/ usr/share/python-faraday/ | |
14 | shell/ usr/share/python-faraday/ | |
15 | test_cases/ usr/share/python-faraday/ | |
16 | updates/ usr/share/python-faraday/ | |
17 | utils/ usr/share/python-faraday/ | |
18 | views/ usr/share/python-faraday/ | |
19 | zsh/ usr/share/python-faraday/ | |
20 | __init__.py usr/share/python-faraday/ | |
21 | default.keytab usr/share/python-faraday/ | |
22 | faraday-terminal.zsh usr/share/python-faraday/ | |
23 | faraday.py usr/share/python-faraday/ | |
24 | debian/helper-script/* usr/bin/ |
0 | usr/lib/python-faraday/external_libs usr/share/python-faraday/external_libs |
0 | --- a/faraday.py | |
1 | +++ b/faraday.py | |
2 | @@ -17,7 +17,6 @@ import shutil | |
3 | import argparse | |
4 | import platform | |
5 | import subprocess | |
6 | -import pip | |
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 | |
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 | - | |
24 | - modules = [] | |
25 | - f = open(CONST_REQUIREMENTS_FILE) | |
26 | - for line in f: | |
27 | - if line.find('#'): | |
28 | - modules.append([line[:line.index('=')], (line[line.index('=')+2:]).strip()]) | |
29 | - f.close() | |
30 | - | |
31 | - 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']) | |
39 | - | |
40 | - else: | |
41 | - return False | |
42 | - | |
43 | - return True | |
44 | - | |
45 | ||
46 | def startProfiler(app, output, depth): | |
47 | """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 @@ _/ ____\_____ ____________ __| _/__ | |
62 | print(Fore.RESET + Back.RESET + Style.RESET_ALL) | |
63 | logger.info("Starting Faraday IDE.") | |
64 | ||
65 | -def update(): | |
66 | - """Updates Faraday IDE. | |
67 | - | |
68 | - Deletes every .pyc file and does a git pull to the official repository. | |
69 | - | |
70 | - """ | |
71 | - if args.update: | |
72 | - from updates.updater import Updater | |
73 | - Updater().doUpdates() | |
74 | - logger.info("Update process finished with no errors") | |
75 | - logger.info("Faraday will start now.") | |
76 | - | |
77 | -def checkUpdates(): | |
78 | - import requests | |
79 | - uri = getInstanceConfiguration().getUpdatesUri() | |
80 | - resp = u"OK" | |
81 | - try: | |
82 | - resp = requests.get(uri, timeout=1, verify=True) | |
83 | - resp = resp.text.strip() | |
84 | - except Exception as e: | |
85 | - logger.error(e) | |
86 | - if not resp == u'OK': | |
87 | - logger.info("You have available updates. Run ./faraday.py --update to catchup!") | |
88 | - else: | |
89 | - logger.info("No updates available, enjoy Faraday") | |
90 | ||
91 | ||
92 | def init(): | |
93 | @@ -549,16 +492,11 @@ def main(): | |
94 | """ | |
95 | ||
96 | init() | |
97 | - update() | |
98 | - if checkDependencies(): | |
99 | - printBanner() | |
100 | - logger.info("Dependencies met.") | |
101 | - checkConfiguration() | |
102 | - setConf() | |
103 | - checkUpdates() | |
104 | - startFaraday() | |
105 | - else: | |
106 | - logger.error("Dependencies not met. Unable to start Faraday.") | |
107 | + printBanner() | |
108 | + logger.info("Dependencies met.") | |
109 | + checkConfiguration() | |
110 | + setConf() | |
111 | + startFaraday() | |
112 | ||
113 | ||
114 | if __name__ == '__main__': |
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. |
0 | #!/usr/bin/make -f | |
1 | ||
2 | PACKAGE_DIR = debian/python-faraday/usr/share/python-faraday/shell/core | |
3 | UNAME_M = $(shell uname -m) | |
4 | ||
5 | %: | |
6 | dh $@ --with python2 | |
7 | ||
8 | override_dh_install: | |
9 | dh_install | |
10 | if [ "$(DEB_HOST_ARCH)" = "amd64" ]; then \ | |
11 | rm $(PACKAGE_DIR)/_helpers.so.i386 $(PACKAGE_DIR)/_helpers.so.darwin ; \ | |
12 | elif [ "$(DEB_HOST_ARCH)" = "i386" ] ; then \ | |
13 | rm $(PACKAGE_DIR)/_helpers.so.amd64 $(PACKAGE_DIR)/_helpers.so.darwin ; \ | |
14 | fi | |
15 | wget "https://www.faradaysec.com/down/faraday/lib-kali-$(UNAME_M).tgz" -O lib-kali.tgz ; \ | |
16 | tar -xvzf lib-kali.tgz; \ | |
17 | mv lib-kali-*/ external_libs ; \ | |
18 | cp -R external_libs debian/python-faraday/usr/lib/python-faraday/ ; \ | |
19 | rm -f /usr/share/python-faraday/shell/core/helpers.c /usr/share/python-faraday/shell/core/helpers.h | |
20 | ||
21 | override_dh_shlibdeps: | |
22 | dh_shlibdeps --exclude=usr/lib/python-faraday/external_libs |
0 | 3.0 (quilt) |