Files
huishou/test-mobile.mjs
T
2026-07-27 14:07:26 +08:00

62 lines
1.7 KiB
JavaScript

import { Client } from 'ssh2';
const conn = new Client();
conn.on('ready', () => {
console.log('=== 测试手机端访问 ===\n');
conn.exec('curl -s -k -A "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148" https://hs.yifenbao.cn/', (err, stream) => {
if (err) {
console.log('手机端测试失败:', err.message);
conn.end();
return;
}
stream.on('data', (data) => {
console.log('手机端响应:', data.toString());
});
stream.on('close', () => {
conn.exec('curl -s -k -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" https://hs.yifenbao.cn/', (err, stream2) => {
if (err) {
console.log('电脑端测试失败:', err.message);
conn.end();
return;
}
stream2.on('data', (data) => {
console.log('\n电脑端响应:', data.toString());
});
stream2.on('close', () => {
conn.exec('curl -s -k https://hs.yifenbao.cn/assets/index-B5v3elQl.js | head -5', (err, stream3) => {
if (err) {
console.log('静态资源测试失败:', err.message);
conn.end();
return;
}
stream3.on('data', (data) => {
console.log('\n静态资源:', data.toString());
});
stream3.on('close', () => {
conn.end();
});
});
});
});
});
});
});
conn.on('error', (err) => {
console.log('连接错误:', err.message);
});
conn.connect({
host: 'hs.yifenbao.cn',
port: 22,
username: 'root',
password: 'Torch1112'
});