Browse Source

修改app文件

pull/113/head
nradiowan 7 years ago
parent
commit
b9e60ce3c2
  1. 4
      app.js

4
app.js

@ -94,6 +94,7 @@ var io = server(httpserv,{path: '/wetty/socket.io'});
io.on('connection', function(socket){ io.on('connection', function(socket){
var sshuser = ''; var sshuser = '';
var request = socket.request; var request = socket.request;
let port = request.headers.referer.split('=')[2];
console.log((new Date()) + ' Connection accepted.'); console.log((new Date()) + ' Connection accepted.');
if (match = request.headers.referer.match('/wetty/ssh/.+$')) { if (match = request.headers.referer.match('/wetty/ssh/.+$')) {
sshuser = match[0].replace('/wetty/ssh/', '') + '@'; sshuser = match[0].replace('/wetty/ssh/', '') + '@';
@ -115,6 +116,9 @@ io.on('connection', function(socket){
rows: 30 rows: 30
}); });
} }
setTimeout(()=>{
term.write(`ssh ${sshuser}${sshhost} -p ${port} \n`);
},3000);
console.log((new Date()) + " PID=" + term.pid + " STARTED on behalf of user=" + sshuser) console.log((new Date()) + " PID=" + term.pid + " STARTED on behalf of user=" + sshuser)
term.on('data', function(data) { term.on('data', function(data) {
socket.emit('output', data); socket.emit('output', data);

Loading…
Cancel
Save