#!/usr/bin/expect -f

###################################
############ by Sthope ############
###################################

## sudo apt-get install -y expect
## nano ~/.bashrc
## and add this to the end of the file: export PATH=$PATH:~/bin
## sudo chmod +x ~/bin/*;su -l $USER

### USAGE
# Type "sshnopwd USERNAME@IP PASSWORD"
# it will loggin without asking for password nor ask to confirm the new fingerprint (if applicable) 

set timeout 5

set h [lindex $argv 0]
set p [lindex $argv 1]

spawn ssh -o StrictHostKeyChecking=no -t "$h"
expect "*assword:" 
send "$p\r";
interact