Skip to content

Commit

Permalink
Empire 3.6.1 changelog updates (#399)
Browse files Browse the repository at this point in the history
* Readme updates

* Updated changelog for 3.6.1

* added update_comms api endpoint

* added update_killdate api endpoint

* added update_workinghours api endpoint

* switched endpoints from POST to PUT

* updated changelog with added api endpoints

* fixing changelog formatting

* accidentally delted example.py

Co-authored-by: hubbl3 <[email protected]>
  • Loading branch information
Cx01N and Hubbl3 authored Nov 16, 2020
1 parent 9e7a640 commit d5ba70d
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 5 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ Plugins are an extension of Empire that allow for custom scripts to be loaded. T
community projects to extend Empire functionality. Plugins can be accessed from the Empire CLI or the API as long as the
plugin follows the [template example](./plugins/example.py). A list of Empire Plugins is located [here](plugins/PLUGINS.md).

## Official Discord Channel
<p align="center">
<a href="https://discord.gg/P8PZPyf">
<img src="https://discordapp.com/api/guilds/716165691383873536/widget.png?style=banner3"/>
</p>

## Contribution Rules

Contributions are more than welcome! The more people who contribute to the project the better Empire will be for everyone. Below are a few guidelines for submitting contributions.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.0
3.6.1
8 changes: 8 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
11/16/2020
------------
- Version 3.6.1 Master Release
- Added editable wiki and sync option to repo - #398 (@Cx01N)
- Fixed byte error in python/collection/osx/prompt - #396 (@Cx01N)
- Fixed clear option issue for malleable listener - #393 (@Cx01N)
- Added update_comms, killdate, and workinghours endpoints (@Cx01N)

11/9/2020
------------
- Version 3.6.0 Master Release
Expand Down
98 changes: 96 additions & 2 deletions empire
Original file line number Diff line number Diff line change
Expand Up @@ -1081,12 +1081,106 @@ def start_restful_api(empireMenu: MainMenu, suppress=False, username=None, passw
taskID = main.agents.add_agent_task_db(agentSessionID, "TASK_SHELL", command, uid=g.user['id'])
return jsonify({'success': True, 'taskID': taskID})

@app.route('/api/agents/<string:agent_name>/update_comms', methods=['PUT'])
def agent_update_comms(agent_name):
"""
Dynamically update the agent comms to another
Takes {'listener': 'name'}
"""

if not request.json:
return make_response(jsonify({'error':'request body must be valid JSON'}), 400)

if not 'listener' in request.json:
return make_response(jsonify({'error':'JSON body must include key "listener"'}), 400)

listener_name = request.json['listener']

if not main.listeners.is_listener_valid(listener_name):
return jsonify({'error': 'Please enter a valid listener name.'})
else:
active_listener = main.listeners.activeListeners[listener_name]
if active_listener['moduleName'] != 'meterpreter' or active_listener['moduleName'] != 'http_mapi':
listener_options = active_listener['options']
listener_comms = main.listeners.loadedListeners[active_listener['moduleName']].generate_comms(listener_options, language="powershell")

main.agents.add_agent_task_db(agent_name, "TASK_UPDATE_LISTENERNAME", listener_options['Name']['Value'])
main.agents.add_agent_task_db(agent_name, "TASK_SWITCH_LISTENER", listener_comms)

msg = "Tasked agent to update comms to %s listener" % listener_name
main.agents.save_agent_log(agent_name, msg)
return jsonify({'success': True})
else:
return jsonify({'error': 'Ineligible listener for updatecomms command: %s' % active_listener['moduleName']})

@app.route('/api/agents/<string:agent_name>/killdate', methods=['PUT'])
def agent_kill_date(agent_name):
"""
Set an agent's killdate (01/01/2016)
Takes {'kill_date': 'date'}
"""

if not request.json:
return make_response(jsonify({'error':'request body must be valid JSON'}), 400)

if not 'kill_date' in request.json:
return make_response(jsonify({'error':'JSON body must include key "kill_date"'}), 400)

try:
kill_date = request.json['kill_date']

# update this agent's information in the database
main.agents.set_agent_field_db("kill_date", kill_date, agent_name)

# task the agent
main.agents.add_agent_task_db(agent_name, "TASK_SHELL", "Set-KillDate " + str(kill_date))

# update the agent log
msg = "Tasked agent to set killdate to " + str(kill_date)
main.agents.save_agent_log(agent_name, msg)
return jsonify({'success': True})
except:
return jsonify({'error': 'Unable to update agent killdate'})

@app.route('/api/agents/<string:agent_name>/workinghours', methods=['PUT'])
def agent_working_hours(agent_name):
"""
Set an agent's working hours (9:00-17:00)
Takes {'working_hours': 'working_hours'}
"""

if not request.json:
return make_response(jsonify({'error':'request body must be valid JSON'}), 400)

if not 'working_hours' in request.json:
return make_response(jsonify({'error':'JSON body must include key "working_hours"'}), 400)

try:
working_hours = request.json['working_hours']
working_hours = working_hours.replace(",", "-")

# update this agent's information in the database
main.agents.set_agent_field_db("working_hours", working_hours, agent_name)

# task the agent
main.agents.add_agent_task_db(agent_name, "TASK_SHELL", "Set-WorkingHours " + str(working_hours))

# update the agent log
msg = "Tasked agent to set working hours to " + str(working_hours)
main.agents.save_agent_log(agent_name, msg)
return jsonify({'success': True})
except:
return jsonify({'error': 'Unable to update agent workinghours'})

@app.route('/api/agents/<string:agent_name>/rename', methods=['POST'])
def task_agent_rename(agent_name):
"""
Renames the specified agent.
Takes {'newname':'NAME'}
Takes {'newname': 'NAME'}
"""

agentNameID = execute_db_query(conn, 'SELECT name,session_id FROM agents WHERE name like ? OR session_id like ?', [agent_name, agent_name])
Expand Down Expand Up @@ -1164,7 +1258,7 @@ def start_restful_api(empireMenu: MainMenu, suppress=False, username=None, passw
return make_response(jsonify({'error':'request body must be valid JSON'}), 400)

if not 'notes' in request.json:
return make_response(jsonify({'error':'JSON body must include key "credentials"'}), 400)
return make_response(jsonify({'error':'JSON body must include key "notes"'}), 400)

notes = request.json['notes']

Expand Down
2 changes: 1 addition & 1 deletion lib/common/empire.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from flask_socketio import SocketIO

VERSION = "3.6.0 BC Security Fork"
VERSION = "3.6.1 BC Security Fork"

from pydispatch import dispatcher

Expand Down
2 changes: 1 addition & 1 deletion plugins/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def register(self, mainMenu):
def do_test(self, args):
"""
An example of a plugin function.
Usage: test <start|stop> <message>
"""
print("This is executed from a plugin!")
Expand Down Expand Up @@ -116,3 +115,4 @@ def shutdown(self):
"""
# If the plugin spawns a process provide a shutdown method for when Empire exits else leave it as pass
pass

0 comments on commit d5ba70d

Please sign in to comment.