add: implement #13 for multi-server

This commit is contained in:
ziirish 2014-12-11 18:55:53 +01:00
parent 706015cae8
commit 3dfc0ebf05
6 changed files with 25 additions and 5 deletions

View file

@ -66,6 +66,7 @@ class BUIAgent:
'get_tree': self.backend.get_tree,
'restore_files': self.backend.restore_files,
'read_conf': self.backend.read_conf,
'store_conf': self.backend.store_conf,
'get_parser_attr': self.backend.get_parser_attr
}

View file

@ -702,9 +702,14 @@ class Burp(BUIbackend, BUIlogging):
def read_conf(self, agent=None):
if not self.parser:
return None
return []
return self.parser.read_server_conf()
def store_conf(self, data, agent=None):
if not self.parser:
return []
return self.parser.store_server_conf(data)
def get_parser_attr(self, attr=None, agent=None):
if not attr or not self.parser:
return None

View file

@ -33,6 +33,12 @@ class BUIbackend:
def restore_files(self, name=None, backup=None, files=None, strip=None, agent=None):
raise NotImplementedError("Sorry, the current Backend does not implement this method!")
def read_conf(self, agent=None):
raise NotImplementedError("Sorry, the current Backend does not implement this method!")
def store_conf(self, data, agent=None):
raise NotImplementedError("Sorry, the current Backend does not implement this method!")
def get_parser_attr(self, attr=None, agent=None):
raise NotImplementedError("Sorry, the current Backend does not implement this method!")

View file

@ -115,6 +115,9 @@ class Burp(BUIbackend):
def read_conf(self, agent=None):
return self.servers[agent].read_conf()
def store_conf(self, data, agent=None):
return self.servers[agent].store_conf(data)
def get_parser_attr(self, attr=None, agent=None):
return self.servers[agent].get_parser_attr(attr)
@ -281,6 +284,10 @@ class NClient(BUIbackend):
data = {'func': 'read_conf', 'args': None}
return json.loads(self.do_command(data))
def store_conf(self, data, agent=None):
data = {'func': 'store_conf', 'args': {'data': data}}
return json.loads(self.do_comman(data))
def get_parser_attr(self, attr=None, agent=None):
data = {'func': 'get_parser_attr', 'args': {'attr': attr}}
return json.loads(self.do_command(data))

View file

@ -8,5 +8,8 @@ class BUIparser:
def read_server_conf(self):
raise NotImplementedError("Sorry, the current Parser does not implement this method!")
def store_server_conf(self, data):
raise NotImplementedError("Sorry, the current Parser does not implement this method!")
def get_priv_attr(self, key):
raise NotImplementedError("Sorry, the current Parser does not implement this method!")

View file

@ -24,11 +24,9 @@ def load_user(userid):
@login_required
def settings(server=None):
if request.method == 'POST':
print request.form.keys()
print request.form.getlist('keep')
noti = [[0, 'Yo Dawg!']]
noti = bui.cli.store_conf(request.form)
return jsonify(notif=noti)
return render_template('config.html', settings=True, server=server)
return render_template('settings.html', settings=True, server=server)
@app.route('/api/server-config')
@app.route('/api/<server>/server-config')