@miraj181/ipingyou 2.1.9 → 2.1.18
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 +9 -4
- package/SECURITY.md +21 -0
- package/package.json +13 -13
- package/src/cli.js +55 -22
- package/src/lib/ai/safety.js +69 -12
- package/src/lib/broker.js +5 -5
- package/src/lib/chat.js +20 -6
- package/src/lib/checksum.js +22 -2
- package/src/lib/cleanup.js +60 -93
- package/src/lib/crypto.js +27 -0
- package/src/lib/open-url.js +28 -0
- package/src/lib/platform.js +38 -481
- package/src/lib/secure-print.js +7 -1
- package/src/lib/session-log.js +78 -3
- package/src/lib/socket-firewall.js +34 -0
- package/src/lib/ssh.js +32 -6
- package/src/lib/tunnel.js +1 -0
- package/src/lib/uid.js +6 -3
- package/src/lib/worker-runtime.js +81 -0
- package/src/lib/workers/crypto-checksum-worker.js +70 -0
- package/src/modes/ai.js +104 -31
- package/src/modes/client.js +20 -13
- package/src/modes/host.js +316 -116
- package/src/server.js +95 -18
package/src/modes/client.js
CHANGED
|
@@ -24,9 +24,9 @@ import { getConfig, saveAlias } from '../lib/config.js';
|
|
|
24
24
|
import { pushTelemetry, requestHostApproval, resolveUID, revokeUID, waitForApproval } from '../lib/broker.js';
|
|
25
25
|
import { calculateChecksum } from '../lib/checksum.js';
|
|
26
26
|
import { promptLocalPath, promptRemotePath } from '../lib/path-browser.js';
|
|
27
|
-
import { buildSshArgs, extractHostname, formatScpRemotePath, getKnownHostsOptions, getSshControlOptions, quoteRemoteShell } from '../lib/ssh.js';
|
|
27
|
+
import { buildProxyCommandOption, buildSshArgs, extractHostname, formatScpRemotePath, getKnownHostsOptions, getSshControlOptions, quoteRemoteShell } from '../lib/ssh.js';
|
|
28
28
|
import { buildTmuxSessionName, TMUX_SOCKET_PATH } from '../lib/tmux.js';
|
|
29
|
-
import
|
|
29
|
+
import { openUrl } from '../lib/open-url.js';
|
|
30
30
|
import { secureSensitiveUrl } from '../lib/secure-print.js';
|
|
31
31
|
import { cleanupSessionLog, initSessionLog, logSessionEvent, recordEvent } from '../lib/session-log.js';
|
|
32
32
|
|
|
@@ -187,12 +187,10 @@ async function performSCP(username, hostname, direction, privateKeyPath, sharedD
|
|
|
187
187
|
|
|
188
188
|
await showConnectionTrace('Local', 'Remote SCP');
|
|
189
189
|
|
|
190
|
-
const proxyCommand = `cloudflared access tcp --hostname ${hostname}`;
|
|
191
|
-
|
|
192
190
|
// Construct SCP args
|
|
193
191
|
const scpArgs = [
|
|
194
192
|
'-r', // recursive just in case
|
|
195
|
-
|
|
193
|
+
...buildProxyCommandOption(hostname),
|
|
196
194
|
...getKnownHostsOptions(persistKnownHosts),
|
|
197
195
|
'-o', 'IdentitiesOnly=yes',
|
|
198
196
|
...getSshControlOptions(hostname)
|
|
@@ -223,6 +221,16 @@ async function performSCP(username, hostname, direction, privateKeyPath, sharedD
|
|
|
223
221
|
const child = execa('scp', scpArgs, {
|
|
224
222
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
225
223
|
reject: false,
|
|
224
|
+
buffer: false,
|
|
225
|
+
});
|
|
226
|
+
const maxDiagnosticBytes = 64 * 1024;
|
|
227
|
+
let stderrOutput = Buffer.alloc(0);
|
|
228
|
+
child.stdout?.resume();
|
|
229
|
+
child.stderr?.on('data', (chunk) => {
|
|
230
|
+
const next = Buffer.concat([stderrOutput, Buffer.from(chunk)]);
|
|
231
|
+
stderrOutput = next.length > maxDiagnosticBytes
|
|
232
|
+
? next.subarray(next.length - maxDiagnosticBytes)
|
|
233
|
+
: next;
|
|
226
234
|
});
|
|
227
235
|
|
|
228
236
|
trackPID(child.pid);
|
|
@@ -262,9 +270,10 @@ async function performSCP(username, hostname, direction, privateKeyPath, sharedD
|
|
|
262
270
|
console.log(chalk.green(` ✅ Transfer completed successfully!`));
|
|
263
271
|
recordEvent('scp_transfer_success', { direction, localPath, remotePath, hostname });
|
|
264
272
|
} else {
|
|
273
|
+
const stderr = stderrOutput.toString('utf8');
|
|
265
274
|
console.error(chalk.red(' ❌ SCP transfer failed'));
|
|
266
|
-
if (
|
|
267
|
-
recordEvent('scp_transfer_failed', { direction, localPath, remotePath, hostname, error:
|
|
275
|
+
if (stderr) console.error(chalk.dim(` ${stderr.trim()}`));
|
|
276
|
+
recordEvent('scp_transfer_failed', { direction, localPath, remotePath, hostname, error: stderr });
|
|
268
277
|
}
|
|
269
278
|
} catch (err) {
|
|
270
279
|
console.error(chalk.red(` ❌ SCP error: ${err.message}`));
|
|
@@ -273,10 +282,9 @@ async function performSCP(username, hostname, direction, privateKeyPath, sharedD
|
|
|
273
282
|
|
|
274
283
|
async function downloadSpecificRemotePath(username, hostname, privateKeyPath, remotePath, localPath, persistKnownHosts = true) {
|
|
275
284
|
await showConnectionTrace('Local', 'Remote SCP');
|
|
276
|
-
const proxyCommand = `cloudflared access tcp --hostname ${hostname}`;
|
|
277
285
|
const scpArgs = [
|
|
278
286
|
'-r',
|
|
279
|
-
|
|
287
|
+
...buildProxyCommandOption(hostname),
|
|
280
288
|
...getKnownHostsOptions(persistKnownHosts),
|
|
281
289
|
'-o', 'IdentitiesOnly=yes',
|
|
282
290
|
...getSshControlOptions(hostname),
|
|
@@ -471,7 +479,7 @@ export async function startClientMode(options = {}) {
|
|
|
471
479
|
console.log('');
|
|
472
480
|
logSessionEvent('client_http_mode', { uid: targetUid, port: payload.port || null });
|
|
473
481
|
try {
|
|
474
|
-
await
|
|
482
|
+
await openUrl(payload.url);
|
|
475
483
|
} catch {
|
|
476
484
|
console.log(chalk.dim(` Could not auto-open. Please visit: ${payload.url}`));
|
|
477
485
|
}
|
|
@@ -667,8 +675,7 @@ export async function performSCPNonInteractive(params = {}) {
|
|
|
667
675
|
const privateKeyPath = payload.privateKey ? await writeEphemeralPrivateKey(payload.privateKey) : null;
|
|
668
676
|
|
|
669
677
|
// Build scp args similar to performSCP
|
|
670
|
-
const
|
|
671
|
-
const scpArgs = ['-r', '-o', `ProxyCommand=${proxyCommand}`, ...getKnownHostsOptions(persistKnownHosts), '-o', 'IdentitiesOnly=yes', ...getSshControlOptions(hostname)];
|
|
678
|
+
const scpArgs = ['-r', ...buildProxyCommandOption(hostname), ...getKnownHostsOptions(persistKnownHosts), '-o', 'IdentitiesOnly=yes', ...getSshControlOptions(hostname)];
|
|
672
679
|
if (privateKeyPath) scpArgs.push('-i', privateKeyPath, '-o', 'IdentityAgent=none');
|
|
673
680
|
|
|
674
681
|
const remoteSpec = `${username}@${hostname}:${formatScpRemotePath(remotePath)}`;
|
|
@@ -704,7 +711,7 @@ async function handleClientChat(uid, password, cachedChatUrl) {
|
|
|
704
711
|
spinner.succeed('Chat Room found! Opening browser...');
|
|
705
712
|
try {
|
|
706
713
|
const fullUrl = `${chatUrl}#${password}`;
|
|
707
|
-
await
|
|
714
|
+
await openUrl(fullUrl);
|
|
708
715
|
} catch {
|
|
709
716
|
console.log(chalk.cyan(` 👉 Please open: ${secureSensitiveUrl(chatUrl, password)}`));
|
|
710
717
|
}
|