Search code examples
shellterminaltelnetputty

Auto Login using MOBAxterm


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 !


Solution

  • 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 :

    1. Right Click on the session & Go to "Edit Session" > SSH > Advanced SSH Settings > Execute Macros At Session Start > "Select Custom Macro"
    2. Configure the Setting in the below manner (I wanted to Automate For Docker hence the configuration below - It will change depending upon your host IP's/password etc) :

    enter image description here