This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from paramiko import SSHClient, AutoAddPolicy | |
from sys import exit | |
def connect(host, port, username, password): | |
ssh_client = SSHClient() | |
ssh_client.set_missing_host_key_policy(AutoAddPolicy()) | |
ssh_client.connect(host, port=port, username=username, password=password) | |
return ssh_client.invoke_shell('raw') | |
def write_line(channel, line): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function connect($host, $port, $username, $password) | |
{ | |
$connection = ssh2_connect($host, $port); | |
if (!$connection) | |
die('Connection failed'); | |
if (!ssh2_auth_password($connection, $username, $password)) | |
die('Authentication Failed...'); |