diff --git a/dist/index.js b/dist/index.js index ce46aa8..e106a24 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -var args, ask, dhcpd, httpd, ip, pkg, port, servers, tftp; +var args, ask, dhcpd, httpd, ip, pkg, port, rl, servers, tftp; pkg = require('../package.json'); @@ -36,6 +36,16 @@ if (args.tftp) { }); } +if (process.platform === 'win32') { + rl = require('readline').createInterface({ + input: process.stdin, + output: process.stdout + }); + rl.on('SIGINT', function() { + return process.emit('SIGINT'); + }); +} + process.on('SIGINT', function() { console.log("\nshutting down servers from SIGINT (Ctrl+C)"); servers.forEach(function(server) { diff --git a/package.json b/package.json index 1c862c5..4fa0f92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tch-exploit", - "version": "2.0.1-rc5", + "version": "2.0.1-rc6", "main": "dist/index.js", "bin": "dist/index.js", "scripts": { diff --git a/src/index.coffee b/src/index.coffee index 1c56b4e..1b55e32 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -41,9 +41,17 @@ else servers.push dhcpd ip, url, args.acspass servers.push httpd ip, p, url +if process.platform is 'win32' + rl = require('readline').createInterface + input: process.stdin + output: process.stdout + + rl.on 'SIGINT', -> + process.emit 'SIGINT' + process.on 'SIGINT', -> console.log "\nshutting down servers from SIGINT (Ctrl+C)" - + servers.forEach (server) -> server.close()