Advertisement
Guest User

Untitled

a guest
May 12th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. HOST=$1
  4. USER=$2
  5. PASS=$3
  6. CMD="echo 0th3rs1d3"
  7. VAR=$(expect -c "
  8. spawn ssh -o StrictHostKeyChecking=no $USER@$HOST $CMD $PASS $HOST
  9. match_max 100000
  10. expect \"*?assword:*\"
  11. send -- \"$PASS\r\"
  12. send -- \"\r\"
  13. expect eof
  14. ")
  15. echo "==============="
  16. echo "$VAR"
  17. echo $PASS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement