有什么方法可以远程发出telnet命令并重复两次telnet会话? [关闭] - python

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
                            
                        
                    
                
                                6年前关闭。
            
                    
我需要什么:

telnet 1.1.1.1 (no password or login required)
#connected
telnet localhost 1234
command_1
command_2
command_3
exit
exit

有什么办法可以在bash或python上编写它吗?

python大神给出的解决方案

您可以使用管道将输入传递到telnet。在您的外壳上:

$ echo "echo -e 'command_1\ncommand_2\ncommand_3' | telnet localhost 1234" | telnet 1.1.1.1

如果修改脚本和脚本名称以退出progrom,则有任何技巧[关闭] - python

Closed. This question needs details or clarity。它当前不接受答案。                                                                                                                            …

Python sqlite3数据库已锁定 - python

我在Windows上使用Python 3和sqlite3。我正在开发一个使用数据库存储联系人的小型应用程序。我注意到,如果应用程序被强制关闭(通过错误或通过任务管理器结束),则会收到sqlite3错误(sqlite3.OperationalError:数据库已锁定)。我想这是因为在应用程序关闭之前,我没有正确关闭数据库连接。我已经试过了: connectio…

Shell脚本如何从自身内部执行另一个Shell脚本 - python

我的问题是,shell脚本如何执行在新进程中生成的另一个shell脚本?还是在与调用它的脚本相同的过程中执行?一个示例是一个Python脚本,该脚本在满足条件后从Shell脚本执行,还有人如何编写此Shell脚本,使其生成Python脚本,然后退出自身而不会杀死Python脚本 python大神给出的解决方案 是的,如果您在外壳程序中调用外壳程序脚本,外壳程…

将sys.arvg与列表进行比较[关闭] - python

Closed. This question is off-topic。它当前不接受答案。                                                                                                                                        …

Python pytz时区函数返回的时区为9分钟 - python

由于某些原因,我无法从以下代码中找出原因:>>> from pytz import timezone >>> timezone('America/Chicago') 我得到:<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD…