osx下用python自动登录服务器(iterm2)

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

mport os
s = """osascript <<EOD
tell application "iterm"
    activate
    set myterm to (make new terminal)
    tell myterm
        launch session "Default Session"
        tell the last session
            write text "ssh user@ip"
            delay 3
            write text "password"
         end tell
    end tell
end tell
EOD"""
os.system(s)