reporting API GET fixes

mdns
bneg 2017-04-22 12:01:48 -07:00
parent e66b62ba42
commit b488e2f3e0
1 changed files with 12 additions and 12 deletions

24
empire
View File

@ -1023,12 +1023,12 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password
""" """
Returns JSON describing the reporting events from the backend database. Returns JSON describing the reporting events from the backend database.
""" """
reportingRaw = execute_db_query(conn, 'SELECT * FROM reporting') reportingRaw = execute_db_query(conn, 'SELECT ID, name, event_type, message, time_stamp, taskID FROM reporting')
reportingEvents = [] reportingEvents = []
for reportingEvent in reportingRaw: for reportingEvent in reportingRaw:
[ID, name, eventType, message, timestamp, taskID] = reportingEvent [ID, name, event_type, message, time_stamp, taskID] = reportingEvent
reportingEvents.append({"ID":ID, "agentname":name, "event_type":eventType, "message":message, "timestamp":timestamp, "taskID":taskID}) reportingEvents.append({"ID":ID, "agentname":name, "event_type":event_type, "message":message, "timestamp":time_stamp, "taskID":taskID})
return jsonify({'reporting' : reportingEvents}) return jsonify({'reporting' : reportingEvents})
@ -1047,12 +1047,12 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password
else: else:
return jsonify({'reporting' : ''}) return jsonify({'reporting' : ''})
reportingRaw = execute_db_query(conn, 'SELECT * FROM reporting WHERE name=?', [sessionID]) reportingRaw = execute_db_query(conn, 'SELECT ID, name, event_type, message, time_stamp, taskID FROM reporting WHERE name=?', [sessionID])
reportingEvents = [] reportingEvents = []
for reportingEvent in reportingRaw: for reportingEvent in reportingRaw:
[ID, name, eventType, message, timestamp] = reportingEvent [ID, name, event_type, message, time_stamp, taskID] = reportingEvent
reportingEvents.append({"ID":ID, "agentname":name, "event_type":eventType, "message":message, "timestamp":timestamp}) reportingEvents.append({"ID":ID, "agentname":name, "event_type":event_type, "message":message, "timestamp":time_stamp, "taskID":taskID})
return jsonify({'reporting' : reportingEvents}) return jsonify({'reporting' : reportingEvents})
@ -1063,12 +1063,12 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password
Returns JSON describing the reporting events from the backend database for Returns JSON describing the reporting events from the backend database for
the event type specified by event_type. the event type specified by event_type.
""" """
reportingRaw = execute_db_query(conn, 'SELECT * FROM reporting WHERE event_type=?', [event_type]) reportingRaw = execute_db_query(conn, 'SELECT ID, name, event_type, message, time_stamp, taskID FROM reporting WHERE event_type=?', [event_type])
reportingEvents = [] reportingEvents = []
for reportingEvent in reportingRaw: for reportingEvent in reportingRaw:
[ID, name, eventType, message, timestamp] = reportingEvent [ID, name, event_type, message, time_stamp, taskID] = reportingEvent
reportingEvents.append({"ID":ID, "agentname":name, "event_type":eventType, "message":message, "timestamp":timestamp}) reportingEvents.append({"ID":ID, "agentname":name, "event_type":event_type, "message":message, "timestamp":time_stamp, "taskID":taskID})
return jsonify({'reporting' : reportingEvents}) return jsonify({'reporting' : reportingEvents})
@ -1079,12 +1079,12 @@ def start_restful_api(startEmpire=False, suppress=False, username=None, password
Returns JSON describing the reporting events from the backend database for Returns JSON describing the reporting events from the backend database for
the any messages with *msg* specified by msg. the any messages with *msg* specified by msg.
""" """
reportingRaw = execute_db_query(conn, "SELECT * FROM reporting WHERE message like ?", ['%'+msg+'%']) reportingRaw = execute_db_query(conn, "SELECT ID, name, event_type, message, time_stamp, taskID FROM reporting WHERE message like ?", ['%'+msg+'%'])
reportingEvents = [] reportingEvents = []
for reportingEvent in reportingRaw: for reportingEvent in reportingRaw:
[ID, name, eventType, message, timestamp] = reportingEvent [ID, name, event_type, message, time_stamp, taskID] = reportingEvent
reportingEvents.append({"ID":ID, "agentname":name, "event_type":eventType, "message":message, "timestamp":timestamp}) reportingEvents.append({"ID":ID, "agentname":name, "event_type":event_type, "message":message, "timestamp":time_stamp, "taskID":taskID})
return jsonify({'reporting' : reportingEvents}) return jsonify({'reporting' : reportingEvents})