1 | // quickest version - allow any host ID and search for pw in JavaX-Secret |
2 | // not sure which encoding is used for input and output |
3 | static S quickSSH2(S user, S host, S command, int timeoutSeconds) ctex { |
4 | final SSHClient client = sshLogin(user, host); |
5 | try { |
6 | final Session session = client.startSession(); |
7 | //print("Started session"); |
8 | try { |
9 | //print("Executing command: " + command); |
10 | final Session.Command cmd = session.exec(command); |
11 | S output = IOUtils.readFully(cmd.getInputStream()).toString(); |
12 | cmd.join(timeoutSeconds, TimeUnit.SECONDS); |
13 | ret output; |
14 | } finally { |
15 | session.close(); |
16 | } |
17 | } finally { |
18 | client.disconnect(); |
19 | } |
20 | } |
Began life as a copy of #1003579
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004835 |
Snippet name: | quickSSH2 - issue SSH command on server and return output |
Eternal ID of this version: | #1004835/2 |
Text MD5: | 072563ae3508c02e48adfc4fb05f8600 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-28 00:52:13 |
Source code size: | 705 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 585 / 610 |
Version history: | 1 change(s) |
Referenced in: | [show references] |