[nsp] Cisco commands automatically sent

john heasley heas@shrubbery.net
Fri, 9 Aug 2002 10:12:41 -0700


rancid has part of what you desire, the login and run commands portion.
you can augment it with expect script parts that perform the logic of
what commands where.  eg:

	cat >cmds
	conf t
	int s4/3
	shut
	end
	^D
	clogin -x cmds router

ni [132] clogin -x c shaggy
shaggy
spawn ssh -c 3des -x -l heas shaggy
heas@shaggy's password: 

shaggy#
shaggy#term length 0
shaggy#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
shaggy(config)#in s4/3
shaggy(config-if)#shut
shaggy(config-if)#end
shaggy#
shaggy#exit
Connection to shaggy closed.

-x has limitations.

	cat > cmds.expect
	bunch-o ugly expect drivel
	^D
	clogin -s cmds.expect router

http://www.shrubbery.net/rancid/

example cmds.expect scripts comes with, under util/*.exp

Fri, Aug 09, 2002 at 04:58:30PM +0200, odusseus:
> Hi,
> 
> +----------------+
> | Unix box       |
> | running a prog |
> +----------------+
>         |
>         |
>         |
>         |
>         V
> +---------------------+
> | Cisco device        |
> | (router or switche) |
> +---------------------+
> 
> 
> I would like to know if it is possible to write a program on a Unix box where it could automatically run some commands on a 
> cisco devices (7200 series and 3500XL) like:
> 
> enable
> conf t
> int fa0/1
> shut
> end
> 
> Thank you.
> 
> Regards,
> 
> Christophe
> ------------------------------------------
> 
> Faites un voeu et puis Voila ! www.voila.fr 
> 
> _______________________________________________
> cisco-nsp mailing list  real_name)s@puck.nether.net
> http://puck.nether.net/mailman/listinfo/cisco-nsp
> archive at http://puck.nether.net/pipermail/cisco-nsp/