@tulpep/leopardcreek-remotecommand v1.0.14
LeopardCreek remote command
Module for execute remote commands.
Supported Operating Systems
- Windows
- Linux
How to Install it
npm i @tulpep/leopardcreek-remotecommand
Available Methods:
rmCommand()
Allows you to exucute remote commands on the consoles of operating systems.
Parameters
function rmCommand(command, device, user, password, port)
command: 'hostname' // command syntax.
device: 'PC-test' or '192.168.137.2' // specify the device to execute remote commands.
user: 'username' // specify the username to authenticate in remote devices.
password: 'Passw0rd' // specify the password to authenticate in remote devices.
port: '222' // specify the port number for use in ssh service, apply for linux os.
Example return for Windows
{
output:'PsExec v2.2 - Execute processes remotely\r\nCopyright (C) 2001-2016 Mark Russinovich\r\nSysinternals - www.sysinternals.com\r\n\r\nDESKTOP-JQSOKBO',
error:'Connecting to 192.168.137.2...\r\r\rStarting PSEXESVC service on 192.168.137.2...\r\r\rConnecting with PsExec service on 192.168.137.2...\r\r\rStarting hostname on 192.168.137.2...\r\r\r\r\nhostname exited on 192.168.137.2 with error code 0.',
exitCode: 0,
message:'Connecting to 192.168.137.2...\r\r\rStarting PSEXESVC service on 192.168.137.2...\r\r\rConnecting with PsExec service on 192.168.137.2...\r\r\rStarting hostname on 192.168.137.2...\r\r\r\r\nhostname exited on 192.168.137.2 with error code 0.' }
}
Example return for Linux
{
output: 'Lnx-Comp',
error: '',
exitCode: 0,
message: 'Lnx-Comp'
}
How To Use it:
const remote = require('@tulpep/leopardcreek-remotecommand')();
async function testCommandExecutor() {
return new Promise((resolve) => {
remote.remoteCommand('hostname', '192.168.137.2', 'jasg', 'PHE123')
.then(async (response) => {
console.log(response);
resolve(response);
})
});
};
const command = testCommandExecutor();
console.log(command);
Dependencies
arch: This module is used by WebTorrent Desktop to determine if the user is on a 32-bit vs. 64-bit operating system to offer the right app installer.
axios: This module is used by WebTorrent Desktop to determine if the user is on a 32-bit vs. 64-bit operating system to offer the right app installer.
@tulpep/leopardcreek-cross: This module to execute commands to the operating system and platform validate.
fs-extra: This adds file system methods that aren't included in the native fs module and adds promise support to the fs methods.
is-elevated: This module Check if the process is running with elevated privileges.
semver: This module calculates the range of addresses.