예제 #1
0
def do_get_platform_info():
    from xpra.os_util import platform_name
    info = {
            ""          : sys.platform,
            "name"      : platform_name(sys.platform, python_platform.release()),
            "release"   : python_platform.release(),
            "platform"  : python_platform.platform(),
            "machine"   : python_platform.machine(),
            "processor" : python_platform.processor(),
            }
    if sys.platform.startswith("linux") and hasattr(python_platform, "linux_distribution"):
        info["linux_distribution"] = python_platform.linux_distribution()
    return info
예제 #2
0
def do_get_platform_info():
    from xpra.os_util import platform_name
    info = {
        "": sys.platform,
        "name": platform_name(sys.platform, python_platform.release()),
        "release": python_platform.release(),
        "platform": python_platform.platform(),
        "machine": python_platform.machine(),
        "processor": python_platform.processor(),
    }
    if sys.platform.startswith("linux") and hasattr(python_platform,
                                                    "linux_distribution"):
        info["linux_distribution"] = python_platform.linux_distribution()
    return info
예제 #3
0
def do_get_platform_info():
    from xpra.scripts.config import python_platform
    from xpra.os_util import platform_name
    info = {
            "platform"           : sys.platform,
            "platform.name"      : platform_name(sys.platform, python_platform.release()),
            "platform.release"   : python_platform.release(),
            "platform.platform"  : python_platform.platform(),
            "platform.machine"   : python_platform.machine(),
            "platform.processor" : python_platform.processor(),
            }
    if sys.platform.startswith("linux"):
        info["platform.linux_distribution"] = python_platform.linux_distribution()
    return info
예제 #4
0
 def make_hello(self, challenge_response=None):
     capabilities = {}
     add_version_info(capabilities)
     if challenge_response:
         assert self.password
         capabilities["challenge_response"] = challenge_response
     if self.encryption:
         assert self.encryption in ENCRYPTION_CIPHERS
         capabilities["cipher"] = self.encryption
         iv = get_hex_uuid()[:16]
         capabilities["cipher.iv"] = iv
         key_salt = get_hex_uuid()
         capabilities["cipher.key_salt"] = key_salt
         iterations = 1000
         capabilities["cipher.key_stretch_iterations"] = iterations
         self._protocol.set_cipher_in(self.encryption, iv, self.get_password(), key_salt, iterations)
         log("encryption capabilities: %s", [(k,v) for k,v in capabilities.items() if k.startswith("cipher")])
     if self.encoding:
         capabilities["encoding"] = self.encoding
     capabilities["encodings"] = ENCODINGS
     if self.quality>0:
         capabilities["jpeg"] = self.quality
         capabilities["quality"] = self.quality
         capabilities["encoding.quality"] = self.quality
     if self.min_quality>0:
         capabilities["encoding.min-quality"] = self.min_quality
     if self.speed>=0:
         capabilities["speed"] = self.speed
         capabilities["encoding.speed"] = self.speed
     if self.min_speed>=0:
         capabilities["encoding.min-speed"] = self.min_speed
     log("encoding capabilities: %s", [(k,v) for k,v in capabilities.items() if k.startswith("encoding")])
     capabilities["platform"] = sys.platform
     capabilities["platform.release"] = python_platform.release()
     capabilities["platform.machine"] = python_platform.machine()
     capabilities["platform.processor"] = python_platform.processor()
     capabilities["client_type"] = "Python/Gobject"
     capabilities["raw_packets"] = True
     capabilities["chunked_compression"] = True
     capabilities["rencode"] = has_rencode
     if has_rencode:
         capabilities["rencode.version"] = rencode_version
     capabilities["server-window-resize"] = True
     capabilities["hostname"] = socket.gethostname()
     capabilities["uuid"] = self.uuid
     capabilities["randr_notify"] = False    #only client.py cares about this
     capabilities["windows"] = False         #only client.py cares about this
     if self._reverse_aliases:
         capabilities["aliases"] = self._reverse_aliases
     return capabilities
예제 #5
0
 def make_hello(self, challenge_response=None):
     capabilities = {}
     add_version_info(capabilities)
     capabilities["python.version"] = sys.version_info[:3]
     if challenge_response:
         assert self.password
         capabilities["challenge_response"] = challenge_response
     if self.encryption:
         assert self.encryption in ENCRYPTION_CIPHERS
         capabilities["cipher"] = self.encryption
         iv = get_hex_uuid()[:16]
         capabilities["cipher.iv"] = iv
         key_salt = get_hex_uuid()
         capabilities["cipher.key_salt"] = key_salt
         iterations = 1000
         capabilities["cipher.key_stretch_iterations"] = iterations
         self._protocol.set_cipher_in(self.encryption, iv,
                                      self.get_password(), key_salt,
                                      iterations)
         log("encryption capabilities: %s",
             [(k, v)
              for k, v in capabilities.items() if k.startswith("cipher")])
     capabilities["platform"] = sys.platform
     capabilities["platform.release"] = python_platform.release()
     capabilities["platform.machine"] = python_platform.machine()
     capabilities["platform.processor"] = python_platform.processor()
     capabilities["client_type"] = self.client_type()
     capabilities["namespace"] = True
     capabilities["raw_packets"] = True
     capabilities["chunked_compression"] = True
     capabilities["bencode"] = True
     capabilities["rencode"] = has_rencode
     if has_rencode:
         capabilities["rencode.version"] = rencode_version
     capabilities["hostname"] = socket.gethostname()
     capabilities["uuid"] = self.uuid
     try:
         from xpra.platform.info import get_username, get_name
         capabilities["username"] = get_username()
         capabilities["name"] = get_name()
     except:
         log.error("failed to get username/name", exc_info=True)
     capabilities["randr_notify"] = False  #only client.py cares about this
     capabilities["windows"] = False  #only client.py cares about this
     if self._reverse_aliases:
         capabilities["aliases"] = self._reverse_aliases
     return capabilities
