sorry.. i am on the same page, below is the error
Output:dishash all
mac address | bport | vlan | flow agg |static|aging|proccess|deny_sa
==========================================================================
e8 37 7a 9d 1a f1 | 1616 | 3612 | 44200059 | 0 | 1 | 0 | 0
54 b8 a 49 97 d5 | 1696 | 3612 | 442000a5 | 0 | 1 | 0 | 0
b0 b2 dc 5 d 87 | 1730 | 3612 | 442000c7 | 0 | 1 | 0 | 0
0 16 fa d0 be a1 | 300 | 4094 | 4420002c | 1 | 0 | 0 | 0
28 28 5d ed b4 41 | 1640 | 3612 | 4420006f | 0 | 0 | 0 | 0
0 17 7c 76 99 4d | 1622 | 3612 | 4420005d | 0 | 1 | 0 | 0
28 28 5d 94 78 da | 1704 | 3612 | 442000ad | 0 | 1 | 0 | 0
48 ee c 95 8 ee | 1630 | 3612 | 44200065 | 0 | 1 | 0 | 0
48 ee c bf 49 65 | 1628 | 3612 | 44200063 | 0 | 1 | 0 | 0
0 17 7c 80 7c 4a | 1732 | 3612 | 442000c9 | 0 | 1 | 0 | 0
e8 cc 18 62 4b d3 | 1736 | 3612 | 442000cd | 0 | 1 | 0 | 0
0 17 7c 61 c2 c2 | 1596 | 3612 | 44200047 | 0 | 1 | 0 | 0
0 25 5e 3f e7 18 | 1716 | 3612 | 442000b9 | 0 | 1 | 0 | 0
cc 5d 4e 26 e8 e2 | 1706 | 3612 | 442000af | 0 | 1 | 0 | 0
c d2 b5 5f 62 6e | 1632 | 3612 | 44200067 | 0 | 1 | 0 | 0
28 28 5d f4 f dc | 1680 | 3612 | 44200095 | 0 | 1 | 0 | 0
6c 72 20 ee a8 66 | 1594 | 3612 | 44200045 | 0 | 1 | 0 | 0
e8 37 7a 9d e 6b | 1734 | 3612 | 442000cb | 0 | 1 | 0 | 0
cc 5d 4e 26 e2 30 | 1698 | 3612 | 442000a7 | 0 | 1 | 0 | 0
c d2 b5 63 51 87 | 1710 | 3612 | 442000b3 | 0 | 1 | 0 | 0
Total number of MAC addresses: 20
MCR64A >
Traceback (most recent call last):
File "ecicollector.py", line 43, in <module>
mac_addr, bport, vlan = [column.strip() for column in output.split('\n')[0].split('|')[:3]]
ValueError: need more than 1 value to unpack
import xlwt import sys import os import xlrd import unidecode import telnetlib import time import re from time import sleep user = 'eciecidslam' password = 'Hi-FOCuS' start = time.time() print ("Starting Client...") host = "10.117.1.84" timeout = 120 print ("Connecting...") try: session = telnetlib.Telnet(host, 23, timeout) time.sleep(1) session.read_until("Login :",2) session.write(user+"\r") time.sleep(2) session.read_until("Password :",2) session.write(password + "\r") except Exception,e: print ("socket timeout") else: time.sleep(2) session.read_until("MCR64A >") print("Sending Commands...") session.write("dishash all".encode('ascii') + b"\r") print("Reading...") output = session.read_until("MCR64A >", timeout ) session.write("logout"+"\r") print (output) session.close() mac_addr, bport, vlan = [column.strip() for column in output.split('\n')[0].split('|')[:3]] print("{:^23}\t{:^5}\t{:^5}".format(mac_addr, bport, vlan)) print() for line in output.split('\n')[2:]: data = [field.strip() for field in line.split('|')[:3]] mac = [elm for elm in address if elm] mac_addr = '{:0>2}:{:0>2}:{:0>2}:{:0>2}:{:0>2}:{:0>2}'.format(*mac) bport, vlan = data[1:] print("{:^23}\t{:^5}\t{:^5}".format(mac_addr, bport, vlan)) print("Done") print 'It took', time.time()-start, 'seconds.'is my code ok?