SSH to remote host (edgemarc 4200 or 4500 series routers) and pull arp data

Posted by MaQleod on Super User See other posts from Super User or by MaQleod
Published on 2011-03-07T07:57:40Z Indexed on 2011/03/07 8:12 UTC
Read the original article Hit count: 246

Filed under:
|
|
|
|

I've been trying to think of a method to do this for days, but have not come up with anything yet. Ideally, this is what I'm looking to do:

From a windows XP machine, I need to open an SSH connection to a remote host, send the arp command, and pull the text results of the command back for use on the client. I will need to parse this data and preferably produce a 2D array of IPs and MAC addresses. There will be no shared keys, this is all done with a username and password that will always be different, they will need to be fed into the command via variables that will be pulled from a database using an autoit script based on the WAN ip of the remote host.

Now the actual parsing of the data and creation of the array will be easy if I can just get the text of the arp table. Is there any way to ssh to a remote host, run a command and return the data from that command to the client in a batch script or perl script (it is ok if it writes the text to a file, I can read it out of the file later, I just need it to get to the client)?

© Super User or respective owner

Related posts about command-line

Related posts about router