Skip to content

Instantly share code, notes, and snippets.

@amoblin
Created August 24, 2012 03:21
Show Gist options
  • Save amoblin/3445107 to your computer and use it in GitHub Desktop.
Save amoblin/3445107 to your computer and use it in GitHub Desktop.
sina autologin
#!/usr/bin/osascript
set username to ""
set login_passwd to ""
set passcode_prefix to ""
set dest_ip to ""
set init_command to ""
set host_name to "10.210.224.66"
set terminal_name to "Terminal"
set delay_time to 1
tell application terminal_name
activate
tell application "System Events"
keystroke "t" using {command down}
delay delay_time
keystroke "ssh " & username & "@" & host_name & "\n"
delay delay_time
keystroke login_passwd & "\n"
delay delay_time
keystroke passcode_prefix
end tell
display dialog "ESCODE: " default answer "1"
tell application "System Events"
keystroke (text returned of the result) & "\n" & dest_ip & "\n"
delay delay_time
keystroke init_command & "\n"
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment