• Support
  • Articles
  • Resources
  • Products

Macro for SSH

Moderator: boris

  • 1
  • 2

33 postsPage 2 of 2

 

boris
Moderator, LogMeTT and TTLEditor developer

Posts:
1596
Joined: Sat Jan 08, 2005 2:52 pm
by boris » Wed May 16, 2007 6:46 pm
I'd suggest you to add setsync 1 next to your connect command. Then if there is no branching involved you just do wait then sendln, then wait again etc. Usually argument of wait is the command prompt text.
Thanks.
Best regards,
Boris

 

thrdbseshwcase3
Newbie

Posts:
17
Joined: Mon May 14, 2007 3:30 pm
by thrdbseshwcase3 » Wed May 16, 2007 6:55 pm
Could you give me an example?

I want to do a en (sendln 'en')
(sendln 'sh run')
I put setsync 1 next to it and still couldnt get it

 

boris
Moderator, LogMeTT and TTLEditor developer

Posts:
1596
Joined: Sat Jan 08, 2005 2:52 pm
by boris » Wed May 16, 2007 7:14 pm

Code: Select all

  1. connect 'your connect line here'
  2. setsync 1
  3. wait 'whatever prompt you get on the screen once you connected'
  4. sendln 'en'
  5. wait 'probably the same prompt as above'
  6. sendln 'sh run'
  7. wait 'whatever prompt will be after running the script  run'
  8. ; the rest of your macro
  9.  
Thanks.
Best regards,
Boris

 

thrdbseshwcase3
Newbie

Posts:
17
Joined: Mon May 14, 2007 3:30 pm
by thrdbseshwcase3 » Wed May 16, 2007 7:52 pm
here is what i have and is working. What i want to do is have it execute what i put and grab another IP form a list instead of writing them out like this

Code: Select all

  1. connect 'xxx.xxxx.xxx.xxx22 /ssh /auth=password /user=net /passwd='
  2. xxxxx
  3. Enable = 'en'
  4. ShowRun = 'show run'
  5. Config = 'config'
  6.  
  7. mpause 3000
  8.  
  9. sendln Enable
  10. sendln ShowRun
  11. sendln ' '
  12. sendln ' '
  13. sendln ' '
  14.  
  15. mpause 5000
  16.  
  17. unlink
  18.  
  19. mpause 5000
  20. connect 'xxxx.xxx.xxx.xx:22 /ssh /auth=password /user=net/passwd=xxxxx'
  21.  
  22. Enable = 'en'
  23. ShowRun = 'show run'
  24. Config = 'config'
  25.  
  26. mpause 3000
  27.  
  28. sendln Enable
  29. sendln ShowRun
  30. sendln ' '
  31. sendln ' '
  32. sendln ' '

 

IshmaelCallMe
Guru

Posts:
672
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Thu May 17, 2007 1:22 pm
Something like this?

Code: Select all

  1.  
  2. fileopen fh "c:\tmp.txt" 0
  3. filereadln fh line
  4. while result=0
  5.     mpause 5000
  6.     strconcat line ':22 /ssh /auth=password   user=net/passwd=xxxxx'
  7.     connect line
  8.  
  9.     Enable = 'en'
  10.     ShowRun = 'show run'
  11.     Config = 'config'
  12.  
  13.     mpause 3000
  14.  
  15.     sendln Enable
  16.     sendln ShowRun
  17.     sendln ' '
  18.     sendln ' '
  19.     sendln ' '
  20.     unlink
  21.     filereadln fh line
  22. endwhile
  23.  

 

boris
Moderator, LogMeTT and TTLEditor developer

Posts:
1596
Joined: Sat Jan 08, 2005 2:52 pm
by boris » Thu May 17, 2007 1:37 pm
I would still add waits between sendlns :wink:
Thanks.
Best regards,
Boris

 

boris
Moderator, LogMeTT and TTLEditor developer

Posts:
1596
Joined: Sat Jan 08, 2005 2:52 pm
by boris » Thu May 17, 2007 9:57 pm
Indeed, missing wait can make difference between working and not working script :wink:
Thanks.
Best regards,
Boris
bjdraw
Newbie

Posts:
7
Joined: Wed Aug 27, 2008 4:00 pm
by bjdraw » Thu Aug 28, 2008 2:36 pm
I am using this marco and it works great, but I can't figure out how to log failed connection attempts and move on to the next one in the list.
Display posts from previous:
Sort by:
  • 1
  • 2

33 postsPage 2 of 2

Users browsing this forum: No registered users
cron