mirror of https://github.com/n1nj4sec/pupy.git
Try to preserve arch specific library bundles between simple cleans
This commit is contained in:
parent
071a4f8d77
commit
25fac6a96a
|
@ -44,7 +44,7 @@ import compileall
|
|||
|
||||
compileall.compile_dir(PATCHES)
|
||||
|
||||
zf = zipfile.ZipFile(os.path.join('resources','library.zip'), mode='w', compression=zipfile.ZIP_DEFLATED)
|
||||
zf = zipfile.ZipFile(sys.argv[1], mode='w', compression=zipfile.ZIP_DEFLATED)
|
||||
|
||||
if 'win' in sys.platform:
|
||||
for root, _, files in os.walk(r'C:\Python27\Lib\site-packages'):
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import StringIO, zipfile, os.path, imp, sys
|
||||
import StringIO, zipfile, os.path, imp, sys, os
|
||||
import marshal
|
||||
import pylzma
|
||||
import struct
|
||||
|
||||
def get_encoded_library_string():
|
||||
filepath=None
|
||||
filepath=os.path.join("resources","library.zip")
|
||||
def get_encoded_library_string(filepath):
|
||||
dest = os.path.dirname(filepath)
|
||||
if not os.path.exists(dest):
|
||||
os.makedirs(dest)
|
||||
|
||||
f = StringIO.StringIO()
|
||||
f.write(open(filepath, "rb").read())
|
||||
f.write(open(filepath, 'rb').read())
|
||||
|
||||
zip = zipfile.ZipFile(f)
|
||||
|
||||
|
@ -23,5 +24,5 @@ def get_encoded_library_string():
|
|||
|
||||
return marshal.dumps(modules)
|
||||
|
||||
with open(os.path.join("resources","library_compressed_string.txt"),'wb') as w:
|
||||
w.write(get_encoded_library_string())
|
||||
with open(sys.argv[1],'wb') as w:
|
||||
w.write(get_encoded_library_string(sys.argv[2]))
|
||||
|
|
|
@ -5,6 +5,7 @@ import marshal
|
|||
import struct
|
||||
import base64
|
||||
import os.path
|
||||
import os
|
||||
import argparse
|
||||
|
||||
remove_stdout='''
|
||||
|
@ -74,6 +75,9 @@ if __name__=="__main__":
|
|||
pp+'\n',
|
||||
]
|
||||
|
||||
if not os.path.exists('resources'):
|
||||
os.makedirs('resources')
|
||||
|
||||
with open(os.path.join("resources","bootloader.pyc"),'wb') as w:
|
||||
w.write(marshal.dumps([
|
||||
compile(block, '<string>', 'exec') for block in bootloader
|
||||
|
|
|
@ -4,19 +4,22 @@ import sys
|
|||
import binascii
|
||||
import pylzma
|
||||
import struct
|
||||
import os
|
||||
|
||||
MAX_CHAR_PER_LINE=50
|
||||
|
||||
if __name__=="__main__":
|
||||
h_file=""
|
||||
file_bytes=b""
|
||||
output = os.path.basename(sys.argv[2]).replace('.', '_')
|
||||
|
||||
with open(sys.argv[1], "rb") as f:
|
||||
file_bytes=f.read()
|
||||
|
||||
compressed = int(sys.argv[2])
|
||||
compressed = int(sys.argv[3])
|
||||
|
||||
attribute = '\n'.join([
|
||||
'__attribute__(({}))'.format(x) for x in sys.argv[3:]
|
||||
'__attribute__(({}))'.format(x) for x in sys.argv[4:]
|
||||
])
|
||||
|
||||
payload_len = len(file_bytes)
|
||||
|
@ -26,9 +29,9 @@ if __name__=="__main__":
|
|||
) if compressed else file_bytes
|
||||
)
|
||||
|
||||
h_file += "static const int %s_size = %s;"%(sys.argv[1].replace(".","_").replace("\\","_").replace("/","_"), len(payload))
|
||||
h_file += "static const int %s_size = %s;"%(output, len(payload))
|
||||
h_file += attribute
|
||||
h_file += "\nstatic const char %s_start[] = {\n"%sys.argv[1].replace(".","_").replace("\\","_").replace("/","_")
|
||||
h_file += "\nstatic const char %s_start[] = {\n"%(output)
|
||||
current_size=0
|
||||
|
||||
for c in payload:
|
||||
|
@ -40,5 +43,5 @@ if __name__=="__main__":
|
|||
|
||||
h_file += "'\\x00' };\n"
|
||||
|
||||
with open(sys.argv[1].replace(".","_").replace("\\","_").replace("/","_")+".c",'w') as w:
|
||||
with open(sys.argv[2],'w') as w:
|
||||
w.write(h_file)
|
||||
|
|
|
@ -19,12 +19,13 @@ XZARGS ?= "aligned(0x1000)" 'section(".xzrodata")'
|
|||
ARCH ?= $(shell file $(LIBPYTHON) | grep 32-bit >/dev/null && echo 32 || echo 64)
|
||||
ifeq ($(ARCH),64)
|
||||
NAME := 64
|
||||
CFLAGS += -m64
|
||||
LDFLAGS += -m64
|
||||
else
|
||||
NAME := 86
|
||||
endif
|
||||
|
||||
CFLAGS += -Iresources/$(ARCH) -Iresources
|
||||
|
||||
LINUX_INJECT_CFLAGS := -include fixes.h -include debug.h \
|
||||
-Dmain=linux_inject_main -Drealpath=fakepath
|
||||
|
||||
|
@ -75,9 +76,9 @@ revision.h:
|
|||
if [ x"$$COMMIT" = x"" ]; then rev=`cat ../../.git/\`cat ../../.git/HEAD | cut -f 2 -d \ \` | cut -c 1-8`; \
|
||||
else rev=$$COMMIT; fi; echo "#define GIT_REVISION_HEAD \"$$rev\"" >$@
|
||||
|
||||
pupy.o: resources_library_compressed_string_txt.c revision.h
|
||||
pupy_load.o: resources_bootloader_pyc.c resources_python27_so.c \
|
||||
resources_libssl_so.c resources_libcrypto_so.c revision.h
|
||||
pupy.o: resources/$(ARCH)/library.c revision.h
|
||||
pupy_load.o: resources/bootloader.c resources/$(ARCH)/python27.c \
|
||||
resources/$(ARCH)/libssl.c resources/$(ARCH)/libcrypto.c revision.h
|
||||
|
||||
import-tab.c import-tab.h: mktab.py
|
||||
$(PYTHON) $(PFLAGS) $<
|
||||
|
@ -90,54 +91,56 @@ LzmaDec.o: ../lzma/LzmaDec.c
|
|||
$(CC) $(CFLAGS) -O3 -fPIC -c -o $@ $<
|
||||
endif
|
||||
|
||||
resources/library_compressed_string.txt: ../gen_library_compressed_string.py resources/library.zip
|
||||
$(PYTHON) $(PFLAGS) ../gen_library_compressed_string.py
|
||||
resources/$(ARCH)/library.txt: ../gen_library_compressed_string.py resources/$(ARCH)/library.zip
|
||||
$(PYTHON) $(PFLAGS) ../gen_library_compressed_string.py $@ resources/$(ARCH)/library.zip
|
||||
|
||||
resources_library_compressed_string_txt.c: ../gen_resource_header.py resources/library_compressed_string.txt resources/library.zip
|
||||
$(PYTHON) $(PFLAGS) ../gen_resource_header.py \
|
||||
resources/library_compressed_string.txt $(COMPRESSED) $(XZARGS)
|
||||
resources/$(ARCH)/library.c: ../gen_resource_header.py resources/$(ARCH)/library.txt resources/$(ARCH)/library.zip
|
||||
$(PYTHON) $(PFLAGS) ../gen_resource_header.py resources/$(ARCH)/library.txt $@ $(COMPRESSED) $(XZARGS)
|
||||
|
||||
resources/bootloader.pyc: ../gen_python_bootloader.py ../../pupy/packages/all/pupyimporter.py ../../pupy/pp.py
|
||||
$(PYTHON) $(PFLAGS) ../gen_python_bootloader.py $(DEBUG_ADD)
|
||||
|
||||
resources_bootloader_pyc.c: ../gen_resource_header.py resources/bootloader.pyc
|
||||
$(PYTHON) $(PFLAGS) $+ $(COMPRESSED) $(XZARGS)
|
||||
resources/bootloader.c: ../gen_resource_header.py resources/bootloader.pyc
|
||||
$(PYTHON) $(PFLAGS) $+ $@ $(COMPRESSED) $(XZARGS)
|
||||
|
||||
linux-inject/%.o: linux-inject/%.c
|
||||
$(CC) -c $(LINUX_INJECT_CFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
resources/python27.so: $(LIBPYTHON)
|
||||
resources/$(ARCH)/python27.so: $(LIBPYTHON)
|
||||
@mkdir -p resources/$(ARCH)
|
||||
cp -f $< $@.tmp
|
||||
-chmod 600 $@.tmp
|
||||
-strip $@.tmp
|
||||
mv $@.tmp $@
|
||||
rm -f $@.tmp
|
||||
|
||||
resources/libcrypto.so: $(LIBCRYPTO)
|
||||
resources/$(ARCH)/libcrypto.so: $(LIBCRYPTO)
|
||||
@mkdir -p resources/$(ARCH)
|
||||
cp -f $< $@.tmp
|
||||
-chmod 600 $@.tmp
|
||||
-strip $@.tmp
|
||||
mv $@.tmp $@
|
||||
rm -f $@.tmp
|
||||
|
||||
resources/libssl.so: $(LIBSSL)
|
||||
resources/$(ARCH)/libssl.so: $(LIBSSL)
|
||||
@mkdir -p resources/$(ARCH)
|
||||
cp -f $< $@.tmp
|
||||
-chmod 600 $@.tmp
|
||||
-strip $@.tmp
|
||||
mv $@.tmp $@
|
||||
rm -f $@.tmp
|
||||
|
||||
resources/library.zip: ../build_library_zip.py ../additional_imports.py
|
||||
$(PYTHON) -OO $(PFLAGS) $<
|
||||
resources/$(ARCH)/library.zip: ../build_library_zip.py ../additional_imports.py
|
||||
$(PYTHON) -OO $(PFLAGS) $< $@
|
||||
|
||||
resources_python27_so.c: ../gen_resource_header.py resources/python27.so
|
||||
$(PYTHON) $(PFLAGS) $+ $(COMPRESSED) $(XZARGS)
|
||||
resources/$(ARCH)/python27.c: ../gen_resource_header.py resources/$(ARCH)/python27.so
|
||||
$(PYTHON) $(PFLAGS) $+ $@ $(COMPRESSED) $(XZARGS)
|
||||
|
||||
resources_libssl_so.c: ../gen_resource_header.py resources/libssl.so
|
||||
$(PYTHON) $(PFLAGS) $+ $(COMPRESSED) $(XZARGS)
|
||||
resources/$(ARCH)/libssl.c: ../gen_resource_header.py resources/$(ARCH)/libssl.so
|
||||
$(PYTHON) $(PFLAGS) $+ $@ $(COMPRESSED) $(XZARGS)
|
||||
|
||||
resources_libcrypto_so.c: ../gen_resource_header.py resources/libcrypto.so
|
||||
$(PYTHON) $(PFLAGS) $+ $(COMPRESSED) $(XZARGS)
|
||||
resources/$(ARCH)/libcrypto.c: ../gen_resource_header.py resources/$(ARCH)/libcrypto.so
|
||||
$(PYTHON) $(PFLAGS) $+ $@ $(COMPRESSED) $(XZARGS)
|
||||
|
||||
$(TEMPLATE_OUTPUT_PATH)/pupyx$(NAME).$(SUFFIX): main_exe.o $(PYOBJS) $(COMMON_OBJS)
|
||||
$(CC) $(PIE) $+ -o $@ $(LDFLAGS)
|
||||
|
@ -148,23 +151,18 @@ $(TEMPLATE_OUTPUT_PATH)/pupyx$(NAME).$(SUFFIX).so: main_so.o $(PYOBJS) $(COMMON_
|
|||
.PHONY: clean all
|
||||
|
||||
clean:
|
||||
rm -f $(COMMON_OBJS)
|
||||
rm -f $(COMMON_OBJS) $(PYOBJS)
|
||||
rm -f pupy pupy.so
|
||||
rm -f *.o
|
||||
rm -f linux-inject/*.o
|
||||
rm -f resources/*.pyc
|
||||
rm -f resources/*.pyo
|
||||
rm -f resources/bootloader.pyc
|
||||
rm -f resources_bootloader_pyc.c
|
||||
rm -f resources/bootloader.c
|
||||
|
||||
distclean: clean
|
||||
rm -f import-tab.c
|
||||
rm -f import-tab.h
|
||||
rm -f resources_*.c
|
||||
rm -f resources/*.so
|
||||
rm -f resources/*.txt
|
||||
rm -f resources/library.zip
|
||||
rm -f revision.h
|
||||
rm -rf resources
|
||||
|
||||
$(COMMON_OBJS) $(PYOBJS): import-tab.h
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ su - pupy
|
|||
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
cd /mnt/client/sources-linux
|
||||
make clean
|
||||
make PIE=
|
||||
make -j PIE=
|
||||
make clean
|
||||
make DEBUG=1 PIE=
|
||||
make -j DEBUG=1 PIE=
|
||||
make clean
|
||||
make PIE= UNCOMPRESSED=1
|
||||
make -j PIE= UNCOMPRESSED=1
|
||||
make clean
|
||||
make DEBUG=1 PIE= UNCOMPRESSED=1
|
||||
make -j DEBUG=1 PIE= UNCOMPRESSED=1
|
||||
__CMDS__
|
||||
|
||||
umount buildenv/lin32/dev
|
||||
|
@ -45,13 +45,13 @@ su - pupy
|
|||
export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
cd /mnt/client/sources-linux
|
||||
make clean
|
||||
make
|
||||
make -j
|
||||
make clean
|
||||
make DEBUG=1
|
||||
make -j DEBUG=1
|
||||
make clean
|
||||
make UNCOMPRESSED=1
|
||||
make -j UNCOMPRESSED=1
|
||||
make clean
|
||||
make DEBUG=1 UNCOMPRESSED=1
|
||||
make -j DEBUG=1 UNCOMPRESSED=1
|
||||
__CMDS__
|
||||
|
||||
umount buildenv/lin64/dev
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
int linux_inject_main(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#include "resources_library_compressed_string_txt.c"
|
||||
#include "library.c"
|
||||
|
||||
#include "revision.h"
|
||||
|
||||
|
@ -39,12 +39,12 @@ static PyObject *Py_get_modules(PyObject *self, PyObject *args)
|
|||
static PyObject *modules = NULL;
|
||||
if (!modules) {
|
||||
modules = PyObject_lzmaunpack(
|
||||
resources_library_compressed_string_txt_start,
|
||||
resources_library_compressed_string_txt_size
|
||||
library_c_start,
|
||||
library_c_size
|
||||
);
|
||||
|
||||
munmap((char *) resources_library_compressed_string_txt_start,
|
||||
resources_library_compressed_string_txt_size);
|
||||
munmap((char *) library_c_start,
|
||||
library_c_size);
|
||||
|
||||
Py_XINCREF(modules);
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#include "tmplibrary.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "resources_bootloader_pyc.c"
|
||||
#include "resources_python27_so.c"
|
||||
#include "resources_libssl_so.c"
|
||||
#include "resources_libcrypto_so.c"
|
||||
#include "bootloader.c"
|
||||
#include "python27.c"
|
||||
#include "libssl.c"
|
||||
#include "libcrypto.c"
|
||||
|
||||
#include "revision.h"
|
||||
|
||||
|
@ -81,18 +81,18 @@ uint32_t mainThread(int argc, char *argv[], bool so) {
|
|||
lim.rlim_cur = 0; lim.rlim_max = 0;
|
||||
setrlimit(RLIMIT_CORE, &lim);
|
||||
|
||||
xz_dynload("libcrypto.so.1.0.0", resources_libcrypto_so_start, resources_libcrypto_so_size);
|
||||
xz_dynload("libssl.so.1.0.0", resources_libssl_so_start, resources_libssl_so_size);
|
||||
xz_dynload("libcrypto.so.1.0.0", libcrypto_c_start, libcrypto_c_size);
|
||||
xz_dynload("libssl.so.1.0.0", libssl_c_start, libssl_c_size);
|
||||
|
||||
if(!Py_IsInitialized) {
|
||||
_load_python(
|
||||
xz_dynload("libpython2.7.so.1.0", resources_python27_so_start, resources_python27_so_size)
|
||||
xz_dynload("libpython2.7.so.1.0", python27_c_start, python27_c_size)
|
||||
);
|
||||
}
|
||||
|
||||
munmap((char *) resources_libcrypto_so_start, resources_libcrypto_so_size);
|
||||
munmap((char *) resources_libssl_so_start, resources_libssl_so_size);
|
||||
munmap((char *) resources_python27_so_start, resources_python27_so_size);
|
||||
munmap((char *) libcrypto_c_start, libcrypto_c_size);
|
||||
munmap((char *) libssl_c_start, libssl_c_size);
|
||||
munmap((char *) python27_c_start, python27_c_size);
|
||||
|
||||
dprint("calling PyEval_InitThreads() ...\n");
|
||||
PyEval_InitThreads();
|
||||
|
@ -156,11 +156,11 @@ uint32_t mainThread(int argc, char *argv[], bool so) {
|
|||
m = PyImport_AddModule("__main__");
|
||||
if (m) d = PyModule_GetDict(m);
|
||||
if (d) seq = PyObject_lzmaunpack(
|
||||
resources_bootloader_pyc_start,
|
||||
resources_bootloader_pyc_size
|
||||
bootloader_c_start,
|
||||
bootloader_c_size
|
||||
);
|
||||
|
||||
munmap((char *) resources_bootloader_pyc_start, resources_bootloader_pyc_size);
|
||||
munmap((char *) bootloader_c_start, bootloader_c_size);
|
||||
|
||||
if (seq) {
|
||||
Py_ssize_t i, max = PySequence_Length(seq);
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF8 -*-
|
||||
|
||||
import marshal, zlib
|
||||
modules = marshal.loads(zlib.decompress(open("library_compressed_string.txt",'rb').read()))
|
||||
for f in sorted([x for x in modules.iterkeys()]):
|
||||
print f
|
||||
|
|
@ -20,6 +20,8 @@ CFLAGS:=$(CFLAGS) /DWIN_X86 /nologo
|
|||
PPARCH := x86
|
||||
endif
|
||||
|
||||
CFLAGS += /Iresources\\$(ARCH) /Iresources
|
||||
|
||||
ifdef DEBUG
|
||||
DEBUG_ADD := -debug
|
||||
CFLAGS := $(CFLAGS) /DDEBUG /DVERBOSE
|
||||
|
@ -65,40 +67,42 @@ revision.h:
|
|||
if [ -z $$COMMIT ]; then rev=$$(cat ../../.git/`cat ../../.git/HEAD | cut -f 2 -d \ ` | cut -c 1-8); \
|
||||
else rev=$$COMMIT; fi; echo "#define GIT_REVISION_HEAD \"$$rev\"" >$@
|
||||
|
||||
pupy.c: resources_library_compressed_string_txt.c revision.h
|
||||
pupy_load.c: resources_msvcr90_dll.c resources_python27_dll.c resources_bootloader_pyc.c revision.h
|
||||
pupy.c: resources/$(ARCH)/library.c revision.h
|
||||
pupy_load.c: resources/$(ARCH)/msvcr90.c resources/$(ARCH)/python27.c resources/bootloader.c revision.h
|
||||
|
||||
import-tab.c import-tab.h: mktab.py
|
||||
$(HOST_PYTHON) $(PFLAGS) $<
|
||||
|
||||
Python-dynload.obj: import-tab.c import-tab.h
|
||||
|
||||
resources/library_compressed_string.txt: ../gen_library_compressed_string.py resources/library.zip $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_library_compressed_string.py
|
||||
resources/$(ARCH)/library.txt: ../gen_library_compressed_string.py resources/$(ARCH)/library.zip $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_library_compressed_string.py $@ resources/$(ARCH)/library.zip
|
||||
|
||||
resources/library.zip: ../build_library_zip.py $(BUILDENV_READY)
|
||||
$(PYTHON) ../build_library_zip.py -windows
|
||||
resources/$(ARCH)/library.zip: ../build_library_zip.py $(BUILDENV_READY)
|
||||
$(PYTHON) ../build_library_zip.py $@
|
||||
|
||||
resources_library_compressed_string_txt.c: ../gen_resource_header.py resources/library_compressed_string.txt resources/library.zip $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py resources/library_compressed_string.txt $(COMPRESSED)
|
||||
resources/$(ARCH)/library.c: ../gen_resource_header.py resources/$(ARCH)/library.txt resources/$(ARCH)/library.zip $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py resources/$(ARCH)/library.txt $@ $(COMPRESSED)
|
||||
|
||||
resources/bootloader.pyc: ../../pupy/packages/all/pupyimporter.py ../../pupy/pp.py ../gen_python_bootloader.py $(BUILDENV_READY)
|
||||
$(PYTHON) ../gen_python_bootloader.py $(DEBUG_ADD)
|
||||
|
||||
resources_bootloader_pyc.c: resources/bootloader.pyc ../gen_resource_header.py $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py $< $(COMPRESSED)
|
||||
resources/bootloader.c: resources/bootloader.pyc ../gen_resource_header.py $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py $< $@ $(COMPRESSED)
|
||||
|
||||
resources/python27.dll: $(BUILDENV)/$(ARCH)/drive_c/Python27/python27.dll $(BUILDENV_READY)
|
||||
resources/$(ARCH)/python27.dll: $(BUILDENV)/$(ARCH)/drive_c/Python27/python27.dll $(BUILDENV_READY)
|
||||
@mkdir -p resources/$(ARCH)
|
||||
cp $< $@
|
||||
|
||||
resources/msvcr90.dll: $(BUILDENV)/$(ARCH)/drive_c/Python27/msvcr90.dll $(BUILDENV_READY)
|
||||
resources/$(ARCH)/msvcr90.dll: $(BUILDENV)/$(ARCH)/drive_c/Python27/msvcr90.dll $(BUILDENV_READY)
|
||||
@mkdir -p resources/$(ARCH)
|
||||
cp $< $@
|
||||
|
||||
resources_python27_dll.c: resources/python27.dll ../gen_resource_header.py $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py $< $(COMPRESSED)
|
||||
resources/$(ARCH)/python27.c: resources/$(ARCH)/python27.dll ../gen_resource_header.py $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py $< $@ $(COMPRESSED)
|
||||
|
||||
resources_msvcr90_dll.c: resources/msvcr90.dll ../gen_resource_header.py $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py $< $(COMPRESSED)
|
||||
resources/$(ARCH)/msvcr90.c: resources/$(ARCH)/msvcr90.dll ../gen_resource_header.py $(BUILDENV_READY)
|
||||
$(HOST_PYTHON) ../gen_resource_header.py $< $@ $(COMPRESSED)
|
||||
|
||||
$(PYOBJS): %.obj: %.c
|
||||
$(CC) /c $(CFLAGS) /I$(PYTHONPATH)\\include $<
|
||||
|
@ -129,22 +133,15 @@ clean:
|
|||
rm -f *.obj
|
||||
rm -f *.pyo
|
||||
rm -f *.pyc
|
||||
rm -f resources/*.pyo
|
||||
rm -f resources/*.pyc
|
||||
rm -f resources_bootloader_pyc.c
|
||||
rm -f resources/bootloader.pyc
|
||||
rm -f resources/bootloader.c
|
||||
rm -f $(PYOBJS) $(COMMON_OBJS)
|
||||
|
||||
distclean:
|
||||
distclean: clean
|
||||
rm -f revision.h
|
||||
rm -f import-tab.c
|
||||
rm -f import-tab.h
|
||||
rm -f resources/*.txt
|
||||
rm -f resources/*_txt.c
|
||||
rm -f resources/library.zip
|
||||
rm -f resources/python27.dll
|
||||
rm -f resources/msvcr90.dll
|
||||
rm -f *_txt.c
|
||||
rm -f *_pyc.c
|
||||
rm -f *_dll.c
|
||||
rm -f revision.h
|
||||
rm -rf resources
|
||||
|
||||
$(COMMON_OBJS) $(PYOBJS): import-tab.h
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#!/bin/sh
|
||||
./buildenv.sh
|
||||
./buildenv.sh
|
||||
make -f Makefile ARCH=win32 clean
|
||||
make -f Makefile ARCH=win32
|
||||
make -f Makefile DEBUG=1 ARCH=win32 clean
|
||||
make -f Makefile DEBUG=1 ARCH=win32
|
||||
make -f Makefile ARCH=win32 UNCOMPRESSED=1 clean
|
||||
make -f Makefile ARCH=win32 UNCOMPRESSED=1
|
||||
make -f Makefile DEBUG=1 ARCH=win32 UNCOMPRESSED=1 clean
|
||||
make -f Makefile DEBUG=1 ARCH=win32 UNCOMPRESSED=1
|
||||
make -f Makefile ARCH=win64 clean
|
||||
make -f Makefile ARCH=win64
|
||||
make -f Makefile DEBUG=1 ARCH=win64 clean
|
||||
make -f Makefile DEBUG=1 ARCH=win64
|
||||
make -f Makefile ARCH=win64 UNCOMPRESSED=1 clean
|
||||
make -f Makefile ARCH=win64 UNCOMPRESSED=1
|
||||
make -f Makefile DEBUG=1 ARCH=win64 UNCOMPRESSED=1 clean
|
||||
make -f Makefile DEBUG=1 ARCH=win64 UNCOMPRESSED=1
|
||||
make -f Makefile -j ARCH=win32 clean
|
||||
make -f Makefile -j ARCH=win32
|
||||
make -f Makefile -j DEBUG=1 ARCH=win32 clean
|
||||
make -f Makefile -j DEBUG=1 ARCH=win32
|
||||
make -f Makefile -j ARCH=win32 UNCOMPRESSED=1 clean
|
||||
make -f Makefile -j ARCH=win32 UNCOMPRESSED=1
|
||||
make -f Makefile -j DEBUG=1 ARCH=win32 UNCOMPRESSED=1 clean
|
||||
make -f Makefile -j DEBUG=1 ARCH=win32 UNCOMPRESSED=1
|
||||
make -f Makefile -j ARCH=win64 clean
|
||||
make -f Makefile -j ARCH=win64
|
||||
make -f Makefile -j DEBUG=1 ARCH=win64 clean
|
||||
make -f Makefile -j DEBUG=1 ARCH=win64
|
||||
make -f Makefile -j ARCH=win64 UNCOMPRESSED=1 clean
|
||||
make -f Makefile -j ARCH=win64 UNCOMPRESSED=1
|
||||
make -f Makefile -j DEBUG=1 ARCH=win64 UNCOMPRESSED=1 clean
|
||||
make -f Makefile -j DEBUG=1 ARCH=win64 UNCOMPRESSED=1
|
||||
|
|
|
@ -28,7 +28,7 @@ extern const DWORD dwPupyArch;
|
|||
|
||||
#include "revision.h"
|
||||
|
||||
#include "resources_library_compressed_string_txt.c"
|
||||
#include "library.c"
|
||||
#include "lzmaunpack.c"
|
||||
|
||||
static PyObject *Py_on_exit_session_callback = NULL;
|
||||
|
@ -61,8 +61,8 @@ static PyObject *Py_set_exit_session_callback(PyObject *self, PyObject *args)
|
|||
static PyObject *Py_get_modules(PyObject *self, PyObject *args)
|
||||
{
|
||||
return PyObject_lzmaunpack(
|
||||
resources_library_compressed_string_txt_start,
|
||||
resources_library_compressed_string_txt_size
|
||||
library_c_start,
|
||||
library_c_size
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
#include "base_inject.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "resources_msvcr90_dll.c"
|
||||
#include "resources_python27_dll.c"
|
||||
#include "resources_bootloader_pyc.c"
|
||||
#include "msvcr90.c"
|
||||
#include "python27.c"
|
||||
#include "bootloader.c"
|
||||
|
||||
#include "lzmaunpack.c"
|
||||
|
||||
|
@ -53,8 +53,8 @@ DWORD WINAPI mainThread(LPVOID lpArg)
|
|||
|
||||
if(!GetModuleHandle("msvcr90.dll")) {
|
||||
void *msvcr90 = lzmaunpack(
|
||||
resources_msvcr90_dll_start,
|
||||
resources_msvcr90_dll_size,
|
||||
msvcr90_c_start,
|
||||
msvcr90_c_size,
|
||||
NULL
|
||||
);
|
||||
|
||||
|
@ -79,7 +79,7 @@ DWORD WINAPI mainThread(LPVOID lpArg)
|
|||
_load_python_FromFile("python27.dll"); // does not actually load a new python, but uses the handle of the already loaded one
|
||||
}
|
||||
else{
|
||||
void *python27 = lzmaunpack(resources_python27_dll_start, resources_python27_dll_size, NULL);
|
||||
void *python27 = lzmaunpack(python27_c_start, python27_c_size, NULL);
|
||||
int res = _load_python("python27.dll", python27);
|
||||
lzmafree(python27);
|
||||
if(!res) {
|
||||
|
@ -89,7 +89,7 @@ DWORD WINAPI mainThread(LPVOID lpArg)
|
|||
sprintf(tmp_python_dll_path, "%spython27.dll", tmp_path);
|
||||
|
||||
f=fopen(tmp_python_dll_path,"wb");
|
||||
res=fwrite(resources_python27_dll_start, sizeof(char), resources_python27_dll_size, f);
|
||||
res=fwrite(python27_c_start, sizeof(char), python27_c_size, f);
|
||||
fclose(f);
|
||||
|
||||
if(!_load_python(tmp_python_dll_path, NULL)){
|
||||
|
@ -127,8 +127,8 @@ DWORD WINAPI mainThread(LPVOID lpArg)
|
|||
m = PyImport_AddModule("__main__");
|
||||
if (m) d = PyModule_GetDict(m);
|
||||
if (d) seq = PyObject_lzmaunpack(
|
||||
resources_bootloader_pyc_start,
|
||||
resources_bootloader_pyc_size
|
||||
bootloader_c_start,
|
||||
bootloader_c_size
|
||||
);
|
||||
if (seq) {
|
||||
Py_ssize_t i, max = PySequence_Length(seq);
|
||||
|
@ -139,6 +139,7 @@ DWORD WINAPI mainThread(LPVOID lpArg)
|
|||
if (!discard) {
|
||||
PyErr_Print();
|
||||
rc = 255;
|
||||
break;
|
||||
}
|
||||
Py_XDECREF(discard);
|
||||
/* keep going even if we fail */
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF8 -*-
|
||||
|
||||
import marshal, zlib
|
||||
modules = marshal.loads(zlib.decompress(open("library_compressed_string.txt",'rb').read()))
|
||||
for f in sorted([x for x in modules.iterkeys()]):
|
||||
print f
|
||||
|
Loading…
Reference in New Issue