虽然iSSH在Mac上使用已经很便利,但是并不完美,主要是每次都需要重新加载设置才能连接,而且设置的加载也不完整。于是萌生了自己写一个链接端的念头。
程序使用Applescript编写,在Snow Leopard 10.6.1调试通过,程序前半部分通过调用终端实现ssh -D连接,后半部分通过curl调用twitter告诉大家你在“为自由而奋斗”,最后一句是语音反馈,告知你一切已经就绪。
就那么简单。把这个脚本打包成app文件,放在dock上,点击一次就能实现ssh -D翻墙了,一切一切只需要一次点击,自由的曙光离我们越来越近了。
下面提供程序给大家复制,大家可以根据自己的需要随意修改!祝你们好运!
(*
Version 0.3
Code by Leask Huang
https://leaskh.com
i@leaskh.com
*)global ServerName
global LocalPorts
global UserName
global Passwd
set ServerName to "ssh.*****.com" -- Set ServerName
set LocalPort to "7070" -- Set LocalPorts
set UserName to "*****" -- Set UserName
set Passwd to "*****" -- Set Password
set SSHCommand to "nohup ssh -D " & LocalPort & " " & UserName & "@" & ServerName
tell application "Terminal"
activate
do script "killall ssh" in window 1
do script "killall ssh-agent" in window 1
do script SSHCommand in window 1
delay 5
do script Passwd in window 1
quit
end tellglobal TwitterUsername
global TwitterPassword
global TwitterLogin
global TwitterStatus
set TwitterUsername to "*****"
set TwitterPassword to "*****"
set TwitterLogin to quoted form of (TwitterUsername & ":" & TwitterPassword)
set TwitterStatus to quoted form of ("status=" & "@Leaskh I am @" & TwitterUsername & " , and I am crossing the #GFW with #ssh -D now!")
do shell script "curl --user " & TwitterLogin & " --data-binary " & TwitterStatus & " https://twitter.com/statuses/update.json"say "Congratulations! Your Socks proxy over SSH dashes D has been successfully connected."