telnet

let telnet execute single command in one line

允我心安 提交于 2019-12-03 11:42:17
hey i can login into telnet with "telnet localhost 4242" now i want to execute a single command "show network". How can i do this in one line ? something like that $ telnet localhost 4242 <- "show network" woa here the output i want I found expect to do exactly what i want, wait for a certain output and then act upon it: expect << EOF spawn telnet localhost 4242 expect -re ".*>" send "show network\r" expect -re ".*>" send "exit\r" EOF If you don't have to log in or anything, you can use a "here document" like this: telnet localhost 4242 << EOF show network EOF 来源: https://stackoverflow.com

How does telnet differ from a raw tcp connection

心已入冬 提交于 2019-12-03 11:02:18
问题 I am trying to send commands to a server via a python script. I can see the socket connection being established on the server. But the commands I am sending across , do not seem to make it through(server does a read on the socket). The server currently supports a telnet command interpreter. ie: you telnet to the command address and port, and you can start sending string commands. My question is , is there anything fundamentally different from sending strings over a tcp socket, as opposed to

Ruby script to telnet switch

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've created the following ruby script that telnet to Cisco devices, that telnet to Cisco devices and run command 'show int status err'. require 'net/telnet' C3550_20_PterraEst = "192.168.244.20" #Enter the IP address here USER = "user" #Enter username here PASS = "password" #Enter password here ENABLE = "password" #Enter enable password here print "Selezionare il piano [0-1-2-All]: "; # get the input from the console, val1 = gets; tn = Net::Telnet::new("Host" => C3550_20_PterraEst, "Timeout" => 5, "Prompt" => /Username/ ) tn.cmd("\n#{USER}"

How can I see what I am typing in telnet? [closed]

≯℡__Kan透↙ 提交于 2019-12-03 09:28:36
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. When using telnet by using the command: telnet <host ip> <port> I can connect but then I cannot see what I am typing. So I try: telnet set localecho open <host ip> <port> But this time it just hangs with the message: Connecting to <host ip>... How can I use telnet successfully after setting localecho? It actually isn't hanging; it's just that, for some reason, it doesn't give any feedback to show that it's connected. If

let telnet execute single command in one line

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: hey i can login into telnet with "telnet localhost 4242" now i want to execute a single command "show network". How can i do this in one line ? something like that $ telnet localhost 4242 <- "show network" woa here the output i want 回答1: I found expect to do exactly what i want, wait for a certain output and then act upon it: expect << EOF spawn telnet localhost 4242 expect -re ".*>" send "show network\r" expect -re ".*>" send "exit\r" EOF 回答2: If you don't have to log in or anything, you can use a "here document" like this: telnet localhost

Telnet inside a shell script

北战南征 提交于 2019-12-03 07:42:17
How can I run telnet inside a shell script and execute commands on the remote server? I do not have expect installed on my solaris machine because of security reasons. I also do not have the perl net::telnet module installed. So with out using expect and perl how can I do it? I tried the below thing but its not working. #!/usr/bin/sh telnet 172.16.69.116 <<! user password ls exit ! When I execute it, this is what I am getting: > cat tel.sh telnet 172.16.69.116 <<EOF xxxxxx xxxxxxxxx ls exit EOF > tel.sh Trying 172.16.69.116... Connected to 172.16.69.116. Escape character is '^]'. Connection to

Linux 端口开始后仍然无法telnet

心已入冬 提交于 2019-12-03 06:48:31
问题来源:在本地虚拟机上搭的redis,但是重启Linux过后一直telnet不通redis 的6379端口(linux 自己telnet自己6379都不可以),linux端口确实是开启的。问了同事、领导,最终才知道原来是redis自启动占用了6379端口,我修改端口是在启动后修改的(顺序逻辑还需再理理)。 相关配置 开启linux端口(linux 7 与 linux 6 有差异) 来源: https://www.cnblogs.com/httpc/p/11781226.html

Can't close a scpi(telnet) session with echo “^]” when I use it in a script

夙愿已清 提交于 2019-12-03 06:20:23
问题 The use of echo-e "\ 029" does not work either. But if use strg + alt gr + ] directly in a terminal session -> it works. I have to ask my question more concretely: I connect an RF generator (AGILENT) via Telnet/SCPI. If I do this manual on terminal and press at the end of the session CTRL + ALT GR + ] for '^]' then close the scpi session properly and I can type quit to close the telnet session properly. There is no error message on the display of the RF generator. So it should be. If I do

Windows automate telnet

匆匆过客 提交于 2019-12-03 05:01:37
I would like to run a set of commands that would typically be run in telnet(from c#). For example I would like to run the following using System; using System.Diagnostics; namespace InteractWithConsoleApp { class Program { static void Main(string[] args) { ProcessStartInfo cmdStartInfo = new ProcessStartInfo(); cmdStartInfo.FileName = @"C:\Windows\System32\cmd.exe"; cmdStartInfo.RedirectStandardOutput = true; cmdStartInfo.RedirectStandardError = true; cmdStartInfo.RedirectStandardInput = true; cmdStartInfo.UseShellExecute = false; cmdStartInfo.CreateNoWindow = true; Process cmdProcess = new

Accept a persistent tcp connection in Golang Server

馋奶兔 提交于 2019-12-03 03:51:49
I am experimenting with Go - and would like to create a TCP server which I can telnet to, send commands and receive responses. const ( CONN_HOST = "localhost" CONN_PORT = "3333" CONN_TYPE = "tcp" ) func main() { listener, err := net.Listen(CONN_TYPE, fmt.Sprintf("%s:%s", CONN_HOST, CONN_PORT)) if err != nil { log.Panicln(err) } defer listener.Close() for { conn, err := listener.Accept() if err != nil { log.Panicln(err) } go handleRequest(conn) } } func handleRequest(conn net.Conn) { buffer := make([]byte, 1024) length, err := conn.Read(buffer) if err != nil { log.Panicln(err) } str := string