78 lines
2.2 KiB
JavaScript
78 lines
2.2 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连接成功');
|
|
|
|
// 搜索服务器上所有包含tabBar的文件
|
|
conn.exec('grep -r "tabBar:" /www/huishou --include="*.js" --include="*.css" 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('docker exec huishou grep -r "tabBar:" /usr/share/nginx/html --include="*.js" --include="*.css" 2>/dev/null', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let containerOutput = '';
|
|
stream.stdout.on('data', (data) => {
|
|
containerOutput += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('\n容器内所有文件中的tabBar调试信息:');
|
|
console.log(containerOutput || '未找到任何调试信息');
|
|
|
|
// 检查admin目录
|
|
conn.exec('ls -la /www/huishou/admin/h5/assets/ 2>/dev/null', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let adminOutput = '';
|
|
stream.stdout.on('data', (data) => {
|
|
adminOutput += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('\nadmin/h5/assets目录:');
|
|
console.log(adminOutput || '目录不存在');
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.error('SSH连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect(config); |