pyautogui自动ssh登录服务器

import subprocess
import sys
import time
import pyperclip
import pyautogui
print(sys.executable)
subprocess.Popen('"F:\Program Files\Git\git-bash.exe"');
time.sleep(3);
pyperclip.copy("ssh tr@10.1.8.56") # 复制
pyautogui.hotkey('ctrl', 'v') # 粘贴
pyautogui.press('enter') # 输入回车键
time.sleep(1);
pyperclip.copy("sudo su") # 复制
pyautogui.hotkey('ctrl', 'v') # 粘贴
pyautogui.press('enter') # 输入回车键
time.sleep(1);
pyperclip.copy("www") # 复制
pyautogui.hotkey('ctrl', 'v') # 粘贴
pyautogui.press('enter') # 输入回车键

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: