// quickest version - allow any host ID and search for pw in JavaX-Secret // not sure which encoding is used for input and output static S quickSSH2(S user, S host, S command, int timeoutSeconds) ctex { final SSHClient client = sshLogin(user, host); try { final Session session = client.startSession(); //print("Started session"); try { //print("Executing command: " + command); final Session.Command cmd = session.exec(command); S output = IOUtils.readFully(cmd.getInputStream()).toString(); cmd.join(timeoutSeconds, TimeUnit.SECONDS); ret output; } finally { session.close(); } } finally { client.disconnect(); } }
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: | 813 / 847 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |