Commit 836f522f authored by Benjamin "Ziirish" SANS's avatar Benjamin "Ziirish" SANS
Browse files

add: gunicorn support

parent 09aea2e0
Loading
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ Build Status
.. image:: http://ci.ziirish.me/projects/1/status.png?ref=master
    :target: http://ci.ziirish.me/projects/1?ref=master


Requirements
------------

@@ -29,7 +30,7 @@ Then we install the module itself:
Installation
------------

Burp-UI is written in Python with the `Flask`_ micro-framework.
``Burp-UI`` is written in Python with the `Flask`_ micro-framework.
The easiest way to install Flask is to use ``pip``.

On Debian, you can install ``pip`` with the following command:
@@ -58,6 +59,27 @@ By default, ``burp-ui`` listens on all interfaces (including IPv6) on port 5000.

You can then point your browser to http://127.0.0.1:5000/


Gunicorn
--------

``Burp-UI`` now supports `Gunicorn <http://gunicorn.org>`_ in order to handle 
multiple users simultaneously.

You need to install ``gunicorn`` and ``eventlet``:

::

    pip install eventlet
    pip install gunicorn

You will then be able to launch ``Burp-UI`` this way:

::

    gunicorn -k eventlet -w 4 'burpui:init(conf="/path/to/burpui.cfg")'


Instructions
------------

@@ -74,6 +96,7 @@ you need to check a few things:
   restore files of other clients (option *restore_client* in burp-server
   configuration)


Notes
-----

@@ -89,6 +112,7 @@ TODO
Also note that in the future, I'd like to write a burp-client GUI.
But I didn't think yet of what to do.


Changelog
---------

@@ -133,6 +157,7 @@ But this project is built on top of other tools listed here:

Also note that this project is made with the Awesome `Flask`_ micro-framework.


Thanks
------

+2 −20
Original line number Diff line number Diff line
@@ -2,12 +2,11 @@
# -*- coding: utf8 -*-
import sys
import os
import os.path
from optparse import OptionParser

sys.path.append('{0}/..'.format(os.path.join(os.path.dirname(os.path.realpath(__file__)))))

from burpui import app, bui
from burpui import bui, init

if __name__ == '__main__':
    """
@@ -19,25 +18,8 @@ if __name__ == '__main__':

    (options, args) = parser.parse_args()
    d = options.log
    app.config['DEBUG'] = d
    if d:
        app.config['TESTING'] = True

    if options.config:
        if os.path.isfile(options.config):
            conf = options.config
            app.config['CFG'] = conf
        else:
            raise IOError('File not found: \'{0}\''.format(options.config))
    else:
        conf_files = ['/etc/burp/burpui.cfg', os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'share', 'burpui', 'etc', 'burpui.cfg')]
        for p in conf_files:
            app.logger.debug('Trying file \'%s\'', p)
            if os.path.isfile(p):
                app.config['CFG'] = p
                app.logger.debug('Using file \'%s\'', p)
                break
    init(options.config, d, False)

    bui.setup(app.config['CFG'])
    bui.run(d)
+28 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ __title__ = 'burp-ui'
__author__ = 'Benjamin SANS (Ziirish)'
__license__ = 'BSD 3-clause'

import os

from flask import Flask
from flask.ext.login import LoginManager
@@ -31,3 +32,30 @@ login_manager.login_message_category = 'info'

# Then we load our routes
import burpui.routes

def init(conf=None, debug=False, gunicorn=True):
    app.config['DEBUG'] = debug
    if debug:
        app.config['TESTING'] = True

    if conf:
        if os.path.isfile(conf):
            app.config['CFG'] = conf
        else:
            raise IOError('File not found: \'{0}\''.format(conf))
    else:
        conf_files = ['/etc/burp/burpui.cfg', os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', 'share', 'burpui', 'etc', 'burpui.cfg')]
        for p in conf_files:
            app.logger.debug('Trying file \'%s\'', p)
            if os.path.isfile(p):
                app.config['CFG'] = p
                app.logger.debug('Using file \'%s\'', p)
                break

    bui.setup(app.config['CFG'])

    if gunicorn:
        from werkzeug.contrib.fixers import ProxyFix
        app.wsgi_app = ProxyFix(app.wsgi_app)

    return app