Created
May 17, 2016 12:09
-
-
Save rebrec/5e847b159e7a5a5adfc82ff5442f1df9 to your computer and use it in GitHub Desktop.
This file contains 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 characters
const net = require('net'); | |
// common proxy ports | |
var honeyPort = [ 8080, 3128, 3129, 80 ]; | |
function FakeSrv(port){ | |
this.port = port; | |
this.server = net.createServer((socket) => { | |
socket.end('Bye\n'); | |
}); | |
this.server.on('connection', (socket) => { | |
console.log('FaksSrv (port %s) <-- %s:%s', this.port, socket.remoteAddress, socket.remotePort); | |
}); | |
this.server.on('listening', () => { | |
console.log('Listening on port %s ...', this.port); | |
}); | |
this.server.on('error', () => { | |
console.log('Error binding port %s', this.port); | |
}); | |
this.server.listen(this.port, '0.0.0.0'); | |
} | |
for (var i=0; i<honeyPort.length; i++) { | |
try{ | |
new FakeSrv(honeyPort[i]); | |
} catch(e) { | |
console.log('Error ' + e.message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment