From d7c9d43d227beeb0d7c2e5cba818ecf6a0cb47e5 Mon Sep 17 00:00:00 2001 From: Dakota Nelson Date: Fri, 5 Jan 2018 14:12:51 -0700 Subject: [PATCH 1/2] Include Docker and non-docker paths in template search, fix #904 --- lib/listeners/dbx.py | 4 +++- lib/listeners/http.py | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/listeners/dbx.py b/lib/listeners/dbx.py index 0252ff0..d9be38a 100755 --- a/lib/listeners/dbx.py +++ b/lib/listeners/dbx.py @@ -431,7 +431,9 @@ class Listener: elif language.lower() == 'python': - template_path = os.path.join(self.mainMenu.installPath, '/data/agent/stagers') + template_path = [ + os.path.join(self.mainMenu.installPath, '/data/agent/stagers'), + os.path.join(self.mainMenu.installPath, './data/agent/stagers')] eng = templating.TemplateEngine(template_path) template = eng.get_template('dropbox.py') diff --git a/lib/listeners/http.py b/lib/listeners/http.py index 720b7d0..dc21262 100644 --- a/lib/listeners/http.py +++ b/lib/listeners/http.py @@ -591,7 +591,9 @@ class Listener: return randomizedStager elif language.lower() == 'python': - template_path = os.path.join(self.mainMenu.installPath, 'data/agent/stagers') + template_path = [ + os.path.join(self.mainMenu.installPath, '/data/agent/stagers'), + os.path.join(self.mainMenu.installPath, './data/agent/stagers')] eng = templating.TemplateEngine(template_path) template = eng.get_template('http.py') @@ -898,7 +900,7 @@ def send_message(packets=None): return launcher else: return make_response(self.default_response(), 404) - + @app.before_request def check_ip(): """ @@ -930,7 +932,7 @@ def send_message(packets=None): """ Return default server web page if user navigates to index. """ - + static_dir = self.mainMenu.installPath + "data/misc/" return make_response(self.index_page(), 200) From aba0cbfb94033021823441da1e55d408511b0d61 Mon Sep 17 00:00:00 2001 From: xorrior Date: Sun, 7 Jan 2018 19:24:06 -0500 Subject: [PATCH 2/2] Additional patch for launcher generation with dbx listener --- lib/common/empire.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/common/empire.py b/lib/common/empire.py index c5fc36c..bc60a69 100644 --- a/lib/common/empire.py +++ b/lib/common/empire.py @@ -3011,8 +3011,11 @@ class ListenersMenu(SubMenu): stager.options['Listener']['Value'] = listenerName stager.options['Language']['Value'] = language stager.options['Base64']['Value'] = "True" - stager.options['Proxy']['Value'] = listenerOptions['options']['Proxy']['Value'] - stager.options['ProxyCreds']['Value'] = listenerOptions['options']['ProxyCreds']['Value'] + try: + stager.options['Proxy']['Value'] = listenerOptions['options']['Proxy']['Value'] + stager.options['ProxyCreds']['Value'] = listenerOptions['options']['ProxyCreds']['Value'] + except: + pass if self.mainMenu.obfuscate: stager.options['Obfuscate']['Value'] = "True" else: @@ -3124,8 +3127,11 @@ class ListenerMenu(SubMenu): stager.options['Listener']['Value'] = self.listenerName stager.options['Language']['Value'] = parts[0] stager.options['Base64']['Value'] = "True" - stager.options['Proxy']['Value'] = listenerOptions['options']['Proxy']['Value'] - stager.options['ProxyCreds']['Value'] = listenerOptions['options']['ProxyCreds']['Value'] + try: + stager.options['Proxy']['Value'] = listenerOptions['options']['Proxy']['Value'] + stager.options['ProxyCreds']['Value'] = listenerOptions['options']['ProxyCreds']['Value'] + except: + pass print stager.generate() except Exception as e: print helpers.color("[!] Error generating launcher: %s" % (e))