Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 !

like image 452
md10 Avatar asked Jul 16 '26 00:07

md10


2 Answers

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

like image 87
Satheesh V Avatar answered Jul 19 '26 08:07

Satheesh V


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.

like image 27
Nate Avatar answered Jul 19 '26 10:07

Nate



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!