diff options
author | Lew Gordon <lew.gordon@genesys.com> | 2021-03-29 13:20:32 -0400 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2022-03-11 11:38:18 -0500 |
commit | 3bb7877c13c22ec184ec77e4c4396539ae9f90b4 (patch) | |
tree | 95c2532a4b0e5816e9fa3ac790ab5d8d0201768a /paramiko/win_openssh.py | |
parent | 6e2dcda476ef6b0a360a7b8e01088b1cbef94fcf (diff) | |
download | paramiko-3bb7877c13c22ec184ec77e4c4396539ae9f90b4.tar.gz |
support Windows OpenSSH agent besides Putty's pageant (addresses #1509)
Since quite a while there exists a native openssh port for windows.
If the Putty pageant is not present, try to use the native port's agent
instead.
Diffstat (limited to 'paramiko/win_openssh.py')
-rw-r--r-- | paramiko/win_openssh.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/paramiko/win_openssh.py b/paramiko/win_openssh.py new file mode 100644 index 00000000..593cdbe4 --- /dev/null +++ b/paramiko/win_openssh.py @@ -0,0 +1,39 @@ +# Copyright (C) 2021 Lew Gordon <lew.gordon@genesys.com> +# Copyright (C) 2022 Patrick Spendrin <ps_ml@gmx.de> +# +# This file is part of paramiko. +# +# Paramiko is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Paramiko; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +import os.path + +PIPE_NAME = r"\\.\pipe\openssh-ssh-agent" + + +def can_talk_to_agent(): + return os.path.exists(PIPE_NAME) + + +class OpenSSHAgentConnection: + def __init__(self): + self._pipe = open(PIPE_NAME, "rb+", buffering=0) + + def send(self, data): + return self._pipe.write(data) + + def recv(self, n): + return self._pipe.read(n) + + def close(self): + return self._pipe.close() |