views:

110

answers:

3

I'm not sure if this is possible or not.

What I'm looking for is a way to tell telnet to use a certain IP address to log into and then run commands where the commands change based on a user's MAC address.

Basically it would be:

  • tell telnet to use x.x.x.x as the IP to log into and put in the correct username and password
  • tell telnet to run commands (based on the user's MAC address) that can change based on which user stats you want to see, for example: show macaddress
  • export the output to notepad
  • close
A: 

Not to blow my own horn, but you may be able to twist a personal app of mine to this end.

There's currently no documentation other than what is on that page and no public source code (though I've been meaning to get onto that, and will work that out tomorrow if you're interested), but I'd be happy to answer any questions.

That said, any MUD client could be turned to the same use too.

Matthew Scharley
+1  A: 

I think you're looking for expect (it automates these kind of interactive applications). Here is a gratis chapter from the authority on expect, the book "Exploring Expect".

Also you should use SSH if this is over the internet. Telnet is insecure as it's a plain text protocol.

jjclarkson
+1  A: 

expect can do this. If you don't have Tcl but Python, try Pexpect.

If you just want to run one command, use ssh (which allows you to log in, run a command and which will return with the error code of the command, so you can handle errors, too).

If you want to run more than a single command, write a script, use scp to copy that script to the other side and then execute the script with ssh. I've used this approach with great success to build a simple spider that could run a script to gather system information over a large number of hosts.

Aaron Digulla