add: documentation + new API

This commit is contained in:
ziirish 2015-07-26 23:06:13 +02:00
parent db51b9d9d1
commit 57450fd9ef
2 changed files with 146 additions and 2 deletions

View file

@ -1,4 +1,12 @@
# -*- coding: utf8 -*-
"""
.. module:: settings
:platform: Unix
:synopsis: Burp-UI settings api module.
.. moduleauthor:: Ziirish <ziirish@ziirish.info>
"""
from burpui import app, bui, login_manager
from burpui.api import api
@ -8,11 +16,147 @@ from flask import request, render_template, jsonify
@api.resource('/api/server-config',
'/api/<server>/server-config')
'/api/<server>/server-config',
endpoint='api.server_settings')
class ServerSettings(Resource):
"""
The :class:`burpui.api.settings.ServerSettings` resource allows you to
retrieve the server's configuration.
This resource is part of the :mod:`burpui.api.settings` module.
"""
@login_required
def get(self, server=None):
"""
**GET** method provided by the webservice.
The *JSON* returned is:
::
{
"boolean": [
"daemon",
"fork",
...
],
"defaults": {
"address": "",
"autoupgrade_dir": "",
"ca_burp_ca": "",
"ca_conf": "",
"ca_name": "",
"ca_server_name": "",
"client_can_delete": true,
...
},
"integer": [
"port",
"status_port",
...
],
"multi": [
"keep",
"restore_client",
...
],
"placeholders": {
"autoupgrade_dir": "path",
"ca_burp_ca": "path",
"ca_conf": "path",
"ca_name": "name",
"ca_server_name": "name",
"client_can_delete": "0|1",
...
},
"results": {
"boolean": [
{
"name": "hardlinked_archive",
"value": false
},
{
"name": "syslog",
"value": true
},
...
],
"clients": [
{
"name": "testclient",
"value": "/etc/burp/clientconfdir/testclient"
}
],
"common": [
{
"name": "mode",
"value": "server"
},
{
"name": "directory",
"value": "/var/spool/burp"
},
...
],
"includes": [],
"includes_ext": [],
"integer": [
{
"name": "port",
"value": 4971
},
{
"name": "status_port",
"value": 4972
},
...
],
"multi": [
{
"name": "keep",
"value": [
"7",
"4"
]
},
...
]
},
"server_doc": {
"address": "Defines the main TCP address that the server listens on. The default is either '::' or '0.0.0.0', dependent upon compile time options.",
...
},
"string": [
"mode",
"address",
...
],
"suggest": {
"compression": [
"gzip1",
"gzip2",
"gzip3",
"gzip4",
"gzip5",
"gzip6",
"gzip7",
"gzip8",
"gzip9"
],
"mode": [
"client",
"server"
],
...
}
}
:param server: Which server to collect data from when in multi-agent mode
:type server: str
:returns: The *JSON* described above.
"""
# Only the admin can edit the configuration
if (bui.acl_handler and not
bui.acl_handler.acl.is_admin(current_user.name)):

View file

@ -129,7 +129,7 @@ app.controller('ConfigCtrl', function($scope, $http) {
'multis': false
};
$scope.changed = false;
$http.get('{{ api.url_for(ServerSettings, server=server) }}').
$http.get('{{ url_for("api.server_settings", server=server) }}').
success(function(data, status, headers, config) {
$scope.bools = data.results.boolean;
$scope.all.bools = data.boolean;