-
-
Save jbis9051/0b963a888eac16485b806ea3eb25bea1 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
socks.createServer(function (info, accept, deny) { | |
Console.log(`Request to "${info.dstAddr}:${info.dstPort}"`); | |
console.log(info); | |
sshClient.forwardOut(info.srcAddr, | |
info.srcPort, | |
info.dstAddr, | |
info.dstPort, | |
function (err, stream) { | |
if (err) { | |
Console.error(`Unable to start forward data`); | |
Console.error(err.toString()); | |
console.error(err); | |
return deny(); | |
} | |
let clientSocket; | |
if (clientSocket = accept(true)) { | |
stream.pipe(clientSocket).pipe(stream).on('data', (data) => { | |
bytesTransferred += data.length; | |
if (Date.now() - lastUpdate > 200) { | |
document.querySelector('#data-counter-num').innerText = bytesToHumanReadable(bytesTransferred); | |
lastUpdate = Date.now(); | |
} | |
}); | |
} | |
}); | |
}).listen(socksPort, 'localhost', function () { | |
Console.success(`SOCKS5 Server started successfully. Listening on port ${socksPort}`); | |
}).useAuth(socks.auth.None()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment