From e85bd78905e29de54be0df3a9ecd27e5a0fd6ff8 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 1 Jun 2018 02:10:27 -0600 Subject: [PATCH] ssh detection works --- lib/sorting-hat.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/sorting-hat.js b/lib/sorting-hat.js index 21fae43..b200084 100644 --- a/lib/sorting-hat.js +++ b/lib/sorting-hat.js @@ -284,6 +284,23 @@ module.exports.assign = function (state, tun, cb) { return; } + function trySsh(tun) { + // https://security.stackexchange.com/questions/43231/plausibly-deniable-ssh-does-it-make-sense?rq=1 + // https://tools.ietf.org/html/rfc4253#section-4.2 + if ('SSH-2.0-' !== tun.data.slice(0, 8).toString()) { + return false; + } + cb(null, getNetConn(state.config.sshPort || 22)); + return true; + } + + if ('tcp' === tun.service) { + if (trySsh(tun)) { return; } + cb(new Error("No TCP handler")); + } + + console.warn("Unknown service '" + tun.service + "'"); + /* var portList = state.services[service]; var port;