telnet

How to automate telnet session using Expect?

筅森魡賤 提交于 2019-11-28 03:57:30
问题 I'm trying to write an expect script to automate telnet. This is what I have so far. #!/usr/bin/expect # Test expect script to telnet. spawn telnet 10.62.136.252 expect "foobox login:" send "foo1\r" expect "Password:" send "foo2\r" send "echo HELLO WORLD\r" # end of expect script. Basically, what I want to do is telnet to the following IP address and then echo HELLO WORLD. However, it seems that the script fails after attempting to telnet...I'm not sure if it's able to accept login and

Connecting to smtp.gmail.com via command line

旧街凉风 提交于 2019-11-28 03:55:43
I am in the process of writing an application that sends mail via an valid GMail user ID and password. I just wanted to simulate the SMTP connection on my Windows XP command line, and when I telnet smtp.gmail.com at 465 port - I don't see any thing. A blank command window with title Telnet smtp.gmail.com opens with cursor. When I type in EHLO or usual SMTP handshake commands, the prompt just closes. I am unable to figure out whats going wrong and where. I tried connecting to 587, it does not connect in telnet at all. Could anyone please clarify if I am doing something wrong? the911s Using

Send data over telnet without pressing enter

北战南征 提交于 2019-11-27 23:38:39
I've recently started messing around with Java sockets and telnet... I want the user to be able to connect to the server, just type a letter and have it sent to the server, without pressing enter to send it. I'm sure there's no way for the server to set this up, but maybe telnet has a parameter or something which could allow this? Maybe if I got the user to type stty cbreak or stty raw before running telnet, this would work? (UNIX only, I know!) If I can get telnet to do this then it saves me having to write a special client just for this feature... You should be able to do this with telnet

Accessing a telnet session in python

让人想犯罪 __ 提交于 2019-11-27 22:44:02
问题 so I need to access a telnet session. More specifically JPL's ephemeris service. I know exactly what I need to do in the command prompt, but I've had trouble using the telnetlib package. Here are the steps I need to take through command prompt: telnet o horizons.jpl.nasa.gov 6775 DES=C/2012 X1; y E o H06 y 2013-Nov-7 9:00 2013-Nov-17 9:00 1d y 1,4,9,19,20,24 and then after that there is a large output that I need to save to a text file, or simply keep as a variable. I'll be using it later.

Using conditional statements inside 'expect'

倖福魔咒の 提交于 2019-11-27 18:47:15
I need to automate logging into a TELNET session using expect , but I need to take care of multiple passwords for the same username. Here's the flow I need to create: Open TELNET session to an IP Send user-name Send password Wrong password? Send the same user-name again, then a different password Should have successfully logged-in at this point... For what it's worth, here's what I've got so far: #!/usr/bin/expect spawn telnet 192.168.40.100 expect "login:" send "spongebob\r" expect "password:" send "squarepants\r" expect "login incorrect" { expect "login:" send "spongebob\r" expect "password:

How to send carriage return over telnet?

我的梦境 提交于 2019-11-27 17:32:51
问题 I am using Ubuntu telnet client. I am trying to send 2 lines over the telnet connection that I have made. For example: > telnet en.wikipedia.org 80 GET /wiki/Main_Page http/1.1 <CR> // line 1 Host: en.wikipedia.org <CR> // line 2 <CR> where CR stands for carriage return. The problem is after typing line 1, press CR , that line will be sent over the telnet connection. I can not be able to send line 2 immediately after that. Can somebody help? 回答1: When you are operating in a Telnet client,

Is there a Telnet library for JavaScript?

痞子三分冷 提交于 2019-11-27 15:47:20
问题 We have a network camera. It has an HTTP server to provides the current image. There is also a Telnet interface for controlling the camera (i.e. trigger, focus, etc.). I would like to add an HTML page to the camera that would provide a simple interface (we already have client software we write). I can "GET" the image and display that, but I would also like to have controls that use the Telnet interface to control the camera. So a button might have JavaScript code behind it that connects to

expect script to automate telnet login

一世执手 提交于 2019-11-27 15:12:19
I have been trying to create an expect script to automatically login to my device through telnet If there are no multiple possibilities for the expect command , the script works fine, logs in to the device. #!/usr/bin/expect set timeout 20 set ip [lindex $argv 0] set port [lindex $argv 1] set user [lindex $argv 2] set password [lindex $argv 3] spawn telnet $ip $port expect "'^]'." sleep .1; send "\r"; sleep .1; expect "login:" send "$user\r" expect "Password:" send "$password\r"; interact The script above works fine and logs in successfully when i pass the correct parameters. But once i add

Using AsyncTask for android network connection

时间秒杀一切 提交于 2019-11-27 14:53:31
I am having some trouble using AsyncTask as I have never come across it before and have no clue what I am doing with it. Basically I am getting a force close because I am trying to run the connection on a main class. Could someone possibly help me with adding AsyncTask into the code: package com.smarte.smartipcontrol; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.InetAddress; import java.net.Socket; import java.net.UnknownHostException;

Python Telnet connection

江枫思渺然 提交于 2019-11-27 14:11:13
问题 I was playing around with python 3.1 when I came to a problem. I want to connect to a telnet server. Here is my code: import sys import telnetlib tn = telnetlib.Telnet("10.0.0.138") tn.read_until(b"Username :", 2) tn.write(b"\n") tn.read_until(b"Password :", 2) tn.write(b"\n") tn.read_until(b"=>", 2) tn.write(b"exit\n") tn.close It works to read until "Username :". There is also no error message when writing an emty line. But when i read until "Password :" i get an empty string. I also get an