前面介绍过Conemu , Msys2工具,提升了windows本地文件操作的效率,但使用ssh时候,总需要重新输入密码,不能像SercurityCRT等工具记住密码,使用时不是很爽快。
其实通过sshpass 工具和python脚本就可以实现ssh记住密码的功能。
首先,通过pacman -S sshpass 安装sshpass
然后再编写 python脚本 如下:
#!/usr/bin/python2
import io,os,pickle,getopt,sys
DataFile='/c/Users/zhoushuang/bin/h.dat'
Hosts=[]
def loadHosts():
global Hosts
if os.path.isfile(DataFile):
with open(DataFile,'rb') as f:
Hosts = pickle.load(f)
else:
with open(DataFile,'wb') as f:
pickle.dump(Hosts,f)
def saveHosts():
global Hosts
with open(DataFile,'wb') as f:
pickle.dump(Hosts, f)
def printHosts():
global Hosts
seq = 1
nnu = 4
s = io.BytesIO()
for item in Hosts:
s.write(str(seq)+')'+item[0]+'\t')
if 0==seq%nnu: