Advertisement
Guest User

Untitled

a guest
Sep 14th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #!/usr/bin/expect -f
  2.  
  3. set timeout -1
  4. spawn $env(SHELL)
  5. match_max 100000
  6. expect -exact "use@home:~$ "
  7. send -- "telnet xxx.xxx.xxx.xxx"
  8. expect -exact "telnet xxx.xxx.xxx.xxx"
  9. send -- "r"
  10. expect -exact "r
  11. Trying xxx.xxx.xxx.xxx...r
  12. Connected to xxx.xxx.xxx.xxx.r
  13. Escape character is '^]'.r
  14. r
  15. r
  16. User Access Verificationr
  17. r
  18. Username: "
  19. send -- "exampleuser"
  20. expect -exact "exampleuser"
  21. send -- "r"
  22. expect -exact "r
  23. Password: "
  24. send -- "examplepasswordr"
  25. expect -exact "r
  26. ROUTERCISCO>"
  27. send -- "enabler"
  28. expect -exact "enabler
  29. Password: "
  30. send -- "examplepasswordr"
  31. expect -exact "r
  32. ROUTERCISCO#"
  33. send -- "terminal length 0"
  34. expect -exact "terminal length 0"
  35. send -- "r"
  36. expect -exact "r
  37. ROUTERCISCO#"
  38. send -- "show running-config"
  39. expect -exact "show running-config"
  40. send -- "r"
  41. expect -exact "r
  42. !r
  43. !r
  44. !r
  45. !r
  46. endr
  47. r
  48. ROUTERCISCO#"
  49. send -- "exitr"
  50. expect -exact "exitr
  51. Connection closed by foreign host.r
  52. use@home:~$ "
  53. send -- ""
  54. expect eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement