npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tulpep/foundit-remotecommand

v2.0.7

Published

Module for execute remote commands.

Readme

FOUNDiT Remote Command Module

Module for execute remote commands.

Supported Operating Systems

  • Windows
  • Linux

How to Install it

npm i @tulpep/foundit-remotecommand

Available Methods

remoteCommand()

It allows you to execute commands in remote devices.

Parameters

function remoteCommand(fileToCopy, command, device, remoteWindows, username, password)

    fileToCopy: {
        remoteFolder: 'foundit' // the remote folder where the file will be copied.
        localfilePath: '/home/foundit/agent' // The path to the local file to be copied.
    }
    command: 'hostname' // command to execute
    device: 'PC-test' or '192.168.137.2' // specify the device to execute remote commands.
    remoteWindows: 'true' // true if the remote device is Windows.
    username: 'username' // specify the username to authenticate in remote device.
    password: 'Passw0rd' // specify the password to authenticate in remote device.

If fileToCopy parameter has value, the file copied will be executed with the command parameter, otherwise, if fileToCopy is undefined the command parameter will run directly on the console.

Example return for Windows

    {
        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.'
        portRecheable: true
    }

Example return for Linux

    {   
        exitCode: 0,
        message: 'Lnx-Comp',
        portRecheable: true
    }

copyFileToRemoteDevice()

It allows you to copy a local file to a remote device.

Parameters

function copyFileToRemoteDevice(localfilePath, md5, device, remoteWindows, remoteFolder, username, password)

    localfilePath: '/home/foundit/agent.exe' // The path to the local file to be copied.
    md5: '9810784ce10b72a1ef2f50bc5fec59ba' // Optional md5 of the file to be copied.
    device: 'PC-test' or '192.168.137.2' // specify the device to execute remote commands.
    remoteWindows: 'true' // true if the remote device is Windows.
    remoteFolder: 'foundit' // the remote folder where the file will be copied.
    username: 'username' // specify the username to authenticate in remote device.
    password: 'Passw0rd' // specify the password to authenticate in remote device.

If the md5 parameter is undefined, this module will generate the MD5 of the file to be copied.

Example return for Windows

    {
        exitCode: 0,
        message:'File copied successfully' 
        finalPath: C:\\users\\foundit\\9810784ce10b72a1ef2f50bc5fec59ba.exe'
    }

Example return for Linux

    {
        exitCode: 0,
        message:'File copied successfully' 
        finalPath: /home/foundit/9810784ce10b72a1ef2f50bc5fec59ba.exe'
    }

How To Use it:

const remote = require('@tulpep/foundit-remotecommand')();

async function testCommandExecutor() {
    const response = await remote.remoteCommand(undefined, 'hostname', '192.168.137.2', true, 'jasg', 'PHE123');
    return response;
};

async function testCopyFile() {
    const response = await remote.copyFileToRemoteDevice('./package.json', undefined, '192.168.137.2', true, 'foundit', 'jasg', 'PHE123');
    return response;
};

const command = testCommandExecutor();
console.log('command');
console.log(command);
const copy = testCopyFile();
console.log('copy');
console.log(copy);

Dependencies

  • samba-client | License MIT: This library is a Node JS wrapper for smbclient. It allows you to access a SMB2 share as if you were using the native fs library.

  • @tulpep/foundit-cross | License MIT: This module to execute commands to the operating system and platform validate.

  • hasha | License MIT: Hashing made simple. Get the hash of a buffer/string/stream/file.

  • is-port-reachable | License MIT: Check if a local or remote port is reachable.

  • node-ssh | License MIT: Node-SSH is an extremely lightweight Promise wrapper for ssh2, Period.

  • winexe | License MIT: Wrapper around the winexe and psexec.