Compile obfuscated objects

This commit is contained in:
Oleksii Shevchuk 2017-06-03 09:17:39 +03:00
parent 2ed5c669c9
commit a00c4beb9f
1 changed files with 5 additions and 4 deletions

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu) # Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms # Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
import base64, zlib
import marshal, zlib, base64
def compress_encode_obfs(code): def compress_encode_obfs(code):
return "import base64,zlib;exec zlib.decompress(base64.b64decode(%s))"%repr( return "import zlib,base64,marshal;exec marshal.loads(zlib.decompress(base64.b64decode(%s)))"%repr(
base64.b64encode(zlib.compress(code+"\n"))) base64.b64encode(zlib.compress(marshal.dumps(compile(code, '', 'exec')), 9)))