diff --git a/empire b/empire index d2ba086..7847d12 100755 --- a/empire +++ b/empire @@ -703,11 +703,12 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password @app.route('/api/listeners/options', methods=['GET']) def get_listener_options(): """ - -- Is this deprecated? -bneg - Returns JSON describing the current listener options. + Returns JSON describing the current listener options """ - #return jsonify({'listeneroptions' : [main.listeners.options]}) - return jsonify({'listeneroptions':'Deprecated. Retrieve from /api/listeners/[name]'}) + optionsRaw = execute_db_query(conn, 'SELECT options FROM listeners') + options = pickle.loads(optionsRaw[0][0]) + + return jsonify({'listeneroptions' : options}) @app.route('/api/listeners', methods=['POST']) diff --git a/lib/common/listeners.py b/lib/common/listeners.py index c6c898b..8f24a2b 100644 --- a/lib/common/listeners.py +++ b/lib/common/listeners.py @@ -366,6 +366,20 @@ class Listeners: else: return None + def get_listener_options(self): + """ + Return the options for a listener type + """ + cur = self.conn.cursor() + cur.execute('SELECT options FROM listeners') + results = cur.fetchall() + cur.close() + + if results: + return results[0][0] + else: + return None + def get_listener_names(self): """