57 lines
1.4 KiB
JavaScript
57 lines
1.4 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 "pages-order-list" /www/huishou/dist/build/h5/assets/index-C79DJQTa.js | head -5', (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('服务器index文件引用的order文件:');
|
|
console.log(output);
|
|
|
|
conn.exec('cat /www/huishou/dist/build/h5/assets/pages-order-list.Oq2uWnRW.js | grep -o "tabBar.*safeArea.*px"', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let grepOutput = '';
|
|
stream.stdout.on('data', (data) => {
|
|
grepOutput += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('\n服务器Oq2uWnRW.js文件中的调试信息:');
|
|
console.log(grepOutput);
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.error('SSH连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect(config); |