mirror of
				https://git.coolaj86.com/coolaj86/telebit.js.git
				synced 2025-11-04 02:32:47 +00:00 
			
		
		
		
	ssh detection works
This commit is contained in:
		
							parent
							
								
									9239153681
								
							
						
					
					
						commit
						e85bd78905
					
				@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user