Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_ui(login):
- HOST = bras_ip
- tn = telnetlib.Telnet(HOST)
- tn.read_until("Username: ")
- tn.write("superlogin\n")
- tn.read_until("Password: ")
- tn.write("superpass\n")
- tn.read_until("bras2>")
- tn.write("sh users | include %s \r" % login)
- data = tn.read_until("bras2>")
- data.split()
- Vi = data.split()[5]
- try:
- connect_type = data.split()[7]
- except IndexError:
- return "xuy"
- sys.exit(0)
- connect_time = data.split()[8]
- ip_adr = data.split()[9]
- tn.write("sh pppoe session | include %s \r" % Vi)
- data2 = tn.read_until("bras2>")
- data2.split()
- mac_adr = data2.split()[8]
- vlan = data2.split()[9]
- tn.write("exit\n")
- tn.close();
- return Vi, connect_type, connect_time, ip_adr, mac_adr, vlan
Add Comment
Please, Sign In to add comment