Telnet C++或启动时的 SSH 程序
我想知道是否有人可以为我提供几个 C++ 函数,允许我通过 telnet 端口发送和接收数据。
我还听说我可以创建一个程序,并通过 SSH 运行它,这将是首选,因为 SSH 的安全优势,有任何示例吗?
更新: 我想做的是创建一个用户可以通过 SSH 或 telnet 远程使用的控制台程序。我是一名 C++ 程序员。
更新 2:我知道我很模糊,我正在创建一个库存系统,我希望我们的员工可以通过 SSH 或 telnet 访问该系统。我将使用套接字,并且经常通过(telnet 或通过 ssh)向用户显示数据并接受来自它们的输入。我必须实现套接字,并发送数据和接收数据,我知道,有一个库可以实现这一点吗?
I am wondering if someone can provide me with a couple c++ functions that would allow me to send and receive data over a telnet port.
I've also heard that I can create a program, and have it run via SSH, this would be preferred just because of the security benefits of SSH, are there any samples out there?
Update:
What I want to do, is create a console program users could use remotely via SSH or telnet. I am a C++ programmer.
Update 2: I know I was vague, I am creating an inventory system that I want to be accessible to our employees via SSH or telnet. I will be using sockets, and will often display data to the user via (telnet or through ssh) and accept input from them. I will have to implement sockets, and send data and receive data I know, is there a library for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太确定你在这里问什么。
您可以通过以下方式执行远程程序:(
前提是您已准备好无密码的 pubkey 身份验证;否则,系统会要求您输入密码/密码。第一次调用还需要用户输入,因为 SSH 想要验证 SSH 的指纹 然后,
您可以通过通常的方式捕获该命令行的输出(这相当于远程命令的输出,除非 ssh 本身发出错误)。
I am not quite sure what you are asking here.
You can execute a remote program via:
(Provided you have prepared a passphrase-less pubkey authentication; you'd be asked for a password / passphrase otherwise. The very first invokation will also require user input as SSH wants to verify the fingerprint of the remote machine.)
You could then capture the output of that command line (which is equivalent to the output of the remote command, unless ssh itself belches an error) via the usual means.
我真的不相信你想通过你的手写代码来实现 telnet 和 SSH 协议!那对你来说太难了。
我认为你想做的是“远程运行命令”。是吗?
如果是,那么您需要按照 DevSolar 的指示执行命令,但您需要生成要安装的 SSH 密钥生成器,这样它就不会在提示符下要求输入密码。
否则编写一个期望脚本。
I seriously dont believe you want to implement telnet and SSH protocol all by your handwritten code!! That would be too difficult for you.
What I think you want to do is to "Run a command remotely". is it?
If yes then you you would need to execute the command as told by DevSolar but you will need to generate SSH keygen to be installed so that it doesnt ask for password at the prompt.
Else write an expect script.