add a warning if the templates are not synced with pupy version

This commit is contained in:
n1nj4sec 2017-04-23 15:25:49 +02:00
parent 8a422ff217
commit 032807f59e
2 changed files with 15 additions and 3 deletions

View File

@ -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:

View File

@ -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="""
_____ _ _ _