Help - system(telnet) on WinXP (ssh too)
Hi
I am very new at this. Did some C 15 years ago but not an expert, then or now :)
Have Watcom C free compiler on XP.
Trying to write something (C/PERL/EXPECT ?) that will telnet to a (list of later) device (cisco router) pass my username and password to the device to log in, do some things by passing commands to the telnet window, and, if possible read the screen generated, and decide what to do or not do from that screen. I have a small program telneting to one box working with system("telnet x.x.x.x"); and I can initialize and define char variables with
char *name; and
name="smith";
but I am stuck after this !
example:
telnet a.b.c.d
pass name and password
enable
pass password
show ver
if screen shows IOS is version (have to search for a string) xxx, then do these commands, else, do some others.
Also, does Watcom (or?) have their own telnet or ssh so I don't need to use the system's ?
Small steps along the way
I was -just- about to post that I figured out putty.exe can be used command line....
However, I still need to do a lot of other things....C or PERL or ?
Before I even get to putty I need to determine if the host can run ssh, by telneting then...
I need to tell putty to ignore the fact that the host key is not in the registry (press left arrow then enter).
Then I need to send a password to putty.exe, etc etc...
SMALLSTEP:
How can I send a username and password to Win-telnet used as system ("telnet host"); ?
BTW, these are mostly cisco devices, and 'telnet host -l username' does not work.
Oops...not to start a war :)
I see perl as, not C, not assy, not machine language (1/0)...and like other higher level languages which can -almost- do whatever it is you need, perl/they have loads of extensions, more libraries of functions that might do what you need, all for the same reason is that they don't interact at a low enough level to be able to really do almost everything, like C does. BASIC I see the same way as perl. Just MHO.
Win tnt and putty/ssh are fine
I should point out again that I am not a 'programmer' per se...my goal is to get 500 devices configured, not build the roads so UPS can get them to their destination :) When netcat is suggested it just puts me further behind as I try to download it, recfg my antivirus so it won't boot it off (may not be possible) and then I need to learn expect too...
I am 'back to C' - how can I use windows telnet, and 'win' putty.exe, and pass parameters to them ? Please remember I'm a novice and the learning curve is always steep in the beginning like any language. I don't know how to use expect within a C program even...sorry.