dartssh4 4.0.0 dartssh4: ^4.0.0 copied to clipboard
SSH and SFTP client written in pure Dart, aiming to be feature-rich as well as easy to use.
import 'dart:convert';
import 'dart:io';
import 'package:dartssh4/dartssh4.dart';
void main(List<String> args) async {
final socket = await SSHSocket.connect('localhost', 22);
final client = SSHClient(
socket,
username: 'root',
onPasswordRequest: () {
stdout.write('Password: ');
stdin.echoMode = false;
return stdin.readLineSync() ?? exit(1);
},
);
final uptime = await client.run('uptime');
print(utf8.decode(uptime));
client.close();
await client.done;
}