Skip to content

Instantly share code, notes, and snippets.

@jbis9051

jbis9051/file.js Secret

Created March 8, 2020 19:22
Show Gist options
  • Save jbis9051/0b963a888eac16485b806ea3eb25bea1 to your computer and use it in GitHub Desktop.
Save jbis9051/0b963a888eac16485b806ea3eb25bea1 to your computer and use it in GitHub Desktop.
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