예제 #6
0
def do_get_platform_info():
    from xpra.os_util import platform_name

    def get_processor_name():
        if pp.system() == "Windows":
            return pp.processor()
        elif pp.system() == "Darwin":
            os.environ['PATH'] = os.environ['PATH'] + os.pathsep + '/usr/sbin'
            command = "sysctl -n machdep.cpu.brand_string"
            import subprocess
            return subprocess.check_output(command).strip()
        elif pp.system() == "Linux":
            with open("/proc/cpuinfo") as f:
                data = f.read()
            import re
            for line in data.split("\n"):
                if "model name" in line:
                    return re.sub(".*model name.*:", "", line, 1).strip()
        assert False

    info = {}
    if sys.platform.startswith("linux") and hasattr(pp, "linux_distribution"):
        info["linux_distribution"] = pp.linux_distribution()
    info.update({
        "":
        sys.platform,
        "name":
        platform_name(sys.platform,
                      info.get("linux_distribution") or pp.release()),
        "release":
        pp.release(),
        "platform":
        pp.platform(),
        "machine":
        pp.machine(),
        "processor":
        pp.processor(),
        "architecture":
        pp.architecture(),
    })
    try:
        info["processor"] = get_processor_name()
    except:
        info["processor"] = pp.processor()
    return info
예제 #7
0
 def make_hello(self, challenge_response=None):
     capabilities = {}
     add_version_info(capabilities)
     capabilities["python.version"] = sys.version_info[:3]
     if challenge_response:
         assert self.password
         capabilities["challenge_response"] = challenge_response
     if self.encryption:
         assert self.encryption in ENCRYPTION_CIPHERS
         capabilities["cipher"] = self.encryption
         iv = get_hex_uuid()[:16]
         capabilities["cipher.iv"] = iv
         key_salt = get_hex_uuid()
         capabilities["cipher.key_salt"] = key_salt
         iterations = 1000
         capabilities["cipher.key_stretch_iterations"] = iterations
         self._protocol.set_cipher_in(self.encryption, iv, self.get_password(), key_salt, iterations)
         log("encryption capabilities: %s", [(k,v) for k,v in capabilities.items() if k.startswith("cipher")])
     capabilities["platform"] = sys.platform
     capabilities["platform.release"] = python_platform.release()
     capabilities["platform.machine"] = python_platform.machine()
     capabilities["platform.processor"] = python_platform.processor()
     capabilities["client_type"] = self.client_type()
     capabilities["namespace"] = True
     capabilities["raw_packets"] = True
     capabilities["chunked_compression"] = True
     capabilities["bencode"] = True
     capabilities["rencode"] = has_rencode
     if has_rencode:
         capabilities["rencode.version"] = rencode_version
     capabilities["hostname"] = socket.gethostname()
     capabilities["uuid"] = self.uuid
     try:
         from xpra.platform.info import get_username, get_name
         capabilities["username"] = get_username()
         capabilities["name"] = get_name()
     except:
         log.error("failed to get username/name", exc_info=True)
     capabilities["randr_notify"] = False    #only client.py cares about this
     capabilities["windows"] = False         #only client.py cares about this
     if self._reverse_aliases:
         capabilities["aliases"] = self._reverse_aliases
     return capabilities
예제 #8
0
def do_get_platform_info():
    from xpra.os_util import platform_name

    def get_processor_name():
        if pp.system() == "Windows":
            return pp.processor()
        elif pp.system() == "Darwin":
            os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin"
            command = "sysctl -n machdep.cpu.brand_string"
            import subprocess

            return subprocess.check_output(command).strip()
        elif pp.system() == "Linux":
            with open("/proc/cpuinfo") as f:
                data = f.read()
            import re

            for line in data.split("\n"):
                if "model name" in line:
                    return re.sub(".*model name.*:", "", line, 1).strip()
        assert False

    info = {}
    if sys.platform.startswith("linux") and hasattr(pp, "linux_distribution"):
        info["linux_distribution"] = pp.linux_distribution()
    info.update(
        {
            "": sys.platform,
            "name": platform_name(sys.platform, info.get("linux_distribution") or pp.release()),
            "release": pp.release(),
            "platform": pp.platform(),
            "machine": pp.machine(),
            "processor": pp.processor(),
            "architecture": pp.architecture(),
        }
    )
    try:
        info["processor"] = get_processor_name()
    except:
        info["processor"] = pp.processor()
    return info