From 0953f60d0bf2315ae6627a984e9ca94ad28c79d8 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Fri, 5 May 2023 11:40:29 -0400 Subject: [PATCH] sshyp-mfa - Added WSL clipboard support --- .gitignore | 1 + commit.sh | 4 ++++ sshyp-mfa/lib/sshyp-mfa.py | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100755 commit.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* diff --git a/commit.sh b/commit.sh new file mode 100755 index 0000000..1b0cfa2 --- /dev/null +++ b/commit.sh @@ -0,0 +1,4 @@ +#!/bin/sh +git add -f extra password-pasture sshyp-mfa LICENSE README.md version commit.sh .gitignore +git commit -m "$1" +git push diff --git a/sshyp-mfa/lib/sshyp-mfa.py b/sshyp-mfa/lib/sshyp-mfa.py index e279baf..12f8ea3 100755 --- a/sshyp-mfa/lib/sshyp-mfa.py +++ b/sshyp-mfa/lib/sshyp-mfa.py @@ -76,7 +76,9 @@ if __name__ == '__main__': _mfa_key = steam_totp(b32decode(mfa_data[1])) else: _mfa_key = totp(mfa_data[1], mfa_data[2], mfa_data[3], mfa_data[4]) - if 'WAYLAND_DISPLAY' in environ: # Wayland clipboard detection + if 'WSL_DISTRO_NAME' in environ: # WSL clipboard detection + run(['powershell.exe', '-c', 'Set-Clipboard', _mfa_key]) + elif 'WAYLAND_DISPLAY' in environ: # Wayland clipboard detection run(['wl-copy', _mfa_key]) elif uname()[0] == 'Haiku': # Haiku clipboard detection run(['clipboard', '-c', _mfa_key])