-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbso
More file actions
executable file
·26 lines (22 loc) · 705 Bytes
/
Copy pathbso
File metadata and controls
executable file
·26 lines (22 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
import telnetlib
import os
hosts = ['9.42.68.120', '9.111.142.16']
#hosts = ['9.42.68.120']
user = os.getenv('intranet_id')
password = os.getenv('intranet_password')
telnet=telnetlib.Telnet()
for host in hosts:
try:
telnet.open(host)
rc = telnet.read_until('Username: ', 10)
rc.index('Username:') ## throw ValueError if "Username" is not found
telnet.write(user + '\n')
telnet.read_until('Password: ', 10)
telnet.write(password + '\n')
telnet.read_until('Success', 10)
print('BSO successfully passed for %s' % host)
except:
print('BSO already passed for %s' % host)
finally:
telnet.close()