Created
November 17, 2016 10:11
-
-
Save corny/75e14c948fa7f2cb6c63da07fba3fb85 to your computer and use it in GitHub Desktop.
KTI switch ARP table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Script to read the ARP table from a KTI switch using SSH without password | |
import pexpect | |
import sys | |
from collections import defaultdict | |
res = defaultdict(list) | |
prompt = '\S+:/>' | |
s = pexpect.spawn("sshpass", ["-p",'', "ssh", "-l", "admin", "-oStrictHostKeyChecking=no", "-oKexAlgorithms=+diffie-hellman-group1-sha1", sys.argv[1]]) | |
s.expect(prompt) | |
s.send("mac dump\r\n") | |
s.expect("\r\n") | |
s.expect(prompt) | |
print(s.before.decode('utf-8')) | |
s.sendline('logout\r') | |
s.sendeof() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment