【问题标题】:password not working in node-telnet-client密码在 node-telnet-client 中不起作用
【发布时间】:2017-12-01 17:55:41
【问题描述】:

我正在使用 node-telnet-client 连接到服务器。但是服务器需要密码才能创建连接。我尝试在 params 对象中包含密码属性,但没有成功。

变量参数 = { 主机:'10.97.42.172', 端口:23, shellPrompt: '/#', 密码:1, 超时:10000, // removeEcho: 4 }

connection.connect(参数)

【问题讨论】:

  • 使用密码提示符代替密码。如果它不起作用,请尝试在密码字段中传递一个字符串。
  • 我也试过 passwordPromt。同样的结果。它会超时,然后每次都关闭

标签: node.js telnet


【解决方案1】:
var params = {
  host: '127.0.0.1',
  port: 2323,
  shellPrompt: '/ # ',
  loginPrompt: 'Username: ',
  passwordPrompt: 'Password: ',
  username: 'foo',
  password: 'bar',
  initialLFCR: true,
  timeout: 1500
}

这将帮助您连接到您的服务器。 请注意,密码是一个字符串。 这能解决您的问题吗?

【讨论】:

  • 我没有收到任何错误。它进入超时然后关闭状态。我已将超时设置为 5000 毫秒
  • 我怎么知道使用的shellPrompt?? @aswin
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-03-11
  • 1970-01-01
  • 1970-01-01
  • 2021-01-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多