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

44 lines
1.0 KiB
JavaScript

import { Client } from 'ssh2';
const conn = new Client();
conn.on('ready', () => {
console.log('=== 测试静态文件 ===\n');
conn.exec('curl -s -k https://hs.yifenbao.cn/assets/uni.6c38f965.css | head -3', (err, stream) => {
if (err) {
console.log('CSS文件访问失败:', err.message);
} else {
stream.on('data', (data) => {
console.log('CSS文件:', data.toString());
});
}
stream.on('close', () => {
conn.exec('curl -s -k https://hs.yifenbao.cn/index.html | head -5', (err, stream2) => {
if (err) {
console.log('HTML文件访问失败:', err.message);
} else {
stream2.on('data', (data) => {
console.log('\nHTML文件:', data.toString());
});
}
stream2.on('close', () => {
conn.end();
});
});
});
});
});
conn.on('error', (err) => {
console.log('连接错误:', err.message);
});
conn.connect({
host: 'hs.yifenbao.cn',
port: 22,
username: 'root',
password: 'Torch1112'
});