23 lines
723 B
Python
23 lines
723 B
Python
#!/usr/bin/env python3
|
|
import logging
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
from cisco_mac_monitor import CiscoSSHConnector, CiscoMacTableParser
|
|
|
|
ssh = CiscoSSHConnector('10.150.226.19', 'itops', 'Tr4!D0r3s')
|
|
parser = CiscoMacTableParser()
|
|
|
|
print("Conectando...")
|
|
ssh.connect()
|
|
print("Ejecutando comando...")
|
|
output = ssh.execute_command('show mac address-table')
|
|
print('OUTPUT LENGTH:', len(output))
|
|
|
|
print("\nParseando...")
|
|
mac_entries = parser._parse_mac_table_output(output)
|
|
print(f"MAC ENTRIES FOUND: {len(mac_entries)}")
|
|
|
|
for i, entry in enumerate(mac_entries[:3]):
|
|
print(f"Entry {i+1}: VLAN={entry.vlan}, MAC={entry.mac_address}, Type={entry.type}, Port={entry.port}")
|
|
|
|
ssh.disconnect()
|
|
print("Desconectado.") |