# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):
# 
# Path: core/utils/network_utils.py
# def get_free_port():
#     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#     s.bind(('', 0))
#     port = s.getsockname()[1]
#     s.close()
#     return port
# 
# Path: core/exceptions.py
# class VNCProxyException(Exception):
#     pass


import os
import sys
import time
import signal
import logging
import os.path
import websockify
import multiprocessing
from core.config import config
from vnc2flv import flv, rfb, video
from core.utils.network_utils import get_free_port
from core.exceptions import VNCProxyException
            )

    def is_alive(self):
        if self.recorder:
            return self.recorder.is_alive()
        return False

    def stop(self):
        self.stop_recording()


def start_vnc_proxy(vnc_server_host, vnc_server_port=5900):
    port = get_free_port()
    sys.argv = [
        "--daemon",
        "--wrap-mode=ignore",
        "--record=/tmp/proxy_vnc_{}.log".format(port),
        "0.0.0.0:{}".format(port),
        "{}:{}".format(vnc_server_host, vnc_server_port)
    ]

    proxy = multiprocessing.Process(
        target=websockify.websocketproxy.websockify_init,
        name="{}.proxy".format(__name__)
    )

    proxy.start()
    if proxy.is_alive():
        return port, proxy.pid
    else:

# Path: core/config.py
# def full_path(path_to_config):
# def _import(filename):
# def create_if_not_exist(directory):
#     def update(self, new_values):
# def setup_config(path_to_config):
# class Config(object):
# 
# Path: core/utils/network_utils.py
# def get_free_port():
#     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
#     s.bind(('', 0))
#     port = s.getsockname()[1]
#     s.close()
#     return port
# 
# Path: core/exceptions.py
# class VNCProxyException(Exception):
#     pass


# Path: core/video.py
import os
import sys
import time
import signal
import logging
import os.path
import websockify
import multiprocessing
from core.config import config
from vnc2flv import flv, rfb, video
from core.utils.network_utils import get_free_port
from core.exceptions import VNCProxyException

            )

    def is_alive(self):
        if self.recorder:
            return self.recorder.is_alive()
        return False

    def stop(self):
        self.stop_recording()


def start_vnc_proxy(vnc_server_host, vnc_server_port=5900):
    port = get_free_port()
    sys.argv = [
        "--daemon",
        "--wrap-mode=ignore",
        "--record=/tmp/proxy_vnc_{}.log".format(port),
        "0.0.0.0:{}".format(port),
        "{}:{}".format(vnc_server_host, vnc_server_port)
    ]

    proxy = multiprocessing.Process(
        target=websockify.websocketproxy.websockify_init,
        name="{}.proxy".format(__name__)
    )

    proxy.start()
    if proxy.is_alive():
        return port, proxy.pid
    else:

        raise VNCProxyException("VNCScreencastProxy wasn't ran for {}:{}".format(