WIP: refactor Burp Settings panel in order to integrate templates management

This commit is contained in:
ziirish 2018-01-23 18:38:29 +01:00
parent 6422bc7c92
commit 4eb7e5c79e
No known key found for this signature in database
GPG key ID: 72DB229A64B54E46
8 changed files with 127 additions and 31 deletions

View file

@ -748,6 +748,7 @@ def create_app(conf=None, verbose=0, logfile=None, **kwargs):
@app.before_request
def setup_request():
g.version = '{}-{}'.format(__version__, __release__)
g.locale = get_locale()
g.date_format = session.get('dateFormat', 'llll')
# make sure to store secure cookie if required

View file

@ -56,11 +56,15 @@ class Parser(Burp1):
u'manual_delete': __(u"path"),
u'label': __(u"some informations"),
u'server_can_override_includes': u"0|1",
u'status_address': __(u"address|localhost"),
u'glob_after_script_pre': u"0|1",
u'enabled': u"0|1",
u'cname_fqdn': u"0|1",
u'cname_lowercase': u"0|1",
})
values = Burp1.values
# status_address can now listen on any address
del values['status_address']
defaults = Burp1.defaults
defaults.update({
u'acl': True,
@ -109,6 +113,11 @@ class Parser(Burp1):
" able to override your local"
" include/exclude list, set this"
" to 0. The default is 1."),
u'status_address': __(u"Defines the main TCP address that the server "
"listens on for status requests. The default "
"is special value 'localhost' that includes "
"both '::1' (if available) and '127.0.0.1' "
"(always)."),
u'glob_after_script_pre': __(u"Set this to 0 if you do not want"
" include_glob settings to be evaluated"
" after the pre script is run. The"

View file

@ -123,6 +123,7 @@ class Doc(BUIparser):
}
placeholders = {
u'.': __(u"path or glob"),
u'address': __(u"address"),
u'atime': u"0|1",
u'autoupgrade_dir': __(u"path"),
u'ca_burp_ca': __(u"path"),

View file

@ -184,7 +184,7 @@ width:100%;
text-transform: uppercase;
}
#tree {
#tree, #tree-hierarchy {
background-color: #E9F2F9;
color: #697075;
}

View file

