I am facing issues writing a script in Mobaxterm to automate my logins. The expect script doesn't seem to work quite well.
#!/usr/bin/expect -f
spawn telnet <IP address>
expect -re "login"
send "username\n"
expect -re "Password"
send "password of the user\n"
interact
Scenario: The infrastructure of my company requires me to ssh into a jump server and only then can i telnet into cisco routers. So my log in would look like this if I had to do it through CLI:
ssh x.x.x.x
telnet y.y.y.y
*******Company banner********
NOC : username
Password : password
Kindly help !
Probably the Answer is late and you might have found the solution but posting my solution just in case it helps someone in future :
For the Already Created Session which you want to Automate :

You can also click the record macro button and type out what you want then save the macro. That's a lot faster than hand-typing your own custom macro. Works right away without having to debug the macro you hand wrote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With