Permalink
Browse files

Initial Commit

  • Loading branch information...
0 parents commit 6ed0d796862e5b4418c63686437c81e127fa7268 @markcarver committed Sep 15, 2011
Showing with 70 additions and 0 deletions.
  1. +19 −0 INSTALL
  2. +19 −0 README.md
  3. +32 −0 ssh-askpass
19 INSTALL
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Script: INSTALL
+# Author: Mark Carver
+# Created: 2011-09-14
+# Copyright (c) 2011 Beyond Eden Development, LLC. All rights reserved.
+
+if [[ $EUID -ne 0 ]]; then
+ echo "ERROR: This installation must be run as 'root'. Try using the command \`sudo INSTALL\`." &>/dev/stderr;
+ exit 1
+else
+ sshaskpass='/usr/libexec/ssh-askpass';
+ if [[ $(cp ./ssh-askpass ${sshaskpass}) -eq 0 ]] && [[ $(chmod +x ${sshaskpass}) -eq 0 ]]; then
+ echo "Successfully installed '${sshaskpass}'.";
+ ${sshaskpass} "$(printf "Testing ssh-askpass!\n\nNOTE: Test will output to terminal!")";
+ exit $?;
+ else
+ echo "Failed to install '${sshaskpass}'. Check to make sure you have write abilities for '$(dirname ${sshaskpass}) and then try again." &>/dev/stderr; exit 1;
+ fi
+fi
19 README.md
@@ -0,0 +1,19 @@
+# ssh-askpass (for Mac OS X)
+
+Author: Mark Carver
+Created: 2011-09-14
+Copyright (c) 2011 Beyond Eden Development, LLC. All rights reserved.
+
+Based from author: Joseph Mocker, Sun Microsystems
+[http://blogs.oracle.com/mock/entry/and\_now\_chicken\_of\_the](http://blogs.oracle.com/mock/entry/and\_now\_chicken\_of\_the)
+
+---
+
+# Usage
+Install this script as root
+> `sudo ./INSTALL`
+
+# Notes
+If you plan on manually installing this script, please note that you will have to set the following variable for SSH to recognize where the script is located:
+
+> `export SSH_ASKPASS="/path/to/ssh-askpass"`
32 ssh-askpass
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Script: ssh-askpass
+# Author: Mark Carver
+# Created: 2011-09-14
+# Copyright (c) 2011 Beyond Eden Development, LLC. All rights reserved.
+
+# A ssh-askpass command for Mac OS X
+# Based from author: Joseph Mocker, Sun Microsystems
+# http://blogs.oracle.com/mock/entry/and_now_chicken_of_the
+
+# To use this script:
+# Install this script running INSTALL as root
+#
+# If you plan on manually installing this script, please note that you will have
+# to set the following variable for SSH to recognize where the script is located:
+# export SSH_ASKPASS="/path/to/ssh-askpass"
+
+TITLE="${SSH_ASKPASS_TITLE:-SSH}";
+TEXT="$(whoami)'s password:";
+IFS=$(printf "\n");
+CODE=("on GetCurrentApp()");
+CODE=(${CODE[*]} "tell application \"System Events\" to get short name of first process whose frontmost is true");
+CODE=(${CODE[*]} "end GetCurrentApp");
+CODE=(${CODE[*]} "tell application GetCurrentApp()");
+CODE=(${CODE[*]} "display dialog \"${@:-$TEXT}\" default answer \"\" with title \"${TITLE}\" with icon caution with hidden answer");
+CODE=(${CODE[*]} "text returned of result");
+CODE=(${CODE[*]} "end tell");
+SCRIPT="/usr/bin/osascript"
+for LINE in ${CODE[*]}; do
+ SCRIPT="${SCRIPT} -e $(printf "%q" "${LINE}")";
+done;
+eval "${SCRIPT}";

0 comments on commit 6ed0d79

Please sign in to comment.