Telnet in JavaScript - Node.js

0

I wanted to ask if someone could help me with a Telnet in JavaScript to use on port 25. Practically what I need to connect to a domain server to know if an email exists or not in that domain.

I found this code that suits a bit but I do not understand how it works yet. If someone has an idea, it would help me a lot.

Code:

function ConnectTelnet(){
  var connection = new telnet();

  var params = {
    host: '127.0.0.1',
    port: 3001,
    shellPrompt: '/ # ',
    timeout: 1500,
  }

  connection.on('ready', function(prompt){
    connection.exec(cmd,function(response){
      console.log(response)
    })
  })

  connection.on('timeout', function(){
    console.log('socket timeout!')
    connection.end();
  })

  connection.on('close',function() {
    console.log('connection closed')
  });

  connection.connect(params);
}
    
asked by java005 12.09.2018 в 22:04
source

0 answers