def connect(target, sshport, user, password):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect(target, port = sshport, username = user, password = password, timeout=5, banner_timeout = 5, auth_timeout=5)
resultCode = 1
except paramiko.AuthenticationException:
resultCode = 0
except socket.error:
resultCode = 2