From d7c9d43d227beeb0d7c2e5cba818ecf6a0cb47e5 Mon Sep 17 00:00:00 2001 From: Dakota Nelson Date: Fri, 5 Jan 2018 14:12:51 -0700 Subject: [PATCH] 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)