mirror of https://github.com/n1nj4sec/pupy.git
add space in templates for scriptlets
This commit is contained in:
parent
4ec9885f63
commit
620c951f19
|
@ -21,7 +21,7 @@ int linux_inject_main(int argc, char **argv);
|
||||||
|
|
||||||
static const char module_doc[] = "Builtins utilities for pupy";
|
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;
|
static PyObject *ExecError;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "base_inject.h"
|
#include "base_inject.h"
|
||||||
static char module_doc[] = "Builtins utilities for pupy";
|
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;
|
extern const DWORD dwPupyArch;
|
||||||
|
|
||||||
#include "resources_library_compressed_string_txt.c"
|
#include "resources_library_compressed_string_txt.c"
|
||||||
|
|
|
@ -29,6 +29,7 @@ import getpass
|
||||||
import json
|
import json
|
||||||
|
|
||||||
ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__)))
|
ROOT=os.path.abspath(os.path.join(os.path.dirname(__file__)))
|
||||||
|
HARDCODED_CONF_SIZE=32768
|
||||||
|
|
||||||
def get_edit_binary(path, conf):
|
def get_edit_binary(path, conf):
|
||||||
logging.debug("generating binary %s with conf: %s"%(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 = struct.pack('>II', compressed, uncompressed) + new_conf
|
||||||
new_conf_len = len(new_conf)
|
new_conf_len = len(new_conf)
|
||||||
|
|
||||||
if new_conf_len > 8192:
|
|
||||||
|
if new_conf_len > HARDCODED_CONF_SIZE:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
'Error: config or offline script too long ({}/8192 bytes)'
|
'Error: config or offline script too long ({}/{} bytes)'
|
||||||
'You need to recompile the dll with a bigger buffer'.format(new_conf_len)
|
'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]
|
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
|
return binary
|
||||||
|
|
||||||
def get_raw_conf(conf, obfuscate=False):
|
def get_raw_conf(conf, obfuscate=False):
|
||||||
|
|
Loading…
Reference in New Issue