Files
huishou/check-loaded-file.js
T
2026-07-27 14:07:26 +08:00

57 lines
1.3 KiB
JavaScript

const { Client } = require('ssh2');
const config = {
host: 'hs.yifenbao.cn',
port: 22,
username: 'root',
password: 'Torch1112'
};
const conn = new Client();
conn.on('ready', () => {
console.log('SSH连接成功');
conn.exec('grep -r "tabBar:" /www/huishou --include="*.js" 2>/dev/null', (err, stream) => {
if (err) {
console.error('执行命令错误:', err.message);
conn.end();
return;
}
let output = '';
stream.stdout.on('data', (data) => {
output += data.toString();
});
stream.on('close', () => {
console.log('包含 tabBar 的文件:');
console.log(output);
conn.exec('cat /www/huishou/dist/build/h5/index.html 2>/dev/null', (err, stream) => {
if (err) {
console.error('执行命令错误:', err.message);
conn.end();
return;
}
let htmlOutput = '';
stream.stdout.on('data', (data) => {
htmlOutput += data.toString();
});
stream.on('close', () => {
console.log('\n=== index.html ===');
console.log(htmlOutput);
conn.end();
});
});
});
});
});
conn.on('error', (err) => {
console.error('SSH连接错误:', err.message);
});
conn.connect(config);