@mtethuc/mremote
v1.0.3
Published
Remote command execution via TCP socket - Control cmd/powershell remotely
Downloads
44
Maintainers
Readme
MRemote
Remote command execution via TCP socket - Control cmd/powershell remotely through network.
🚀 Features
- Remote Shell Access: Execute commands on remote machines via TCP socket
- Cross-Platform: Works on Windows (PowerShell/CMD) and Unix systems (bash/sh)
- Easy to Use: Simple CLI interface with intuitive commands
- Real-time Output: Stream command output in real-time
- Multiple Clients: Support multiple simultaneous connections
- Secure Connection: TCP socket connection on configurable port
📦 Installation
Global Installation (Recommended)
npm install -g mremoteDuring installation, you'll be prompted to setup auto-start on Windows. The server will automatically start when you log in to Windows.
Local Installation
npm install mremote🚀 Auto-Start Setup (Windows)
After installing globally, MRemote can automatically start the server when Windows boots.
Automatic Setup (During Installation)
When you run npm install -g mremote, you'll be asked:
Do you want MRemote Server to start automatically when Windows starts? (y/N):Type y to enable auto-start.
Manual Setup
If you skipped the auto-start setup during installation, you can enable it later:
# Find your npm global path first
npm root -g
# Then run the setup script
node <npm-global-path>/mremote/scripts/setup-autostart.jsRemove Auto-Start
# Using scheduled tasks command
schtasks /delete /tn "MRemote Server AutoStart" /f
# Or run the removal script
node <npm-global-path>/mremote/scripts/remove-autostart.jsManual Management
- View Task: Open Task Scheduler (
taskschd.msc) and look for "MRemote Server AutoStart" - Disable: Right-click the task → Disable
- Edit: Right-click the task → Properties
🔧 Usage
Start Server
On the machine you want to control remotely:
# Start server on default port 9000
mrm server
# Start server on custom port
mrm server -p 8080
# Start server on specific host
mrm server -h 192.168.1.100 -p 9000Or using npm:
npm startConnect to Remote Server
From another machine:
# Connect to remote server
mrm connect <IP_ADDRESS>
# Connect to custom port
mrm connect <IP_ADDRESS> -p 8080
# Examples
mrm connect 192.168.1.100
mrm connect 10.0.0.50 -p 8080
mrm connect localhostAvailable Commands (When Connected)
exit- Disconnect from serverhelp- Show help message- Any shell command - Execute directly on remote machine
📋 Examples
Example 1: Control Windows Machine
On Windows machine (192.168.1.100):
mrm serverFrom another machine:
mrm connect 192.168.1.100Now you can run Windows commands:
dir
ipconfig
Get-ProcessExample 2: Control Linux Server
On Linux server (10.0.0.50):
mrm serverFrom another machine:
mrm connect 10.0.0.50Run Linux commands:
ls -la
ps aux
df -hExample 3: Custom Port
Server:
mrm server -p 7777Client:
mrm connect 192.168.1.100 -p 7777🔐 Security Considerations
⚠️ Important Security Notes:
- This tool provides full shell access to the server machine
- Use only in trusted networks (private LAN, VPN)
- NOT recommended for public internet exposure
- Consider using firewall rules to restrict access
- For production use, implement authentication mechanisms
Recommended Security Practices
- Firewall Configuration: Only allow connections from trusted IPs
- VPN: Use within a VPN tunnel for remote access
- Private Network: Use only on private networks
- Port Configuration: Use non-standard ports
- Monitoring: Monitor connection logs
🛠️ Programmatic Usage
You can also use MRemote in your Node.js applications:
Server
const { RemoteServer } = require('mremote');
const server = new RemoteServer(9000, '0.0.0.0');
server.start();Client
const { RemoteClient } = require('mremote');
async function main() {
const client = new RemoteClient('192.168.1.100', 9000);
try {
await client.connect();
console.log('Connected!');
client.onData((data) => {
console.log(data.toString());
});
client.send('dir');
setTimeout(() => {
client.disconnect();
}, 5000);
} catch (err) {
console.error('Error:', err.message);
}
}
main();🔍 Troubleshooting
Connection Refused
✗ Connection error: connect ECONNREFUSEDSolutions:
- Make sure the server is running on the target machine
- Check if the port is correct
- Verify firewall settings allow the connection
Connection Timeout
✗ Connection error: connect ETIMEDOUTSolutions:
- Check network connectivity between machines
- Verify the IP address is correct
- Check firewall and router settings
Port Already in Use
Server error: listen EADDRINUSESolutions:
- Another process is using the port
- Use a different port:
mrm server -p 8080 - Stop the other process using the port
Permission Denied
On Linux/Mac:
sudo mrm server -p 9000Or use a port above 1024 (doesn't require root):
mrm server -p 9000📝 System Requirements
- Node.js >= 14.0.0
- Network connectivity between machines
- Firewall rules allowing TCP connections
🔄 Network Configuration
Windows Firewall
Allow inbound connection on port 9000:
# PowerShell (Run as Administrator)
New-NetFirewallRule -DisplayName "MRemote Server" -Direction Inbound -Protocol TCP -LocalPort 9000 -Action AllowLinux Firewall (UFW)
sudo ufw allow 9000/tcpLinux Firewall (iptables)
sudo iptables -A INPUT -p tcp --dport 9000 -j ACCEPT🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
MIT
⚠️ Disclaimer
This tool is for educational and legitimate administrative purposes only. Users are responsible for ensuring they have proper authorization before accessing remote systems. Unauthorized access to computer systems is illegal.
📞 Support
For issues and questions, please open an issue on the GitHub repository.
Made with ❤️ for remote system administration