@ -163,6 +163,7 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope,
$scope.includes_ori = angular.copy($scope.includes);
$scope.includes_ext = data.results.includes_ext;
$scope.hierarchy = data.results.hierarchy;
$scope.refreshHierarchy();
$scope.refreshScrollspy();
$('#waiting-container').hide();
$('#settings-panel').show();
@ -251,6 +252,60 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope,
});
}
};
$scope.refreshHierarchy = function() {
if ($scope.hierarchy) {
$('#tree-hierarchy').fancytree({
extensions: ["glyph", "table"],
glyph: {
preset: "bootstrap3",
map: {
doc: "glyphicon glyphicon-file",
docOpen: "glyphicon glyphicon-file",
checkbox: "glyphicon glyphicon-unchecked",
checkboxSelected: "glyphicon glyphicon-check",
checkboxUnknown: "glyphicon glyphicon-share",
dragHelper: "glyphicon glyphicon-play",
dropMarker: "glyphicon glyphicon-arrow-right",
error: "glyphicon glyphicon-warning-sign",
expanderClosed: "glyphicon glyphicon-plus-sign",
expanderLazy: "glyphicon glyphicon-plus-sign",
// expanderLazy: "glyphicon glyphicon-expand",
expanderOpen: "glyphicon glyphicon-minus-sign",
// expanderOpen: "glyphicon glyphicon-collapse-down",
folder: "glyphicon glyphicon-folder-close",
folderOpen: "glyphicon glyphicon-folder-open",
loading: "glyphicon glyphicon-refresh glyphicon-spin"
}
},
source: $scope.hierarchy,
init: function() {
$('#tree-hierarchy').floatThead({
position: 'auto',
autoReflow: true,
top: $('.navbar').height(),
});
},
scrollParent: $(window),
renderColumns: function(event, data) {
var node = data.node;
$tdList = $(node.tr).find(">td");
{% if client -%}
var URL = '{{ url_for("view.cli_settings", client=client, server=server) }}?conf='+encodeURIComponent(node.data.full);
{% else -%}
var URL = '{{ url_for("view.settings", server=server) }}?conf='+encodeURIComponent(node.data.full);
{% endif -%}
$tdList.eq(1).html('<a href="'+URL+'" class="btn btn-info btn-xs no-link pull-right"><span class="glyphicon glyphicon-pencil" aria-hidden="true">&nbsp;{{ _("Edit") }}</a>');
},
});
var tree = $('#tree-hierarchy').fancytree('getTree');
tree.getRootNode().visit(function(node) {
node.setExpanded(true);
});
}
};
$scope.refreshScrollspy = function() {
angular.forEach($('.bui-scrollspy > li'), function(e) {
var ae = angular.element(e);
@ -370,11 +425,11 @@ app.controller('ConfigCtrl', ['$scope', '$http', '$scrollspy', function($scope,
{% endif -%}
$scope.inc_invalid = {};
$http.get(
api,
{
headers: { 'X-From-UI': true },
params: { 'path': path },
}
api,
{
headers: { 'X-From-UI': true },
params: { 'path': path },
}
).then(
function(response) {
data = response.data;

View file

@ -8,7 +8,7 @@
<meta name="author" content="Ziirish">
<meta name="session" content="{% if 'tag_id' in session %}{{ session['tag_id'] }}{% endif %}">
<meta name="_extra" content="{{ g._extra }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}?_ver={{ g.version }}">
<title>Burp-UI</title>
@ -40,7 +40,7 @@
<link href="{{ url_for('bower.static', filename='components-font-awesome/css/font-awesome.min.css') }}" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{{ url_for('static', filename='dashboard.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='dashboard.css') }}?_ver={{ g.version }}" rel="stylesheet">
</head>

View file

@ -4,22 +4,45 @@
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
{% include "small_topbar.html" %}
<ul class="breadcrumb" style="margin-bottom: 5px;">
{% if conf -%}
{% set conf=conf|replace("%2F", "/")|escape -%}
{% endif -%}
{% if server -%}
<li><a href="{{ url_for('view.home') }}">{{ _('Home') }}</a></li>
<li><a href="{{ url_for('view.clients', server=server) }}">{{ _('%(server)s clients', server=server) }}</a></li>
{% if client -%}
<li><a href="{{ url_for('view.settings', server=server) }}">{{ _('Burp Server Configuration of %(server)s', server=server) }}</a></li>
<li class="active">{{ _('Burp Server Configuration of %(client)s client on %(server)s', client=client, server=server) }}</li>
{% if conf -%}
<li><a href="{{ url_for('view.cli_settings', server=server, client=client) }}">{{ _('%(client)s on %(server)s', client=client, server=server) }}</a></li>
<li class="active">{{ conf|replace("%2F", "/")|escape }}</li>
{% else -%}
<li class="active">{{ _('%(client)s on %(server)s', client=client, server=server) }}</li>
{% endif -%}
{% else -%}
{% if conf -%}
<li><a href="{{ url_for('view.settings', server=server) }}">{{ _('Burp Server Configuration of %(server)s', server=server) }}</a></li>
<li class="active">{{ conf|replace("%2F", "/")|escape }}</li>
{% else -%}
<li class="active">{{ _('Burp Server Configuration of %(server)s', server=server) }}</li>
{% endif -%}
{% endif -%}
{% else -%}
<li><a href="{{ url_for('view.home') }}">{{ _('Home') }}</a></li>
{% if client -%}
<li><a href="{{ url_for('view.settings', server=server) }}">{{ _('Burp Server Configuration') }}</a></li>
<li class="active">{{ _('Burp Server Configuration of %(client)s client', client=client) }}</li>
{% if conf -%}
<li><a href="{{ url_for('view.cli_settings', server=server, client=client) }}">{{ client }}</a></li>
<li class="active">{{ conf|replace("%2F", "/")|escape }}</li>
{% else -%}
<li class="active">{{ client }}</li>
{% endif -%}
{% else -%}
{% if conf -%}
<li><a href="{{ url_for('view.settings', server=server) }}">{{ _('Burp Server Configuration') }}</a></li>
<li class="active">{{ conf|replace("%2F", "/")|escape }}</li>
{% else -%}
<li class="active">{{ _('Burp Server Configuration') }}</li>
{% endif -%}
{% endif -%}
{% endif -%}
</ul>
@ -268,13 +291,37 @@
</div>
</div>
<div class="tab-pane fade" id="hierarchy">
<div id="tree-hierarchy" data-type="json">
{% raw -%}
{{ hierarchy }}
{% endraw -%}
<div style="padding-top: 80px; margin-top: -45px;"></div>
<div id="tree-container" class="table-responsive row">
<table id="tree-hierarchy" class="table">
<thead>
<tr>
<th>{{ _('File') }}</th><th></th>
</tr>
</thead>
</table>
</div>
</div>
<div class="tab-pane fade" id="clients">
<div style="padding-top: 80px; margin-top: -45px;"></div>
<div id="table-clients" class="table-responsive row">
<table class="table table-striped table-hover nowrap" width="100%">
<thead>
<tr>
<th>{{ _('Name') }}</th><th>{{ _('Path') }}</th><th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clients">
{% raw -%}
<td>{{ client.name }}</td>
<td>{{ client.value }}</td>
{% endraw -%}
<td><a href="{{ url_for("view.cli_settings", server=server) }}?client={{ '{{' }} client.name {{ '}}' }}" class="btn btn-info btn-xs no-link pull-right"><span class="glyphicon glyphicon-pencil" aria-hidden="true">&nbsp;Edit</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View file

@ -9,23 +9,6 @@
<li data-target="#includes_source"><a class="scroll" href="#includes_source">{{ _('Source files') }}</a></li>
</ul>
<h4>{{ _('Client to configure') }}</h4>
<ul class="nav nav-sidebar" ng-cloak>
<li>
<ui-select ng-model="client.selected" style="width: 100%;" on-select="selectClient($item, $select)">
<ui-select-match placeholder="{{ _('Select a client') }}">
{% raw -%}
{{ $select.selected.name }}
</ui-select-match>
<ui-select-choices repeat="client in clients | filter: {name: $select.search}">
<div ng-bind-html="client.name | highlight: $select.search"></div>
<small>
{% endraw -%}
{{ _('config:') }} <span ng-bind-html="''+client.value | highlight: $select.search"></span>
</small>
</ui-select-choices>
</ui-select>
</li>
</ul>
<ul class="nav nav-sidebar">
<li>
<form action="{{ url_for('api.new_client', server=server) }}" method="POST" ng-submit="createClient($event)">