TEXT   74
asa dump connections
Guest on 16th March 2023 12:11:34 AM


  1. #!/usr/bin/expect -f
  2.  
  3. set ip [lindex $argv 0]
  4. set pass [lindex $argv 1]
  5. set enable [lindex $argv 2]
  6.  
  7. set force_conservative 0 ;# set to 1 to force conservative mode even if
  8. ;# script wasn't run conservatively originally
  9. if {$force_conservative} {
  10. set send_slow {1 .1}
  11. proc send {ignore arg} {
  12. sleep .1
  13. exp_send -s -- $arg
  14. }
  15. }
  16.  
  17. #
  18. # 2) differing output - Some programs produce different output each time
  19. # they run. The "date" command is an obvious example. Another is
  20. # ftp, if it produces throughput statistics at the end of a file
  21. # transfer. If this causes a problem, delete these patterns or replace
  22. # them with wildcards. An alternative is to use the -p flag (for
  23. # "prompt") which makes Expect only look for the last line of output
  24. # (i.e., the prompt). The -P flag allows you to define a character to
  25. # toggle this mode off and on.
  26. #
  27. # Read the man page for more info.
  28. #
  29. # -Don
  30.  
  31.  
  32. set timeout -1
  33. spawn $env(SHELL)
  34. match_max 100000
  35.  
  36. send -- "ssh pix@$ip\r"
  37. expect "'s password: "
  38. send -- "$pass\r"
  39. expect "> "
  40. send -- "enable\r"
  41. expect "enable\r
  42. Password: "
  43. send -- "$enable\r"
  44.  
  45. expect "# "
  46. send -- "terminal pager 0\r"
  47. expect "# "
  48. send -- "show conn\r"
  49. expect "# "
  50. send -- "exit\r"

Raw Paste

Login or Register to edit or fork this paste. It's free.