Files
huishou/test-device-detect.js
2026-07-27 14:07:26 +08:00

21 lines
923 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
console.log('=== 测试电脑访问(应该跳转到/admin===');
conn.exec('curl -s -I -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" https://hs.yifenbao.cn/', (err, stream) => {
if (err) { console.log('ERR:', err); conn.end(); return; }
stream.on('data', (d) => console.log(d.toString()));
stream.on('close', () => {
console.log('\n=== 测试手机访问(应该跳转到/h5===');
conn.exec('curl -s -I -A "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0)" https://hs.yifenbao.cn/', (err2, stream2) => {
if (err2) { console.log('ERR2:', err2); conn.end(); return; }
stream2.on('data', (d) => console.log(d.toString()));
stream2.on('close', () => conn.end());
});
});
});
});
conn.connect({ host: 'hs.yifenbao.cn', port: 22, username: 'root', password: 'Torch1112' });