@miraj181/ipingyou 1.0.2 β†’ 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,133 +1,106 @@
1
- # πŸ”— iPingYou β€” SecureLink CLI
1
+ <div align="center">
2
+ <h1>πŸ”— iPingYou β€” SecureLink CLI v2.0</h1>
3
+ <p><strong>Military-Grade, Zero-Knowledge P2P Remote Access & Collaboration Tool</strong></p>
2
4
 
3
- Secure peer-to-peer remote access via SSH & Cloudflare Tunnels. A Node.js CLI tool that lets two machines establish an encrypted SSH connection through Cloudflare's network, coordinated by a lightweight broker.
5
+ [![npm version](https://img.shields.io/npm/v/@miraj181/ipingyou.svg?style=flat-square)](https://www.npmjs.com/package/@miraj181/ipingyou)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
7
+ [![Node.js Version](https://img.shields.io/node/v/@miraj181/ipingyou.svg?style=flat-square)](https://nodejs.org)
8
+ </div>
4
9
 
5
- ## Architecture
10
+ ---
6
11
 
7
- ```
8
- Host Machine Broker (Express.js) Client Machine
9
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” POST β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” GET β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
10
- β”‚ cloudflared │──/register──▢│ In-Memory Map │◀─/resolve──│ ipingyou β”‚
11
- β”‚ tunnel :22 β”‚ {uid,url} β”‚ AES-256-CBC β”‚ /:uid β”‚ connect β”‚
12
- β”‚ β”‚ β”‚ 1hr TTL expiry β”‚ β”‚ β”‚
13
- β”‚ SSH daemon │◀─────────────│──────────────────│─────────────│ SSH via β”‚
14
- β”‚ β”‚ cloudflared β”‚ β”‚ ProxyCmd β”‚ ProxyCmd β”‚
15
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ TCP proxy β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
16
- ```
12
+ **iPingYou** is a zero-configuration Node.js CLI that establishes AES-encrypted, peer-to-peer SSH tunnels using Cloudflare's Edge network. Version 2.0 introduces **End-to-End Encrypted WebSockets**, **Terminal Mirroring**, **Passwordless Ephemeral Keys**, and **Background Daemonization**.
17
13
 
18
- ### Flow
19
- 1. **Host** starts `ipingyou host` β†’ generates an 8-char UID, spins up `cloudflared` tunnel, registers with broker
20
- 2. **Host** shares UID with the client (verbally, chat, etc.)
21
- 3. **Client** runs `ipingyou connect` β†’ enters UID, broker resolves it to tunnel URL β†’ SSH connects via cloudflared proxy
22
- 4. On `Ctrl+C`, all spawned processes are killed via `tree-kill` and the UID is revoked from the broker
14
+ No firewalls to configure. No port forwarding. No plaintext leakage.
23
15
 
24
- ## Quick Start
16
+ ## ✨ God-Tier Features (New in v2.0)
25
17
 
26
- ### 1. Start the Broker (self-hosted or Render)
18
+ * πŸ” **Ephemeral Passwordless Auth**: The Host automatically injects a temporary `Ed25519` key into `authorized_keys`. Clients connect instantly without knowing the machine's actual root/user password. Keys are purged immediately on exit.
19
+ * πŸ’¬ **E2E Web Crypto Chat Room**: A real-time, browser-based chat UI using native Web Crypto API (`AES-GCM`). Your chat keys are passed via URL fragments (`#password`) so they never touch a serverβ€”not even the Host machine's Node server!
20
+ * πŸ“Ί **Terminal Mirroring**: Wrap client SSH sessions in a multiplexed `tmux` terminal. The Host can spectate connected clients in real-time right from the dashboard to audit or assist.
21
+ * πŸ”„ **Reverse Port Forwarding (`ssh -R`)**: Clients can expose their *local* `localhost` development ports back to the Host through the secure tunnel.
22
+ * πŸ“‘ **Hardware Telemetry Verification**: Clients silently generate hardware footprint reports (OS, RAM, CPU, IP), encrypt them locally with the session password, and send them to the Host for authorization.
23
+ * 🚨 **Panic Kill-Switch**: Type `ipingyou panic` to instantly vaporize all associated keys, wipe all alias configs, and send a `SIGKILL` to every active tunnel and SSH shell.
24
+ * πŸ‘» **Daemonization**: Run `ipingyou service install` to quietly install and run the Host listener in the background (survives system reboots using PM2).
27
25
 
28
- ```bash
29
- cd ipingyou
30
- cp .env.example .env
31
- npm install
32
- npm run broker
33
- # Broker: http://localhost:4000
34
- ```
26
+ ---
35
27
 
36
- ### 2. Host Mode (Machine being accessed)
28
+ ## πŸš€ Quick Start
37
29
 
30
+ You don't need to download any code. `iPingYou` runs natively from the global npm registry.
31
+
32
+ ### The "On-the-Fly" Way (Recommended)
38
33
  ```bash
39
- npx ipingyou host
40
- # or interactively:
41
- npx ipingyou
42
- ```
34
+ # Start the interactive wizard
35
+ npx @miraj181/ipingyou
43
36
 
44
- ### 3. Client Mode (Machine accessing)
37
+ # Instantly spin up your machine as a Host
38
+ npx @miraj181/ipingyou host
45
39
 
46
- ```bash
47
- npx ipingyou connect
48
- # or interactively:
49
- npx ipingyou
40
+ # Connect to a remote machine using a session UID
41
+ npx @miraj181/ipingyou connect
50
42
  ```
51
43
 
52
- ## CLI Commands
44
+ ### Global Install
45
+ ```bash
46
+ npm install -g @miraj181/ipingyou
53
47
 
48
+ # Execute globally using aliases:
49
+ ipingyou
50
+ # or
51
+ securelink
54
52
  ```
55
- ipingyou Interactive mode (prompts for host/client)
56
- ipingyou host Start as host β€” allow remote access
57
- ipingyou connect Start as client β€” access a remote machine
58
- ipingyou broker Start the central broker server
59
- ipingyou broker -p 5000 Start broker on custom port
60
- ```
61
-
62
- ## Prerequisites
63
53
 
64
- | Tool | Required | Install |
65
- |------|----------|---------|
66
- | Node.js β‰₯18 | βœ… | [nodejs.org](https://nodejs.org) |
67
- | `ssh` | βœ… | Ships with macOS/Linux; `winget install Microsoft.OpenSSH.Client` on Windows |
68
- | `cloudflared` | βœ… | `brew install cloudflared` / [download](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) |
54
+ ---
69
55
 
70
- The CLI auto-detects your OS and will attempt to install missing dependencies on Linux (apt/pacman) and guide you on macOS/Windows.
56
+ ## πŸ”’ Zero-Knowledge Architecture
71
57
 
72
- ## Project Structure
58
+ The public broker server exists solely to rendezvous connections. It is fundamentally a **"Dumb Pipe"**.
73
59
 
60
+ ```mermaid
61
+ graph LR
62
+ H[Host CLI] -->|AES-256-CBC Encrypted Payload| B((Broker Relay))
63
+ B -->|Encrypted Payload| C[Client CLI]
64
+ C -->|Locally Decrypts Password| C
65
+ C -->|Direct Cloudflare SSH| H
66
+ C -->|E2E AES-GCM WebSockets| H
74
67
  ```
75
- ipingyou/
76
- β”œβ”€β”€ src/
77
- β”‚ β”œβ”€β”€ cli.js ← Main CLI entry (npx-ready, shebang)
78
- β”‚ β”œβ”€β”€ server.js ← Central Broker (Express.js)
79
- β”‚ β”œβ”€β”€ lib/
80
- β”‚ β”‚ β”œβ”€β”€ cleanup.js ← Graceful shutdown + tree-kill
81
- β”‚ β”‚ β”œβ”€β”€ crypto.js ← AES-256-CBC encrypt/decrypt
82
- β”‚ β”‚ β”œβ”€β”€ platform.js ← OS detection + dependency check
83
- β”‚ β”‚ └── uid.js ← Random 8-char UID generator (nanoid)
84
- β”‚ └── modes/
85
- β”‚ β”œβ”€β”€ host.js ← Host mode logic
86
- β”‚ └── client.js ← Client mode logic
87
- β”œβ”€β”€ .env.example
88
- β”œβ”€β”€ .gitignore
89
- β”œβ”€β”€ package.json
90
- β”œβ”€β”€ render.yaml ← One-click Render deploy
91
- └── README.md
92
- ```
93
68
 
94
- ## Security
69
+ 1. **Host** starts up, spawns `cloudflared` tunnels for SSH and Chat, and generates a random, offline **AES-256 Session Password**.
70
+ 2. **Host** encrypts the tunnel data with the password and sends the *ciphertext* to the Broker alongside a short UID.
71
+ 3. **Client** runs `ipingyou connect`, enters the UID and Password.
72
+ 4. **Client** fetches the ciphertext, decrypts it locally, and connects directly via SSH and WebSockets.
73
+ 5. On `Ctrl+C`, `tree-kill` initiates a graceful shutdown, revokes the UID from the broker, and scrubs `/tmp` memory.
74
+
75
+ ---
76
+
77
+ ## πŸ›  Prerequisites
95
78
 
96
- - **AES-256-CBC** β€” Tunnel URLs are encrypted at rest in the broker's memory
97
- - **Random UIDs** β€” 8-char nanoid, not hardware-based; session dies = door locked forever
98
- - **1-hour TTL** β€” Broker auto-expires entries; no stale data
99
- - **Auto-revoke** β€” On `Ctrl+C`, UID is deleted from broker before exit
100
- - **tree-kill** β€” All child processes (cloudflared, SSH) are recursively killed on shutdown
101
- - **No persistence** β€” Broker uses in-memory Map only; server restart = clean slate
79
+ | Tool | Required | Installation Guide |
80
+ |------|----------|--------------------|
81
+ | **Node.js β‰₯18** | βœ… | [nodejs.org](https://nodejs.org) |
82
+ | **`ssh`** | βœ… | Ships native on macOS/Linux. Windows: `winget install Microsoft.OpenSSH.Client` |
83
+ | **`cloudflared`** | βœ… | `brew install cloudflared` or [Download Here](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) |
84
+ | **`tmux`** | 〰️ | *Optional*. Required on Host machine if you want to use **Terminal Mirroring**. |
102
85
 
103
- ## Deploy Broker to Render (Free)
86
+ *(Note: The CLI auto-detects your OS and will attempt to guide you on how to install any missing dependencies!)*
104
87
 
105
- 1. Push this repo to GitHub
106
- 2. Go to [render.com/new](https://render.com/new)
107
- 3. Click **"New Web Service"** β†’ connect your repo
108
- 4. Render auto-detects `render.yaml` β†’ click **Deploy**
109
- 5. Set `SECRET_KEY` in Render Dashboard β†’ Environment
110
- 6. Set `BROKER_URL` in your local `.env` to your Render URL
88
+ ---
111
89
 
112
- ## Environment Variables
90
+ ## πŸ“– CLI Command Reference
113
91
 
114
- | Variable | Default | Description |
115
- |----------|---------|-------------|
116
- | `SECRET_KEY` | Dev key | AES-256 hex key (64 chars) |
117
- | `BROKER_URL` | `http://localhost:4000` | Broker endpoint for CLI |
118
- | `BROKER_PORT` | `4000` | Port for broker server |
92
+ | Command | Description |
93
+ |---------|-------------|
94
+ | `ipingyou` | Interactive CLI dashboard wizard. |
95
+ | `ipingyou host` | Start hosting and exposing your local machine securely. |
96
+ | `ipingyou connect -u <UID>` | Connect directly to a specific UID. |
97
+ | `ipingyou panic` | 🚨 Self-destruct mode. Wipes configs, memory, and kills all processes. |
98
+ | `ipingyou service install` | πŸ‘» Installs Host mode as an always-on background daemon. |
99
+ | `ipingyou service stop` | Stops and removes the background daemon. |
119
100
 
120
- ## Differences from remote-penitrator
101
+ ---
121
102
 
122
- | Aspect | remote-penitrator | iPingYou |
123
- |--------|-------------------|----------|
124
- | Interface | Shell scripts + web dashboard | Interactive Node.js CLI |
125
- | Direction | One-way (runner β†’ C2) | Peer-to-peer (host ↔ client) |
126
- | UID System | Hardcoded PC IDs | Random per-session UIDs |
127
- | Process Mgmt | Manual | tree-kill auto-cleanup |
128
- | Install | Copy scripts | `npx ipingyou` |
129
- | Modes | Reporter only | Host + Client + Broker |
103
+ ## πŸ“œ License
130
104
 
131
- ## License
105
+ [MIT License](LICENSE) Β© Sk Mirajul Islam
132
106
 
133
- MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraj181/ipingyou",
3
- "version": "1.0.2",
3
+ "version": "2.0.1",
4
4
  "description": "SecureLink-CLI β€” Secure peer-to-peer remote access via SSH & Cloudflare Tunnels",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -45,10 +45,15 @@
45
45
  "chalk": "^5.3.0",
46
46
  "commander": "^12.1.0",
47
47
  "execa": "^9.5.2",
48
+ "express": "^5.2.1",
49
+ "express-rate-limit": "^8.5.2",
50
+ "helmet": "^8.1.0",
48
51
  "inquirer": "^12.3.2",
49
52
  "nanoid": "^5.0.9",
53
+ "open": "^11.0.0",
50
54
  "ora": "^8.1.1",
51
- "tree-kill": "^1.2.2"
55
+ "tree-kill": "^1.2.2",
56
+ "ws": "^8.20.1"
52
57
  },
53
58
  "devDependencies": {
54
59
  "nodemon": "^3.1.4"
@@ -57,4 +62,4 @@
57
62
  "node": ">=18.0.0"
58
63
  },
59
64
  "type": "module"
60
- }
65
+ }
package/src/cli.js CHANGED
@@ -23,9 +23,14 @@ import inquirer from 'inquirer';
23
23
  import chalk from 'chalk';
24
24
 
25
25
  import { detectOS, checkDependencies } from './lib/platform.js';
26
- import { installShutdownHandlers } from './lib/cleanup.js';
26
+ import { installShutdownHandlers, executePanicMode } from './lib/cleanup.js';
27
27
  import { startHostMode } from './modes/host.js';
28
28
  import { startClientMode } from './modes/client.js';
29
+ import { execa } from 'execa';
30
+ import path from 'node:path';
31
+ import { fileURLToPath } from 'node:url';
32
+
33
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
29
34
 
30
35
  // ─── ASCII Banner ────────────────────────────────────────────
31
36
  function showBanner() {
@@ -67,10 +72,20 @@ function showRichHelp() {
67
72
  console.log(` β€’ The Broker never sees your plaintext URL, only ciphertext.`);
68
73
  console.log('');
69
74
 
75
+ console.log(chalk.bold.white(' πŸ”₯ Advanced Features:'));
76
+ console.log(` β€’ ${chalk.green('Terminal Mirroring')} : Host can spectate connected SSH clients in real-time.`);
77
+ console.log(` β€’ ${chalk.green('Reverse Forwarding')} : Clients can expose their local localhost ports back to the Host.`);
78
+ console.log(` β€’ ${chalk.green('E2E Chat Room')} : Real-time Web Crypto AES-GCM secure chat UI for Host & Clients.`);
79
+ console.log(` β€’ ${chalk.green('Daemonization')} : Run Host mode as a background service via PM2.`);
80
+ console.log(` β€’ ${chalk.green('Panic Kill-Switch')} : Instantly purge all processes, configurations, and traces.`);
81
+ console.log('');
82
+
70
83
  console.log(chalk.bold.white(' πŸ’‘ Examples:'));
71
- console.log(` $ npx ipingyou ${chalk.dim('# Interactive wizard (Recommended)')}`);
72
- console.log(` $ npx ipingyou host ${chalk.dim('# Quick start as Host')}`);
73
- console.log(` $ npx ipingyou connect ${chalk.dim('# Quick start as Client')}`);
84
+ console.log(` $ npx ipingyou ${chalk.dim('# Interactive wizard (Recommended)')}`);
85
+ console.log(` $ npx ipingyou host ${chalk.dim('# Quick start as Host')}`);
86
+ console.log(` $ npx ipingyou connect ${chalk.dim('# Quick start as Client')}`);
87
+ console.log(` $ npx ipingyou panic ${chalk.dim('# Self-destruct and wipe memory/traces')}`);
88
+ console.log(` $ npx ipingyou service install ${chalk.dim('# Install Host mode as a background daemon')}`);
74
89
  console.log('');
75
90
  }
76
91
 
@@ -91,6 +106,16 @@ function fatal(context, err) {
91
106
  process.exit(1);
92
107
  }
93
108
 
109
+ // ─── Process-Level Error Catching ────────────────────────────
110
+ process.on('uncaughtException', (err) => {
111
+ fatal('uncaughtException', err);
112
+ });
113
+
114
+ process.on('unhandledRejection', (reason) => {
115
+ const err = reason instanceof Error ? reason : new Error(String(reason));
116
+ fatal('unhandledRejection', err);
117
+ });
118
+
94
119
  // ─── Interactive Mode Selection ──────────────────────────────
95
120
  async function interactiveMode() {
96
121
  showBanner();
@@ -158,6 +183,7 @@ program
158
183
  .name('ipingyou')
159
184
  .description('SecureLink-CLI β€” Secure P2P remote access via SSH & Cloudflare Tunnels')
160
185
  .version('1.0.0')
186
+ .option('-b, --broker <url>', 'Override the central broker URL')
161
187
  .addHelpText('beforeAll', () => {
162
188
  showBanner();
163
189
  showRichHelp();
@@ -169,6 +195,9 @@ program
169
195
  .description('Start host mode β€” allow remote access to this machine')
170
196
  .action(async () => {
171
197
  try {
198
+ const opts = program.opts();
199
+ if (opts.broker) process.env.BROKER_URL = opts.broker;
200
+
172
201
  showBanner();
173
202
  showSystemInfo();
174
203
  installShutdownHandlers();
@@ -185,6 +214,9 @@ program
185
214
  .option('-u, --uid <uid>', 'The remote host UID')
186
215
  .action(async () => {
187
216
  try {
217
+ const opts = program.opts();
218
+ if (opts.broker) process.env.BROKER_URL = opts.broker;
219
+
188
220
  showBanner();
189
221
  showSystemInfo();
190
222
  installShutdownHandlers();
@@ -195,9 +227,57 @@ program
195
227
  }
196
228
  });
197
229
 
230
+ program
231
+ .command('panic')
232
+ .description('🚨 Self-destruct mode: wipe all configs, kill tunnels, and remove traces')
233
+ .action(async () => {
234
+ try {
235
+ showBanner();
236
+ await executePanicMode();
237
+ } catch (err) {
238
+ fatal('panic', err);
239
+ }
240
+ });
241
+
242
+ program
243
+ .command('service <action>')
244
+ .description('πŸ‘» Manage background daemon (actions: install, stop, status)')
245
+ .action(async (action) => {
246
+ try {
247
+ showBanner();
248
+ console.log(chalk.bold.cyan(' πŸ‘» Background Service Manager'));
249
+ console.log(chalk.dim(' ──────────────────────────────────────'));
250
+
251
+ const { execaCommand } = await import('execa');
252
+
253
+ if (action === 'install') {
254
+ console.log(chalk.dim(' Installing PM2 globally and starting host...'));
255
+ await execaCommand('npm install -g pm2', { stdio: 'inherit' });
256
+ await execaCommand('pm2 start ipingyou --name "ipingyou-host" -- host', { stdio: 'inherit' });
257
+ await execaCommand('pm2 save', { stdio: 'inherit' });
258
+ await execaCommand('pm2 startup', { stdio: 'inherit' });
259
+ console.log(chalk.green('\n βœ… Service installed and running in the background.'));
260
+ } else if (action === 'stop') {
261
+ await execaCommand('pm2 stop ipingyou-host', { stdio: 'inherit' });
262
+ await execaCommand('pm2 delete ipingyou-host', { stdio: 'inherit' });
263
+ await execaCommand('pm2 save', { stdio: 'inherit' });
264
+ console.log(chalk.green('\n βœ… Service stopped and removed.'));
265
+ } else if (action === 'status') {
266
+ await execaCommand('pm2 status ipingyou-host', { stdio: 'inherit' });
267
+ } else {
268
+ console.log(chalk.red(` ❌ Unknown action: ${action}. Use install, stop, or status.`));
269
+ }
270
+ } catch (err) {
271
+ fatal('service', err);
272
+ }
273
+ });
274
+
198
275
  // ─── Default: interactive mode ──────────────────────────────
199
276
  program.action(async () => {
200
277
  try {
278
+ const opts = program.opts();
279
+ if (opts.broker) process.env.BROKER_URL = opts.broker;
280
+
201
281
  installShutdownHandlers();
202
282
  await interactiveMode();
203
283
  } catch (err) {