'Creates a new ssh connection.
Arguments:
user(str): The username to log in with
host(str): The hostname to connect to
port(int): The port to connect to
password(str): Try to authenticate using this password
key(str): Try to authenticate using this private key. The string should be the actual private key.
keyfile(str): Try to authenticate using this private key. The string should be a filename.
proxy_command(str): Use this as a proxy command. It has approximately the same semantics as ProxyCommand from ssh(1).
proxy_sock(str): Use this socket instead of connecting to the host.
timeout: Timeout, in seconds
level: Log level
cache: Cache downloaded files (by hash/size/timestamp)
ssh_agent: If :const:`True`, enable usage of keys via ssh-agent
NOTE: The proxy_command and proxy_sock arguments is only available if a
fairly new version of paramiko is used.'

def __init__(self, user, host, port=22, password=None, key=None, keyfile=None, proxy_command=None, proxy_sock=None, level=None, cache=True, ssh_agent=False, *a, **kw):

    super(ssh, self).__init__(*a, **kw)
    Logger.__init__(self)
    if (level is not None):
        self.setLevel(level)
    self.host = host
    self.port = port
    self.user = user
    self.password = password
    self.key = key
    self.keyfile = keyfile
    self._cachedir = os.path.join(tempfile.gettempdir(), 'pwntools-ssh-cache')
    self.cwd = '.'
    self.cache = cache
    self._platform_info = {}
    self._aslr = None
    self._aslr_ulimit = None
    misc.mkdir_p(self._cachedir)
    if (not ssh_agent):
        os.environ.pop('SSH_AUTH_SOCK', None)
    import paramiko
    try:
        config_file = os.path.expanduser('~/.ssh/config')
        if os.path.exists(config_file):
            ssh_config = paramiko.SSHConfig()
            ssh_config.parse(file(config_file))
            host_config = ssh_config.lookup(host)
            if ('hostname' in host_config):
                self.host = host = host_config['hostname']
            if ((not keyfile) and ('identityfile' in host_config)):
                keyfile = host_config['identityfile'][0]
                if (keyfile.lower() == 'none'):
                    keyfile = None
    except Exception as e:
        self.debug(('An    error    occurred    while    parsing    ~/.ssh/config:\n%s' % e))
    keyfiles = ([os.path.expanduser(keyfile)] if keyfile else [])
    msg = ('Connecting    to    %s    on    port    %d' % (host, port))
    with self.waitfor(msg) as h:
        self.client = paramiko.SSHClient()
        self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        known_hosts = os.path.expanduser('~/.ssh/known_hosts')
        if os.path.exists(known_hosts):
            self.client.load_host_keys(known_hosts)
        has_proxy = ((proxy_sock or proxy_command) and True)
        if has_proxy:
            if ('ProxyCommand' not in dir(paramiko)):
                self.error('This    version    of    paramiko    does    not    support    proxies.')
            if (proxy_sock and proxy_command):
                self.error('Cannot    have    both    a    proxy    command    and    a    proxy    sock')
            if proxy_command:
                proxy_sock = paramiko.ProxyCommand(proxy_command)
            self.client.connect(host, port, user, password, key, keyfiles, self.timeout, compress=True, sock=proxy_sock)
        else:
            self.client.connect(host, port, user, password, key, keyfiles, self.timeout, compress=True)
        self.transport = self.client.get_transport()
        self.transport.use_compression(True)
        h.success()
    self._tried_sftp = False
    with context.local(log_level='error'):
        def getppid():
            import os
            print os.getppid()
        try:
            self.pid = int(self.process('false', preexec_fn=getppid).recvall())
        except Exception:
            self.pid = None
    try:
        self.info_once(self.checksec())
    except Exception:
        self.warn_once(("Couldn't    check    security    settings    on    %r" % self.host))
