57 lines
1.5 KiB
JavaScript
57 lines
1.5 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('docker exec huishou grep -o "新增商户|新增个人" /usr/share/nginx/html/h5/assets/pages-index-index.Dfg3o6TQ.js', (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('服务器首页JS中的商户/个人选项:');
|
|
console.log(output || '未找到');
|
|
|
|
conn.exec('docker exec huishou cat /usr/share/nginx/html/h5/assets/pages-index-index.Dfg3o6TQ.js | grep -o "custom-region"', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let customOutput = '';
|
|
stream.stdout.on('data', (data) => {
|
|
customOutput += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('\n服务器首页JS中的自定义输入框区域:');
|
|
console.log(customOutput || '未找到');
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.error('SSH连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect(config); |