def rc4byteencrypt(data): """This is a function for encrypting bytes in jinja2 templates data must be hexascii encoded. """ encrypted = encrypt_rc4(b64encode(unhexlify(data)), ph_app.key) return b64encode(encrypted).decode()
def payload_h(): """Load next stage of the Hub""" try: with open(os.path.join(XDG_DATA_HOME, "profile.ps1"), "r") as f: profile = f.read() except Exception: profile = "" context = { "modules": modules, "webdav_url": webdav_url, "symbol_name": symbol_name, "profile": profile, "transport": request.args['t'], } result = render_template( "powershell/powerhub.ps1", **context, ).encode() result = b64encode(encrypt_rc4(result, ph_app.key)) return Response(result, content_type='text/plain; charset=utf-8')
def rc4encrypt(msg): """This is a function for encrypting strings in jinja2 templates""" return b64encode(encrypt_rc4(msg.encode(), ph_app.key)).decode()