Update websocket.ts

This commit is contained in:
Baobhan Sith
2025-04-27 11:03:32 +08:00
parent fcba14fe7a
commit b2e59b880a
+2 -2
View File
@@ -493,8 +493,8 @@ export const initializeWebSocket = async (server: http.Server, sessionParser: Re
// 5. 设置 Shell 事件转发
shellStream.on('data', (data: Buffer) => {
// --- 添加日志:打印收到的原始数据 ---
console.log(`SSH Data (会话: ${newSessionId}, 原始): `, data.toString()); // 添加原始数据日志 (尝试 utf8)
console.log(`SSH Data (会话: ${newSessionId}, Hex): `, data.toString('hex')); // 添加 Hex 日志
// console.log(`SSH Data (会话: ${newSessionId}, 原始): `, data.toString()); // 添加原始数据日志 (尝试 utf8)
// console.log(`SSH Data (会话: ${newSessionId}, Hex): `, data.toString('hex')); // 添加 Hex 日志
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({ type: 'ssh:output', payload: data.toString('base64'), encoding: 'base64' }));