Guest User

Untitled

a guest
Sep 28th, 2022
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # автоматический ответ
  4. exec_expect()
  5. {
  6. expect <<EOF
  7. log_user 0
  8. spawn $1
  9. log_user 1
  10. expect {
  11. "Are you*" {
  12. send -- "yes\r"
  13. exp_continue
  14. }
  15. "*password:" {
  16. send -- "$2\r"
  17. exp_continue
  18. }
  19. "*no matching key exchange method found*" {
  20. exit 255
  21. }
  22. "*ermission" {
  23. exit 254
  24. }
  25. "*isconnected" {
  26. exit 254
  27. }
  28. "Overwrite*" {
  29. send -- "y\r"
  30. exp_continue
  31. }
  32. "*continue?*" {
  33. send -- "Y\r"
  34. exit 0
  35. }
  36. "*password:" {
  37. send -- "$2\r"
  38. exp_continue
  39. }
  40.  
  41. }
  42. EOF
  43. }
  44.  
  45. PASSWORD='[eqdjqyt'
  46. PASSWORD="$(printf '%s\n' "${PASSWORD}" | sed "s/\[/\\\\[/g")"
  47. CMD="$@"
  48. exec_expect "$CMD" "$PASSWORD"
  49.  
Advertisement
Add Comment
Please, Sign In to add comment