Re-implemented /api/listeners/options GET Rest call

mdns
chris 2017-04-28 22:04:10 -04:00
parent 38054a8cc9
commit 48116d35d6
2 changed files with 19 additions and 4 deletions

9
empire
View File

@ -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'])

View File

@ -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):
"""