Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ var http = require('http'),
ss = require('socket.io-stream');

var config = require('./config.json');
var use_input = true;
if (config["input"] != null)
use_input = config["input"];

var server = http.createServer()
.listen(config.port, config.interface);
Expand Down Expand Up @@ -43,7 +46,12 @@ socketio(server).of('pty').on('connection', function(socket) {
var name = options.name;

var pty = child_pty.spawn('/bin/sh', ['-c', config.login], options);
pty.stdout.pipe(stream).pipe(pty.stdin);
if (use_input)
pty.stdout.pipe(stream).pipe(pty.stdin);
else {
pty.stdout.pipe(stream);
stream.on('data', function(chunk) {});
}
ptys[name] = pty;
socket.on('disconnect', function() {
console.log("end");
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"login": "echo \"Please don't use this in productive environments as all keystrokes are sent in plain text!\"; /bin/sh",
"port": 3000,
"interface": "127.0.0.1"
"interface": "127.0.0.1",
"input": true
}