From 032807f59e1d9884a0cc2d64af1bcbc9baaa62ce Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Sun, 23 Apr 2017 15:25:49 +0200 Subject: [PATCH] add a warning if the templates are not synced with pupy version --- pupy/pupygen.py | 14 +++++++++++++- pupy/pupylib/PupyVersion.py | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pupy/pupygen.py b/pupy/pupygen.py index b3947ed3..e595ef34 100755 --- a/pupy/pupygen.py +++ b/pupy/pupygen.py @@ -17,6 +17,7 @@ from scriptlets.scriptlets import ScriptletArgumentError from modules.lib.windows.powershell_upload import obfuscatePowershellScript from pupylib.PupyCredentials import Credentials, EncryptionError from pupylib import PupyCredentials +from pupylib.PupyVersion import __version__ import marshal import scriptlets @@ -31,6 +32,16 @@ import json ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__))) HARDCODED_CONF_SIZE=32768 +def check_templates_version(): + try: + with open(os.path.join(ROOT, "payload_templates", "version.txt"), 'r') as f: + v=f.read().strip() + except: + v="0.0" + if v != __version__: + logging.warning("Your templates are not synced with your pupy version ! , you should update them with \"git submodule update\"") + + def get_edit_binary(path, conf): logging.debug("generating binary %s with conf: %s"%(path, conf)) binary=b"" @@ -392,7 +403,7 @@ def get_parser(base_parser, config): parser.add_argument( 'launcher_args', default=config.get('gen', 'launcher_args'), nargs=argparse.REMAINDER, help="launcher options") - + check_templates_version() return parser def pupygen(args, config): @@ -541,6 +552,7 @@ def pupygen(args, config): if __name__ == '__main__': Credentials.DEFAULT_ROLE = 'CLIENT' + check_templates_version() config = PupyConfig() parser = get_parser(argparse.ArgumentParser, config) try: diff --git a/pupy/pupylib/PupyVersion.py b/pupy/pupylib/PupyVersion.py index 0d2aeef6..b380d640 100644 --- a/pupy/pupylib/PupyVersion.py +++ b/pupy/pupylib/PupyVersion.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- __author__='Nicolas VERDIER' -__version__='v1.3' -__date__='Jun 17 2016' +__version__='v1.4' +__date__='Apr 23 2017' BANNER=""" _____ _ _ _