-
-
Save itayw/7656798 to your computer and use it in GitHub Desktop.
Revisions
-
TooTallNate revised this gist
Jun 26, 2012 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ var net = require('net') var sock = net.connect(1337) @@ -22,9 +21,8 @@ process.stdin.on('end', function () { console.log() }) process.stdin.on('data', function (b) { if (b.length === 1 && b[0] === 4) { process.stdin.emit('end') } }) -
TooTallNate revised this gist
Mar 27, 2012 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,10 +11,9 @@ sock.on('connect', function () { process.stdin.setRawMode(true) }) sock.on('close', function done () { process.stdin.setRawMode(false) process.stdin.pause() sock.removeListener('close', done) }) @@ -28,4 +27,4 @@ process.stdin.on('keypress', function (char, key) { if (key && key.ctrl && key.name == 'd') { process.stdin.emit('end') } }) -
TooTallNate revised this gist
Mar 27, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ var net = require('net') var readline = require('readline') var sock = net.connect(1337) process.stdin.pipe(sock) sock.pipe(process.stdout) -
TooTallNate revised this gist
Mar 26, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,9 +4,9 @@ var net = require('net') net.createServer(function (socket) { var r = repl.start({ prompt: 'socket '+socket.remoteAddress+':'+socket.remotePort+'> ' , input: socket , output: socket , terminal: true , useGlobal: false }) r.on('exit', function () { -
TooTallNate revised this gist
Mar 26, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ net.createServer(function (socket) { var r = repl.start({ prompt: 'socket '+socket.remoteAddress+':'+socket.remotePort+'> ' , socket: socket , terminal: true , useColors: true , useGlobal: false }) -
TooTallNate created this gist
Mar 26, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ var net = require('net') var readline = require('readline') var sock = net.createConnection(1337) process.stdin.pipe(sock) sock.pipe(process.stdout) sock.on('connect', function () { process.stdin.resume(); process.stdin.setRawMode(true) }) sock.on('close', function () { process.stdin.setRawMode(false) process.stdin.pause() sock.removeListener('end', done) sock.removeListener('close', done) }) process.stdin.on('end', function () { sock.destroy() console.log() }) readline.emitKeypressEvents(process.stdin) process.stdin.on('keypress', function (char, key) { if (key && key.ctrl && key.name == 'd') { process.stdin.emit('end') } }) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ var repl = require('repl') var net = require('net') net.createServer(function (socket) { var r = repl.start({ prompt: 'socket '+socket.remoteAddress+':'+socket.remotePort+'> ' , socket: socket , enabled: true , useColors: true , useGlobal: false }) r.on('exit', function () { socket.end() }) r.context.socket = socket }).listen(1337)