Skip to content

Commit

Permalink
Remove old Empire CLI (#31)
Browse files Browse the repository at this point in the history
* cleaned up empire.py

* removed arg handler

* more empire.py cleanup

* removed table functions

* removed need to use \n to print on new line

* re-added display_agent for now

* updated initial launcher

* updated formatting in empire

* updated imports

Co-authored-by: Vincent Rose <vrose04@gmail.com>
  • Loading branch information
Cx01N and vinnybod authored Feb 17, 2021
1 parent 948832f commit 187164c
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 4,909 deletions.
2 changes: 1 addition & 1 deletion data/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def process_packet(packetType, data, resultID):
result += data[0].strip()
try:
os.remove(implantPath)
result += "\n[*] Module path was properly removed: %s" %(implantPath)
result += "[*] Module path was properly removed: %s" %(implantPath)
except Exception as e:
print("error removing module filed: %s" %(e))
fileCheck = os.path.isfile(implantPath)
Expand Down
360 changes: 150 additions & 210 deletions empire

Large diffs are not rendered by default.

15 changes: 3 additions & 12 deletions lib/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,13 @@
generalGroup.add_argument('-r', '--resource', nargs=1,
help='Run the Empire commands in the specified resource file after startup.')

cliGroup = parser.add_argument_group('CLI Payload Options')
cliGroup.add_argument('-l', '--listener', nargs='?', const="list",
help='Display listener options. Displays all listeners if nothing is specified.')
cliGroup.add_argument('-s', '--stager', nargs='?', const="list",
help='Specify a stager to generate. Lists all stagers if none is specified.')
cliGroup.add_argument('-o', '--stager-options', nargs='*',
help="Supply options to set for a stager in OPTION=VALUE format. Lists options if nothing is specified.")

restGroup = parser.add_argument_group('RESTful API Options')
launchGroup = restGroup.add_mutually_exclusive_group()
launchGroup.add_argument('--rest', action='store_true', help='Run Empire and the RESTful API & Socket Server.')
launchGroup.add_argument('--rest', action='store_true', help='No longer needed, RESTful API is on by default.')
launchGroup.add_argument('--headless', action='store_true',
help='Run the RESTful API and Socket Server headless without the usual interface.')
launchGroup.add_argument('--teamserver', action='store_true',
help='Run Empire Team Server with RESTful API and Socket Server.')
restGroup.add_argument('-n', '--notifications', action='store_true', help='Run the SocketIO notifications server.')
restGroup.add_argument('-n', '--notifications', action='store_true', help='No longer needed, SocketIO notifications '
'server is on by default.')
restGroup.add_argument('--restport', type=int, nargs=1, help='Port to run the Empire RESTful API on. Defaults to 1337')
restGroup.add_argument('--socketport', type=int, nargs=1, help='Port to run socketio on. Defaults to 5000')
restGroup.add_argument('--username', nargs=1,
Expand Down
10 changes: 5 additions & 5 deletions lib/common/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def save_file(self, sessionID, path, data, filesize, append=False):

if "python" in lang:
print(
helpers.color("\n[*] Compressed size of %s download: %s" % (filename, helpers.get_file_size(data)),
helpers.color("[*] Compressed size of %s download: %s" % (filename, helpers.get_file_size(data)),
color="green"))
d = decompress.decompress()
dec_data = d.dec_data(data)
Expand Down Expand Up @@ -341,7 +341,7 @@ def save_module_file(self, sessionID, path, data):

# decompress data if coming from a python agent:
if "python" in lang:
print(helpers.color("\n[*] Compressed size of %s download: %s" % (filename, helpers.get_file_size(data)),
print(helpers.color("[*] Compressed size of %s download: %s" % (filename, helpers.get_file_size(data)),
color="green"))
d = decompress.decompress()
dec_data = d.dec_data(data)
Expand Down Expand Up @@ -384,7 +384,7 @@ def save_module_file(self, sessionID, path, data):
self.lock.release()

# notify everyone that the file was downloaded
message = "\n[+] File {} from {} saved".format(path, sessionID)
message = "[+] File {} from {} saved".format(path, sessionID)
signal = json.dumps({
'print': True,
'message': message
Expand Down Expand Up @@ -1340,7 +1340,7 @@ def handle_agent_staging(self, sessionID, language, meta, additional, encData, s

# save the initial sysinfo information in the agent log
output = messages.display_agent(agent, returnAsString=True)
output += "\n[+] Agent %s now active:\n" % (sessionID)
output += "[+] Agent %s now active:\n" % (sessionID)
self.mainMenu.agents.save_agent_log(sessionID, output)

# if a script autorun is set, set that as the agent's first tasking
Expand Down Expand Up @@ -1600,7 +1600,7 @@ def process_agent_packet(self, session_id, response_name, task_id, data):

if response_name == "ERROR":
# error code
message = "\n[!] Received error response from {}".format(session_id)
message = "[!] Received error response from {}".format(session_id)
signal = json.dumps({
'print': True,
'message': message
Expand Down
2 changes: 1 addition & 1 deletion lib/common/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def export_credentials(self, export_path=''):

if os.path.exists(export_path):
try:
choice = input(helpers.color("\n[>] File %s already exists, overwrite? [y/N] " % (export_path), "red"))
choice = input(helpers.color("[>] File %s already exists, overwrite? [y/N] " % (export_path), "red"))
if choice.lower() != "" and choice.lower()[0] == "y":
pass
else:
Expand Down
Loading

0 comments on commit 187164c

Please sign in to comment.